devicetree-language-server 0.10.2 → 0.10.3
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 +2 -26
- package/dist/server.js +47 -47
- package/package.json +4 -4
package/dist/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var qB=Object.create;var Tg=Object.defineProperty;var $B=Object.getOwnPropertyDescriptor;var FB=Object.getOwnPropertyNames;var BB=Object.getPrototypeOf,jB=Object.prototype.hasOwnProperty;var N=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),UB=(t,e)=>{for(var n in e)Tg(t,n,{get:e[n],enumerable:!0})},HB=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of FB(e))!jB.call(t,i)&&i!==n&&Tg(t,i,{get:()=>e[i],enumerable:!(r=$B(e,i))||r.enumerable});return t};var L=(t,e,n)=>(n=t!=null?qB(BB(t)):{},HB(e||!t||!t.__esModule?Tg(n,"default",{value:t,enumerable:!0}):n,t));var vd=N(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.thenable=Ht.typedArray=Ht.stringArray=Ht.array=Ht.func=Ht.error=Ht.number=Ht.string=Ht.boolean=void 0;function VB(t){return t===!0||t===!1}Ht.boolean=VB;function FP(t){return typeof t=="string"||t instanceof String}Ht.string=FP;function WB(t){return typeof t=="number"||t instanceof Number}Ht.number=WB;function zB(t){return t instanceof Error}Ht.error=zB;function BP(t){return typeof t=="function"}Ht.func=BP;function jP(t){return Array.isArray(t)}Ht.array=jP;function GB(t){return jP(t)&&t.every(e=>FP(e))}Ht.stringArray=GB;function YB(t,e){return Array.isArray(t)&&t.every(e)}Ht.typedArray=YB;function KB(t){return t&&BP(t.then)}Ht.thenable=KB});var Uo=N(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.stringArray=_n.array=_n.func=_n.error=_n.number=_n.string=_n.boolean=void 0;function XB(t){return t===!0||t===!1}_n.boolean=XB;function UP(t){return typeof t=="string"||t instanceof String}_n.string=UP;function JB(t){return typeof t=="number"||t instanceof Number}_n.number=JB;function QB(t){return t instanceof Error}_n.error=QB;function ZB(t){return typeof t=="function"}_n.func=ZB;function HP(t){return Array.isArray(t)}_n.array=HP;function ej(t){return HP(t)&&t.every(e=>UP(e))}_n.stringArray=ej});var Hg=N(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.Message=ae.NotificationType9=ae.NotificationType8=ae.NotificationType7=ae.NotificationType6=ae.NotificationType5=ae.NotificationType4=ae.NotificationType3=ae.NotificationType2=ae.NotificationType1=ae.NotificationType0=ae.NotificationType=ae.RequestType9=ae.RequestType8=ae.RequestType7=ae.RequestType6=ae.RequestType5=ae.RequestType4=ae.RequestType3=ae.RequestType2=ae.RequestType1=ae.RequestType=ae.RequestType0=ae.AbstractMessageSignature=ae.ParameterStructures=ae.ResponseError=ae.ErrorCodes=void 0;var Zs=Uo(),vg;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(vg||(ae.ErrorCodes=vg={}));var bg=class t extends Error{constructor(e,n,r){super(n),this.code=Zs.number(e)?e:vg.UnknownErrorCode,this.data=r,Object.setPrototypeOf(this,t.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};ae.ResponseError=bg;var Vn=class t{constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};ae.ParameterStructures=Vn;Vn.auto=new Vn("auto");Vn.byPosition=new Vn("byPosition");Vn.byName=new Vn("byName");var bt=class{constructor(e,n){this.method=e,this.numberOfParams=n}get parameterStructures(){return Vn.auto}};ae.AbstractMessageSignature=bt;var Sg=class extends bt{constructor(e){super(e,0)}};ae.RequestType0=Sg;var _g=class extends bt{constructor(e,n=Vn.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};ae.RequestType=_g;var Pg=class extends bt{constructor(e,n=Vn.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};ae.RequestType1=Pg;var kg=class extends bt{constructor(e){super(e,2)}};ae.RequestType2=kg;var Ng=class extends bt{constructor(e){super(e,3)}};ae.RequestType3=Ng;var Rg=class extends bt{constructor(e){super(e,4)}};ae.RequestType4=Rg;var wg=class extends bt{constructor(e){super(e,5)}};ae.RequestType5=wg;var Eg=class extends bt{constructor(e){super(e,6)}};ae.RequestType6=Eg;var Cg=class extends bt{constructor(e){super(e,7)}};ae.RequestType7=Cg;var Dg=class extends bt{constructor(e){super(e,8)}};ae.RequestType8=Dg;var Ag=class extends bt{constructor(e){super(e,9)}};ae.RequestType9=Ag;var Ig=class extends bt{constructor(e,n=Vn.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};ae.NotificationType=Ig;var Og=class extends bt{constructor(e){super(e,0)}};ae.NotificationType0=Og;var Mg=class extends bt{constructor(e,n=Vn.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};ae.NotificationType1=Mg;var xg=class extends bt{constructor(e){super(e,2)}};ae.NotificationType2=xg;var Lg=class extends bt{constructor(e){super(e,3)}};ae.NotificationType3=Lg;var qg=class extends bt{constructor(e){super(e,4)}};ae.NotificationType4=qg;var $g=class extends bt{constructor(e){super(e,5)}};ae.NotificationType5=$g;var Fg=class extends bt{constructor(e){super(e,6)}};ae.NotificationType6=Fg;var Bg=class extends bt{constructor(e){super(e,7)}};ae.NotificationType7=Bg;var jg=class extends bt{constructor(e){super(e,8)}};ae.NotificationType8=jg;var Ug=class extends bt{constructor(e){super(e,9)}};ae.NotificationType9=Ug;var VP;(function(t){function e(i){let s=i;return s&&Zs.string(s.method)&&(Zs.string(s.id)||Zs.number(s.id))}t.isRequest=e;function n(i){let s=i;return s&&Zs.string(s.method)&&i.id===void 0}t.isNotification=n;function r(i){let s=i;return s&&(s.result!==void 0||!!s.error)&&(Zs.string(s.id)||Zs.number(s.id)||s.id===null)}t.isResponse=r})(VP||(ae.Message=VP={}))});var Wg=N(is=>{"use strict";var WP;Object.defineProperty(is,"__esModule",{value:!0});is.LRUCache=is.LinkedMap=is.Touch=void 0;var Pn;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(Pn||(is.Touch=Pn={}));var bd=class{constructor(){this[WP]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,n=Pn.None){let r=this._map.get(e);if(r)return n!==Pn.None&&this.touch(r,n),r.value}set(e,n,r=Pn.None){let i=this._map.get(e);if(i)i.value=n,r!==Pn.None&&this.touch(i,r);else{switch(i={key:e,value:n,next:void 0,previous:void 0},r){case Pn.None:this.addItemLast(i);break;case Pn.First:this.addItemFirst(i);break;case Pn.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let n=this._map.get(e);if(n)return this._map.delete(e),this.removeItem(n),this._size--,n.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,n){let r=this._state,i=this._head;for(;i;){if(n?e.bind(n)(i.value,i.key,this):e(i.value,i.key,this),this._state!==r)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:n.key,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}values(){let e=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:n.value,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}entries(){let e=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:[n.key,n.value],done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}[(WP=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let n=this._head,r=this.size;for(;n&&r>e;)this._map.delete(n.key),n=n.next,r--;this._head=n,this._size=r,n&&(n.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let n=e.next,r=e.previous;if(!n||!r)throw new Error("Invalid list");n.previous=r,r.next=n}e.next=void 0,e.previous=void 0,this._state++}touch(e,n){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(n!==Pn.First&&n!==Pn.Last)){if(n===Pn.First){if(e===this._head)return;let r=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(r.previous=i,i.next=r),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(n===Pn.Last){if(e===this._tail)return;let r=e.next,i=e.previous;e===this._head?(r.previous=void 0,this._head=r):(r.previous=i,i.next=r),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((n,r)=>{e.push([r,n])}),e}fromJSON(e){this.clear();for(let[n,r]of e)this.set(n,r)}};is.LinkedMap=bd;var Vg=class extends bd{constructor(e,n=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,n),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,n=Pn.AsNew){return super.get(e,n)}peek(e){return super.get(e,Pn.None)}set(e,n){return super.set(e,n,Pn.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};is.LRUCache=Vg});var GP=N(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:!0});Sd.Disposable=void 0;var zP;(function(t){function e(n){return{dispose:n}}t.create=e})(zP||(Sd.Disposable=zP={}))});var ss=N(Yg=>{"use strict";Object.defineProperty(Yg,"__esModule",{value:!0});var zg;function Gg(){if(zg===void 0)throw new Error("No runtime abstraction layer installed");return zg}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");zg=n}t.install=e})(Gg||(Gg={}));Yg.default=Gg});var Vo=N(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.Emitter=Ho.Event=void 0;var tj=ss(),YP;(function(t){let e={dispose(){}};t.None=function(){return e}})(YP||(Ho.Event=YP={}));var Kg=class{add(e,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,n)})}remove(e,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i<s;i++)if(this._callbacks[i]===e)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];let n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,o=r.length;s<o;s++)try{n.push(r[s].apply(i[s],e))}catch(a){(0,tj.default)().console.error(a)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},_d=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,n,r)=>{this._callbacks||(this._callbacks=new Kg),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,n);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,n),i.dispose=t._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};Ho.Emitter=_d;_d._noop=function(){}});var Nd=N(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});Wo.CancellationTokenSource=Wo.CancellationToken=void 0;var nj=ss(),rj=Uo(),Xg=Vo(),Pd;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Xg.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Xg.Event.None});function e(n){let r=n;return r&&(r===t.None||r===t.Cancelled||rj.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}t.is=e})(Pd||(Wo.CancellationToken=Pd={}));var ij=Object.freeze(function(t,e){let n=(0,nj.default)().timer.setTimeout(t.bind(e),0);return{dispose(){n.dispose()}}}),kd=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?ij:(this._emitter||(this._emitter=new Xg.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Jg=class{get token(){return this._token||(this._token=new kd),this._token}cancel(){this._token?this._token.cancel():this._token=Pd.Cancelled}dispose(){this._token?this._token instanceof kd&&this._token.dispose():this._token=Pd.None}};Wo.CancellationTokenSource=Jg});var KP=N(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});zo.SharedArrayReceiverStrategy=zo.SharedArraySenderStrategy=void 0;var sj=Nd(),Ec;(function(t){t.Continue=0,t.Cancelled=1})(Ec||(Ec={}));var Qg=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let n=new SharedArrayBuffer(4),r=new Int32Array(n,0,1);r[0]=Ec.Continue,this.buffers.set(e.id,n),e.$cancellationData=n}async sendCancellation(e,n){let r=this.buffers.get(n);if(r===void 0)return;let i=new Int32Array(r,0,1);Atomics.store(i,0,Ec.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};zo.SharedArraySenderStrategy=Qg;var Zg=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Ec.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},ey=class{constructor(e){this.token=new Zg(e)}cancel(){}dispose(){}},ty=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let n=e.$cancellationData;return n===void 0?new sj.CancellationTokenSource:new ey(n)}};zo.SharedArrayReceiverStrategy=ty});var ry=N(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.Semaphore=void 0;var oj=ss(),ny=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((n,r)=>{this._waiting.push({thunk:e,resolve:n,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,oj.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let n=e.thunk();n instanceof Promise?n.then(r=>{this._active--,e.resolve(r),this.runNext()},r=>{this._active--,e.reject(r),this.runNext()}):(this._active--,e.resolve(n),this.runNext())}catch(n){this._active--,e.reject(n),this.runNext()}}};Rd.Semaphore=ny});var JP=N(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.ReadableStreamMessageReader=os.AbstractMessageReader=os.MessageReader=void 0;var sy=ss(),Go=Uo(),iy=Vo(),aj=ry(),XP;(function(t){function e(n){let r=n;return r&&Go.func(r.listen)&&Go.func(r.dispose)&&Go.func(r.onError)&&Go.func(r.onClose)&&Go.func(r.onPartialMessage)}t.is=e})(XP||(os.MessageReader=XP={}));var wd=class{constructor(){this.errorEmitter=new iy.Emitter,this.closeEmitter=new iy.Emitter,this.partialMessageEmitter=new iy.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${Go.string(e.message)?e.message:"unknown"}`)}};os.AbstractMessageReader=wd;var oy;(function(t){function e(n){let r,i,s,o=new Map,a,c=new Map;if(n===void 0||typeof n=="string")r=n??"utf-8";else{if(r=n.charset??"utf-8",n.contentDecoder!==void 0&&(s=n.contentDecoder,o.set(s.name,s)),n.contentDecoders!==void 0)for(let l of n.contentDecoders)o.set(l.name,l);if(n.contentTypeDecoder!==void 0&&(a=n.contentTypeDecoder,c.set(a.name,a)),n.contentTypeDecoders!==void 0)for(let l of n.contentTypeDecoders)c.set(l.name,l)}return a===void 0&&(a=(0,sy.default)().applicationJson.decoder,c.set(a.name,a)),{charset:r,contentDecoder:s,contentDecoders:o,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(oy||(oy={}));var ay=class extends wd{constructor(e,n){super(),this.readable=e,this.options=oy.fromOptions(n),this.buffer=(0,sy.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new aj.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let n=this.readable.onData(r=>{this.onData(r)});return this.readable.onError(r=>this.fireError(r)),this.readable.onClose(()=>this.fireClose()),n}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let r=this.buffer.tryReadHeaders(!0);if(!r)return;let i=r.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property.
|
|
2
|
+
"use strict";var qB=Object.create;var Tg=Object.defineProperty;var $B=Object.getOwnPropertyDescriptor;var FB=Object.getOwnPropertyNames;var BB=Object.getPrototypeOf,jB=Object.prototype.hasOwnProperty;var N=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},UB=(t,e)=>{for(var n in e)Tg(t,n,{get:e[n],enumerable:!0})},HB=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of FB(e))!jB.call(t,i)&&i!==n&&Tg(t,i,{get:()=>e[i],enumerable:!(r=$B(e,i))||r.enumerable});return t};var L=(t,e,n)=>(n=t!=null?qB(BB(t)):{},HB(e||!t||!t.__esModule?Tg(n,"default",{value:t,enumerable:!0}):n,t));var vd=N(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.thenable=Vt.typedArray=Vt.stringArray=Vt.array=Vt.func=Vt.error=Vt.number=Vt.string=Vt.boolean=void 0;function VB(t){return t===!0||t===!1}Vt.boolean=VB;function FP(t){return typeof t=="string"||t instanceof String}Vt.string=FP;function WB(t){return typeof t=="number"||t instanceof Number}Vt.number=WB;function zB(t){return t instanceof Error}Vt.error=zB;function BP(t){return typeof t=="function"}Vt.func=BP;function jP(t){return Array.isArray(t)}Vt.array=jP;function GB(t){return jP(t)&&t.every(e=>FP(e))}Vt.stringArray=GB;function YB(t,e){return Array.isArray(t)&&t.every(e)}Vt.typedArray=YB;function KB(t){return t&&BP(t.then)}Vt.thenable=KB});var Uo=N(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.stringArray=_n.array=_n.func=_n.error=_n.number=_n.string=_n.boolean=void 0;function XB(t){return t===!0||t===!1}_n.boolean=XB;function UP(t){return typeof t=="string"||t instanceof String}_n.string=UP;function JB(t){return typeof t=="number"||t instanceof Number}_n.number=JB;function QB(t){return t instanceof Error}_n.error=QB;function ZB(t){return typeof t=="function"}_n.func=ZB;function HP(t){return Array.isArray(t)}_n.array=HP;function ej(t){return HP(t)&&t.every(e=>UP(e))}_n.stringArray=ej});var Hg=N(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.Message=ae.NotificationType9=ae.NotificationType8=ae.NotificationType7=ae.NotificationType6=ae.NotificationType5=ae.NotificationType4=ae.NotificationType3=ae.NotificationType2=ae.NotificationType1=ae.NotificationType0=ae.NotificationType=ae.RequestType9=ae.RequestType8=ae.RequestType7=ae.RequestType6=ae.RequestType5=ae.RequestType4=ae.RequestType3=ae.RequestType2=ae.RequestType1=ae.RequestType=ae.RequestType0=ae.AbstractMessageSignature=ae.ParameterStructures=ae.ResponseError=ae.ErrorCodes=void 0;var Zs=Uo(),vg;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(vg||(ae.ErrorCodes=vg={}));var bg=class t extends Error{constructor(e,n,r){super(n),this.code=Zs.number(e)?e:vg.UnknownErrorCode,this.data=r,Object.setPrototypeOf(this,t.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};ae.ResponseError=bg;var Vn=class t{constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};ae.ParameterStructures=Vn;Vn.auto=new Vn("auto");Vn.byPosition=new Vn("byPosition");Vn.byName=new Vn("byName");var bt=class{constructor(e,n){this.method=e,this.numberOfParams=n}get parameterStructures(){return Vn.auto}};ae.AbstractMessageSignature=bt;var Sg=class extends bt{constructor(e){super(e,0)}};ae.RequestType0=Sg;var _g=class extends bt{constructor(e,n=Vn.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};ae.RequestType=_g;var Pg=class extends bt{constructor(e,n=Vn.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};ae.RequestType1=Pg;var kg=class extends bt{constructor(e){super(e,2)}};ae.RequestType2=kg;var Ng=class extends bt{constructor(e){super(e,3)}};ae.RequestType3=Ng;var Rg=class extends bt{constructor(e){super(e,4)}};ae.RequestType4=Rg;var wg=class extends bt{constructor(e){super(e,5)}};ae.RequestType5=wg;var Eg=class extends bt{constructor(e){super(e,6)}};ae.RequestType6=Eg;var Cg=class extends bt{constructor(e){super(e,7)}};ae.RequestType7=Cg;var Dg=class extends bt{constructor(e){super(e,8)}};ae.RequestType8=Dg;var Ag=class extends bt{constructor(e){super(e,9)}};ae.RequestType9=Ag;var Ig=class extends bt{constructor(e,n=Vn.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};ae.NotificationType=Ig;var Og=class extends bt{constructor(e){super(e,0)}};ae.NotificationType0=Og;var Mg=class extends bt{constructor(e,n=Vn.auto){super(e,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};ae.NotificationType1=Mg;var xg=class extends bt{constructor(e){super(e,2)}};ae.NotificationType2=xg;var Lg=class extends bt{constructor(e){super(e,3)}};ae.NotificationType3=Lg;var qg=class extends bt{constructor(e){super(e,4)}};ae.NotificationType4=qg;var $g=class extends bt{constructor(e){super(e,5)}};ae.NotificationType5=$g;var Fg=class extends bt{constructor(e){super(e,6)}};ae.NotificationType6=Fg;var Bg=class extends bt{constructor(e){super(e,7)}};ae.NotificationType7=Bg;var jg=class extends bt{constructor(e){super(e,8)}};ae.NotificationType8=jg;var Ug=class extends bt{constructor(e){super(e,9)}};ae.NotificationType9=Ug;var VP;(function(t){function e(i){let s=i;return s&&Zs.string(s.method)&&(Zs.string(s.id)||Zs.number(s.id))}t.isRequest=e;function n(i){let s=i;return s&&Zs.string(s.method)&&i.id===void 0}t.isNotification=n;function r(i){let s=i;return s&&(s.result!==void 0||!!s.error)&&(Zs.string(s.id)||Zs.number(s.id)||s.id===null)}t.isResponse=r})(VP||(ae.Message=VP={}))});var Wg=N(is=>{"use strict";var WP;Object.defineProperty(is,"__esModule",{value:!0});is.LRUCache=is.LinkedMap=is.Touch=void 0;var Pn;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(Pn||(is.Touch=Pn={}));var bd=class{constructor(){this[WP]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,n=Pn.None){let r=this._map.get(e);if(r)return n!==Pn.None&&this.touch(r,n),r.value}set(e,n,r=Pn.None){let i=this._map.get(e);if(i)i.value=n,r!==Pn.None&&this.touch(i,r);else{switch(i={key:e,value:n,next:void 0,previous:void 0},r){case Pn.None:this.addItemLast(i);break;case Pn.First:this.addItemFirst(i);break;case Pn.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let n=this._map.get(e);if(n)return this._map.delete(e),this.removeItem(n),this._size--,n.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,n){let r=this._state,i=this._head;for(;i;){if(n?e.bind(n)(i.value,i.key,this):e(i.value,i.key,this),this._state!==r)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:n.key,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}values(){let e=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:n.value,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}entries(){let e=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:[n.key,n.value],done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}[(WP=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let n=this._head,r=this.size;for(;n&&r>e;)this._map.delete(n.key),n=n.next,r--;this._head=n,this._size=r,n&&(n.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let n=e.next,r=e.previous;if(!n||!r)throw new Error("Invalid list");n.previous=r,r.next=n}e.next=void 0,e.previous=void 0,this._state++}touch(e,n){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(n!==Pn.First&&n!==Pn.Last)){if(n===Pn.First){if(e===this._head)return;let r=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(r.previous=i,i.next=r),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(n===Pn.Last){if(e===this._tail)return;let r=e.next,i=e.previous;e===this._head?(r.previous=void 0,this._head=r):(r.previous=i,i.next=r),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((n,r)=>{e.push([r,n])}),e}fromJSON(e){this.clear();for(let[n,r]of e)this.set(n,r)}};is.LinkedMap=bd;var Vg=class extends bd{constructor(e,n=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,n),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,n=Pn.AsNew){return super.get(e,n)}peek(e){return super.get(e,Pn.None)}set(e,n){return super.set(e,n,Pn.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};is.LRUCache=Vg});var GP=N(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:!0});Sd.Disposable=void 0;var zP;(function(t){function e(n){return{dispose:n}}t.create=e})(zP||(Sd.Disposable=zP={}))});var ss=N(Yg=>{"use strict";Object.defineProperty(Yg,"__esModule",{value:!0});var zg;function Gg(){if(zg===void 0)throw new Error("No runtime abstraction layer installed");return zg}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");zg=n}t.install=e})(Gg||(Gg={}));Yg.default=Gg});var Vo=N(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.Emitter=Ho.Event=void 0;var tj=ss(),YP;(function(t){let e={dispose(){}};t.None=function(){return e}})(YP||(Ho.Event=YP={}));var Kg=class{add(e,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,n)})}remove(e,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i<s;i++)if(this._callbacks[i]===e)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];let n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,o=r.length;s<o;s++)try{n.push(r[s].apply(i[s],e))}catch(a){(0,tj.default)().console.error(a)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},_d=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,n,r)=>{this._callbacks||(this._callbacks=new Kg),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,n);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,n),i.dispose=t._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};Ho.Emitter=_d;_d._noop=function(){}});var Nd=N(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});Wo.CancellationTokenSource=Wo.CancellationToken=void 0;var nj=ss(),rj=Uo(),Xg=Vo(),Pd;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Xg.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Xg.Event.None});function e(n){let r=n;return r&&(r===t.None||r===t.Cancelled||rj.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}t.is=e})(Pd||(Wo.CancellationToken=Pd={}));var ij=Object.freeze(function(t,e){let n=(0,nj.default)().timer.setTimeout(t.bind(e),0);return{dispose(){n.dispose()}}}),kd=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?ij:(this._emitter||(this._emitter=new Xg.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Jg=class{get token(){return this._token||(this._token=new kd),this._token}cancel(){this._token?this._token.cancel():this._token=Pd.Cancelled}dispose(){this._token?this._token instanceof kd&&this._token.dispose():this._token=Pd.None}};Wo.CancellationTokenSource=Jg});var KP=N(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});zo.SharedArrayReceiverStrategy=zo.SharedArraySenderStrategy=void 0;var sj=Nd(),Ec;(function(t){t.Continue=0,t.Cancelled=1})(Ec||(Ec={}));var Qg=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let n=new SharedArrayBuffer(4),r=new Int32Array(n,0,1);r[0]=Ec.Continue,this.buffers.set(e.id,n),e.$cancellationData=n}async sendCancellation(e,n){let r=this.buffers.get(n);if(r===void 0)return;let i=new Int32Array(r,0,1);Atomics.store(i,0,Ec.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};zo.SharedArraySenderStrategy=Qg;var Zg=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Ec.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},ey=class{constructor(e){this.token=new Zg(e)}cancel(){}dispose(){}},ty=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let n=e.$cancellationData;return n===void 0?new sj.CancellationTokenSource:new ey(n)}};zo.SharedArrayReceiverStrategy=ty});var ry=N(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.Semaphore=void 0;var oj=ss(),ny=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((n,r)=>{this._waiting.push({thunk:e,resolve:n,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,oj.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let n=e.thunk();n instanceof Promise?n.then(r=>{this._active--,e.resolve(r),this.runNext()},r=>{this._active--,e.reject(r),this.runNext()}):(this._active--,e.resolve(n),this.runNext())}catch(n){this._active--,e.reject(n),this.runNext()}}};Rd.Semaphore=ny});var JP=N(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.ReadableStreamMessageReader=os.AbstractMessageReader=os.MessageReader=void 0;var sy=ss(),Go=Uo(),iy=Vo(),aj=ry(),XP;(function(t){function e(n){let r=n;return r&&Go.func(r.listen)&&Go.func(r.dispose)&&Go.func(r.onError)&&Go.func(r.onClose)&&Go.func(r.onPartialMessage)}t.is=e})(XP||(os.MessageReader=XP={}));var wd=class{constructor(){this.errorEmitter=new iy.Emitter,this.closeEmitter=new iy.Emitter,this.partialMessageEmitter=new iy.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${Go.string(e.message)?e.message:"unknown"}`)}};os.AbstractMessageReader=wd;var oy;(function(t){function e(n){let r,i,s,o=new Map,a,c=new Map;if(n===void 0||typeof n=="string")r=n??"utf-8";else{if(r=n.charset??"utf-8",n.contentDecoder!==void 0&&(s=n.contentDecoder,o.set(s.name,s)),n.contentDecoders!==void 0)for(let l of n.contentDecoders)o.set(l.name,l);if(n.contentTypeDecoder!==void 0&&(a=n.contentTypeDecoder,c.set(a.name,a)),n.contentTypeDecoders!==void 0)for(let l of n.contentTypeDecoders)c.set(l.name,l)}return a===void 0&&(a=(0,sy.default)().applicationJson.decoder,c.set(a.name,a)),{charset:r,contentDecoder:s,contentDecoders:o,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(oy||(oy={}));var ay=class extends wd{constructor(e,n){super(),this.readable=e,this.options=oy.fromOptions(n),this.buffer=(0,sy.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new aj.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let n=this.readable.onData(r=>{this.onData(r)});return this.readable.onError(r=>this.fireError(r)),this.readable.onClose(()=>this.fireClose()),n}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let r=this.buffer.tryReadHeaders(!0);if(!r)return;let i=r.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property.
|
|
3
3
|
${JSON.stringify(Object.fromEntries(r))}`));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 n=this.buffer.tryReadBody(this.nextMessageLength);if(n===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let r=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(n):n,i=await this.options.contentTypeDecoder.decode(r,this.options);this.callback(i)}).catch(r=>{this.fireError(r)})}}catch(n){this.fireError(n)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,sy.default)().timer.setTimeout((e,n)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:n}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};os.ReadableStreamMessageReader=ay});var nk=N(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.WriteableStreamMessageWriter=as.AbstractMessageWriter=as.MessageWriter=void 0;var QP=ss(),Cc=Uo(),cj=ry(),ZP=Vo(),lj="Content-Length: ",ek=`\r
|
|
4
4
|
`,tk;(function(t){function e(n){let r=n;return r&&Cc.func(r.dispose)&&Cc.func(r.onClose)&&Cc.func(r.onError)&&Cc.func(r.write)}t.is=e})(tk||(as.MessageWriter=tk={}));var Ed=class{constructor(){this.errorEmitter=new ZP.Emitter,this.closeEmitter=new ZP.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,n,r){this.errorEmitter.fire([this.asError(e),n,r])}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: ${Cc.string(e.message)?e.message:"unknown"}`)}};as.AbstractMessageWriter=Ed;var cy;(function(t){function e(n){return n===void 0||typeof n=="string"?{charset:n??"utf-8",contentTypeEncoder:(0,QP.default)().applicationJson.encoder}:{charset:n.charset??"utf-8",contentEncoder:n.contentEncoder,contentTypeEncoder:n.contentTypeEncoder??(0,QP.default)().applicationJson.encoder}}t.fromOptions=e})(cy||(cy={}));var ly=class extends Ed{constructor(e,n){super(),this.writable=e,this.options=cy.fromOptions(n),this.errorCount=0,this.writeSemaphore=new cj.Semaphore(1),this.writable.onError(r=>this.fireError(r)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(r=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(r):r).then(r=>{let i=[];return i.push(lj,r.byteLength.toString(),ek),i.push(ek),this.doWrite(e,i,r)},r=>{throw this.fireError(r),r}))}async doWrite(e,n,r){try{return await this.writable.write(n.join(""),"ascii"),this.writable.write(r)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,n){this.errorCount++,this.fireError(e,n,this.errorCount)}end(){this.writable.end()}};as.WriteableStreamMessageWriter=ly});var rk=N(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd.AbstractMessageBuffer=void 0;var uj=13,dj=10,fj=`\r
|
|
5
5
|
`,uy=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let n=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(n),this._totalLength+=n.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let n=0,r=0,i=0,s=0;e:for(;r<this._chunks.length;){let l=this._chunks[r];for(i=0;i<l.length;){switch(l[i]){case uj:switch(n){case 0:n=1;break;case 2:n=3;break;default:n=0}break;case dj:switch(n){case 1:n=2;break;case 3:n=4,i++;break e;default:n=0}break;default:n=0}i++}s+=l.byteLength,r++}if(n!==4)return;let o=this._read(s+i),a=new Map,c=this.toString(o,"ascii").split(fj);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 n=this.allocNative(e),r=0,i=0;for(;e>0;){let s=this._chunks[i];if(s.byteLength>e){let o=s.slice(0,e);n.set(o,r),r+=e,this._chunks[i]=s.slice(e),this._totalLength-=e,e-=e}else n.set(s,r),r+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,e-=s.byteLength}return n}};Cd.AbstractMessageBuffer=uy});var ck=N(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.createMessageConnection=ve.ConnectionOptions=ve.MessageStrategy=ve.CancellationStrategy=ve.CancellationSenderStrategy=ve.CancellationReceiverStrategy=ve.RequestCancellationReceiverStrategy=ve.IdCancellationReceiverStrategy=ve.ConnectionStrategy=ve.ConnectionError=ve.ConnectionErrors=ve.LogTraceNotification=ve.SetTraceNotification=ve.TraceFormat=ve.TraceValues=ve.Trace=ve.NullLogger=ve.ProgressType=ve.ProgressToken=void 0;var ik=ss(),Ct=Uo(),pe=Hg(),sk=Wg(),Dc=Vo(),dy=Nd(),Oc;(function(t){t.type=new pe.NotificationType("$/cancelRequest")})(Oc||(Oc={}));var fy;(function(t){function e(n){return typeof n=="string"||typeof n=="number"}t.is=e})(fy||(ve.ProgressToken=fy={}));var Ac;(function(t){t.type=new pe.NotificationType("$/progress")})(Ac||(Ac={}));var py=class{constructor(){}};ve.ProgressType=py;var hy;(function(t){function e(n){return Ct.func(n)}t.is=e})(hy||(hy={}));ve.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Ke;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(Ke||(ve.Trace=Ke={}));var ok;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(ok||(ve.TraceValues=ok={}));(function(t){function e(r){if(!Ct.string(r))return t.Off;switch(r=r.toLowerCase(),r){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 n(r){switch(r){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=n})(Ke||(ve.Trace=Ke={}));var dr;(function(t){t.Text="text",t.JSON="json"})(dr||(ve.TraceFormat=dr={}));(function(t){function e(n){return Ct.string(n)?(n=n.toLowerCase(),n==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(dr||(ve.TraceFormat=dr={}));var my;(function(t){t.type=new pe.NotificationType("$/setTrace")})(my||(ve.SetTraceNotification=my={}));var Dd;(function(t){t.type=new pe.NotificationType("$/logTrace")})(Dd||(ve.LogTraceNotification=Dd={}));var Ic;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(Ic||(ve.ConnectionErrors=Ic={}));var Yo=class t extends Error{constructor(e,n){super(n),this.code=e,Object.setPrototypeOf(this,t.prototype)}};ve.ConnectionError=Yo;var gy;(function(t){function e(n){let r=n;return r&&Ct.func(r.cancelUndispatched)}t.is=e})(gy||(ve.ConnectionStrategy=gy={}));var Ad;(function(t){function e(n){let r=n;return r&&(r.kind===void 0||r.kind==="id")&&Ct.func(r.createCancellationTokenSource)&&(r.dispose===void 0||Ct.func(r.dispose))}t.is=e})(Ad||(ve.IdCancellationReceiverStrategy=Ad={}));var yy;(function(t){function e(n){let r=n;return r&&r.kind==="request"&&Ct.func(r.createCancellationTokenSource)&&(r.dispose===void 0||Ct.func(r.dispose))}t.is=e})(yy||(ve.RequestCancellationReceiverStrategy=yy={}));var Id;(function(t){t.Message=Object.freeze({createCancellationTokenSource(n){return new dy.CancellationTokenSource}});function e(n){return Ad.is(n)||yy.is(n)}t.is=e})(Id||(ve.CancellationReceiverStrategy=Id={}));var Od;(function(t){t.Message=Object.freeze({sendCancellation(n,r){return n.sendNotification(Oc.type,{id:r})},cleanup(n){}});function e(n){let r=n;return r&&Ct.func(r.sendCancellation)&&Ct.func(r.cleanup)}t.is=e})(Od||(ve.CancellationSenderStrategy=Od={}));var Md;(function(t){t.Message=Object.freeze({receiver:Id.Message,sender:Od.Message});function e(n){let r=n;return r&&Id.is(r.receiver)&&Od.is(r.sender)}t.is=e})(Md||(ve.CancellationStrategy=Md={}));var xd;(function(t){function e(n){let r=n;return r&&Ct.func(r.handleMessage)}t.is=e})(xd||(ve.MessageStrategy=xd={}));var ak;(function(t){function e(n){let r=n;return r&&(Md.is(r.cancellationStrategy)||gy.is(r.connectionStrategy)||xd.is(r.messageStrategy))}t.is=e})(ak||(ve.ConnectionOptions=ak={}));var zr;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(zr||(zr={}));function pj(t,e,n,r){let i=n!==void 0?n:ve.NullLogger,s=0,o=0,a=0,c="2.0",l,u=new Map,d,f=new Map,p=new Map,m,h=new sk.LinkedMap,y=new Map,S=new Set,b=new Map,v=Ke.Off,k=dr.Text,R,q=zr.New,O=new Dc.Emitter,B=new Dc.Emitter,Pe=new Dc.Emitter,Qe=new Dc.Emitter,Et=new Dc.Emitter,ke=r&&r.cancellationStrategy?r.cancellationStrategy:Md.Message;function dn(w){if(w===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+w.toString()}function Sn(w){return w===null?"res-unknown-"+(++a).toString():"res-"+w.toString()}function rd(){return"not-"+(++o).toString()}function yg(w,$){pe.Message.isRequest($)?w.set(dn($.id),$):pe.Message.isResponse($)?w.set(Sn($.id),$):w.set(rd(),$)}function id(w){}function _c(){return q===zr.Listening}function Xs(){return q===zr.Closed}function qi(){return q===zr.Disposed}function qo(){(q===zr.New||q===zr.Listening)&&(q=zr.Closed,B.fire(void 0))}function Js(w){O.fire([w,void 0,void 0])}function sd(w){O.fire(w)}t.onClose(qo),t.onError(Js),e.onClose(qo),e.onError(sd);function Pc(){m||h.size===0||(m=(0,ik.default)().timer.setImmediate(()=>{m=void 0,od()}))}function kc(w){pe.Message.isRequest(w)?cd(w):pe.Message.isNotification(w)?ud(w):pe.Message.isResponse(w)?ld(w):$o(w)}function od(){if(h.size===0)return;let w=h.shift();try{let $=r?.messageStrategy;xd.is($)?$.handleMessage(w,kc):kc(w)}finally{Pc()}}let ad=w=>{try{if(pe.Message.isNotification(w)&&w.method===Oc.type.method){let $=w.params.id,G=dn($),ne=h.get(G);if(pe.Message.isRequest(ne)){let Ze=r?.connectionStrategy,vt=Ze&&Ze.cancelUndispatched?Ze.cancelUndispatched(ne,id):void 0;if(vt&&(vt.error!==void 0||vt.result!==void 0)){h.delete(G),b.delete($),vt.id=ne.id,Qs(vt,w.method,Date.now()),e.write(vt).catch(()=>i.error("Sending response for canceled message failed."));return}}let it=b.get($);if(it!==void 0){it.cancel(),Fo(w);return}else S.add($)}yg(h,w)}finally{Pc()}};function cd(w){if(qi())return;function $(Ae,at,Ge){let
|
|
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 n=this.allocNative(e),r=0,i=0;for(;e>0;){let s=this._chunks[i];if(s.byteLength>e){let o=s.slice(0,e);n.set(o,r),r+=e,this._chunks[i]=s.slice(e),this._totalLength-=e,e-=e}else n.set(s,r),r+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,e-=s.byteLength}return n}};Cd.AbstractMessageBuffer=uy});var ck=N(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.createMessageConnection=ve.ConnectionOptions=ve.MessageStrategy=ve.CancellationStrategy=ve.CancellationSenderStrategy=ve.CancellationReceiverStrategy=ve.RequestCancellationReceiverStrategy=ve.IdCancellationReceiverStrategy=ve.ConnectionStrategy=ve.ConnectionError=ve.ConnectionErrors=ve.LogTraceNotification=ve.SetTraceNotification=ve.TraceFormat=ve.TraceValues=ve.Trace=ve.NullLogger=ve.ProgressType=ve.ProgressToken=void 0;var ik=ss(),Ct=Uo(),pe=Hg(),sk=Wg(),Dc=Vo(),dy=Nd(),Oc;(function(t){t.type=new pe.NotificationType("$/cancelRequest")})(Oc||(Oc={}));var fy;(function(t){function e(n){return typeof n=="string"||typeof n=="number"}t.is=e})(fy||(ve.ProgressToken=fy={}));var Ac;(function(t){t.type=new pe.NotificationType("$/progress")})(Ac||(Ac={}));var py=class{constructor(){}};ve.ProgressType=py;var hy;(function(t){function e(n){return Ct.func(n)}t.is=e})(hy||(hy={}));ve.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Ke;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(Ke||(ve.Trace=Ke={}));var ok;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(ok||(ve.TraceValues=ok={}));(function(t){function e(r){if(!Ct.string(r))return t.Off;switch(r=r.toLowerCase(),r){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 n(r){switch(r){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=n})(Ke||(ve.Trace=Ke={}));var dr;(function(t){t.Text="text",t.JSON="json"})(dr||(ve.TraceFormat=dr={}));(function(t){function e(n){return Ct.string(n)?(n=n.toLowerCase(),n==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(dr||(ve.TraceFormat=dr={}));var my;(function(t){t.type=new pe.NotificationType("$/setTrace")})(my||(ve.SetTraceNotification=my={}));var Dd;(function(t){t.type=new pe.NotificationType("$/logTrace")})(Dd||(ve.LogTraceNotification=Dd={}));var Ic;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(Ic||(ve.ConnectionErrors=Ic={}));var Yo=class t extends Error{constructor(e,n){super(n),this.code=e,Object.setPrototypeOf(this,t.prototype)}};ve.ConnectionError=Yo;var gy;(function(t){function e(n){let r=n;return r&&Ct.func(r.cancelUndispatched)}t.is=e})(gy||(ve.ConnectionStrategy=gy={}));var Ad;(function(t){function e(n){let r=n;return r&&(r.kind===void 0||r.kind==="id")&&Ct.func(r.createCancellationTokenSource)&&(r.dispose===void 0||Ct.func(r.dispose))}t.is=e})(Ad||(ve.IdCancellationReceiverStrategy=Ad={}));var yy;(function(t){function e(n){let r=n;return r&&r.kind==="request"&&Ct.func(r.createCancellationTokenSource)&&(r.dispose===void 0||Ct.func(r.dispose))}t.is=e})(yy||(ve.RequestCancellationReceiverStrategy=yy={}));var Id;(function(t){t.Message=Object.freeze({createCancellationTokenSource(n){return new dy.CancellationTokenSource}});function e(n){return Ad.is(n)||yy.is(n)}t.is=e})(Id||(ve.CancellationReceiverStrategy=Id={}));var Od;(function(t){t.Message=Object.freeze({sendCancellation(n,r){return n.sendNotification(Oc.type,{id:r})},cleanup(n){}});function e(n){let r=n;return r&&Ct.func(r.sendCancellation)&&Ct.func(r.cleanup)}t.is=e})(Od||(ve.CancellationSenderStrategy=Od={}));var Md;(function(t){t.Message=Object.freeze({receiver:Id.Message,sender:Od.Message});function e(n){let r=n;return r&&Id.is(r.receiver)&&Od.is(r.sender)}t.is=e})(Md||(ve.CancellationStrategy=Md={}));var xd;(function(t){function e(n){let r=n;return r&&Ct.func(r.handleMessage)}t.is=e})(xd||(ve.MessageStrategy=xd={}));var ak;(function(t){function e(n){let r=n;return r&&(Md.is(r.cancellationStrategy)||gy.is(r.connectionStrategy)||xd.is(r.messageStrategy))}t.is=e})(ak||(ve.ConnectionOptions=ak={}));var zr;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(zr||(zr={}));function pj(t,e,n,r){let i=n!==void 0?n:ve.NullLogger,s=0,o=0,a=0,c="2.0",l,u=new Map,d,f=new Map,p=new Map,m,h=new sk.LinkedMap,y=new Map,S=new Set,b=new Map,v=Ke.Off,k=dr.Text,R,q=zr.New,O=new Dc.Emitter,B=new Dc.Emitter,Pe=new Dc.Emitter,Qe=new Dc.Emitter,Et=new Dc.Emitter,ke=r&&r.cancellationStrategy?r.cancellationStrategy:Md.Message;function dn(w){if(w===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+w.toString()}function Sn(w){return w===null?"res-unknown-"+(++a).toString():"res-"+w.toString()}function rd(){return"not-"+(++o).toString()}function yg(w,$){pe.Message.isRequest($)?w.set(dn($.id),$):pe.Message.isResponse($)?w.set(Sn($.id),$):w.set(rd(),$)}function id(w){}function _c(){return q===zr.Listening}function Xs(){return q===zr.Closed}function qi(){return q===zr.Disposed}function qo(){(q===zr.New||q===zr.Listening)&&(q=zr.Closed,B.fire(void 0))}function Js(w){O.fire([w,void 0,void 0])}function sd(w){O.fire(w)}t.onClose(qo),t.onError(Js),e.onClose(qo),e.onError(sd);function Pc(){m||h.size===0||(m=(0,ik.default)().timer.setImmediate(()=>{m=void 0,od()}))}function kc(w){pe.Message.isRequest(w)?cd(w):pe.Message.isNotification(w)?ud(w):pe.Message.isResponse(w)?ld(w):$o(w)}function od(){if(h.size===0)return;let w=h.shift();try{let $=r?.messageStrategy;xd.is($)?$.handleMessage(w,kc):kc(w)}finally{Pc()}}let ad=w=>{try{if(pe.Message.isNotification(w)&&w.method===Oc.type.method){let $=w.params.id,G=dn($),ne=h.get(G);if(pe.Message.isRequest(ne)){let Ze=r?.connectionStrategy,vt=Ze&&Ze.cancelUndispatched?Ze.cancelUndispatched(ne,id):void 0;if(vt&&(vt.error!==void 0||vt.result!==void 0)){h.delete(G),b.delete($),vt.id=ne.id,Qs(vt,w.method,Date.now()),e.write(vt).catch(()=>i.error("Sending response for canceled message failed."));return}}let it=b.get($);if(it!==void 0){it.cancel(),Fo(w);return}else S.add($)}yg(h,w)}finally{Pc()}};function cd(w){if(qi())return;function $(Ae,at,Ge){let It={jsonrpc:c,id:w.id};Ae instanceof pe.ResponseError?It.error=Ae.toJson():It.result=Ae===void 0?null:Ae,Qs(It,at,Ge),e.write(It).catch(()=>i.error("Sending response failed."))}function G(Ae,at,Ge){let It={jsonrpc:c,id:w.id,error:Ae.toJson()};Qs(It,at,Ge),e.write(It).catch(()=>i.error("Sending response failed."))}function ne(Ae,at,Ge){Ae===void 0&&(Ae=null);let It={jsonrpc:c,id:w.id,result:Ae};Qs(It,at,Ge),e.write(It).catch(()=>i.error("Sending response failed."))}pd(w);let it=u.get(w.method),Ze,vt;it&&(Ze=it.type,vt=it.handler);let kt=Date.now();if(vt||l){let Ae=w.id??String(Date.now()),at=Ad.is(ke.receiver)?ke.receiver.createCancellationTokenSource(Ae):ke.receiver.createCancellationTokenSource(w);w.id!==null&&S.has(w.id)&&at.cancel(),w.id!==null&&b.set(Ae,at);try{let Ge;if(vt)if(w.params===void 0){if(Ze!==void 0&&Ze.numberOfParams!==0){G(new pe.ResponseError(pe.ErrorCodes.InvalidParams,`Request ${w.method} defines ${Ze.numberOfParams} params but received none.`),w.method,kt);return}Ge=vt(at.token)}else if(Array.isArray(w.params)){if(Ze!==void 0&&Ze.parameterStructures===pe.ParameterStructures.byName){G(new pe.ResponseError(pe.ErrorCodes.InvalidParams,`Request ${w.method} defines parameters by name but received parameters by position`),w.method,kt);return}Ge=vt(...w.params,at.token)}else{if(Ze!==void 0&&Ze.parameterStructures===pe.ParameterStructures.byPosition){G(new pe.ResponseError(pe.ErrorCodes.InvalidParams,`Request ${w.method} defines parameters by position but received parameters by name`),w.method,kt);return}Ge=vt(w.params,at.token)}else l&&(Ge=l(w.method,w.params,at.token));let It=Ge;Ge?It.then?It.then(tn=>{b.delete(Ae),$(tn,w.method,kt)},tn=>{b.delete(Ae),tn instanceof pe.ResponseError?G(tn,w.method,kt):tn&&Ct.string(tn.message)?G(new pe.ResponseError(pe.ErrorCodes.InternalError,`Request ${w.method} failed with message: ${tn.message}`),w.method,kt):G(new pe.ResponseError(pe.ErrorCodes.InternalError,`Request ${w.method} failed unexpectedly without providing any details.`),w.method,kt)}):(b.delete(Ae),$(Ge,w.method,kt)):(b.delete(Ae),ne(Ge,w.method,kt))}catch(Ge){b.delete(Ae),Ge instanceof pe.ResponseError?$(Ge,w.method,kt):Ge&&Ct.string(Ge.message)?G(new pe.ResponseError(pe.ErrorCodes.InternalError,`Request ${w.method} failed with message: ${Ge.message}`),w.method,kt):G(new pe.ResponseError(pe.ErrorCodes.InternalError,`Request ${w.method} failed unexpectedly without providing any details.`),w.method,kt)}}else G(new pe.ResponseError(pe.ErrorCodes.MethodNotFound,`Unhandled method ${w.method}`),w.method,kt)}function ld(w){if(!qi())if(w.id===null)w.error?i.error(`Received response message without id: Error is:
|
|
7
7
|
${JSON.stringify(w.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let $=w.id,G=y.get($);if(hd(w,G),G!==void 0){y.delete($);try{if(w.error){let ne=w.error;G.reject(new pe.ResponseError(ne.code,ne.message,ne.data))}else if(w.result!==void 0)G.resolve(w.result);else throw new Error("Should never happen.")}catch(ne){ne.message?i.error(`Response handler '${G.method}' failed with message: ${ne.message}`):i.error(`Response handler '${G.method}' failed unexpectedly.`)}}}}function ud(w){if(qi())return;let $,G;if(w.method===Oc.type.method){let ne=w.params.id;S.delete(ne),Fo(w);return}else{let ne=f.get(w.method);ne&&(G=ne.handler,$=ne.type)}if(G||d)try{if(Fo(w),G)if(w.params===void 0)$!==void 0&&$.numberOfParams!==0&&$.parameterStructures!==pe.ParameterStructures.byName&&i.error(`Notification ${w.method} defines ${$.numberOfParams} params but received none.`),G();else if(Array.isArray(w.params)){let ne=w.params;w.method===Ac.type.method&&ne.length===2&&fy.is(ne[0])?G({token:ne[0],value:ne[1]}):($!==void 0&&($.parameterStructures===pe.ParameterStructures.byName&&i.error(`Notification ${w.method} defines parameters by name but received parameters by position`),$.numberOfParams!==w.params.length&&i.error(`Notification ${w.method} defines ${$.numberOfParams} params but received ${ne.length} arguments`)),G(...ne))}else $!==void 0&&$.parameterStructures===pe.ParameterStructures.byPosition&&i.error(`Notification ${w.method} defines parameters by position but received parameters by name`),G(w.params);else d&&d(w.method,w.params)}catch(ne){ne.message?i.error(`Notification handler '${w.method}' failed with message: ${ne.message}`):i.error(`Notification handler '${w.method}' failed unexpectedly.`)}else Pe.fire(w)}function $o(w){if(!w){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
|
|
8
8
|
${JSON.stringify(w,null,4)}`);let $=w;if(Ct.string($.id)||Ct.number($.id)){let G=$.id,ne=y.get(G);ne&&ne.reject(new Error("The received response has neither a result nor an error property."))}}function Hr(w){if(w!=null)switch(v){case Ke.Verbose:return JSON.stringify(w,null,4);case Ke.Compact:return JSON.stringify(w);default:return}}function dd(w){if(!(v===Ke.Off||!R))if(k===dr.Text){let $;(v===Ke.Verbose||v===Ke.Compact)&&w.params&&($=`Params: ${Hr(w.params)}
|
|
9
9
|
|
|
@@ -29,13 +29,13 @@ ${JSON.stringify(w,null,4)}`);let $=w;if(Ct.string($.id)||Ct.number($.id)){let G
|
|
|
29
29
|
|
|
30
30
|
`:w.error===void 0&&(G=`No result returned.
|
|
31
31
|
|
|
32
|
-
`)),$){let ne=w.error?` Request failed: ${w.error.message} (${w.error.code}).`:"";R.log(`Received response '${$.method} - (${w.id})' in ${Date.now()-$.timerStart}ms.${ne}`,G)}else R.log(`Received response ${w.id} without active response promise.`,G)}else $i("receive-response",w)}function $i(w,$){if(!R||v===Ke.Off)return;let G={isLSPMessage:!0,type:w,message:$,timestamp:Date.now()};R.log(G)}function rs(){if(Xs())throw new Yo(Ic.Closed,"Connection is closed.");if(qi())throw new Yo(Ic.Disposed,"Connection is disposed.")}function md(){if(_c())throw new Yo(Ic.AlreadyListening,"Connection is already listening")}function gd(){if(!_c())throw new Error("Call listen() first.")}function mi(w){return w===void 0?null:w}function Nc(w){if(w!==null)return w}function Rc(w){return w!=null&&!Array.isArray(w)&&typeof w=="object"}function Bo(w,$){switch(w){case pe.ParameterStructures.auto:return Rc($)?Nc($):[mi($)];case pe.ParameterStructures.byName:if(!Rc($))throw new Error("Received parameters by name but param is not an object literal.");return Nc($);case pe.ParameterStructures.byPosition:return[mi($)];default:throw new Error(`Unknown parameter structure ${w.toString()}`)}}function wc(w,$){let G,ne=w.numberOfParams;switch(ne){case 0:G=void 0;break;case 1:G=Bo(w.parameterStructures,$[0]);break;default:G=[];for(let it=0;it<$.length&&it<ne;it++)G.push(mi($[it]));if($.length<ne)for(let it=$.length;it<ne;it++)G.push(null);break}return G}let Fi={sendNotification:(w,...$)=>{rs();let G,ne;if(Ct.string(w)){G=w;let Ze=$[0],vt=0,kt=pe.ParameterStructures.auto;pe.ParameterStructures.is(Ze)&&(vt=1,kt=Ze);let Ae=$.length,at=Ae-vt;switch(at){case 0:ne=void 0;break;case 1:ne=Bo(kt,$[vt]);break;default:if(kt===pe.ParameterStructures.byName)throw new Error(`Received ${at} parameters for 'by Name' notification parameter structure.`);ne=$.slice(vt,Ae).map(Ge=>mi(Ge));break}}else{let Ze=$;G=w.method,ne=wc(w,Ze)}let it={jsonrpc:c,method:G,params:ne};return fd(it),e.write(it).catch(Ze=>{throw i.error("Sending notification failed."),Ze})},onNotification:(w,$)=>{rs();let G;return Ct.func(w)?d=w:$&&(Ct.string(w)?(G=w,f.set(w,{type:void 0,handler:$})):(G=w.method,f.set(w.method,{type:w,handler:$}))),{dispose:()=>{G!==void 0?f.delete(G):d=void 0}}},onProgress:(w,$,G)=>{if(p.has($))throw new Error(`Progress handler for token ${$} already registered`);return p.set($,G),{dispose:()=>{p.delete($)}}},sendProgress:(w,$,G)=>Fi.sendNotification(Ac.type,{token:$,value:G}),onUnhandledProgress:Qe.event,sendRequest:(w,...$)=>{rs(),gd();let G,ne,it;if(Ct.string(w)){G=w;let Ae=$[0],at=$[$.length-1],Ge=0,Ot=pe.ParameterStructures.auto;pe.ParameterStructures.is(Ae)&&(Ge=1,Ot=Ae);let tn=$.length;dy.CancellationToken.is(at)&&(tn=tn-1,it=at);let ur=tn-Ge;switch(ur){case 0:ne=void 0;break;case 1:ne=Bo(Ot,$[Ge]);break;default:if(Ot===pe.ParameterStructures.byName)throw new Error(`Received ${ur} parameters for 'by Name' request parameter structure.`);ne=$.slice(Ge,tn).map(yd=>mi(yd));break}}else{let Ae=$;G=w.method,ne=wc(w,Ae);let at=w.numberOfParams;it=dy.CancellationToken.is(Ae[at])?Ae[at]:void 0}let Ze=s++,vt;it&&(vt=it.onCancellationRequested(()=>{let Ae=ke.sender.sendCancellation(Fi,Ze);return Ae===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${Ze}`),Promise.resolve()):Ae.catch(()=>{i.log(`Sending cancellation messages for id ${Ze} failed`)})}));let kt={jsonrpc:c,id:Ze,method:G,params:ne};return dd(kt),typeof ke.sender.enableCancellation=="function"&&ke.sender.enableCancellation(kt),new Promise(async(Ae,at)=>{let Ge=ur=>{Ae(ur),ke.sender.cleanup(Ze),vt?.dispose()},Ot=ur=>{at(ur),ke.sender.cleanup(Ze),vt?.dispose()},tn={method:G,timerStart:Date.now(),resolve:Ge,reject:Ot};try{await e.write(kt),y.set(Ze,tn)}catch(ur){throw i.error("Sending request failed."),tn.reject(new pe.ResponseError(pe.ErrorCodes.MessageWriteError,ur.message?ur.message:"Unknown reason")),ur}})},onRequest:(w,$)=>{rs();let G=null;return hy.is(w)?(G=void 0,l=w):Ct.string(w)?(G=null,$!==void 0&&(G=w,u.set(w,{handler:$,type:void 0}))):$!==void 0&&(G=w.method,u.set(w.method,{type:w,handler:$})),{dispose:()=>{G!==null&&(G!==void 0?u.delete(G):l=void 0)}}},hasPendingResponse:()=>y.size>0,trace:async(w,$,G)=>{let ne=!1,it=dr.Text;G!==void 0&&(Ct.boolean(G)?ne=G:(ne=G.sendNotification||!1,it=G.traceFormat||dr.Text)),v=w,k=it,v===Ke.Off?R=void 0:R=$,ne&&!Xs()&&!qi()&&await Fi.sendNotification(my.type,{value:Ke.toString(w)})},onError:O.event,onClose:B.event,onUnhandledNotification:Pe.event,onDispose:Et.event,end:()=>{e.end()},dispose:()=>{if(qi())return;q=zr.Disposed,Et.fire(void 0);let w=new pe.ResponseError(pe.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let $ of y.values())$.reject(w);y=new Map,b=new Map,S=new Set,h=new sk.LinkedMap,Ct.func(e.dispose)&&e.dispose(),Ct.func(t.dispose)&&t.dispose()},listen:()=>{rs(),md(),q=zr.Listening,t.listen(ad)},inspect:()=>{(0,ik.default)().console.log("inspect")}};return Fi.onNotification(Dd.type,w=>{if(v===Ke.Off||!R)return;let $=v===Ke.Verbose||v===Ke.Compact;R.log(w.message,$?w.verbose:void 0)}),Fi.onNotification(Ac.type,w=>{let $=p.get(w.token);$?$(w.value):Qe.fire(w)}),Fi}ve.createMessageConnection=pj});var Ld=N(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.ProgressType=M.ProgressToken=M.createMessageConnection=M.NullLogger=M.ConnectionOptions=M.ConnectionStrategy=M.AbstractMessageBuffer=M.WriteableStreamMessageWriter=M.AbstractMessageWriter=M.MessageWriter=M.ReadableStreamMessageReader=M.AbstractMessageReader=M.MessageReader=M.SharedArrayReceiverStrategy=M.SharedArraySenderStrategy=M.CancellationToken=M.CancellationTokenSource=M.Emitter=M.Event=M.Disposable=M.LRUCache=M.Touch=M.LinkedMap=M.ParameterStructures=M.NotificationType9=M.NotificationType8=M.NotificationType7=M.NotificationType6=M.NotificationType5=M.NotificationType4=M.NotificationType3=M.NotificationType2=M.NotificationType1=M.NotificationType0=M.NotificationType=M.ErrorCodes=M.ResponseError=M.RequestType9=M.RequestType8=M.RequestType7=M.RequestType6=M.RequestType5=M.RequestType4=M.RequestType3=M.RequestType2=M.RequestType1=M.RequestType0=M.RequestType=M.Message=M.RAL=void 0;M.MessageStrategy=M.CancellationStrategy=M.CancellationSenderStrategy=M.CancellationReceiverStrategy=M.ConnectionError=M.ConnectionErrors=M.LogTraceNotification=M.SetTraceNotification=M.TraceFormat=M.TraceValues=M.Trace=void 0;var yt=Hg();Object.defineProperty(M,"Message",{enumerable:!0,get:function(){return yt.Message}});Object.defineProperty(M,"RequestType",{enumerable:!0,get:function(){return yt.RequestType}});Object.defineProperty(M,"RequestType0",{enumerable:!0,get:function(){return yt.RequestType0}});Object.defineProperty(M,"RequestType1",{enumerable:!0,get:function(){return yt.RequestType1}});Object.defineProperty(M,"RequestType2",{enumerable:!0,get:function(){return yt.RequestType2}});Object.defineProperty(M,"RequestType3",{enumerable:!0,get:function(){return yt.RequestType3}});Object.defineProperty(M,"RequestType4",{enumerable:!0,get:function(){return yt.RequestType4}});Object.defineProperty(M,"RequestType5",{enumerable:!0,get:function(){return yt.RequestType5}});Object.defineProperty(M,"RequestType6",{enumerable:!0,get:function(){return yt.RequestType6}});Object.defineProperty(M,"RequestType7",{enumerable:!0,get:function(){return yt.RequestType7}});Object.defineProperty(M,"RequestType8",{enumerable:!0,get:function(){return yt.RequestType8}});Object.defineProperty(M,"RequestType9",{enumerable:!0,get:function(){return yt.RequestType9}});Object.defineProperty(M,"ResponseError",{enumerable:!0,get:function(){return yt.ResponseError}});Object.defineProperty(M,"ErrorCodes",{enumerable:!0,get:function(){return yt.ErrorCodes}});Object.defineProperty(M,"NotificationType",{enumerable:!0,get:function(){return yt.NotificationType}});Object.defineProperty(M,"NotificationType0",{enumerable:!0,get:function(){return yt.NotificationType0}});Object.defineProperty(M,"NotificationType1",{enumerable:!0,get:function(){return yt.NotificationType1}});Object.defineProperty(M,"NotificationType2",{enumerable:!0,get:function(){return yt.NotificationType2}});Object.defineProperty(M,"NotificationType3",{enumerable:!0,get:function(){return yt.NotificationType3}});Object.defineProperty(M,"NotificationType4",{enumerable:!0,get:function(){return yt.NotificationType4}});Object.defineProperty(M,"NotificationType5",{enumerable:!0,get:function(){return yt.NotificationType5}});Object.defineProperty(M,"NotificationType6",{enumerable:!0,get:function(){return yt.NotificationType6}});Object.defineProperty(M,"NotificationType7",{enumerable:!0,get:function(){return yt.NotificationType7}});Object.defineProperty(M,"NotificationType8",{enumerable:!0,get:function(){return yt.NotificationType8}});Object.defineProperty(M,"NotificationType9",{enumerable:!0,get:function(){return yt.NotificationType9}});Object.defineProperty(M,"ParameterStructures",{enumerable:!0,get:function(){return yt.ParameterStructures}});var Ty=Wg();Object.defineProperty(M,"LinkedMap",{enumerable:!0,get:function(){return Ty.LinkedMap}});Object.defineProperty(M,"LRUCache",{enumerable:!0,get:function(){return Ty.LRUCache}});Object.defineProperty(M,"Touch",{enumerable:!0,get:function(){return Ty.Touch}});var hj=GP();Object.defineProperty(M,"Disposable",{enumerable:!0,get:function(){return hj.Disposable}});var lk=Vo();Object.defineProperty(M,"Event",{enumerable:!0,get:function(){return lk.Event}});Object.defineProperty(M,"Emitter",{enumerable:!0,get:function(){return lk.Emitter}});var uk=Nd();Object.defineProperty(M,"CancellationTokenSource",{enumerable:!0,get:function(){return uk.CancellationTokenSource}});Object.defineProperty(M,"CancellationToken",{enumerable:!0,get:function(){return uk.CancellationToken}});var dk=KP();Object.defineProperty(M,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return dk.SharedArraySenderStrategy}});Object.defineProperty(M,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return dk.SharedArrayReceiverStrategy}});var vy=JP();Object.defineProperty(M,"MessageReader",{enumerable:!0,get:function(){return vy.MessageReader}});Object.defineProperty(M,"AbstractMessageReader",{enumerable:!0,get:function(){return vy.AbstractMessageReader}});Object.defineProperty(M,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return vy.ReadableStreamMessageReader}});var by=nk();Object.defineProperty(M,"MessageWriter",{enumerable:!0,get:function(){return by.MessageWriter}});Object.defineProperty(M,"AbstractMessageWriter",{enumerable:!0,get:function(){return by.AbstractMessageWriter}});Object.defineProperty(M,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return by.WriteableStreamMessageWriter}});var mj=rk();Object.defineProperty(M,"AbstractMessageBuffer",{enumerable:!0,get:function(){return mj.AbstractMessageBuffer}});var fn=ck();Object.defineProperty(M,"ConnectionStrategy",{enumerable:!0,get:function(){return fn.ConnectionStrategy}});Object.defineProperty(M,"ConnectionOptions",{enumerable:!0,get:function(){return fn.ConnectionOptions}});Object.defineProperty(M,"NullLogger",{enumerable:!0,get:function(){return fn.NullLogger}});Object.defineProperty(M,"createMessageConnection",{enumerable:!0,get:function(){return fn.createMessageConnection}});Object.defineProperty(M,"ProgressToken",{enumerable:!0,get:function(){return fn.ProgressToken}});Object.defineProperty(M,"ProgressType",{enumerable:!0,get:function(){return fn.ProgressType}});Object.defineProperty(M,"Trace",{enumerable:!0,get:function(){return fn.Trace}});Object.defineProperty(M,"TraceValues",{enumerable:!0,get:function(){return fn.TraceValues}});Object.defineProperty(M,"TraceFormat",{enumerable:!0,get:function(){return fn.TraceFormat}});Object.defineProperty(M,"SetTraceNotification",{enumerable:!0,get:function(){return fn.SetTraceNotification}});Object.defineProperty(M,"LogTraceNotification",{enumerable:!0,get:function(){return fn.LogTraceNotification}});Object.defineProperty(M,"ConnectionErrors",{enumerable:!0,get:function(){return fn.ConnectionErrors}});Object.defineProperty(M,"ConnectionError",{enumerable:!0,get:function(){return fn.ConnectionError}});Object.defineProperty(M,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return fn.CancellationReceiverStrategy}});Object.defineProperty(M,"CancellationSenderStrategy",{enumerable:!0,get:function(){return fn.CancellationSenderStrategy}});Object.defineProperty(M,"CancellationStrategy",{enumerable:!0,get:function(){return fn.CancellationStrategy}});Object.defineProperty(M,"MessageStrategy",{enumerable:!0,get:function(){return fn.MessageStrategy}});var gj=ss();M.RAL=gj.default});var hk=N(ky=>{"use strict";Object.defineProperty(ky,"__esModule",{value:!0});var fk=require("util"),ji=Ld(),qd=class t extends ji.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return t.emptyBuffer}fromString(e,n){return Buffer.from(e,n)}toString(e,n){return e instanceof Buffer?e.toString(n):new fk.TextDecoder(n).decode(e)}asNative(e,n){return n===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,n):Buffer.from(e,0,n)}allocNative(e){return Buffer.allocUnsafe(e)}};qd.emptyBuffer=Buffer.allocUnsafe(0);var Sy=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ji.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ji.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ji.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),ji.Disposable.create(()=>this.stream.off("data",e))}},_y=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ji.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ji.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ji.Disposable.create(()=>this.stream.off("end",e))}write(e,n){return new Promise((r,i)=>{let s=o=>{o==null?r():i(o)};typeof e=="string"?this.stream.write(e,n,s):this.stream.write(e,s)})}end(){this.stream.end()}},pk=Object.freeze({messageBuffer:Object.freeze({create:t=>new qd(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(n){return Promise.reject(n)}}}),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 fk.TextDecoder(e.charset).decode(t)))}catch(n){return Promise.reject(n)}}})}),stream:Object.freeze({asReadableStream:t=>new Sy(t),asWritableStream:t=>new _y(t)}),console,timer:Object.freeze({setTimeout(t,e,...n){let r=setTimeout(t,e,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(t,...e){let n=setImmediate(t,...e);return{dispose:()=>clearImmediate(n)}},setInterval(t,e,...n){let r=setInterval(t,e,...n);return{dispose:()=>clearInterval(r)}}})});function Py(){return pk}(function(t){function e(){ji.RAL.install(pk)}t.install=e})(Py||(Py={}));ky.default=Py});var no=N(Le=>{"use strict";var yj=Le&&Le.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),Tj=Le&&Le.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&yj(e,t,n)};Object.defineProperty(Le,"__esModule",{value:!0});Le.createMessageConnection=Le.createServerSocketTransport=Le.createClientSocketTransport=Le.createServerPipeTransport=Le.createClientPipeTransport=Le.generateRandomPipeName=Le.StreamMessageWriter=Le.StreamMessageReader=Le.SocketMessageWriter=Le.SocketMessageReader=Le.PortMessageWriter=Le.PortMessageReader=Le.IPCMessageWriter=Le.IPCMessageReader=void 0;var Ko=hk();Ko.default.install();var mk=require("path"),vj=require("os"),bj=require("crypto"),Bd=require("net"),fr=Ld();Tj(Ld(),Le);var Ny=class extends fr.AbstractMessageReader{constructor(e){super(),this.process=e;let n=this.process;n.on("error",r=>this.fireError(r)),n.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),fr.Disposable.create(()=>this.process.off("message",e))}};Le.IPCMessageReader=Ny;var Ry=class extends fr.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let n=this.process;n.on("error",r=>this.fireError(r)),n.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,n=>{n?(this.errorCount++,this.handleError(n,e)):this.errorCount=0}),Promise.resolve()}catch(n){return this.handleError(n,e),Promise.reject(n)}}handleError(e,n){this.errorCount++,this.fireError(e,n,this.errorCount)}end(){}};Le.IPCMessageWriter=Ry;var wy=class extends fr.AbstractMessageReader{constructor(e){super(),this.onData=new fr.Emitter,e.on("close",()=>this.fireClose),e.on("error",n=>this.fireError(n)),e.on("message",n=>{this.onData.fire(n)})}listen(e){return this.onData.event(e)}};Le.PortMessageReader=wy;var Ey=class extends fr.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",n=>this.fireError(n))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(n){return this.handleError(n,e),Promise.reject(n)}}handleError(e,n){this.errorCount++,this.fireError(e,n,this.errorCount)}end(){}};Le.PortMessageWriter=Ey;var eo=class extends fr.ReadableStreamMessageReader{constructor(e,n="utf-8"){super((0,Ko.default)().stream.asReadableStream(e),n)}};Le.SocketMessageReader=eo;var to=class extends fr.WriteableStreamMessageWriter{constructor(e,n){super((0,Ko.default)().stream.asWritableStream(e),n),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};Le.SocketMessageWriter=to;var $d=class extends fr.ReadableStreamMessageReader{constructor(e,n){super((0,Ko.default)().stream.asReadableStream(e),n)}};Le.StreamMessageReader=$d;var Fd=class extends fr.WriteableStreamMessageWriter{constructor(e,n){super((0,Ko.default)().stream.asWritableStream(e),n)}};Le.StreamMessageWriter=Fd;var gk=process.env.XDG_RUNTIME_DIR,Sj=new Map([["linux",107],["darwin",103]]);function _j(){let t=(0,bj.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let e;gk?e=mk.join(gk,`vscode-ipc-${t}.sock`):e=mk.join(vj.tmpdir(),`vscode-${t}.sock`);let n=Sj.get(process.platform);return n!==void 0&&e.length>n&&(0,Ko.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${n} characters.`),e}Le.generateRandomPipeName=_j;function Pj(t,e="utf-8"){let n,r=new Promise((i,s)=>{n=i});return new Promise((i,s)=>{let o=(0,Bd.createServer)(a=>{o.close(),n([new eo(a,e),new to(a,e)])});o.on("error",s),o.listen(t,()=>{o.removeListener("error",s),i({onConnected:()=>r})})})}Le.createClientPipeTransport=Pj;function kj(t,e="utf-8"){let n=(0,Bd.createConnection)(t);return[new eo(n,e),new to(n,e)]}Le.createServerPipeTransport=kj;function Nj(t,e="utf-8"){let n,r=new Promise((i,s)=>{n=i});return new Promise((i,s)=>{let o=(0,Bd.createServer)(a=>{o.close(),n([new eo(a,e),new to(a,e)])});o.on("error",s),o.listen(t,"127.0.0.1",()=>{o.removeListener("error",s),i({onConnected:()=>r})})})}Le.createClientSocketTransport=Nj;function Rj(t,e="utf-8"){let n=(0,Bd.createConnection)(t,"127.0.0.1");return[new eo(n,e),new to(n,e)]}Le.createServerSocketTransport=Rj;function wj(t){let e=t;return e.read!==void 0&&e.addListener!==void 0}function Ej(t){let e=t;return e.write!==void 0&&e.addListener!==void 0}function Cj(t,e,n,r){n||(n=fr.NullLogger);let i=wj(t)?new $d(t):t,s=Ej(e)?new Fd(e):e;return fr.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,fr.createMessageConnection)(i,s,n,r)}Le.createMessageConnection=Cj});var Cy=N((_8,yk)=>{"use strict";yk.exports=no()});var Ud=N((Tk,jd)=>{(function(t){if(typeof jd=="object"&&typeof jd.exports=="object"){var e=t(require,Tk);e!==void 0&&(jd.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 n;(function(T){function E(C){return typeof C=="string"}T.is=E})(n||(e.DocumentUri=n={}));var r;(function(T){function E(C){return typeof C=="string"}T.is=E})(r||(e.URI=r={}));var i;(function(T){T.MIN_VALUE=-2147483648,T.MAX_VALUE=2147483647;function E(C){return typeof C=="number"&&T.MIN_VALUE<=C&&C<=T.MAX_VALUE}T.is=E})(i||(e.integer=i={}));var s;(function(T){T.MIN_VALUE=0,T.MAX_VALUE=2147483647;function E(C){return typeof C=="number"&&T.MIN_VALUE<=C&&C<=T.MAX_VALUE}T.is=E})(s||(e.uinteger=s={}));var o;(function(T){function E(_,g){return _===Number.MAX_VALUE&&(_=s.MAX_VALUE),g===Number.MAX_VALUE&&(g=s.MAX_VALUE),{line:_,character:g}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&A.uinteger(g.line)&&A.uinteger(g.character)}T.is=C})(o||(e.Position=o={}));var a;(function(T){function E(_,g,D,j){if(A.uinteger(_)&&A.uinteger(g)&&A.uinteger(D)&&A.uinteger(j))return{start:o.create(_,g),end:o.create(D,j)};if(o.is(_)&&o.is(g))return{start:_,end:g};throw new Error("Range#create called with invalid arguments[".concat(_,", ").concat(g,", ").concat(D,", ").concat(j,"]"))}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&o.is(g.start)&&o.is(g.end)}T.is=C})(a||(e.Range=a={}));var c;(function(T){function E(_,g){return{uri:_,range:g}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&a.is(g.range)&&(A.string(g.uri)||A.undefined(g.uri))}T.is=C})(c||(e.Location=c={}));var l;(function(T){function E(_,g,D,j){return{targetUri:_,targetRange:g,targetSelectionRange:D,originSelectionRange:j}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&a.is(g.targetRange)&&A.string(g.targetUri)&&a.is(g.targetSelectionRange)&&(a.is(g.originSelectionRange)||A.undefined(g.originSelectionRange))}T.is=C})(l||(e.LocationLink=l={}));var u;(function(T){function E(_,g,D,j){return{red:_,green:g,blue:D,alpha:j}}T.create=E;function C(_){var g=_;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)}T.is=C})(u||(e.Color=u={}));var d;(function(T){function E(_,g){return{range:_,color:g}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&a.is(g.range)&&u.is(g.color)}T.is=C})(d||(e.ColorInformation=d={}));var f;(function(T){function E(_,g,D){return{label:_,textEdit:g,additionalTextEdits:D}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&A.string(g.label)&&(A.undefined(g.textEdit)||R.is(g))&&(A.undefined(g.additionalTextEdits)||A.typedArray(g.additionalTextEdits,R.is))}T.is=C})(f||(e.ColorPresentation=f={}));var p;(function(T){T.Comment="comment",T.Imports="imports",T.Region="region"})(p||(e.FoldingRangeKind=p={}));var m;(function(T){function E(_,g,D,j,Te,Mt){var gt={startLine:_,endLine:g};return A.defined(D)&&(gt.startCharacter=D),A.defined(j)&&(gt.endCharacter=j),A.defined(Te)&&(gt.kind=Te),A.defined(Mt)&&(gt.collapsedText=Mt),gt}T.create=E;function C(_){var g=_;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))}T.is=C})(m||(e.FoldingRange=m={}));var h;(function(T){function E(_,g){return{location:_,message:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&c.is(g.location)&&A.string(g.message)}T.is=C})(h||(e.DiagnosticRelatedInformation=h={}));var y;(function(T){T.Error=1,T.Warning=2,T.Information=3,T.Hint=4})(y||(e.DiagnosticSeverity=y={}));var S;(function(T){T.Unnecessary=1,T.Deprecated=2})(S||(e.DiagnosticTag=S={}));var b;(function(T){function E(C){var _=C;return A.objectLiteral(_)&&A.string(_.href)}T.is=E})(b||(e.CodeDescription=b={}));var v;(function(T){function E(_,g,D,j,Te,Mt){var gt={range:_,message:g};return A.defined(D)&&(gt.severity=D),A.defined(j)&&(gt.code=j),A.defined(Te)&&(gt.source=Te),A.defined(Mt)&&(gt.relatedInformation=Mt),gt}T.create=E;function C(_){var g,D=_;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))}T.is=C})(v||(e.Diagnostic=v={}));var k;(function(T){function E(_,g){for(var D=[],j=2;j<arguments.length;j++)D[j-2]=arguments[j];var Te={title:_,command:g};return A.defined(D)&&D.length>0&&(Te.arguments=D),Te}T.create=E;function C(_){var g=_;return A.defined(g)&&A.string(g.title)&&A.string(g.command)}T.is=C})(k||(e.Command=k={}));var R;(function(T){function E(D,j){return{range:D,newText:j}}T.replace=E;function C(D,j){return{range:{start:D,end:D},newText:j}}T.insert=C;function _(D){return{range:D,newText:""}}T.del=_;function g(D){var j=D;return A.objectLiteral(j)&&A.string(j.newText)&&a.is(j.range)}T.is=g})(R||(e.TextEdit=R={}));var q;(function(T){function E(_,g,D){var j={label:_};return g!==void 0&&(j.needsConfirmation=g),D!==void 0&&(j.description=D),j}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&A.string(g.label)&&(A.boolean(g.needsConfirmation)||g.needsConfirmation===void 0)&&(A.string(g.description)||g.description===void 0)}T.is=C})(q||(e.ChangeAnnotation=q={}));var O;(function(T){function E(C){var _=C;return A.string(_)}T.is=E})(O||(e.ChangeAnnotationIdentifier=O={}));var B;(function(T){function E(D,j,Te){return{range:D,newText:j,annotationId:Te}}T.replace=E;function C(D,j,Te){return{range:{start:D,end:D},newText:j,annotationId:Te}}T.insert=C;function _(D,j){return{range:D,newText:"",annotationId:j}}T.del=_;function g(D){var j=D;return R.is(j)&&(q.is(j.annotationId)||O.is(j.annotationId))}T.is=g})(B||(e.AnnotatedTextEdit=B={}));var Pe;(function(T){function E(_,g){return{textDocument:_,edits:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&Xs.is(g.textDocument)&&Array.isArray(g.edits)}T.is=C})(Pe||(e.TextDocumentEdit=Pe={}));var Qe;(function(T){function E(_,g,D){var j={kind:"create",uri:_};return g!==void 0&&(g.overwrite!==void 0||g.ignoreIfExists!==void 0)&&(j.options=g),D!==void 0&&(j.annotationId=D),j}T.create=E;function C(_){var g=_;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))}T.is=C})(Qe||(e.CreateFile=Qe={}));var Et;(function(T){function E(_,g,D,j){var Te={kind:"rename",oldUri:_,newUri:g};return D!==void 0&&(D.overwrite!==void 0||D.ignoreIfExists!==void 0)&&(Te.options=D),j!==void 0&&(Te.annotationId=j),Te}T.create=E;function C(_){var g=_;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))}T.is=C})(Et||(e.RenameFile=Et={}));var ke;(function(T){function E(_,g,D){var j={kind:"delete",uri:_};return g!==void 0&&(g.recursive!==void 0||g.ignoreIfNotExists!==void 0)&&(j.options=g),D!==void 0&&(j.annotationId=D),j}T.create=E;function C(_){var g=_;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))}T.is=C})(ke||(e.DeleteFile=ke={}));var dn;(function(T){function E(C){var _=C;return _&&(_.changes!==void 0||_.documentChanges!==void 0)&&(_.documentChanges===void 0||_.documentChanges.every(function(g){return A.string(g.kind)?Qe.is(g)||Et.is(g)||ke.is(g):Pe.is(g)}))}T.is=E})(dn||(e.WorkspaceEdit=dn={}));var Sn=function(){function T(E,C){this.edits=E,this.changeAnnotations=C}return T.prototype.insert=function(E,C,_){var g,D;if(_===void 0?g=R.insert(E,C):O.is(_)?(D=_,g=B.insert(E,C,_)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(_),g=B.insert(E,C,D)),this.edits.push(g),D!==void 0)return D},T.prototype.replace=function(E,C,_){var g,D;if(_===void 0?g=R.replace(E,C):O.is(_)?(D=_,g=B.replace(E,C,_)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(_),g=B.replace(E,C,D)),this.edits.push(g),D!==void 0)return D},T.prototype.delete=function(E,C){var _,g;if(C===void 0?_=R.del(E):O.is(C)?(g=C,_=B.del(E,C)):(this.assertChangeAnnotations(this.changeAnnotations),g=this.changeAnnotations.manage(C),_=B.del(E,g)),this.edits.push(_),g!==void 0)return g},T.prototype.add=function(E){this.edits.push(E)},T.prototype.all=function(){return this.edits},T.prototype.clear=function(){this.edits.splice(0,this.edits.length)},T.prototype.assertChangeAnnotations=function(E){if(E===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},T}(),rd=function(){function T(E){this._annotations=E===void 0?Object.create(null):E,this._counter=0,this._size=0}return T.prototype.all=function(){return this._annotations},Object.defineProperty(T.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),T.prototype.manage=function(E,C){var _;if(O.is(E)?_=E:(_=this.nextId(),C=E),this._annotations[_]!==void 0)throw new Error("Id ".concat(_," is already in use."));if(C===void 0)throw new Error("No annotation provided for id ".concat(_));return this._annotations[_]=C,this._size++,_},T.prototype.nextId=function(){return this._counter++,this._counter.toString()},T}(),yg=function(){function T(E){var C=this;this._textEditChanges=Object.create(null),E!==void 0?(this._workspaceEdit=E,E.documentChanges?(this._changeAnnotations=new rd(E.changeAnnotations),E.changeAnnotations=this._changeAnnotations.all(),E.documentChanges.forEach(function(_){if(Pe.is(_)){var g=new Sn(_.edits,C._changeAnnotations);C._textEditChanges[_.textDocument.uri]=g}})):E.changes&&Object.keys(E.changes).forEach(function(_){var g=new Sn(E.changes[_]);C._textEditChanges[_]=g})):this._workspaceEdit={}}return Object.defineProperty(T.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}),T.prototype.getTextEditChange=function(E){if(Xs.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},_=this._textEditChanges[C.uri];if(!_){var g=[],D={textDocument:C,edits:g};this._workspaceEdit.documentChanges.push(D),_=new Sn(g,this._changeAnnotations),this._textEditChanges[C.uri]=_}return _}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var _=this._textEditChanges[E];if(!_){var g=[];this._workspaceEdit.changes[E]=g,_=new Sn(g),this._textEditChanges[E]=_}return _}},T.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new rd,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},T.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},T.prototype.createFile=function(E,C,_){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;q.is(C)||O.is(C)?g=C:_=C;var D,j;if(g===void 0?D=Qe.create(E,_):(j=O.is(g)?g:this._changeAnnotations.manage(g),D=Qe.create(E,_,j)),this._workspaceEdit.documentChanges.push(D),j!==void 0)return j},T.prototype.renameFile=function(E,C,_,g){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var D;q.is(_)||O.is(_)?D=_:g=_;var j,Te;if(D===void 0?j=Et.create(E,C,g):(Te=O.is(D)?D:this._changeAnnotations.manage(D),j=Et.create(E,C,g,Te)),this._workspaceEdit.documentChanges.push(j),Te!==void 0)return Te},T.prototype.deleteFile=function(E,C,_){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;q.is(C)||O.is(C)?g=C:_=C;var D,j;if(g===void 0?D=ke.create(E,_):(j=O.is(g)?g:this._changeAnnotations.manage(g),D=ke.create(E,_,j)),this._workspaceEdit.documentChanges.push(D),j!==void 0)return j},T}();e.WorkspaceChange=yg;var id;(function(T){function E(_){return{uri:_}}T.create=E;function C(_){var g=_;return A.defined(g)&&A.string(g.uri)}T.is=C})(id||(e.TextDocumentIdentifier=id={}));var _c;(function(T){function E(_,g){return{uri:_,version:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&A.string(g.uri)&&A.integer(g.version)}T.is=C})(_c||(e.VersionedTextDocumentIdentifier=_c={}));var Xs;(function(T){function E(_,g){return{uri:_,version:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&A.string(g.uri)&&(g.version===null||A.integer(g.version))}T.is=C})(Xs||(e.OptionalVersionedTextDocumentIdentifier=Xs={}));var qi;(function(T){function E(_,g,D,j){return{uri:_,languageId:g,version:D,text:j}}T.create=E;function C(_){var g=_;return A.defined(g)&&A.string(g.uri)&&A.string(g.languageId)&&A.integer(g.version)&&A.string(g.text)}T.is=C})(qi||(e.TextDocumentItem=qi={}));var qo;(function(T){T.PlainText="plaintext",T.Markdown="markdown";function E(C){var _=C;return _===T.PlainText||_===T.Markdown}T.is=E})(qo||(e.MarkupKind=qo={}));var Js;(function(T){function E(C){var _=C;return A.objectLiteral(C)&&qo.is(_.kind)&&A.string(_.value)}T.is=E})(Js||(e.MarkupContent=Js={}));var sd;(function(T){T.Text=1,T.Method=2,T.Function=3,T.Constructor=4,T.Field=5,T.Variable=6,T.Class=7,T.Interface=8,T.Module=9,T.Property=10,T.Unit=11,T.Value=12,T.Enum=13,T.Keyword=14,T.Snippet=15,T.Color=16,T.File=17,T.Reference=18,T.Folder=19,T.EnumMember=20,T.Constant=21,T.Struct=22,T.Event=23,T.Operator=24,T.TypeParameter=25})(sd||(e.CompletionItemKind=sd={}));var Pc;(function(T){T.PlainText=1,T.Snippet=2})(Pc||(e.InsertTextFormat=Pc={}));var kc;(function(T){T.Deprecated=1})(kc||(e.CompletionItemTag=kc={}));var od;(function(T){function E(_,g,D){return{newText:_,insert:g,replace:D}}T.create=E;function C(_){var g=_;return g&&A.string(g.newText)&&a.is(g.insert)&&a.is(g.replace)}T.is=C})(od||(e.InsertReplaceEdit=od={}));var ad;(function(T){T.asIs=1,T.adjustIndentation=2})(ad||(e.InsertTextMode=ad={}));var cd;(function(T){function E(C){var _=C;return _&&(A.string(_.detail)||_.detail===void 0)&&(A.string(_.description)||_.description===void 0)}T.is=E})(cd||(e.CompletionItemLabelDetails=cd={}));var ld;(function(T){function E(C){return{label:C}}T.create=E})(ld||(e.CompletionItem=ld={}));var ud;(function(T){function E(C,_){return{items:C||[],isIncomplete:!!_}}T.create=E})(ud||(e.CompletionList=ud={}));var $o;(function(T){function E(_){return _.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}T.fromPlainText=E;function C(_){var g=_;return A.string(g)||A.objectLiteral(g)&&A.string(g.language)&&A.string(g.value)}T.is=C})($o||(e.MarkedString=$o={}));var Hr;(function(T){function E(C){var _=C;return!!_&&A.objectLiteral(_)&&(Js.is(_.contents)||$o.is(_.contents)||A.typedArray(_.contents,$o.is))&&(C.range===void 0||a.is(C.range))}T.is=E})(Hr||(e.Hover=Hr={}));var dd;(function(T){function E(C,_){return _?{label:C,documentation:_}:{label:C}}T.create=E})(dd||(e.ParameterInformation=dd={}));var fd;(function(T){function E(C,_){for(var g=[],D=2;D<arguments.length;D++)g[D-2]=arguments[D];var j={label:C};return A.defined(_)&&(j.documentation=_),A.defined(g)?j.parameters=g:j.parameters=[],j}T.create=E})(fd||(e.SignatureInformation=fd={}));var Qs;(function(T){T.Text=1,T.Read=2,T.Write=3})(Qs||(e.DocumentHighlightKind=Qs={}));var pd;(function(T){function E(C,_){var g={range:C};return A.number(_)&&(g.kind=_),g}T.create=E})(pd||(e.DocumentHighlight=pd={}));var Fo;(function(T){T.File=1,T.Module=2,T.Namespace=3,T.Package=4,T.Class=5,T.Method=6,T.Property=7,T.Field=8,T.Constructor=9,T.Enum=10,T.Interface=11,T.Function=12,T.Variable=13,T.Constant=14,T.String=15,T.Number=16,T.Boolean=17,T.Array=18,T.Object=19,T.Key=20,T.Null=21,T.EnumMember=22,T.Struct=23,T.Event=24,T.Operator=25,T.TypeParameter=26})(Fo||(e.SymbolKind=Fo={}));var hd;(function(T){T.Deprecated=1})(hd||(e.SymbolTag=hd={}));var $i;(function(T){function E(C,_,g,D,j){var Te={name:C,kind:_,location:{uri:D,range:g}};return j&&(Te.containerName=j),Te}T.create=E})($i||(e.SymbolInformation=$i={}));var rs;(function(T){function E(C,_,g,D){return D!==void 0?{name:C,kind:_,location:{uri:g,range:D}}:{name:C,kind:_,location:{uri:g}}}T.create=E})(rs||(e.WorkspaceSymbol=rs={}));var md;(function(T){function E(_,g,D,j,Te,Mt){var gt={name:_,detail:g,kind:D,range:j,selectionRange:Te};return Mt!==void 0&&(gt.children=Mt),gt}T.create=E;function C(_){var g=_;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))}T.is=C})(md||(e.DocumentSymbol=md={}));var gd;(function(T){T.Empty="",T.QuickFix="quickfix",T.Refactor="refactor",T.RefactorExtract="refactor.extract",T.RefactorInline="refactor.inline",T.RefactorRewrite="refactor.rewrite",T.Source="source",T.SourceOrganizeImports="source.organizeImports",T.SourceFixAll="source.fixAll"})(gd||(e.CodeActionKind=gd={}));var mi;(function(T){T.Invoked=1,T.Automatic=2})(mi||(e.CodeActionTriggerKind=mi={}));var Nc;(function(T){function E(_,g,D){var j={diagnostics:_};return g!=null&&(j.only=g),D!=null&&(j.triggerKind=D),j}T.create=E;function C(_){var g=_;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===mi.Invoked||g.triggerKind===mi.Automatic)}T.is=C})(Nc||(e.CodeActionContext=Nc={}));var Rc;(function(T){function E(_,g,D){var j={title:_},Te=!0;return typeof g=="string"?(Te=!1,j.kind=g):k.is(g)?j.command=g:j.edit=g,Te&&D!==void 0&&(j.kind=D),j}T.create=E;function C(_){var g=_;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||dn.is(g.edit))}T.is=C})(Rc||(e.CodeAction=Rc={}));var Bo;(function(T){function E(_,g){var D={range:_};return A.defined(g)&&(D.data=g),D}T.create=E;function C(_){var g=_;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.command)||k.is(g.command))}T.is=C})(Bo||(e.CodeLens=Bo={}));var wc;(function(T){function E(_,g){return{tabSize:_,insertSpaces:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&A.uinteger(g.tabSize)&&A.boolean(g.insertSpaces)}T.is=C})(wc||(e.FormattingOptions=wc={}));var Fi;(function(T){function E(_,g,D){return{range:_,target:g,data:D}}T.create=E;function C(_){var g=_;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.target)||A.string(g.target))}T.is=C})(Fi||(e.DocumentLink=Fi={}));var w;(function(T){function E(_,g){return{range:_,parent:g}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&a.is(g.range)&&(g.parent===void 0||T.is(g.parent))}T.is=C})(w||(e.SelectionRange=w={}));var $;(function(T){T.namespace="namespace",T.type="type",T.class="class",T.enum="enum",T.interface="interface",T.struct="struct",T.typeParameter="typeParameter",T.parameter="parameter",T.variable="variable",T.property="property",T.enumMember="enumMember",T.event="event",T.function="function",T.method="method",T.macro="macro",T.keyword="keyword",T.modifier="modifier",T.comment="comment",T.string="string",T.number="number",T.regexp="regexp",T.operator="operator",T.decorator="decorator"})($||(e.SemanticTokenTypes=$={}));var G;(function(T){T.declaration="declaration",T.definition="definition",T.readonly="readonly",T.static="static",T.deprecated="deprecated",T.abstract="abstract",T.async="async",T.modification="modification",T.documentation="documentation",T.defaultLibrary="defaultLibrary"})(G||(e.SemanticTokenModifiers=G={}));var ne;(function(T){function E(C){var _=C;return A.objectLiteral(_)&&(_.resultId===void 0||typeof _.resultId=="string")&&Array.isArray(_.data)&&(_.data.length===0||typeof _.data[0]=="number")}T.is=E})(ne||(e.SemanticTokens=ne={}));var it;(function(T){function E(_,g){return{range:_,text:g}}T.create=E;function C(_){var g=_;return g!=null&&a.is(g.range)&&A.string(g.text)}T.is=C})(it||(e.InlineValueText=it={}));var Ze;(function(T){function E(_,g,D){return{range:_,variableName:g,caseSensitiveLookup:D}}T.create=E;function C(_){var g=_;return g!=null&&a.is(g.range)&&A.boolean(g.caseSensitiveLookup)&&(A.string(g.variableName)||g.variableName===void 0)}T.is=C})(Ze||(e.InlineValueVariableLookup=Ze={}));var vt;(function(T){function E(_,g){return{range:_,expression:g}}T.create=E;function C(_){var g=_;return g!=null&&a.is(g.range)&&(A.string(g.expression)||g.expression===void 0)}T.is=C})(vt||(e.InlineValueEvaluatableExpression=vt={}));var kt;(function(T){function E(_,g){return{frameId:_,stoppedLocation:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&a.is(_.stoppedLocation)}T.is=C})(kt||(e.InlineValueContext=kt={}));var Ae;(function(T){T.Type=1,T.Parameter=2;function E(C){return C===1||C===2}T.is=E})(Ae||(e.InlayHintKind=Ae={}));var at;(function(T){function E(_){return{value:_}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&(g.tooltip===void 0||A.string(g.tooltip)||Js.is(g.tooltip))&&(g.location===void 0||c.is(g.location))&&(g.command===void 0||k.is(g.command))}T.is=C})(at||(e.InlayHintLabelPart=at={}));var Ge;(function(T){function E(_,g,D){var j={position:_,label:g};return D!==void 0&&(j.kind=D),j}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&o.is(g.position)&&(A.string(g.label)||A.typedArray(g.label,at.is))&&(g.kind===void 0||Ae.is(g.kind))&&g.textEdits===void 0||A.typedArray(g.textEdits,R.is)&&(g.tooltip===void 0||A.string(g.tooltip)||Js.is(g.tooltip))&&(g.paddingLeft===void 0||A.boolean(g.paddingLeft))&&(g.paddingRight===void 0||A.boolean(g.paddingRight))}T.is=C})(Ge||(e.InlayHint=Ge={}));var Ot;(function(T){function E(C){return{kind:"snippet",value:C}}T.createSnippet=E})(Ot||(e.StringValue=Ot={}));var tn;(function(T){function E(C,_,g,D){return{insertText:C,filterText:_,range:g,command:D}}T.create=E})(tn||(e.InlineCompletionItem=tn={}));var ur;(function(T){function E(C){return{items:C}}T.create=E})(ur||(e.InlineCompletionList=ur={}));var yd;(function(T){T.Invoked=0,T.Automatic=1})(yd||(e.InlineCompletionTriggerKind=yd={}));var MP;(function(T){function E(C,_){return{range:C,text:_}}T.create=E})(MP||(e.SelectedCompletionInfo=MP={}));var xP;(function(T){function E(C,_){return{triggerKind:C,selectedCompletionInfo:_}}T.create=E})(xP||(e.InlineCompletionContext=xP={}));var LP;(function(T){function E(C){var _=C;return A.objectLiteral(_)&&r.is(_.uri)&&A.string(_.name)}T.is=E})(LP||(e.WorkspaceFolder=LP={})),e.EOL=[`
|
|
32
|
+
`)),$){let ne=w.error?` Request failed: ${w.error.message} (${w.error.code}).`:"";R.log(`Received response '${$.method} - (${w.id})' in ${Date.now()-$.timerStart}ms.${ne}`,G)}else R.log(`Received response ${w.id} without active response promise.`,G)}else $i("receive-response",w)}function $i(w,$){if(!R||v===Ke.Off)return;let G={isLSPMessage:!0,type:w,message:$,timestamp:Date.now()};R.log(G)}function rs(){if(Xs())throw new Yo(Ic.Closed,"Connection is closed.");if(qi())throw new Yo(Ic.Disposed,"Connection is disposed.")}function md(){if(_c())throw new Yo(Ic.AlreadyListening,"Connection is already listening")}function gd(){if(!_c())throw new Error("Call listen() first.")}function mi(w){return w===void 0?null:w}function Nc(w){if(w!==null)return w}function Rc(w){return w!=null&&!Array.isArray(w)&&typeof w=="object"}function Bo(w,$){switch(w){case pe.ParameterStructures.auto:return Rc($)?Nc($):[mi($)];case pe.ParameterStructures.byName:if(!Rc($))throw new Error("Received parameters by name but param is not an object literal.");return Nc($);case pe.ParameterStructures.byPosition:return[mi($)];default:throw new Error(`Unknown parameter structure ${w.toString()}`)}}function wc(w,$){let G,ne=w.numberOfParams;switch(ne){case 0:G=void 0;break;case 1:G=Bo(w.parameterStructures,$[0]);break;default:G=[];for(let it=0;it<$.length&&it<ne;it++)G.push(mi($[it]));if($.length<ne)for(let it=$.length;it<ne;it++)G.push(null);break}return G}let Fi={sendNotification:(w,...$)=>{rs();let G,ne;if(Ct.string(w)){G=w;let Ze=$[0],vt=0,kt=pe.ParameterStructures.auto;pe.ParameterStructures.is(Ze)&&(vt=1,kt=Ze);let Ae=$.length,at=Ae-vt;switch(at){case 0:ne=void 0;break;case 1:ne=Bo(kt,$[vt]);break;default:if(kt===pe.ParameterStructures.byName)throw new Error(`Received ${at} parameters for 'by Name' notification parameter structure.`);ne=$.slice(vt,Ae).map(Ge=>mi(Ge));break}}else{let Ze=$;G=w.method,ne=wc(w,Ze)}let it={jsonrpc:c,method:G,params:ne};return fd(it),e.write(it).catch(Ze=>{throw i.error("Sending notification failed."),Ze})},onNotification:(w,$)=>{rs();let G;return Ct.func(w)?d=w:$&&(Ct.string(w)?(G=w,f.set(w,{type:void 0,handler:$})):(G=w.method,f.set(w.method,{type:w,handler:$}))),{dispose:()=>{G!==void 0?f.delete(G):d=void 0}}},onProgress:(w,$,G)=>{if(p.has($))throw new Error(`Progress handler for token ${$} already registered`);return p.set($,G),{dispose:()=>{p.delete($)}}},sendProgress:(w,$,G)=>Fi.sendNotification(Ac.type,{token:$,value:G}),onUnhandledProgress:Qe.event,sendRequest:(w,...$)=>{rs(),gd();let G,ne,it;if(Ct.string(w)){G=w;let Ae=$[0],at=$[$.length-1],Ge=0,It=pe.ParameterStructures.auto;pe.ParameterStructures.is(Ae)&&(Ge=1,It=Ae);let tn=$.length;dy.CancellationToken.is(at)&&(tn=tn-1,it=at);let ur=tn-Ge;switch(ur){case 0:ne=void 0;break;case 1:ne=Bo(It,$[Ge]);break;default:if(It===pe.ParameterStructures.byName)throw new Error(`Received ${ur} parameters for 'by Name' request parameter structure.`);ne=$.slice(Ge,tn).map(yd=>mi(yd));break}}else{let Ae=$;G=w.method,ne=wc(w,Ae);let at=w.numberOfParams;it=dy.CancellationToken.is(Ae[at])?Ae[at]:void 0}let Ze=s++,vt;it&&(vt=it.onCancellationRequested(()=>{let Ae=ke.sender.sendCancellation(Fi,Ze);return Ae===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${Ze}`),Promise.resolve()):Ae.catch(()=>{i.log(`Sending cancellation messages for id ${Ze} failed`)})}));let kt={jsonrpc:c,id:Ze,method:G,params:ne};return dd(kt),typeof ke.sender.enableCancellation=="function"&&ke.sender.enableCancellation(kt),new Promise(async(Ae,at)=>{let Ge=ur=>{Ae(ur),ke.sender.cleanup(Ze),vt?.dispose()},It=ur=>{at(ur),ke.sender.cleanup(Ze),vt?.dispose()},tn={method:G,timerStart:Date.now(),resolve:Ge,reject:It};try{await e.write(kt),y.set(Ze,tn)}catch(ur){throw i.error("Sending request failed."),tn.reject(new pe.ResponseError(pe.ErrorCodes.MessageWriteError,ur.message?ur.message:"Unknown reason")),ur}})},onRequest:(w,$)=>{rs();let G=null;return hy.is(w)?(G=void 0,l=w):Ct.string(w)?(G=null,$!==void 0&&(G=w,u.set(w,{handler:$,type:void 0}))):$!==void 0&&(G=w.method,u.set(w.method,{type:w,handler:$})),{dispose:()=>{G!==null&&(G!==void 0?u.delete(G):l=void 0)}}},hasPendingResponse:()=>y.size>0,trace:async(w,$,G)=>{let ne=!1,it=dr.Text;G!==void 0&&(Ct.boolean(G)?ne=G:(ne=G.sendNotification||!1,it=G.traceFormat||dr.Text)),v=w,k=it,v===Ke.Off?R=void 0:R=$,ne&&!Xs()&&!qi()&&await Fi.sendNotification(my.type,{value:Ke.toString(w)})},onError:O.event,onClose:B.event,onUnhandledNotification:Pe.event,onDispose:Et.event,end:()=>{e.end()},dispose:()=>{if(qi())return;q=zr.Disposed,Et.fire(void 0);let w=new pe.ResponseError(pe.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let $ of y.values())$.reject(w);y=new Map,b=new Map,S=new Set,h=new sk.LinkedMap,Ct.func(e.dispose)&&e.dispose(),Ct.func(t.dispose)&&t.dispose()},listen:()=>{rs(),md(),q=zr.Listening,t.listen(ad)},inspect:()=>{(0,ik.default)().console.log("inspect")}};return Fi.onNotification(Dd.type,w=>{if(v===Ke.Off||!R)return;let $=v===Ke.Verbose||v===Ke.Compact;R.log(w.message,$?w.verbose:void 0)}),Fi.onNotification(Ac.type,w=>{let $=p.get(w.token);$?$(w.value):Qe.fire(w)}),Fi}ve.createMessageConnection=pj});var Ld=N(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.ProgressType=M.ProgressToken=M.createMessageConnection=M.NullLogger=M.ConnectionOptions=M.ConnectionStrategy=M.AbstractMessageBuffer=M.WriteableStreamMessageWriter=M.AbstractMessageWriter=M.MessageWriter=M.ReadableStreamMessageReader=M.AbstractMessageReader=M.MessageReader=M.SharedArrayReceiverStrategy=M.SharedArraySenderStrategy=M.CancellationToken=M.CancellationTokenSource=M.Emitter=M.Event=M.Disposable=M.LRUCache=M.Touch=M.LinkedMap=M.ParameterStructures=M.NotificationType9=M.NotificationType8=M.NotificationType7=M.NotificationType6=M.NotificationType5=M.NotificationType4=M.NotificationType3=M.NotificationType2=M.NotificationType1=M.NotificationType0=M.NotificationType=M.ErrorCodes=M.ResponseError=M.RequestType9=M.RequestType8=M.RequestType7=M.RequestType6=M.RequestType5=M.RequestType4=M.RequestType3=M.RequestType2=M.RequestType1=M.RequestType0=M.RequestType=M.Message=M.RAL=void 0;M.MessageStrategy=M.CancellationStrategy=M.CancellationSenderStrategy=M.CancellationReceiverStrategy=M.ConnectionError=M.ConnectionErrors=M.LogTraceNotification=M.SetTraceNotification=M.TraceFormat=M.TraceValues=M.Trace=void 0;var yt=Hg();Object.defineProperty(M,"Message",{enumerable:!0,get:function(){return yt.Message}});Object.defineProperty(M,"RequestType",{enumerable:!0,get:function(){return yt.RequestType}});Object.defineProperty(M,"RequestType0",{enumerable:!0,get:function(){return yt.RequestType0}});Object.defineProperty(M,"RequestType1",{enumerable:!0,get:function(){return yt.RequestType1}});Object.defineProperty(M,"RequestType2",{enumerable:!0,get:function(){return yt.RequestType2}});Object.defineProperty(M,"RequestType3",{enumerable:!0,get:function(){return yt.RequestType3}});Object.defineProperty(M,"RequestType4",{enumerable:!0,get:function(){return yt.RequestType4}});Object.defineProperty(M,"RequestType5",{enumerable:!0,get:function(){return yt.RequestType5}});Object.defineProperty(M,"RequestType6",{enumerable:!0,get:function(){return yt.RequestType6}});Object.defineProperty(M,"RequestType7",{enumerable:!0,get:function(){return yt.RequestType7}});Object.defineProperty(M,"RequestType8",{enumerable:!0,get:function(){return yt.RequestType8}});Object.defineProperty(M,"RequestType9",{enumerable:!0,get:function(){return yt.RequestType9}});Object.defineProperty(M,"ResponseError",{enumerable:!0,get:function(){return yt.ResponseError}});Object.defineProperty(M,"ErrorCodes",{enumerable:!0,get:function(){return yt.ErrorCodes}});Object.defineProperty(M,"NotificationType",{enumerable:!0,get:function(){return yt.NotificationType}});Object.defineProperty(M,"NotificationType0",{enumerable:!0,get:function(){return yt.NotificationType0}});Object.defineProperty(M,"NotificationType1",{enumerable:!0,get:function(){return yt.NotificationType1}});Object.defineProperty(M,"NotificationType2",{enumerable:!0,get:function(){return yt.NotificationType2}});Object.defineProperty(M,"NotificationType3",{enumerable:!0,get:function(){return yt.NotificationType3}});Object.defineProperty(M,"NotificationType4",{enumerable:!0,get:function(){return yt.NotificationType4}});Object.defineProperty(M,"NotificationType5",{enumerable:!0,get:function(){return yt.NotificationType5}});Object.defineProperty(M,"NotificationType6",{enumerable:!0,get:function(){return yt.NotificationType6}});Object.defineProperty(M,"NotificationType7",{enumerable:!0,get:function(){return yt.NotificationType7}});Object.defineProperty(M,"NotificationType8",{enumerable:!0,get:function(){return yt.NotificationType8}});Object.defineProperty(M,"NotificationType9",{enumerable:!0,get:function(){return yt.NotificationType9}});Object.defineProperty(M,"ParameterStructures",{enumerable:!0,get:function(){return yt.ParameterStructures}});var Ty=Wg();Object.defineProperty(M,"LinkedMap",{enumerable:!0,get:function(){return Ty.LinkedMap}});Object.defineProperty(M,"LRUCache",{enumerable:!0,get:function(){return Ty.LRUCache}});Object.defineProperty(M,"Touch",{enumerable:!0,get:function(){return Ty.Touch}});var hj=GP();Object.defineProperty(M,"Disposable",{enumerable:!0,get:function(){return hj.Disposable}});var lk=Vo();Object.defineProperty(M,"Event",{enumerable:!0,get:function(){return lk.Event}});Object.defineProperty(M,"Emitter",{enumerable:!0,get:function(){return lk.Emitter}});var uk=Nd();Object.defineProperty(M,"CancellationTokenSource",{enumerable:!0,get:function(){return uk.CancellationTokenSource}});Object.defineProperty(M,"CancellationToken",{enumerable:!0,get:function(){return uk.CancellationToken}});var dk=KP();Object.defineProperty(M,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return dk.SharedArraySenderStrategy}});Object.defineProperty(M,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return dk.SharedArrayReceiverStrategy}});var vy=JP();Object.defineProperty(M,"MessageReader",{enumerable:!0,get:function(){return vy.MessageReader}});Object.defineProperty(M,"AbstractMessageReader",{enumerable:!0,get:function(){return vy.AbstractMessageReader}});Object.defineProperty(M,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return vy.ReadableStreamMessageReader}});var by=nk();Object.defineProperty(M,"MessageWriter",{enumerable:!0,get:function(){return by.MessageWriter}});Object.defineProperty(M,"AbstractMessageWriter",{enumerable:!0,get:function(){return by.AbstractMessageWriter}});Object.defineProperty(M,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return by.WriteableStreamMessageWriter}});var mj=rk();Object.defineProperty(M,"AbstractMessageBuffer",{enumerable:!0,get:function(){return mj.AbstractMessageBuffer}});var fn=ck();Object.defineProperty(M,"ConnectionStrategy",{enumerable:!0,get:function(){return fn.ConnectionStrategy}});Object.defineProperty(M,"ConnectionOptions",{enumerable:!0,get:function(){return fn.ConnectionOptions}});Object.defineProperty(M,"NullLogger",{enumerable:!0,get:function(){return fn.NullLogger}});Object.defineProperty(M,"createMessageConnection",{enumerable:!0,get:function(){return fn.createMessageConnection}});Object.defineProperty(M,"ProgressToken",{enumerable:!0,get:function(){return fn.ProgressToken}});Object.defineProperty(M,"ProgressType",{enumerable:!0,get:function(){return fn.ProgressType}});Object.defineProperty(M,"Trace",{enumerable:!0,get:function(){return fn.Trace}});Object.defineProperty(M,"TraceValues",{enumerable:!0,get:function(){return fn.TraceValues}});Object.defineProperty(M,"TraceFormat",{enumerable:!0,get:function(){return fn.TraceFormat}});Object.defineProperty(M,"SetTraceNotification",{enumerable:!0,get:function(){return fn.SetTraceNotification}});Object.defineProperty(M,"LogTraceNotification",{enumerable:!0,get:function(){return fn.LogTraceNotification}});Object.defineProperty(M,"ConnectionErrors",{enumerable:!0,get:function(){return fn.ConnectionErrors}});Object.defineProperty(M,"ConnectionError",{enumerable:!0,get:function(){return fn.ConnectionError}});Object.defineProperty(M,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return fn.CancellationReceiverStrategy}});Object.defineProperty(M,"CancellationSenderStrategy",{enumerable:!0,get:function(){return fn.CancellationSenderStrategy}});Object.defineProperty(M,"CancellationStrategy",{enumerable:!0,get:function(){return fn.CancellationStrategy}});Object.defineProperty(M,"MessageStrategy",{enumerable:!0,get:function(){return fn.MessageStrategy}});var gj=ss();M.RAL=gj.default});var hk=N(ky=>{"use strict";Object.defineProperty(ky,"__esModule",{value:!0});var fk=require("util"),ji=Ld(),qd=class t extends ji.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return t.emptyBuffer}fromString(e,n){return Buffer.from(e,n)}toString(e,n){return e instanceof Buffer?e.toString(n):new fk.TextDecoder(n).decode(e)}asNative(e,n){return n===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,n):Buffer.from(e,0,n)}allocNative(e){return Buffer.allocUnsafe(e)}};qd.emptyBuffer=Buffer.allocUnsafe(0);var Sy=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ji.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ji.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ji.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),ji.Disposable.create(()=>this.stream.off("data",e))}},_y=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ji.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ji.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ji.Disposable.create(()=>this.stream.off("end",e))}write(e,n){return new Promise((r,i)=>{let s=o=>{o==null?r():i(o)};typeof e=="string"?this.stream.write(e,n,s):this.stream.write(e,s)})}end(){this.stream.end()}},pk=Object.freeze({messageBuffer:Object.freeze({create:t=>new qd(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(n){return Promise.reject(n)}}}),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 fk.TextDecoder(e.charset).decode(t)))}catch(n){return Promise.reject(n)}}})}),stream:Object.freeze({asReadableStream:t=>new Sy(t),asWritableStream:t=>new _y(t)}),console,timer:Object.freeze({setTimeout(t,e,...n){let r=setTimeout(t,e,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(t,...e){let n=setImmediate(t,...e);return{dispose:()=>clearImmediate(n)}},setInterval(t,e,...n){let r=setInterval(t,e,...n);return{dispose:()=>clearInterval(r)}}})});function Py(){return pk}(function(t){function e(){ji.RAL.install(pk)}t.install=e})(Py||(Py={}));ky.default=Py});var no=N(Le=>{"use strict";var yj=Le&&Le.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),Tj=Le&&Le.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&yj(e,t,n)};Object.defineProperty(Le,"__esModule",{value:!0});Le.createMessageConnection=Le.createServerSocketTransport=Le.createClientSocketTransport=Le.createServerPipeTransport=Le.createClientPipeTransport=Le.generateRandomPipeName=Le.StreamMessageWriter=Le.StreamMessageReader=Le.SocketMessageWriter=Le.SocketMessageReader=Le.PortMessageWriter=Le.PortMessageReader=Le.IPCMessageWriter=Le.IPCMessageReader=void 0;var Ko=hk();Ko.default.install();var mk=require("path"),vj=require("os"),bj=require("crypto"),Bd=require("net"),fr=Ld();Tj(Ld(),Le);var Ny=class extends fr.AbstractMessageReader{constructor(e){super(),this.process=e;let n=this.process;n.on("error",r=>this.fireError(r)),n.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),fr.Disposable.create(()=>this.process.off("message",e))}};Le.IPCMessageReader=Ny;var Ry=class extends fr.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let n=this.process;n.on("error",r=>this.fireError(r)),n.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,n=>{n?(this.errorCount++,this.handleError(n,e)):this.errorCount=0}),Promise.resolve()}catch(n){return this.handleError(n,e),Promise.reject(n)}}handleError(e,n){this.errorCount++,this.fireError(e,n,this.errorCount)}end(){}};Le.IPCMessageWriter=Ry;var wy=class extends fr.AbstractMessageReader{constructor(e){super(),this.onData=new fr.Emitter,e.on("close",()=>this.fireClose),e.on("error",n=>this.fireError(n)),e.on("message",n=>{this.onData.fire(n)})}listen(e){return this.onData.event(e)}};Le.PortMessageReader=wy;var Ey=class extends fr.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",n=>this.fireError(n))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(n){return this.handleError(n,e),Promise.reject(n)}}handleError(e,n){this.errorCount++,this.fireError(e,n,this.errorCount)}end(){}};Le.PortMessageWriter=Ey;var eo=class extends fr.ReadableStreamMessageReader{constructor(e,n="utf-8"){super((0,Ko.default)().stream.asReadableStream(e),n)}};Le.SocketMessageReader=eo;var to=class extends fr.WriteableStreamMessageWriter{constructor(e,n){super((0,Ko.default)().stream.asWritableStream(e),n),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};Le.SocketMessageWriter=to;var $d=class extends fr.ReadableStreamMessageReader{constructor(e,n){super((0,Ko.default)().stream.asReadableStream(e),n)}};Le.StreamMessageReader=$d;var Fd=class extends fr.WriteableStreamMessageWriter{constructor(e,n){super((0,Ko.default)().stream.asWritableStream(e),n)}};Le.StreamMessageWriter=Fd;var gk=process.env.XDG_RUNTIME_DIR,Sj=new Map([["linux",107],["darwin",103]]);function _j(){let t=(0,bj.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let e;gk?e=mk.join(gk,`vscode-ipc-${t}.sock`):e=mk.join(vj.tmpdir(),`vscode-${t}.sock`);let n=Sj.get(process.platform);return n!==void 0&&e.length>n&&(0,Ko.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${n} characters.`),e}Le.generateRandomPipeName=_j;function Pj(t,e="utf-8"){let n,r=new Promise((i,s)=>{n=i});return new Promise((i,s)=>{let o=(0,Bd.createServer)(a=>{o.close(),n([new eo(a,e),new to(a,e)])});o.on("error",s),o.listen(t,()=>{o.removeListener("error",s),i({onConnected:()=>r})})})}Le.createClientPipeTransport=Pj;function kj(t,e="utf-8"){let n=(0,Bd.createConnection)(t);return[new eo(n,e),new to(n,e)]}Le.createServerPipeTransport=kj;function Nj(t,e="utf-8"){let n,r=new Promise((i,s)=>{n=i});return new Promise((i,s)=>{let o=(0,Bd.createServer)(a=>{o.close(),n([new eo(a,e),new to(a,e)])});o.on("error",s),o.listen(t,"127.0.0.1",()=>{o.removeListener("error",s),i({onConnected:()=>r})})})}Le.createClientSocketTransport=Nj;function Rj(t,e="utf-8"){let n=(0,Bd.createConnection)(t,"127.0.0.1");return[new eo(n,e),new to(n,e)]}Le.createServerSocketTransport=Rj;function wj(t){let e=t;return e.read!==void 0&&e.addListener!==void 0}function Ej(t){let e=t;return e.write!==void 0&&e.addListener!==void 0}function Cj(t,e,n,r){n||(n=fr.NullLogger);let i=wj(t)?new $d(t):t,s=Ej(e)?new Fd(e):e;return fr.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,fr.createMessageConnection)(i,s,n,r)}Le.createMessageConnection=Cj});var Cy=N((_8,yk)=>{"use strict";yk.exports=no()});var Ud=N((Tk,jd)=>{(function(t){if(typeof jd=="object"&&typeof jd.exports=="object"){var e=t(require,Tk);e!==void 0&&(jd.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 n;(function(T){function E(C){return typeof C=="string"}T.is=E})(n||(e.DocumentUri=n={}));var r;(function(T){function E(C){return typeof C=="string"}T.is=E})(r||(e.URI=r={}));var i;(function(T){T.MIN_VALUE=-2147483648,T.MAX_VALUE=2147483647;function E(C){return typeof C=="number"&&T.MIN_VALUE<=C&&C<=T.MAX_VALUE}T.is=E})(i||(e.integer=i={}));var s;(function(T){T.MIN_VALUE=0,T.MAX_VALUE=2147483647;function E(C){return typeof C=="number"&&T.MIN_VALUE<=C&&C<=T.MAX_VALUE}T.is=E})(s||(e.uinteger=s={}));var o;(function(T){function E(_,g){return _===Number.MAX_VALUE&&(_=s.MAX_VALUE),g===Number.MAX_VALUE&&(g=s.MAX_VALUE),{line:_,character:g}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&A.uinteger(g.line)&&A.uinteger(g.character)}T.is=C})(o||(e.Position=o={}));var a;(function(T){function E(_,g,D,j){if(A.uinteger(_)&&A.uinteger(g)&&A.uinteger(D)&&A.uinteger(j))return{start:o.create(_,g),end:o.create(D,j)};if(o.is(_)&&o.is(g))return{start:_,end:g};throw new Error("Range#create called with invalid arguments[".concat(_,", ").concat(g,", ").concat(D,", ").concat(j,"]"))}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&o.is(g.start)&&o.is(g.end)}T.is=C})(a||(e.Range=a={}));var c;(function(T){function E(_,g){return{uri:_,range:g}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&a.is(g.range)&&(A.string(g.uri)||A.undefined(g.uri))}T.is=C})(c||(e.Location=c={}));var l;(function(T){function E(_,g,D,j){return{targetUri:_,targetRange:g,targetSelectionRange:D,originSelectionRange:j}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&a.is(g.targetRange)&&A.string(g.targetUri)&&a.is(g.targetSelectionRange)&&(a.is(g.originSelectionRange)||A.undefined(g.originSelectionRange))}T.is=C})(l||(e.LocationLink=l={}));var u;(function(T){function E(_,g,D,j){return{red:_,green:g,blue:D,alpha:j}}T.create=E;function C(_){var g=_;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)}T.is=C})(u||(e.Color=u={}));var d;(function(T){function E(_,g){return{range:_,color:g}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&a.is(g.range)&&u.is(g.color)}T.is=C})(d||(e.ColorInformation=d={}));var f;(function(T){function E(_,g,D){return{label:_,textEdit:g,additionalTextEdits:D}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&A.string(g.label)&&(A.undefined(g.textEdit)||R.is(g))&&(A.undefined(g.additionalTextEdits)||A.typedArray(g.additionalTextEdits,R.is))}T.is=C})(f||(e.ColorPresentation=f={}));var p;(function(T){T.Comment="comment",T.Imports="imports",T.Region="region"})(p||(e.FoldingRangeKind=p={}));var m;(function(T){function E(_,g,D,j,Te,Ot){var gt={startLine:_,endLine:g};return A.defined(D)&&(gt.startCharacter=D),A.defined(j)&&(gt.endCharacter=j),A.defined(Te)&&(gt.kind=Te),A.defined(Ot)&&(gt.collapsedText=Ot),gt}T.create=E;function C(_){var g=_;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))}T.is=C})(m||(e.FoldingRange=m={}));var h;(function(T){function E(_,g){return{location:_,message:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&c.is(g.location)&&A.string(g.message)}T.is=C})(h||(e.DiagnosticRelatedInformation=h={}));var y;(function(T){T.Error=1,T.Warning=2,T.Information=3,T.Hint=4})(y||(e.DiagnosticSeverity=y={}));var S;(function(T){T.Unnecessary=1,T.Deprecated=2})(S||(e.DiagnosticTag=S={}));var b;(function(T){function E(C){var _=C;return A.objectLiteral(_)&&A.string(_.href)}T.is=E})(b||(e.CodeDescription=b={}));var v;(function(T){function E(_,g,D,j,Te,Ot){var gt={range:_,message:g};return A.defined(D)&&(gt.severity=D),A.defined(j)&&(gt.code=j),A.defined(Te)&&(gt.source=Te),A.defined(Ot)&&(gt.relatedInformation=Ot),gt}T.create=E;function C(_){var g,D=_;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))}T.is=C})(v||(e.Diagnostic=v={}));var k;(function(T){function E(_,g){for(var D=[],j=2;j<arguments.length;j++)D[j-2]=arguments[j];var Te={title:_,command:g};return A.defined(D)&&D.length>0&&(Te.arguments=D),Te}T.create=E;function C(_){var g=_;return A.defined(g)&&A.string(g.title)&&A.string(g.command)}T.is=C})(k||(e.Command=k={}));var R;(function(T){function E(D,j){return{range:D,newText:j}}T.replace=E;function C(D,j){return{range:{start:D,end:D},newText:j}}T.insert=C;function _(D){return{range:D,newText:""}}T.del=_;function g(D){var j=D;return A.objectLiteral(j)&&A.string(j.newText)&&a.is(j.range)}T.is=g})(R||(e.TextEdit=R={}));var q;(function(T){function E(_,g,D){var j={label:_};return g!==void 0&&(j.needsConfirmation=g),D!==void 0&&(j.description=D),j}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&A.string(g.label)&&(A.boolean(g.needsConfirmation)||g.needsConfirmation===void 0)&&(A.string(g.description)||g.description===void 0)}T.is=C})(q||(e.ChangeAnnotation=q={}));var O;(function(T){function E(C){var _=C;return A.string(_)}T.is=E})(O||(e.ChangeAnnotationIdentifier=O={}));var B;(function(T){function E(D,j,Te){return{range:D,newText:j,annotationId:Te}}T.replace=E;function C(D,j,Te){return{range:{start:D,end:D},newText:j,annotationId:Te}}T.insert=C;function _(D,j){return{range:D,newText:"",annotationId:j}}T.del=_;function g(D){var j=D;return R.is(j)&&(q.is(j.annotationId)||O.is(j.annotationId))}T.is=g})(B||(e.AnnotatedTextEdit=B={}));var Pe;(function(T){function E(_,g){return{textDocument:_,edits:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&Xs.is(g.textDocument)&&Array.isArray(g.edits)}T.is=C})(Pe||(e.TextDocumentEdit=Pe={}));var Qe;(function(T){function E(_,g,D){var j={kind:"create",uri:_};return g!==void 0&&(g.overwrite!==void 0||g.ignoreIfExists!==void 0)&&(j.options=g),D!==void 0&&(j.annotationId=D),j}T.create=E;function C(_){var g=_;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))}T.is=C})(Qe||(e.CreateFile=Qe={}));var Et;(function(T){function E(_,g,D,j){var Te={kind:"rename",oldUri:_,newUri:g};return D!==void 0&&(D.overwrite!==void 0||D.ignoreIfExists!==void 0)&&(Te.options=D),j!==void 0&&(Te.annotationId=j),Te}T.create=E;function C(_){var g=_;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))}T.is=C})(Et||(e.RenameFile=Et={}));var ke;(function(T){function E(_,g,D){var j={kind:"delete",uri:_};return g!==void 0&&(g.recursive!==void 0||g.ignoreIfNotExists!==void 0)&&(j.options=g),D!==void 0&&(j.annotationId=D),j}T.create=E;function C(_){var g=_;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))}T.is=C})(ke||(e.DeleteFile=ke={}));var dn;(function(T){function E(C){var _=C;return _&&(_.changes!==void 0||_.documentChanges!==void 0)&&(_.documentChanges===void 0||_.documentChanges.every(function(g){return A.string(g.kind)?Qe.is(g)||Et.is(g)||ke.is(g):Pe.is(g)}))}T.is=E})(dn||(e.WorkspaceEdit=dn={}));var Sn=(function(){function T(E,C){this.edits=E,this.changeAnnotations=C}return T.prototype.insert=function(E,C,_){var g,D;if(_===void 0?g=R.insert(E,C):O.is(_)?(D=_,g=B.insert(E,C,_)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(_),g=B.insert(E,C,D)),this.edits.push(g),D!==void 0)return D},T.prototype.replace=function(E,C,_){var g,D;if(_===void 0?g=R.replace(E,C):O.is(_)?(D=_,g=B.replace(E,C,_)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(_),g=B.replace(E,C,D)),this.edits.push(g),D!==void 0)return D},T.prototype.delete=function(E,C){var _,g;if(C===void 0?_=R.del(E):O.is(C)?(g=C,_=B.del(E,C)):(this.assertChangeAnnotations(this.changeAnnotations),g=this.changeAnnotations.manage(C),_=B.del(E,g)),this.edits.push(_),g!==void 0)return g},T.prototype.add=function(E){this.edits.push(E)},T.prototype.all=function(){return this.edits},T.prototype.clear=function(){this.edits.splice(0,this.edits.length)},T.prototype.assertChangeAnnotations=function(E){if(E===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},T})(),rd=(function(){function T(E){this._annotations=E===void 0?Object.create(null):E,this._counter=0,this._size=0}return T.prototype.all=function(){return this._annotations},Object.defineProperty(T.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),T.prototype.manage=function(E,C){var _;if(O.is(E)?_=E:(_=this.nextId(),C=E),this._annotations[_]!==void 0)throw new Error("Id ".concat(_," is already in use."));if(C===void 0)throw new Error("No annotation provided for id ".concat(_));return this._annotations[_]=C,this._size++,_},T.prototype.nextId=function(){return this._counter++,this._counter.toString()},T})(),yg=(function(){function T(E){var C=this;this._textEditChanges=Object.create(null),E!==void 0?(this._workspaceEdit=E,E.documentChanges?(this._changeAnnotations=new rd(E.changeAnnotations),E.changeAnnotations=this._changeAnnotations.all(),E.documentChanges.forEach(function(_){if(Pe.is(_)){var g=new Sn(_.edits,C._changeAnnotations);C._textEditChanges[_.textDocument.uri]=g}})):E.changes&&Object.keys(E.changes).forEach(function(_){var g=new Sn(E.changes[_]);C._textEditChanges[_]=g})):this._workspaceEdit={}}return Object.defineProperty(T.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}),T.prototype.getTextEditChange=function(E){if(Xs.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},_=this._textEditChanges[C.uri];if(!_){var g=[],D={textDocument:C,edits:g};this._workspaceEdit.documentChanges.push(D),_=new Sn(g,this._changeAnnotations),this._textEditChanges[C.uri]=_}return _}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var _=this._textEditChanges[E];if(!_){var g=[];this._workspaceEdit.changes[E]=g,_=new Sn(g),this._textEditChanges[E]=_}return _}},T.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new rd,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},T.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},T.prototype.createFile=function(E,C,_){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;q.is(C)||O.is(C)?g=C:_=C;var D,j;if(g===void 0?D=Qe.create(E,_):(j=O.is(g)?g:this._changeAnnotations.manage(g),D=Qe.create(E,_,j)),this._workspaceEdit.documentChanges.push(D),j!==void 0)return j},T.prototype.renameFile=function(E,C,_,g){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var D;q.is(_)||O.is(_)?D=_:g=_;var j,Te;if(D===void 0?j=Et.create(E,C,g):(Te=O.is(D)?D:this._changeAnnotations.manage(D),j=Et.create(E,C,g,Te)),this._workspaceEdit.documentChanges.push(j),Te!==void 0)return Te},T.prototype.deleteFile=function(E,C,_){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;q.is(C)||O.is(C)?g=C:_=C;var D,j;if(g===void 0?D=ke.create(E,_):(j=O.is(g)?g:this._changeAnnotations.manage(g),D=ke.create(E,_,j)),this._workspaceEdit.documentChanges.push(D),j!==void 0)return j},T})();e.WorkspaceChange=yg;var id;(function(T){function E(_){return{uri:_}}T.create=E;function C(_){var g=_;return A.defined(g)&&A.string(g.uri)}T.is=C})(id||(e.TextDocumentIdentifier=id={}));var _c;(function(T){function E(_,g){return{uri:_,version:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&A.string(g.uri)&&A.integer(g.version)}T.is=C})(_c||(e.VersionedTextDocumentIdentifier=_c={}));var Xs;(function(T){function E(_,g){return{uri:_,version:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&A.string(g.uri)&&(g.version===null||A.integer(g.version))}T.is=C})(Xs||(e.OptionalVersionedTextDocumentIdentifier=Xs={}));var qi;(function(T){function E(_,g,D,j){return{uri:_,languageId:g,version:D,text:j}}T.create=E;function C(_){var g=_;return A.defined(g)&&A.string(g.uri)&&A.string(g.languageId)&&A.integer(g.version)&&A.string(g.text)}T.is=C})(qi||(e.TextDocumentItem=qi={}));var qo;(function(T){T.PlainText="plaintext",T.Markdown="markdown";function E(C){var _=C;return _===T.PlainText||_===T.Markdown}T.is=E})(qo||(e.MarkupKind=qo={}));var Js;(function(T){function E(C){var _=C;return A.objectLiteral(C)&&qo.is(_.kind)&&A.string(_.value)}T.is=E})(Js||(e.MarkupContent=Js={}));var sd;(function(T){T.Text=1,T.Method=2,T.Function=3,T.Constructor=4,T.Field=5,T.Variable=6,T.Class=7,T.Interface=8,T.Module=9,T.Property=10,T.Unit=11,T.Value=12,T.Enum=13,T.Keyword=14,T.Snippet=15,T.Color=16,T.File=17,T.Reference=18,T.Folder=19,T.EnumMember=20,T.Constant=21,T.Struct=22,T.Event=23,T.Operator=24,T.TypeParameter=25})(sd||(e.CompletionItemKind=sd={}));var Pc;(function(T){T.PlainText=1,T.Snippet=2})(Pc||(e.InsertTextFormat=Pc={}));var kc;(function(T){T.Deprecated=1})(kc||(e.CompletionItemTag=kc={}));var od;(function(T){function E(_,g,D){return{newText:_,insert:g,replace:D}}T.create=E;function C(_){var g=_;return g&&A.string(g.newText)&&a.is(g.insert)&&a.is(g.replace)}T.is=C})(od||(e.InsertReplaceEdit=od={}));var ad;(function(T){T.asIs=1,T.adjustIndentation=2})(ad||(e.InsertTextMode=ad={}));var cd;(function(T){function E(C){var _=C;return _&&(A.string(_.detail)||_.detail===void 0)&&(A.string(_.description)||_.description===void 0)}T.is=E})(cd||(e.CompletionItemLabelDetails=cd={}));var ld;(function(T){function E(C){return{label:C}}T.create=E})(ld||(e.CompletionItem=ld={}));var ud;(function(T){function E(C,_){return{items:C||[],isIncomplete:!!_}}T.create=E})(ud||(e.CompletionList=ud={}));var $o;(function(T){function E(_){return _.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}T.fromPlainText=E;function C(_){var g=_;return A.string(g)||A.objectLiteral(g)&&A.string(g.language)&&A.string(g.value)}T.is=C})($o||(e.MarkedString=$o={}));var Hr;(function(T){function E(C){var _=C;return!!_&&A.objectLiteral(_)&&(Js.is(_.contents)||$o.is(_.contents)||A.typedArray(_.contents,$o.is))&&(C.range===void 0||a.is(C.range))}T.is=E})(Hr||(e.Hover=Hr={}));var dd;(function(T){function E(C,_){return _?{label:C,documentation:_}:{label:C}}T.create=E})(dd||(e.ParameterInformation=dd={}));var fd;(function(T){function E(C,_){for(var g=[],D=2;D<arguments.length;D++)g[D-2]=arguments[D];var j={label:C};return A.defined(_)&&(j.documentation=_),A.defined(g)?j.parameters=g:j.parameters=[],j}T.create=E})(fd||(e.SignatureInformation=fd={}));var Qs;(function(T){T.Text=1,T.Read=2,T.Write=3})(Qs||(e.DocumentHighlightKind=Qs={}));var pd;(function(T){function E(C,_){var g={range:C};return A.number(_)&&(g.kind=_),g}T.create=E})(pd||(e.DocumentHighlight=pd={}));var Fo;(function(T){T.File=1,T.Module=2,T.Namespace=3,T.Package=4,T.Class=5,T.Method=6,T.Property=7,T.Field=8,T.Constructor=9,T.Enum=10,T.Interface=11,T.Function=12,T.Variable=13,T.Constant=14,T.String=15,T.Number=16,T.Boolean=17,T.Array=18,T.Object=19,T.Key=20,T.Null=21,T.EnumMember=22,T.Struct=23,T.Event=24,T.Operator=25,T.TypeParameter=26})(Fo||(e.SymbolKind=Fo={}));var hd;(function(T){T.Deprecated=1})(hd||(e.SymbolTag=hd={}));var $i;(function(T){function E(C,_,g,D,j){var Te={name:C,kind:_,location:{uri:D,range:g}};return j&&(Te.containerName=j),Te}T.create=E})($i||(e.SymbolInformation=$i={}));var rs;(function(T){function E(C,_,g,D){return D!==void 0?{name:C,kind:_,location:{uri:g,range:D}}:{name:C,kind:_,location:{uri:g}}}T.create=E})(rs||(e.WorkspaceSymbol=rs={}));var md;(function(T){function E(_,g,D,j,Te,Ot){var gt={name:_,detail:g,kind:D,range:j,selectionRange:Te};return Ot!==void 0&&(gt.children=Ot),gt}T.create=E;function C(_){var g=_;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))}T.is=C})(md||(e.DocumentSymbol=md={}));var gd;(function(T){T.Empty="",T.QuickFix="quickfix",T.Refactor="refactor",T.RefactorExtract="refactor.extract",T.RefactorInline="refactor.inline",T.RefactorRewrite="refactor.rewrite",T.Source="source",T.SourceOrganizeImports="source.organizeImports",T.SourceFixAll="source.fixAll"})(gd||(e.CodeActionKind=gd={}));var mi;(function(T){T.Invoked=1,T.Automatic=2})(mi||(e.CodeActionTriggerKind=mi={}));var Nc;(function(T){function E(_,g,D){var j={diagnostics:_};return g!=null&&(j.only=g),D!=null&&(j.triggerKind=D),j}T.create=E;function C(_){var g=_;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===mi.Invoked||g.triggerKind===mi.Automatic)}T.is=C})(Nc||(e.CodeActionContext=Nc={}));var Rc;(function(T){function E(_,g,D){var j={title:_},Te=!0;return typeof g=="string"?(Te=!1,j.kind=g):k.is(g)?j.command=g:j.edit=g,Te&&D!==void 0&&(j.kind=D),j}T.create=E;function C(_){var g=_;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||dn.is(g.edit))}T.is=C})(Rc||(e.CodeAction=Rc={}));var Bo;(function(T){function E(_,g){var D={range:_};return A.defined(g)&&(D.data=g),D}T.create=E;function C(_){var g=_;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.command)||k.is(g.command))}T.is=C})(Bo||(e.CodeLens=Bo={}));var wc;(function(T){function E(_,g){return{tabSize:_,insertSpaces:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&A.uinteger(g.tabSize)&&A.boolean(g.insertSpaces)}T.is=C})(wc||(e.FormattingOptions=wc={}));var Fi;(function(T){function E(_,g,D){return{range:_,target:g,data:D}}T.create=E;function C(_){var g=_;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.target)||A.string(g.target))}T.is=C})(Fi||(e.DocumentLink=Fi={}));var w;(function(T){function E(_,g){return{range:_,parent:g}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&a.is(g.range)&&(g.parent===void 0||T.is(g.parent))}T.is=C})(w||(e.SelectionRange=w={}));var $;(function(T){T.namespace="namespace",T.type="type",T.class="class",T.enum="enum",T.interface="interface",T.struct="struct",T.typeParameter="typeParameter",T.parameter="parameter",T.variable="variable",T.property="property",T.enumMember="enumMember",T.event="event",T.function="function",T.method="method",T.macro="macro",T.keyword="keyword",T.modifier="modifier",T.comment="comment",T.string="string",T.number="number",T.regexp="regexp",T.operator="operator",T.decorator="decorator"})($||(e.SemanticTokenTypes=$={}));var G;(function(T){T.declaration="declaration",T.definition="definition",T.readonly="readonly",T.static="static",T.deprecated="deprecated",T.abstract="abstract",T.async="async",T.modification="modification",T.documentation="documentation",T.defaultLibrary="defaultLibrary"})(G||(e.SemanticTokenModifiers=G={}));var ne;(function(T){function E(C){var _=C;return A.objectLiteral(_)&&(_.resultId===void 0||typeof _.resultId=="string")&&Array.isArray(_.data)&&(_.data.length===0||typeof _.data[0]=="number")}T.is=E})(ne||(e.SemanticTokens=ne={}));var it;(function(T){function E(_,g){return{range:_,text:g}}T.create=E;function C(_){var g=_;return g!=null&&a.is(g.range)&&A.string(g.text)}T.is=C})(it||(e.InlineValueText=it={}));var Ze;(function(T){function E(_,g,D){return{range:_,variableName:g,caseSensitiveLookup:D}}T.create=E;function C(_){var g=_;return g!=null&&a.is(g.range)&&A.boolean(g.caseSensitiveLookup)&&(A.string(g.variableName)||g.variableName===void 0)}T.is=C})(Ze||(e.InlineValueVariableLookup=Ze={}));var vt;(function(T){function E(_,g){return{range:_,expression:g}}T.create=E;function C(_){var g=_;return g!=null&&a.is(g.range)&&(A.string(g.expression)||g.expression===void 0)}T.is=C})(vt||(e.InlineValueEvaluatableExpression=vt={}));var kt;(function(T){function E(_,g){return{frameId:_,stoppedLocation:g}}T.create=E;function C(_){var g=_;return A.defined(g)&&a.is(_.stoppedLocation)}T.is=C})(kt||(e.InlineValueContext=kt={}));var Ae;(function(T){T.Type=1,T.Parameter=2;function E(C){return C===1||C===2}T.is=E})(Ae||(e.InlayHintKind=Ae={}));var at;(function(T){function E(_){return{value:_}}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&(g.tooltip===void 0||A.string(g.tooltip)||Js.is(g.tooltip))&&(g.location===void 0||c.is(g.location))&&(g.command===void 0||k.is(g.command))}T.is=C})(at||(e.InlayHintLabelPart=at={}));var Ge;(function(T){function E(_,g,D){var j={position:_,label:g};return D!==void 0&&(j.kind=D),j}T.create=E;function C(_){var g=_;return A.objectLiteral(g)&&o.is(g.position)&&(A.string(g.label)||A.typedArray(g.label,at.is))&&(g.kind===void 0||Ae.is(g.kind))&&g.textEdits===void 0||A.typedArray(g.textEdits,R.is)&&(g.tooltip===void 0||A.string(g.tooltip)||Js.is(g.tooltip))&&(g.paddingLeft===void 0||A.boolean(g.paddingLeft))&&(g.paddingRight===void 0||A.boolean(g.paddingRight))}T.is=C})(Ge||(e.InlayHint=Ge={}));var It;(function(T){function E(C){return{kind:"snippet",value:C}}T.createSnippet=E})(It||(e.StringValue=It={}));var tn;(function(T){function E(C,_,g,D){return{insertText:C,filterText:_,range:g,command:D}}T.create=E})(tn||(e.InlineCompletionItem=tn={}));var ur;(function(T){function E(C){return{items:C}}T.create=E})(ur||(e.InlineCompletionList=ur={}));var yd;(function(T){T.Invoked=0,T.Automatic=1})(yd||(e.InlineCompletionTriggerKind=yd={}));var MP;(function(T){function E(C,_){return{range:C,text:_}}T.create=E})(MP||(e.SelectedCompletionInfo=MP={}));var xP;(function(T){function E(C,_){return{triggerKind:C,selectedCompletionInfo:_}}T.create=E})(xP||(e.InlineCompletionContext=xP={}));var LP;(function(T){function E(C){var _=C;return A.objectLiteral(_)&&r.is(_.uri)&&A.string(_.name)}T.is=E})(LP||(e.WorkspaceFolder=LP={})),e.EOL=[`
|
|
33
33
|
`,`\r
|
|
34
|
-
`,"\r"];var qP;(function(T){function E(D,j,Te,
|
|
34
|
+
`,"\r"];var qP;(function(T){function E(D,j,Te,Ot){return new LB(D,j,Te,Ot)}T.create=E;function C(D){var j=D;return!!(A.defined(j)&&A.string(j.uri)&&(A.undefined(j.languageId)||A.string(j.languageId))&&A.uinteger(j.lineCount)&&A.func(j.getText)&&A.func(j.positionAt)&&A.func(j.offsetAt))}T.is=C;function _(D,j){for(var Te=D.getText(),Ot=g(j,function(jo,Td){var $P=jo.range.start.line-Td.range.start.line;return $P===0?jo.range.start.character-Td.range.start.character:$P}),gt=Te.length,Vr=Ot.length-1;Vr>=0;Vr--){var Wr=Ot[Vr],Bi=D.offsetAt(Wr.range.start),xe=D.offsetAt(Wr.range.end);if(xe<=gt)Te=Te.substring(0,Bi)+Wr.newText+Te.substring(xe,Te.length);else throw new Error("Overlapping edit");gt=Bi}return Te}T.applyEdits=_;function g(D,j){if(D.length<=1)return D;var Te=D.length/2|0,Ot=D.slice(0,Te),gt=D.slice(Te);g(Ot,j),g(gt,j);for(var Vr=0,Wr=0,Bi=0;Vr<Ot.length&&Wr<gt.length;){var xe=j(Ot[Vr],gt[Wr]);xe<=0?D[Bi++]=Ot[Vr++]:D[Bi++]=gt[Wr++]}for(;Vr<Ot.length;)D[Bi++]=Ot[Vr++];for(;Wr<gt.length;)D[Bi++]=gt[Wr++];return D}})(qP||(e.TextDocument=qP={}));var LB=(function(){function T(E,C,_,g){this._uri=E,this._languageId=C,this._version=_,this._content=g,this._lineOffsets=void 0}return Object.defineProperty(T.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),T.prototype.getText=function(E){if(E){var C=this.offsetAt(E.start),_=this.offsetAt(E.end);return this._content.substring(C,_)}return this._content},T.prototype.update=function(E,C){this._content=E.text,this._version=C,this._lineOffsets=void 0},T.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var E=[],C=this._content,_=!0,g=0;g<C.length;g++){_&&(E.push(g),_=!1);var D=C.charAt(g);_=D==="\r"||D===`
|
|
35
35
|
`,D==="\r"&&g+1<C.length&&C.charAt(g+1)===`
|
|
36
|
-
`&&g++}_&&C.length>0&&E.push(C.length),this._lineOffsets=E}return this._lineOffsets},T.prototype.positionAt=function(E){E=Math.max(Math.min(E,this._content.length),0);var C=this.getLineOffsets(),_=0,g=C.length;if(g===0)return o.create(0,E);for(;_<g;){var D=Math.floor((_+g)/2);C[D]>E?g=D:_=D+1}var j=_-1;return o.create(j,E-C[j])},T.prototype.offsetAt=function(E){var C=this.getLineOffsets();if(E.line>=C.length)return this._content.length;if(E.line<0)return 0;var _=C[E.line],g=E.line+1<C.length?C[E.line+1]:this._content.length;return Math.max(Math.min(_+E.character,g),_)},Object.defineProperty(T.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),T}(),A;(function(T){var E=Object.prototype.toString;function C(xe){return typeof xe<"u"}T.defined=C;function _(xe){return typeof xe>"u"}T.undefined=_;function g(xe){return xe===!0||xe===!1}T.boolean=g;function D(xe){return E.call(xe)==="[object String]"}T.string=D;function j(xe){return E.call(xe)==="[object Number]"}T.number=j;function Te(xe,jo,Td){return E.call(xe)==="[object Number]"&&jo<=xe&&xe<=Td}T.numberRange=Te;function Mt(xe){return E.call(xe)==="[object Number]"&&-2147483648<=xe&&xe<=2147483647}T.integer=Mt;function gt(xe){return E.call(xe)==="[object Number]"&&0<=xe&&xe<=2147483647}T.uinteger=gt;function Vr(xe){return E.call(xe)==="[object Function]"}T.func=Vr;function Wr(xe){return xe!==null&&typeof xe=="object"}T.objectLiteral=Wr;function Bi(xe,jo){return Array.isArray(xe)&&xe.every(jo)}T.typedArray=Bi})(A||(A={}))})});var Nt=N(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.ProtocolNotificationType=Wn.ProtocolNotificationType0=Wn.ProtocolRequestType=Wn.ProtocolRequestType0=Wn.RegistrationType=Wn.MessageDirection=void 0;var Xo=no(),vk;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(vk||(Wn.MessageDirection=vk={}));var Dy=class{constructor(e){this.method=e}};Wn.RegistrationType=Dy;var Ay=class extends Xo.RequestType0{constructor(e){super(e)}};Wn.ProtocolRequestType0=Ay;var Iy=class extends Xo.RequestType{constructor(e){super(e,Xo.ParameterStructures.byName)}};Wn.ProtocolRequestType=Iy;var Oy=class extends Xo.NotificationType0{constructor(e){super(e)}};Wn.ProtocolNotificationType0=Oy;var My=class extends Xo.NotificationType{constructor(e){super(e,Xo.ParameterStructures.byName)}};Wn.ProtocolNotificationType=My});var Hd=N(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.objectLiteral=Vt.typedArray=Vt.stringArray=Vt.array=Vt.func=Vt.error=Vt.number=Vt.string=Vt.boolean=void 0;function Dj(t){return t===!0||t===!1}Vt.boolean=Dj;function bk(t){return typeof t=="string"||t instanceof String}Vt.string=bk;function Aj(t){return typeof t=="number"||t instanceof Number}Vt.number=Aj;function Ij(t){return t instanceof Error}Vt.error=Ij;function Oj(t){return typeof t=="function"}Vt.func=Oj;function Sk(t){return Array.isArray(t)}Vt.array=Sk;function Mj(t){return Sk(t)&&t.every(e=>bk(e))}Vt.stringArray=Mj;function xj(t,e){return Array.isArray(t)&&t.every(e)}Vt.typedArray=xj;function Lj(t){return t!==null&&typeof t=="object"}Vt.objectLiteral=Lj});var kk=N(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.ImplementationRequest=void 0;var _k=Nt(),Pk;(function(t){t.method="textDocument/implementation",t.messageDirection=_k.MessageDirection.clientToServer,t.type=new _k.ProtocolRequestType(t.method)})(Pk||(Vd.ImplementationRequest=Pk={}))});var wk=N(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.TypeDefinitionRequest=void 0;var Nk=Nt(),Rk;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=Nk.MessageDirection.clientToServer,t.type=new Nk.ProtocolRequestType(t.method)})(Rk||(Wd.TypeDefinitionRequest=Rk={}))});var Dk=N(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.DidChangeWorkspaceFoldersNotification=Jo.WorkspaceFoldersRequest=void 0;var zd=Nt(),Ek;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=zd.MessageDirection.serverToClient,t.type=new zd.ProtocolRequestType0(t.method)})(Ek||(Jo.WorkspaceFoldersRequest=Ek={}));var Ck;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=zd.MessageDirection.clientToServer,t.type=new zd.ProtocolNotificationType(t.method)})(Ck||(Jo.DidChangeWorkspaceFoldersNotification=Ck={}))});var Ok=N(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.ConfigurationRequest=void 0;var Ak=Nt(),Ik;(function(t){t.method="workspace/configuration",t.messageDirection=Ak.MessageDirection.serverToClient,t.type=new Ak.ProtocolRequestType(t.method)})(Ik||(Gd.ConfigurationRequest=Ik={}))});var Lk=N(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.ColorPresentationRequest=Qo.DocumentColorRequest=void 0;var Yd=Nt(),Mk;(function(t){t.method="textDocument/documentColor",t.messageDirection=Yd.MessageDirection.clientToServer,t.type=new Yd.ProtocolRequestType(t.method)})(Mk||(Qo.DocumentColorRequest=Mk={}));var xk;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=Yd.MessageDirection.clientToServer,t.type=new Yd.ProtocolRequestType(t.method)})(xk||(Qo.ColorPresentationRequest=xk={}))});var Fk=N(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.FoldingRangeRefreshRequest=Zo.FoldingRangeRequest=void 0;var Kd=Nt(),qk;(function(t){t.method="textDocument/foldingRange",t.messageDirection=Kd.MessageDirection.clientToServer,t.type=new Kd.ProtocolRequestType(t.method)})(qk||(Zo.FoldingRangeRequest=qk={}));var $k;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=Kd.MessageDirection.serverToClient,t.type=new Kd.ProtocolRequestType0(t.method)})($k||(Zo.FoldingRangeRefreshRequest=$k={}))});var Uk=N(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.DeclarationRequest=void 0;var Bk=Nt(),jk;(function(t){t.method="textDocument/declaration",t.messageDirection=Bk.MessageDirection.clientToServer,t.type=new Bk.ProtocolRequestType(t.method)})(jk||(Xd.DeclarationRequest=jk={}))});var Wk=N(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.SelectionRangeRequest=void 0;var Hk=Nt(),Vk;(function(t){t.method="textDocument/selectionRange",t.messageDirection=Hk.MessageDirection.clientToServer,t.type=new Hk.ProtocolRequestType(t.method)})(Vk||(Jd.SelectionRangeRequest=Vk={}))});var Kk=N(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.WorkDoneProgressCancelNotification=cs.WorkDoneProgressCreateRequest=cs.WorkDoneProgress=void 0;var qj=no(),Qd=Nt(),zk;(function(t){t.type=new qj.ProgressType;function e(n){return n===t.type}t.is=e})(zk||(cs.WorkDoneProgress=zk={}));var Gk;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=Qd.MessageDirection.serverToClient,t.type=new Qd.ProtocolRequestType(t.method)})(Gk||(cs.WorkDoneProgressCreateRequest=Gk={}));var Yk;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=Qd.MessageDirection.clientToServer,t.type=new Qd.ProtocolNotificationType(t.method)})(Yk||(cs.WorkDoneProgressCancelNotification=Yk={}))});var Zk=N(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.CallHierarchyOutgoingCallsRequest=ls.CallHierarchyIncomingCallsRequest=ls.CallHierarchyPrepareRequest=void 0;var ea=Nt(),Xk;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=ea.MessageDirection.clientToServer,t.type=new ea.ProtocolRequestType(t.method)})(Xk||(ls.CallHierarchyPrepareRequest=Xk={}));var Jk;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=ea.MessageDirection.clientToServer,t.type=new ea.ProtocolRequestType(t.method)})(Jk||(ls.CallHierarchyIncomingCallsRequest=Jk={}));var Qk;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=ea.MessageDirection.clientToServer,t.type=new ea.ProtocolRequestType(t.method)})(Qk||(ls.CallHierarchyOutgoingCallsRequest=Qk={}))});var sN=N(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.SemanticTokensRefreshRequest=zn.SemanticTokensRangeRequest=zn.SemanticTokensDeltaRequest=zn.SemanticTokensRequest=zn.SemanticTokensRegistrationType=zn.TokenFormat=void 0;var Ui=Nt(),eN;(function(t){t.Relative="relative"})(eN||(zn.TokenFormat=eN={}));var Mc;(function(t){t.method="textDocument/semanticTokens",t.type=new Ui.RegistrationType(t.method)})(Mc||(zn.SemanticTokensRegistrationType=Mc={}));var tN;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=Ui.MessageDirection.clientToServer,t.type=new Ui.ProtocolRequestType(t.method),t.registrationMethod=Mc.method})(tN||(zn.SemanticTokensRequest=tN={}));var nN;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=Ui.MessageDirection.clientToServer,t.type=new Ui.ProtocolRequestType(t.method),t.registrationMethod=Mc.method})(nN||(zn.SemanticTokensDeltaRequest=nN={}));var rN;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=Ui.MessageDirection.clientToServer,t.type=new Ui.ProtocolRequestType(t.method),t.registrationMethod=Mc.method})(rN||(zn.SemanticTokensRangeRequest=rN={}));var iN;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=Ui.MessageDirection.serverToClient,t.type=new Ui.ProtocolRequestType0(t.method)})(iN||(zn.SemanticTokensRefreshRequest=iN={}))});var cN=N(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.ShowDocumentRequest=void 0;var oN=Nt(),aN;(function(t){t.method="window/showDocument",t.messageDirection=oN.MessageDirection.serverToClient,t.type=new oN.ProtocolRequestType(t.method)})(aN||(Zd.ShowDocumentRequest=aN={}))});var dN=N(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.LinkedEditingRangeRequest=void 0;var lN=Nt(),uN;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=lN.MessageDirection.clientToServer,t.type=new lN.ProtocolRequestType(t.method)})(uN||(ef.LinkedEditingRangeRequest=uN={}))});var vN=N(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.WillDeleteFilesRequest=kn.DidDeleteFilesNotification=kn.DidRenameFilesNotification=kn.WillRenameFilesRequest=kn.DidCreateFilesNotification=kn.WillCreateFilesRequest=kn.FileOperationPatternKind=void 0;var br=Nt(),fN;(function(t){t.file="file",t.folder="folder"})(fN||(kn.FileOperationPatternKind=fN={}));var pN;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolRequestType(t.method)})(pN||(kn.WillCreateFilesRequest=pN={}));var hN;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolNotificationType(t.method)})(hN||(kn.DidCreateFilesNotification=hN={}));var mN;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolRequestType(t.method)})(mN||(kn.WillRenameFilesRequest=mN={}));var gN;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolNotificationType(t.method)})(gN||(kn.DidRenameFilesNotification=gN={}));var yN;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolNotificationType(t.method)})(yN||(kn.DidDeleteFilesNotification=yN={}));var TN;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolRequestType(t.method)})(TN||(kn.WillDeleteFilesRequest=TN={}))});var kN=N(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.MonikerRequest=us.MonikerKind=us.UniquenessLevel=void 0;var bN=Nt(),SN;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(SN||(us.UniquenessLevel=SN={}));var _N;(function(t){t.$import="import",t.$export="export",t.local="local"})(_N||(us.MonikerKind=_N={}));var PN;(function(t){t.method="textDocument/moniker",t.messageDirection=bN.MessageDirection.clientToServer,t.type=new bN.ProtocolRequestType(t.method)})(PN||(us.MonikerRequest=PN={}))});var EN=N(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.TypeHierarchySubtypesRequest=ds.TypeHierarchySupertypesRequest=ds.TypeHierarchyPrepareRequest=void 0;var ta=Nt(),NN;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=ta.MessageDirection.clientToServer,t.type=new ta.ProtocolRequestType(t.method)})(NN||(ds.TypeHierarchyPrepareRequest=NN={}));var RN;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=ta.MessageDirection.clientToServer,t.type=new ta.ProtocolRequestType(t.method)})(RN||(ds.TypeHierarchySupertypesRequest=RN={}));var wN;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=ta.MessageDirection.clientToServer,t.type=new ta.ProtocolRequestType(t.method)})(wN||(ds.TypeHierarchySubtypesRequest=wN={}))});var AN=N(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.InlineValueRefreshRequest=na.InlineValueRequest=void 0;var tf=Nt(),CN;(function(t){t.method="textDocument/inlineValue",t.messageDirection=tf.MessageDirection.clientToServer,t.type=new tf.ProtocolRequestType(t.method)})(CN||(na.InlineValueRequest=CN={}));var DN;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=tf.MessageDirection.serverToClient,t.type=new tf.ProtocolRequestType0(t.method)})(DN||(na.InlineValueRefreshRequest=DN={}))});var xN=N(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.InlayHintRefreshRequest=fs.InlayHintResolveRequest=fs.InlayHintRequest=void 0;var ra=Nt(),IN;(function(t){t.method="textDocument/inlayHint",t.messageDirection=ra.MessageDirection.clientToServer,t.type=new ra.ProtocolRequestType(t.method)})(IN||(fs.InlayHintRequest=IN={}));var ON;(function(t){t.method="inlayHint/resolve",t.messageDirection=ra.MessageDirection.clientToServer,t.type=new ra.ProtocolRequestType(t.method)})(ON||(fs.InlayHintResolveRequest=ON={}));var MN;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=ra.MessageDirection.serverToClient,t.type=new ra.ProtocolRequestType0(t.method)})(MN||(fs.InlayHintRefreshRequest=MN={}))});var UN=N(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.DiagnosticRefreshRequest=Sr.WorkspaceDiagnosticRequest=Sr.DocumentDiagnosticRequest=Sr.DocumentDiagnosticReportKind=Sr.DiagnosticServerCancellationData=void 0;var jN=no(),$j=Hd(),ia=Nt(),LN;(function(t){function e(n){let r=n;return r&&$j.boolean(r.retriggerRequest)}t.is=e})(LN||(Sr.DiagnosticServerCancellationData=LN={}));var qN;(function(t){t.Full="full",t.Unchanged="unchanged"})(qN||(Sr.DocumentDiagnosticReportKind=qN={}));var $N;(function(t){t.method="textDocument/diagnostic",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method),t.partialResult=new jN.ProgressType})($N||(Sr.DocumentDiagnosticRequest=$N={}));var FN;(function(t){t.method="workspace/diagnostic",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method),t.partialResult=new jN.ProgressType})(FN||(Sr.WorkspaceDiagnosticRequest=FN={}));var BN;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=ia.MessageDirection.serverToClient,t.type=new ia.ProtocolRequestType0(t.method)})(BN||(Sr.DiagnosticRefreshRequest=BN={}))});var KN=N(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.DidCloseNotebookDocumentNotification=xt.DidSaveNotebookDocumentNotification=xt.DidChangeNotebookDocumentNotification=xt.NotebookCellArrayChange=xt.DidOpenNotebookDocumentNotification=xt.NotebookDocumentSyncRegistrationType=xt.NotebookDocument=xt.NotebookCell=xt.ExecutionSummary=xt.NotebookCellKind=void 0;var xc=Ud(),Gr=Hd(),gi=Nt(),xy;(function(t){t.Markup=1,t.Code=2;function e(n){return n===1||n===2}t.is=e})(xy||(xt.NotebookCellKind=xy={}));var Ly;(function(t){function e(i,s){let o={executionOrder:i};return(s===!0||s===!1)&&(o.success=s),o}t.create=e;function n(i){let s=i;return Gr.objectLiteral(s)&&xc.uinteger.is(s.executionOrder)&&(s.success===void 0||Gr.boolean(s.success))}t.is=n;function r(i,s){return i===s?!0:i==null||s===null||s===void 0?!1:i.executionOrder===s.executionOrder&&i.success===s.success}t.equals=r})(Ly||(xt.ExecutionSummary=Ly={}));var nf;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function n(s){let o=s;return Gr.objectLiteral(o)&&xy.is(o.kind)&&xc.DocumentUri.is(o.document)&&(o.metadata===void 0||Gr.objectLiteral(o.metadata))}t.is=n;function r(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)&&!Ly.equals(s.executionSummary,o.executionSummary)&&a.add("executionSummary"),a}t.diff=r;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(Gr.objectLiteral(s)&&Gr.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}})(nf||(xt.NotebookCell=nf={}));var HN;(function(t){function e(r,i,s,o){return{uri:r,notebookType:i,version:s,cells:o}}t.create=e;function n(r){let i=r;return Gr.objectLiteral(i)&&Gr.string(i.uri)&&xc.integer.is(i.version)&&Gr.typedArray(i.cells,nf.is)}t.is=n})(HN||(xt.NotebookDocument=HN={}));var sa;(function(t){t.method="notebookDocument/sync",t.messageDirection=gi.MessageDirection.clientToServer,t.type=new gi.RegistrationType(t.method)})(sa||(xt.NotebookDocumentSyncRegistrationType=sa={}));var VN;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=gi.MessageDirection.clientToServer,t.type=new gi.ProtocolNotificationType(t.method),t.registrationMethod=sa.method})(VN||(xt.DidOpenNotebookDocumentNotification=VN={}));var WN;(function(t){function e(r){let i=r;return Gr.objectLiteral(i)&&xc.uinteger.is(i.start)&&xc.uinteger.is(i.deleteCount)&&(i.cells===void 0||Gr.typedArray(i.cells,nf.is))}t.is=e;function n(r,i,s){let o={start:r,deleteCount:i};return s!==void 0&&(o.cells=s),o}t.create=n})(WN||(xt.NotebookCellArrayChange=WN={}));var zN;(function(t){t.method="notebookDocument/didChange",t.messageDirection=gi.MessageDirection.clientToServer,t.type=new gi.ProtocolNotificationType(t.method),t.registrationMethod=sa.method})(zN||(xt.DidChangeNotebookDocumentNotification=zN={}));var GN;(function(t){t.method="notebookDocument/didSave",t.messageDirection=gi.MessageDirection.clientToServer,t.type=new gi.ProtocolNotificationType(t.method),t.registrationMethod=sa.method})(GN||(xt.DidSaveNotebookDocumentNotification=GN={}));var YN;(function(t){t.method="notebookDocument/didClose",t.messageDirection=gi.MessageDirection.clientToServer,t.type=new gi.ProtocolNotificationType(t.method),t.registrationMethod=sa.method})(YN||(xt.DidCloseNotebookDocumentNotification=YN={}))});var QN=N(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.InlineCompletionRequest=void 0;var XN=Nt(),JN;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=XN.MessageDirection.clientToServer,t.type=new XN.ProtocolRequestType(t.method)})(JN||(rf.InlineCompletionRequest=JN={}))});var dw=N(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.WorkspaceSymbolRequest=P.CodeActionResolveRequest=P.CodeActionRequest=P.DocumentSymbolRequest=P.DocumentHighlightRequest=P.ReferencesRequest=P.DefinitionRequest=P.SignatureHelpRequest=P.SignatureHelpTriggerKind=P.HoverRequest=P.CompletionResolveRequest=P.CompletionRequest=P.CompletionTriggerKind=P.PublishDiagnosticsNotification=P.WatchKind=P.RelativePattern=P.FileChangeType=P.DidChangeWatchedFilesNotification=P.WillSaveTextDocumentWaitUntilRequest=P.WillSaveTextDocumentNotification=P.TextDocumentSaveReason=P.DidSaveTextDocumentNotification=P.DidCloseTextDocumentNotification=P.DidChangeTextDocumentNotification=P.TextDocumentContentChangeEvent=P.DidOpenTextDocumentNotification=P.TextDocumentSyncKind=P.TelemetryEventNotification=P.LogMessageNotification=P.ShowMessageRequest=P.ShowMessageNotification=P.MessageType=P.DidChangeConfigurationNotification=P.ExitNotification=P.ShutdownRequest=P.InitializedNotification=P.InitializeErrorCodes=P.InitializeRequest=P.WorkDoneProgressOptions=P.TextDocumentRegistrationOptions=P.StaticRegistrationOptions=P.PositionEncodingKind=P.FailureHandlingKind=P.ResourceOperationKind=P.UnregistrationRequest=P.RegistrationRequest=P.DocumentSelector=P.NotebookCellTextDocumentFilter=P.NotebookDocumentFilter=P.TextDocumentFilter=void 0;P.MonikerRequest=P.MonikerKind=P.UniquenessLevel=P.WillDeleteFilesRequest=P.DidDeleteFilesNotification=P.WillRenameFilesRequest=P.DidRenameFilesNotification=P.WillCreateFilesRequest=P.DidCreateFilesNotification=P.FileOperationPatternKind=P.LinkedEditingRangeRequest=P.ShowDocumentRequest=P.SemanticTokensRegistrationType=P.SemanticTokensRefreshRequest=P.SemanticTokensRangeRequest=P.SemanticTokensDeltaRequest=P.SemanticTokensRequest=P.TokenFormat=P.CallHierarchyPrepareRequest=P.CallHierarchyOutgoingCallsRequest=P.CallHierarchyIncomingCallsRequest=P.WorkDoneProgressCancelNotification=P.WorkDoneProgressCreateRequest=P.WorkDoneProgress=P.SelectionRangeRequest=P.DeclarationRequest=P.FoldingRangeRefreshRequest=P.FoldingRangeRequest=P.ColorPresentationRequest=P.DocumentColorRequest=P.ConfigurationRequest=P.DidChangeWorkspaceFoldersNotification=P.WorkspaceFoldersRequest=P.TypeDefinitionRequest=P.ImplementationRequest=P.ApplyWorkspaceEditRequest=P.ExecuteCommandRequest=P.PrepareRenameRequest=P.RenameRequest=P.PrepareSupportDefaultBehavior=P.DocumentOnTypeFormattingRequest=P.DocumentRangesFormattingRequest=P.DocumentRangeFormattingRequest=P.DocumentFormattingRequest=P.DocumentLinkResolveRequest=P.DocumentLinkRequest=P.CodeLensRefreshRequest=P.CodeLensResolveRequest=P.CodeLensRequest=P.WorkspaceSymbolResolveRequest=void 0;P.InlineCompletionRequest=P.DidCloseNotebookDocumentNotification=P.DidSaveNotebookDocumentNotification=P.DidChangeNotebookDocumentNotification=P.NotebookCellArrayChange=P.DidOpenNotebookDocumentNotification=P.NotebookDocumentSyncRegistrationType=P.NotebookDocument=P.NotebookCell=P.ExecutionSummary=P.NotebookCellKind=P.DiagnosticRefreshRequest=P.WorkspaceDiagnosticRequest=P.DocumentDiagnosticRequest=P.DocumentDiagnosticReportKind=P.DiagnosticServerCancellationData=P.InlayHintRefreshRequest=P.InlayHintResolveRequest=P.InlayHintRequest=P.InlineValueRefreshRequest=P.InlineValueRequest=P.TypeHierarchySupertypesRequest=P.TypeHierarchySubtypesRequest=P.TypeHierarchyPrepareRequest=void 0;var z=Nt(),ZN=Ud(),nn=Hd(),Fj=kk();Object.defineProperty(P,"ImplementationRequest",{enumerable:!0,get:function(){return Fj.ImplementationRequest}});var Bj=wk();Object.defineProperty(P,"TypeDefinitionRequest",{enumerable:!0,get:function(){return Bj.TypeDefinitionRequest}});var aw=Dk();Object.defineProperty(P,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return aw.WorkspaceFoldersRequest}});Object.defineProperty(P,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return aw.DidChangeWorkspaceFoldersNotification}});var jj=Ok();Object.defineProperty(P,"ConfigurationRequest",{enumerable:!0,get:function(){return jj.ConfigurationRequest}});var cw=Lk();Object.defineProperty(P,"DocumentColorRequest",{enumerable:!0,get:function(){return cw.DocumentColorRequest}});Object.defineProperty(P,"ColorPresentationRequest",{enumerable:!0,get:function(){return cw.ColorPresentationRequest}});var lw=Fk();Object.defineProperty(P,"FoldingRangeRequest",{enumerable:!0,get:function(){return lw.FoldingRangeRequest}});Object.defineProperty(P,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return lw.FoldingRangeRefreshRequest}});var Uj=Uk();Object.defineProperty(P,"DeclarationRequest",{enumerable:!0,get:function(){return Uj.DeclarationRequest}});var Hj=Wk();Object.defineProperty(P,"SelectionRangeRequest",{enumerable:!0,get:function(){return Hj.SelectionRangeRequest}});var jy=Kk();Object.defineProperty(P,"WorkDoneProgress",{enumerable:!0,get:function(){return jy.WorkDoneProgress}});Object.defineProperty(P,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return jy.WorkDoneProgressCreateRequest}});Object.defineProperty(P,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return jy.WorkDoneProgressCancelNotification}});var Uy=Zk();Object.defineProperty(P,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return Uy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(P,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return Uy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(P,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return Uy.CallHierarchyPrepareRequest}});var oa=sN();Object.defineProperty(P,"TokenFormat",{enumerable:!0,get:function(){return oa.TokenFormat}});Object.defineProperty(P,"SemanticTokensRequest",{enumerable:!0,get:function(){return oa.SemanticTokensRequest}});Object.defineProperty(P,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return oa.SemanticTokensDeltaRequest}});Object.defineProperty(P,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return oa.SemanticTokensRangeRequest}});Object.defineProperty(P,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return oa.SemanticTokensRefreshRequest}});Object.defineProperty(P,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return oa.SemanticTokensRegistrationType}});var Vj=cN();Object.defineProperty(P,"ShowDocumentRequest",{enumerable:!0,get:function(){return Vj.ShowDocumentRequest}});var Wj=dN();Object.defineProperty(P,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return Wj.LinkedEditingRangeRequest}});var ro=vN();Object.defineProperty(P,"FileOperationPatternKind",{enumerable:!0,get:function(){return ro.FileOperationPatternKind}});Object.defineProperty(P,"DidCreateFilesNotification",{enumerable:!0,get:function(){return ro.DidCreateFilesNotification}});Object.defineProperty(P,"WillCreateFilesRequest",{enumerable:!0,get:function(){return ro.WillCreateFilesRequest}});Object.defineProperty(P,"DidRenameFilesNotification",{enumerable:!0,get:function(){return ro.DidRenameFilesNotification}});Object.defineProperty(P,"WillRenameFilesRequest",{enumerable:!0,get:function(){return ro.WillRenameFilesRequest}});Object.defineProperty(P,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return ro.DidDeleteFilesNotification}});Object.defineProperty(P,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return ro.WillDeleteFilesRequest}});var Hy=kN();Object.defineProperty(P,"UniquenessLevel",{enumerable:!0,get:function(){return Hy.UniquenessLevel}});Object.defineProperty(P,"MonikerKind",{enumerable:!0,get:function(){return Hy.MonikerKind}});Object.defineProperty(P,"MonikerRequest",{enumerable:!0,get:function(){return Hy.MonikerRequest}});var Vy=EN();Object.defineProperty(P,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return Vy.TypeHierarchyPrepareRequest}});Object.defineProperty(P,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return Vy.TypeHierarchySubtypesRequest}});Object.defineProperty(P,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return Vy.TypeHierarchySupertypesRequest}});var uw=AN();Object.defineProperty(P,"InlineValueRequest",{enumerable:!0,get:function(){return uw.InlineValueRequest}});Object.defineProperty(P,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return uw.InlineValueRefreshRequest}});var Wy=xN();Object.defineProperty(P,"InlayHintRequest",{enumerable:!0,get:function(){return Wy.InlayHintRequest}});Object.defineProperty(P,"InlayHintResolveRequest",{enumerable:!0,get:function(){return Wy.InlayHintResolveRequest}});Object.defineProperty(P,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return Wy.InlayHintRefreshRequest}});var Lc=UN();Object.defineProperty(P,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return Lc.DiagnosticServerCancellationData}});Object.defineProperty(P,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return Lc.DocumentDiagnosticReportKind}});Object.defineProperty(P,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return Lc.DocumentDiagnosticRequest}});Object.defineProperty(P,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return Lc.WorkspaceDiagnosticRequest}});Object.defineProperty(P,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return Lc.DiagnosticRefreshRequest}});var yi=KN();Object.defineProperty(P,"NotebookCellKind",{enumerable:!0,get:function(){return yi.NotebookCellKind}});Object.defineProperty(P,"ExecutionSummary",{enumerable:!0,get:function(){return yi.ExecutionSummary}});Object.defineProperty(P,"NotebookCell",{enumerable:!0,get:function(){return yi.NotebookCell}});Object.defineProperty(P,"NotebookDocument",{enumerable:!0,get:function(){return yi.NotebookDocument}});Object.defineProperty(P,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return yi.NotebookDocumentSyncRegistrationType}});Object.defineProperty(P,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return yi.DidOpenNotebookDocumentNotification}});Object.defineProperty(P,"NotebookCellArrayChange",{enumerable:!0,get:function(){return yi.NotebookCellArrayChange}});Object.defineProperty(P,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return yi.DidChangeNotebookDocumentNotification}});Object.defineProperty(P,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return yi.DidSaveNotebookDocumentNotification}});Object.defineProperty(P,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return yi.DidCloseNotebookDocumentNotification}});var zj=QN();Object.defineProperty(P,"InlineCompletionRequest",{enumerable:!0,get:function(){return zj.InlineCompletionRequest}});var qy;(function(t){function e(n){let r=n;return nn.string(r)||nn.string(r.language)||nn.string(r.scheme)||nn.string(r.pattern)}t.is=e})(qy||(P.TextDocumentFilter=qy={}));var $y;(function(t){function e(n){let r=n;return nn.objectLiteral(r)&&(nn.string(r.notebookType)||nn.string(r.scheme)||nn.string(r.pattern))}t.is=e})($y||(P.NotebookDocumentFilter=$y={}));var Fy;(function(t){function e(n){let r=n;return nn.objectLiteral(r)&&(nn.string(r.notebook)||$y.is(r.notebook))&&(r.language===void 0||nn.string(r.language))}t.is=e})(Fy||(P.NotebookCellTextDocumentFilter=Fy={}));var By;(function(t){function e(n){if(!Array.isArray(n))return!1;for(let r of n)if(!nn.string(r)&&!qy.is(r)&&!Fy.is(r))return!1;return!0}t.is=e})(By||(P.DocumentSelector=By={}));var eR;(function(t){t.method="client/registerCapability",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(eR||(P.RegistrationRequest=eR={}));var tR;(function(t){t.method="client/unregisterCapability",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(tR||(P.UnregistrationRequest=tR={}));var nR;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(nR||(P.ResourceOperationKind=nR={}));var rR;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(rR||(P.FailureHandlingKind=rR={}));var iR;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(iR||(P.PositionEncodingKind=iR={}));var sR;(function(t){function e(n){let r=n;return r&&nn.string(r.id)&&r.id.length>0}t.hasId=e})(sR||(P.StaticRegistrationOptions=sR={}));var oR;(function(t){function e(n){let r=n;return r&&(r.documentSelector===null||By.is(r.documentSelector))}t.is=e})(oR||(P.TextDocumentRegistrationOptions=oR={}));var aR;(function(t){function e(r){let i=r;return nn.objectLiteral(i)&&(i.workDoneProgress===void 0||nn.boolean(i.workDoneProgress))}t.is=e;function n(r){let i=r;return i&&nn.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=n})(aR||(P.WorkDoneProgressOptions=aR={}));var cR;(function(t){t.method="initialize",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(cR||(P.InitializeRequest=cR={}));var lR;(function(t){t.unknownProtocolVersion=1})(lR||(P.InitializeErrorCodes=lR={}));var uR;(function(t){t.method="initialized",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(uR||(P.InitializedNotification=uR={}));var dR;(function(t){t.method="shutdown",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType0(t.method)})(dR||(P.ShutdownRequest=dR={}));var fR;(function(t){t.method="exit",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType0(t.method)})(fR||(P.ExitNotification=fR={}));var pR;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(pR||(P.DidChangeConfigurationNotification=pR={}));var hR;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(hR||(P.MessageType=hR={}));var mR;(function(t){t.method="window/showMessage",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(mR||(P.ShowMessageNotification=mR={}));var gR;(function(t){t.method="window/showMessageRequest",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(gR||(P.ShowMessageRequest=gR={}));var yR;(function(t){t.method="window/logMessage",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(yR||(P.LogMessageNotification=yR={}));var TR;(function(t){t.method="telemetry/event",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(TR||(P.TelemetryEventNotification=TR={}));var vR;(function(t){t.None=0,t.Full=1,t.Incremental=2})(vR||(P.TextDocumentSyncKind=vR={}));var bR;(function(t){t.method="textDocument/didOpen",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(bR||(P.DidOpenTextDocumentNotification=bR={}));var SR;(function(t){function e(r){let i=r;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}t.isIncremental=e;function n(r){let i=r;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}t.isFull=n})(SR||(P.TextDocumentContentChangeEvent=SR={}));var _R;(function(t){t.method="textDocument/didChange",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(_R||(P.DidChangeTextDocumentNotification=_R={}));var PR;(function(t){t.method="textDocument/didClose",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(PR||(P.DidCloseTextDocumentNotification=PR={}));var kR;(function(t){t.method="textDocument/didSave",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(kR||(P.DidSaveTextDocumentNotification=kR={}));var NR;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(NR||(P.TextDocumentSaveReason=NR={}));var RR;(function(t){t.method="textDocument/willSave",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(RR||(P.WillSaveTextDocumentNotification=RR={}));var wR;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(wR||(P.WillSaveTextDocumentWaitUntilRequest=wR={}));var ER;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(ER||(P.DidChangeWatchedFilesNotification=ER={}));var CR;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(CR||(P.FileChangeType=CR={}));var DR;(function(t){function e(n){let r=n;return nn.objectLiteral(r)&&(ZN.URI.is(r.baseUri)||ZN.WorkspaceFolder.is(r.baseUri))&&nn.string(r.pattern)}t.is=e})(DR||(P.RelativePattern=DR={}));var AR;(function(t){t.Create=1,t.Change=2,t.Delete=4})(AR||(P.WatchKind=AR={}));var IR;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(IR||(P.PublishDiagnosticsNotification=IR={}));var OR;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(OR||(P.CompletionTriggerKind=OR={}));var MR;(function(t){t.method="textDocument/completion",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(MR||(P.CompletionRequest=MR={}));var xR;(function(t){t.method="completionItem/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(xR||(P.CompletionResolveRequest=xR={}));var LR;(function(t){t.method="textDocument/hover",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(LR||(P.HoverRequest=LR={}));var qR;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(qR||(P.SignatureHelpTriggerKind=qR={}));var $R;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})($R||(P.SignatureHelpRequest=$R={}));var FR;(function(t){t.method="textDocument/definition",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(FR||(P.DefinitionRequest=FR={}));var BR;(function(t){t.method="textDocument/references",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(BR||(P.ReferencesRequest=BR={}));var jR;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(jR||(P.DocumentHighlightRequest=jR={}));var UR;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(UR||(P.DocumentSymbolRequest=UR={}));var HR;(function(t){t.method="textDocument/codeAction",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(HR||(P.CodeActionRequest=HR={}));var VR;(function(t){t.method="codeAction/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(VR||(P.CodeActionResolveRequest=VR={}));var WR;(function(t){t.method="workspace/symbol",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(WR||(P.WorkspaceSymbolRequest=WR={}));var zR;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(zR||(P.WorkspaceSymbolResolveRequest=zR={}));var GR;(function(t){t.method="textDocument/codeLens",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(GR||(P.CodeLensRequest=GR={}));var YR;(function(t){t.method="codeLens/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(YR||(P.CodeLensResolveRequest=YR={}));var KR;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType0(t.method)})(KR||(P.CodeLensRefreshRequest=KR={}));var XR;(function(t){t.method="textDocument/documentLink",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(XR||(P.DocumentLinkRequest=XR={}));var JR;(function(t){t.method="documentLink/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(JR||(P.DocumentLinkResolveRequest=JR={}));var QR;(function(t){t.method="textDocument/formatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(QR||(P.DocumentFormattingRequest=QR={}));var ZR;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(ZR||(P.DocumentRangeFormattingRequest=ZR={}));var ew;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(ew||(P.DocumentRangesFormattingRequest=ew={}));var tw;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(tw||(P.DocumentOnTypeFormattingRequest=tw={}));var nw;(function(t){t.Identifier=1})(nw||(P.PrepareSupportDefaultBehavior=nw={}));var rw;(function(t){t.method="textDocument/rename",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(rw||(P.RenameRequest=rw={}));var iw;(function(t){t.method="textDocument/prepareRename",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(iw||(P.PrepareRenameRequest=iw={}));var sw;(function(t){t.method="workspace/executeCommand",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(sw||(P.ExecuteCommandRequest=sw={}));var ow;(function(t){t.method="workspace/applyEdit",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType("workspace/applyEdit")})(ow||(P.ApplyWorkspaceEditRequest=ow={}))});var pw=N(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.createProtocolConnection=void 0;var fw=no();function Gj(t,e,n,r){return fw.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,fw.createMessageConnection)(t,e,n,r)}sf.createProtocolConnection=Gj});var mw=N(Gn=>{"use strict";var Yj=Gn&&Gn.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),of=Gn&&Gn.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Yj(e,t,n)};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.LSPErrorCodes=Gn.createProtocolConnection=void 0;of(no(),Gn);of(Ud(),Gn);of(Nt(),Gn);of(dw(),Gn);var Kj=pw();Object.defineProperty(Gn,"createProtocolConnection",{enumerable:!0,get:function(){return Kj.createProtocolConnection}});var hw;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(hw||(Gn.LSPErrorCodes=hw={}))});var $t=N(Ti=>{"use strict";var Xj=Ti&&Ti.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),gw=Ti&&Ti.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Xj(e,t,n)};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.createProtocolConnection=void 0;var Jj=Cy();gw(Cy(),Ti);gw(mw(),Ti);function Qj(t,e,n,r){return(0,Jj.createMessageConnection)(t,e,n,r)}Ti.createProtocolConnection=Qj});var zy=N(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.generateUuid=_r.parse=_r.isUUID=_r.v4=_r.empty=void 0;var qc=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},$c=class t extends qc{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(""))}};$c._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];$c._timeHighBits=["8","9","a","b"];_r.empty=new qc("00000000-0000-0000-0000-000000000000");function yw(){return new $c}_r.v4=yw;var Zj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Tw(t){return Zj.test(t)}_r.isUUID=Tw;function eU(t){if(!Tw(t))throw new Error("invalid uuid");return new qc(t)}_r.parse=eU;function tU(){return yw().asHex()}_r.generateUuid=tU});var vw=N(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.attachPartialResult=hs.ProgressFeature=hs.attachWorkDone=void 0;var ps=$t(),nU=zy(),io=class t{constructor(e,n){this._connection=e,this._token=n,t.Instances.set(this._token,this)}begin(e,n,r,i){let s={kind:"begin",title:e,percentage:n,message:r,cancellable:i};this._connection.sendProgress(ps.WorkDoneProgress.type,this._token,s)}report(e,n){let r={kind:"report"};typeof e=="number"?(r.percentage=e,n!==void 0&&(r.message=n)):r.message=e,this._connection.sendProgress(ps.WorkDoneProgress.type,this._token,r)}done(){t.Instances.delete(this._token),this._connection.sendProgress(ps.WorkDoneProgress.type,this._token,{kind:"end"})}};io.Instances=new Map;var af=class extends io{constructor(e,n){super(e,n),this._source=new ps.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Fc=class{constructor(){}begin(){}report(){}done(){}},cf=class extends Fc{constructor(){super(),this._source=new ps.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function rU(t,e){if(e===void 0||e.workDoneToken===void 0)return new Fc;let n=e.workDoneToken;return delete e.workDoneToken,new io(t,n)}hs.attachWorkDone=rU;var iU=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(ps.WorkDoneProgressCancelNotification.type,n=>{let r=io.Instances.get(n.token);(r instanceof af||r instanceof cf)&&r.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Fc:new io(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,nU.generateUuid)();return this.connection.sendRequest(ps.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new af(this.connection,e))}else return Promise.resolve(new cf)}};hs.ProgressFeature=iU;var Gy;(function(t){t.type=new ps.ProgressType})(Gy||(Gy={}));var Yy=class{constructor(e,n){this._connection=e,this._token=n}report(e){this._connection.sendProgress(Gy.type,this._token,e)}};function sU(t,e){if(e===void 0||e.partialResultToken===void 0)return;let n=e.partialResultToken;return delete e.partialResultToken,new Yy(t,n)}hs.attachPartialResult=sU});var bw=N(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.ConfigurationFeature=void 0;var oU=$t(),aU=vd(),cU=t=>class extends t{getConfiguration(e){return e?aU.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let n={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(oU.ConfigurationRequest.type,n).then(r=>Array.isArray(r)?Array.isArray(e)?r:r[0]:Array.isArray(e)?[]:null)}};lf.ConfigurationFeature=cU});var Sw=N(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});df.WorkspaceFoldersFeature=void 0;var uf=$t(),lU=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let n=e.workspace;n&&n.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new uf.Emitter,this.connection.onNotification(uf.DidChangeWorkspaceFoldersNotification.type,r=>{this._onDidChangeWorkspaceFolders.fire(r.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let n=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=n===!0||typeof n=="string"}getWorkspaceFolders(){return this.connection.sendRequest(uf.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(uf.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};df.WorkspaceFoldersFeature=lU});var _w=N(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});ff.CallHierarchyFeature=void 0;var Ky=$t(),uU=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(Ky.CallHierarchyPrepareRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0)),onIncomingCalls:e=>{let n=Ky.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onOutgoingCalls:e=>{let n=Ky.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};ff.CallHierarchyFeature=uU});var Jy=N(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.SemanticTokensBuilder=ms.SemanticTokensDiff=ms.SemanticTokensFeature=void 0;var pf=$t(),dU=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(pf.SemanticTokensRefreshRequest.type),on:e=>{let n=pf.SemanticTokensRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onDelta:e=>{let n=pf.SemanticTokensDeltaRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onRange:e=>{let n=pf.SemanticTokensRangeRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};ms.SemanticTokensFeature=dU;var hf=class{constructor(e,n){this.originalSequence=e,this.modifiedSequence=n}computeDiff(){let e=this.originalSequence.length,n=this.modifiedSequence.length,r=0;for(;r<n&&r<e&&this.originalSequence[r]===this.modifiedSequence[r];)r++;if(r<n&&r<e){let i=e-1,s=n-1;for(;i>=r&&s>=r&&this.originalSequence[i]===this.modifiedSequence[s];)i--,s--;(i<r||s<r)&&(i++,s++);let o=i-r+1,a=this.modifiedSequence.slice(r,s+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:r,deleteCount:o-1}]:[{start:r,deleteCount:o,data:a}]}else return r<n?[{start:r,deleteCount:0,data:this.modifiedSequence.slice(r)}]:r<e?[{start:r,deleteCount:e-r}]:[]}};ms.SemanticTokensDiff=hf;var Xy=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,n,r,i,s){let o=e,a=n;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++]=r,this._data[this._dataLen++]=i,this._data[this._dataLen++]=s,this._prevLine=e,this._prevChar=n}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 hf(this._prevData,this._data).computeDiff()}:this.build()}};ms.SemanticTokensBuilder=Xy});var Pw=N(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});mf.ShowDocumentFeature=void 0;var fU=$t(),pU=t=>class extends t{showDocument(e){return this.connection.sendRequest(fU.ShowDocumentRequest.type,e)}};mf.ShowDocumentFeature=pU});var kw=N(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.FileOperationsFeature=void 0;var aa=$t(),hU=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(aa.DidCreateFilesNotification.type,n=>{e(n)})}onDidRenameFiles(e){return this.connection.onNotification(aa.DidRenameFilesNotification.type,n=>{e(n)})}onDidDeleteFiles(e){return this.connection.onNotification(aa.DidDeleteFilesNotification.type,n=>{e(n)})}onWillCreateFiles(e){return this.connection.onRequest(aa.WillCreateFilesRequest.type,(n,r)=>e(n,r))}onWillRenameFiles(e){return this.connection.onRequest(aa.WillRenameFilesRequest.type,(n,r)=>e(n,r))}onWillDeleteFiles(e){return this.connection.onRequest(aa.WillDeleteFilesRequest.type,(n,r)=>e(n,r))}};gf.FileOperationsFeature=hU});var Nw=N(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});yf.LinkedEditingRangeFeature=void 0;var mU=$t(),gU=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(mU.LinkedEditingRangeRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0))}};yf.LinkedEditingRangeFeature=gU});var Rw=N(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.TypeHierarchyFeature=void 0;var Qy=$t(),yU=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(Qy.TypeHierarchyPrepareRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0)),onSupertypes:e=>{let n=Qy.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onSubtypes:e=>{let n=Qy.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Tf.TypeHierarchyFeature=yU});var Ew=N(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.InlineValueFeature=void 0;var ww=$t(),TU=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(ww.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(ww.InlineValueRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n)))}}};vf.InlineValueFeature=TU});var Dw=N(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.FoldingRangeFeature=void 0;var Cw=$t(),vU=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(Cw.FoldingRangeRefreshRequest.type),on:e=>{let n=Cw.FoldingRangeRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};bf.FoldingRangeFeature=vU});var Aw=N(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.InlayHintFeature=void 0;var Zy=$t(),bU=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Zy.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Zy.InlayHintRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n))),resolve:e=>this.connection.onRequest(Zy.InlayHintResolveRequest.type,(n,r)=>e(n,r))}}};Sf.InlayHintFeature=bU});var Iw=N(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.DiagnosticFeature=void 0;var Bc=$t(),SU=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Bc.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Bc.DocumentDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(Bc.DocumentDiagnosticRequest.partialResult,n))),onWorkspace:e=>this.connection.onRequest(Bc.WorkspaceDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(Bc.WorkspaceDiagnosticRequest.partialResult,n)))}}};_f.DiagnosticFeature=SU});var tT=N(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.TextDocuments=void 0;var so=$t(),eT=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new so.Emitter,this._onDidOpen=new so.Emitter,this._onDidClose=new so.Emitter,this._onDidSave=new so.Emitter,this._onWillSave=new so.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=so.TextDocumentSyncKind.Incremental;let n=[];return n.push(e.onDidOpenTextDocument(r=>{let i=r.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)})),n.push(e.onDidChangeTextDocument(r=>{let i=r.textDocument,s=r.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})))})),n.push(e.onDidCloseTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(r.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),n.push(e.onWillSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:r.reason}))})),n.push(e.onWillSaveTextDocumentWaitUntil((r,i)=>{let s=this._syncedDocuments.get(r.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:r.reason}),i):[]})),n.push(e.onDidSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),so.Disposable.create(()=>{n.forEach(r=>r.dispose())})}};Pf.TextDocuments=eT});var rT=N(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.NotebookDocuments=ca.NotebookSyncFeature=void 0;var Pr=$t(),Ow=tT(),_U=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(Pr.DidOpenNotebookDocumentNotification.type,n=>{e(n)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(Pr.DidChangeNotebookDocumentNotification.type,n=>{e(n)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(Pr.DidSaveNotebookDocumentNotification.type,n=>{e(n)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(Pr.DidCloseNotebookDocumentNotification.type,n=>{e(n)})}}};ca.NotebookSyncFeature=_U;var kf=class t{onDidOpenTextDocument(e){return this.openHandler=e,Pr.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,Pr.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,Pr.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}};kf.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var nT=class{constructor(e){e instanceof Ow.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new Ow.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Pr.Emitter,this._onDidChange=new Pr.Emitter,this._onDidSave=new Pr.Emitter,this._onDidClose=new Pr.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let n=this.notebookCellMap.get(e);return n&&n[0]}findNotebookDocumentForCell(e){let n=typeof e=="string"?e:e.document,r=this.notebookCellMap.get(n);return r&&r[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 n=new kf,r=[];return r.push(this.cellTextDocuments.listen(n)),r.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let s of i.cellTextDocuments)n.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),r.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 S=c.cells;if(S.structure!==void 0){let b=S.structure.array;if(s.cells.splice(b.start,b.deleteCount,...b.cells!==void 0?b.cells:[]),S.structure.didOpen!==void 0)for(let v of S.structure.didOpen)n.openTextDocument({textDocument:v}),l.push(v.uri);if(S.structure.didClose)for(let v of S.structure.didClose)n.closeTextDocument({textDocument:v}),u.push(v.uri)}if(S.data!==void 0){let b=new Map(S.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 R=s.cells.splice(v,1,k);if(d.push({old:R[0],new:k}),b.delete(k.document),b.size===0)break}}}if(S.textContent!==void 0)for(let b of S.textContent)n.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 S of l)m.push(this.getNotebookCell(S));let h=[];for(let S of u)h.push(this.getNotebookCell(S));let y=[];for(let S of f)y.push(this.getNotebookCell(S));(m.length>0||h.length>0||d.length>0||y.length>0)&&(p.cells={added:m,removed:h,changed:{data:d,textContent:y}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),r.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),r.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)n.closeTextDocument({textDocument:o});this.notebookDocuments.delete(i.notebookDocument.uri);for(let o of s.cells)this.notebookCellMap.delete(o.document)}})),Pr.Disposable.create(()=>{r.forEach(i=>i.dispose())})}updateCellMap(e){for(let n of e.cells)this.notebookCellMap.set(n.document,[n,e])}};ca.NotebookDocuments=nT});var Mw=N(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.MonikerFeature=void 0;var PU=$t(),kU=t=>class extends t{get moniker(){return{on:e=>{let n=PU.MonikerRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Nf.MonikerFeature=kU});var lT=N(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.createConnection=Ye.combineFeatures=Ye.combineNotebooksFeatures=Ye.combineLanguagesFeatures=Ye.combineWorkspaceFeatures=Ye.combineWindowFeatures=Ye.combineClientFeatures=Ye.combineTracerFeatures=Ye.combineTelemetryFeatures=Ye.combineConsoleFeatures=Ye._NotebooksImpl=Ye._LanguagesImpl=Ye.BulkUnregistration=Ye.BulkRegistration=Ye.ErrorMessageTracker=void 0;var K=$t(),kr=vd(),sT=zy(),ye=vw(),NU=bw(),RU=Sw(),wU=_w(),EU=Jy(),CU=Pw(),DU=kw(),AU=Nw(),IU=Rw(),OU=Ew(),MU=Dw(),xU=Aw(),LU=Iw(),qU=rT(),$U=Mw();function iT(t){if(t!==null)return t}var oT=class{constructor(){this._messages=Object.create(null)}add(e){let n=this._messages[e];n||(n=0),n++,this._messages[e]=n}sendErrors(e){Object.keys(this._messages).forEach(n=>{e.window.showErrorMessage(n)})}};Ye.ErrorMessageTracker=oT;var Rf=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,n){this._rawConnection&&this._rawConnection.sendNotification(K.LogMessageNotification.type,{type:e,message:n}).catch(()=>{(0,K.RAL)().console.error("Sending log message failed")})}},aT=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,...n){let r={type:K.MessageType.Error,message:e,actions:n};return this.connection.sendRequest(K.ShowMessageRequest.type,r).then(iT)}showWarningMessage(e,...n){let r={type:K.MessageType.Warning,message:e,actions:n};return this.connection.sendRequest(K.ShowMessageRequest.type,r).then(iT)}showInformationMessage(e,...n){let r={type:K.MessageType.Info,message:e,actions:n};return this.connection.sendRequest(K.ShowMessageRequest.type,r).then(iT)}},xw=(0,CU.ShowDocumentFeature)((0,ye.ProgressFeature)(aT)),Lw;(function(t){function e(){return new wf}t.create=e})(Lw||(Ye.BulkRegistration=Lw={}));var wf=class{constructor(){this._registrations=[],this._registered=new Set}add(e,n){let r=kr.string(e)?e:e.method;if(this._registered.has(r))throw new Error(`${r} is already added to this registration`);let i=sT.generateUuid();this._registrations.push({id:i,method:r,registerOptions:n||{}}),this._registered.add(r)}asRegistrationParams(){return{registrations:this._registrations}}},qw;(function(t){function e(){return new jc(void 0,[])}t.create=e})(qw||(Ye.BulkUnregistration=qw={}));var jc=class{constructor(e,n){this._connection=e,this._unregistrations=new Map,n.forEach(r=>{this._unregistrations.set(r.method,r)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let r of this._unregistrations.values())e.push(r);let n={unregisterations:e};this._connection.sendRequest(K.UnregistrationRequest.type,n).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let n=kr.string(e)?e:e.method,r=this._unregistrations.get(n);if(!r)return!1;let i={unregisterations:[r]};return this._connection.sendRequest(K.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(n)},s=>{this._connection.console.info(`Un-registering request handler for ${r.id} failed.`)}),!0}},Ef=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,n,r){return e instanceof wf?this.registerMany(e):e instanceof jc?this.registerSingle1(e,n,r):this.registerSingle2(e,n)}registerSingle1(e,n,r){let i=kr.string(n)?n:n.method,s=sT.generateUuid(),o={registrations:[{id:s,method:i,registerOptions:r||{}}]};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,n){let r=kr.string(e)?e:e.method,i=sT.generateUuid(),s={registrations:[{id:i,method:r,registerOptions:n||{}}]};return this.connection.sendRequest(K.RegistrationRequest.type,s).then(o=>K.Disposable.create(()=>{this.unregisterSingle(i,r).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),o=>(this.connection.console.info(`Registering request handler for ${r} failed.`),Promise.reject(o)))}unregisterSingle(e,n){let r={unregisterations:[{id:e,method:n}]};return this.connection.sendRequest(K.UnregistrationRequest.type,r).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let n=e.asRegistrationParams();return this.connection.sendRequest(K.RegistrationRequest.type,n).then(()=>new jc(this._connection,n.registrations.map(r=>({id:r.id,method:r.method}))),r=>(this.connection.console.info("Bulk registration failed."),Promise.reject(r)))}},cT=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 n(i){return i&&!!i.edit}let r=n(e)?e:{edit:e};return this.connection.sendRequest(K.ApplyWorkspaceEditRequest.type,r)}},$w=(0,DU.FileOperationsFeature)((0,RU.WorkspaceFoldersFeature)((0,NU.ConfigurationFeature)(cT))),Cf=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,n){this._trace!==K.Trace.Off&&this.connection.sendNotification(K.LogTraceNotification.type,{message:e,verbose:this._trace===K.Trace.Verbose?n:void 0}).catch(()=>{})}},Df=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")})}},Af=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,ye.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,n){return(0,ye.attachPartialResult)(this.connection,n)}};Ye._LanguagesImpl=Af;var Fw=(0,MU.FoldingRangeFeature)((0,$U.MonikerFeature)((0,LU.DiagnosticFeature)((0,xU.InlayHintFeature)((0,OU.InlineValueFeature)((0,IU.TypeHierarchyFeature)((0,AU.LinkedEditingRangeFeature)((0,EU.SemanticTokensFeature)((0,wU.CallHierarchyFeature)(Af))))))))),If=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,ye.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,n){return(0,ye.attachPartialResult)(this.connection,n)}};Ye._NotebooksImpl=If;var Bw=(0,qU.NotebookSyncFeature)(If);function jw(t,e){return function(n){return e(t(n))}}Ye.combineConsoleFeatures=jw;function Uw(t,e){return function(n){return e(t(n))}}Ye.combineTelemetryFeatures=Uw;function Hw(t,e){return function(n){return e(t(n))}}Ye.combineTracerFeatures=Hw;function Vw(t,e){return function(n){return e(t(n))}}Ye.combineClientFeatures=Vw;function Ww(t,e){return function(n){return e(t(n))}}Ye.combineWindowFeatures=Ww;function zw(t,e){return function(n){return e(t(n))}}Ye.combineWorkspaceFeatures=zw;function Gw(t,e){return function(n){return e(t(n))}}Ye.combineLanguagesFeatures=Gw;function Yw(t,e){return function(n){return e(t(n))}}Ye.combineNotebooksFeatures=Yw;function FU(t,e){function n(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:n(t.console,e.console,jw),tracer:n(t.tracer,e.tracer,Hw),telemetry:n(t.telemetry,e.telemetry,Uw),client:n(t.client,e.client,Vw),window:n(t.window,e.window,Ww),workspace:n(t.workspace,e.workspace,zw),languages:n(t.languages,e.languages,Gw),notebooks:n(t.notebooks,e.notebooks,Yw)}}Ye.combineFeatures=FU;function BU(t,e,n){let r=n&&n.console?new(n.console(Rf)):new Rf,i=t(r);r.rawAttach(i);let s=n&&n.tracer?new(n.tracer(Cf)):new Cf,o=n&&n.telemetry?new(n.telemetry(Df)):new Df,a=n&&n.client?new(n.client(Ef)):new Ef,c=n&&n.window?new(n.window(xw)):new xw,l=n&&n.workspace?new(n.workspace($w)):new $w,u=n&&n.languages?new(n.languages(Fw)):new Fw,d=n&&n.notebooks?new(n.notebooks(Bw)):new Bw,f=[r,s,o,a,c,l,u,d];function p(b){return b instanceof Promise?b:kr.thenable(b)?new Promise((v,k)=>{b.then(R=>v(R),R=>k(R))}):Promise.resolve(b)}let m,h,y,S={listen:()=>i.listen(),sendRequest:(b,...v)=>i.sendRequest(kr.string(b)?b:b.method,...v),onRequest:(b,v)=>i.onRequest(b,v),sendNotification:(b,v)=>{let k=kr.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=>(y=b,{dispose:()=>{y=void 0}}),get console(){return r},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,ye.attachWorkDone)(i,v),void 0)),onCompletion:b=>i.onRequest(K.CompletionRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onCompletionResolve:b=>i.onRequest(K.CompletionResolveRequest.type,b),onSignatureHelp:b=>i.onRequest(K.SignatureHelpRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),void 0)),onDeclaration:b=>i.onRequest(K.DeclarationRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onDefinition:b=>i.onRequest(K.DefinitionRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onTypeDefinition:b=>i.onRequest(K.TypeDefinitionRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onImplementation:b=>i.onRequest(K.ImplementationRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onReferences:b=>i.onRequest(K.ReferencesRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onDocumentHighlight:b=>i.onRequest(K.DocumentHighlightRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onDocumentSymbol:b=>i.onRequest(K.DocumentSymbolRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onWorkspaceSymbol:b=>i.onRequest(K.WorkspaceSymbolRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onWorkspaceSymbolResolve:b=>i.onRequest(K.WorkspaceSymbolResolveRequest.type,b),onCodeAction:b=>i.onRequest(K.CodeActionRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.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,ye.attachWorkDone)(i,v),(0,ye.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,ye.attachWorkDone)(i,v),void 0)),onDocumentRangeFormatting:b=>i.onRequest(K.DocumentRangeFormattingRequest.type,(v,k)=>b(v,k,(0,ye.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,ye.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,ye.attachWorkDone)(i,v),(0,ye.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,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onColorPresentation:b=>i.onRequest(K.ColorPresentationRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onFoldingRanges:b=>i.onRequest(K.FoldingRangeRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onSelectionRanges:b=>i.onRequest(K.SelectionRangeRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onExecuteCommand:b=>i.onRequest(K.ExecuteCommandRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),void 0)),dispose:()=>i.dispose()};for(let b of f)b.attach(S);return i.onRequest(K.InitializeRequest.type,b=>{e.initialize(b),kr.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,ye.attachWorkDone)(i,b),void 0);return p(v).then(k=>{if(k instanceof K.ResponseError)return k;let R=k;R||(R={capabilities:{}});let q=R.capabilities;q||(q={},R.capabilities=q),q.textDocumentSync===void 0||q.textDocumentSync===null?q.textDocumentSync=kr.number(S.__textDocumentSync)?S.__textDocumentSync:K.TextDocumentSyncKind.None:!kr.number(q.textDocumentSync)&&!kr.number(q.textDocumentSync.change)&&(q.textDocumentSync.change=kr.number(S.__textDocumentSync)?S.__textDocumentSync:K.TextDocumentSyncKind.None);for(let O of f)O.fillServerCapabilities(q);return R})}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{y&&y()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(K.SetTraceNotification.type,b=>{s.trace=K.Trace.fromString(b.value)}),S}Ye.createConnection=BU});var Kw=N(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.resolveModulePath=Yn.FileSystem=Yn.resolveGlobalYarnPath=Yn.resolveGlobalNodePath=Yn.resolve=Yn.uriToFilePath=void 0;var jU=require("url"),Yr=require("path"),uT=require("fs"),hT=require("child_process");function UU(t){let e=jU.parse(t);if(e.protocol!=="file:"||!e.path)return;let n=e.path.split("/");for(var r=0,i=n.length;r<i;r++)n[r]=decodeURIComponent(n[r]);if(process.platform==="win32"&&n.length>1){let s=n[0],o=n[1];s.length===0&&o.length>1&&o[1]===":"&&n.shift()}return Yr.normalize(n.join("/"))}Yn.uriToFilePath=UU;function dT(){return process.platform==="win32"}function Of(t,e,n,r){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&&uT.existsSync(e)&&(l[i]?l[i]=e+Yr.delimiter+l[i]:l[i]=e,r&&r(`NODE_PATH value is: ${l[i]}`)),l.ELECTRON_RUN_AS_NODE="1";try{let u=(0,hT.fork)("",[],{cwd:n,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)}})}Yn.resolve=Of;function fT(t){let e="npm",n=Object.create(null);Object.keys(process.env).forEach(s=>n[s]=process.env[s]),n.NO_UPDATE_NOTIFIER="true";let r={encoding:"utf8",env:n};dT()&&(e="npm.cmd",r.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,hT.spawnSync)(e,["config","get","prefix"],r).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?dT()?Yr.join(o,"node_modules"):Yr.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}Yn.resolveGlobalNodePath=fT;function HU(t){let e="yarn",n={encoding:"utf8"};dT()&&(e="yarn.cmd",n.shell=!0);let r=()=>{};try{process.on("SIGPIPE",r);let i=(0,hT.spawnSync)(e,["global","dir","--json"],n),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 Yr.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",r)}}Yn.resolveGlobalYarnPath=HU;var pT;(function(t){let e;function n(){return e!==void 0||(process.platform==="win32"?e=!1:e=!uT.existsSync(__filename.toUpperCase())||!uT.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=n;function r(i,s){return n()?Yr.normalize(s).indexOf(Yr.normalize(i))===0:Yr.normalize(s).toLowerCase().indexOf(Yr.normalize(i).toLowerCase())===0}t.isParent=r})(pT||(Yn.FileSystem=pT={}));function VU(t,e,n,r){return n?(Yr.isAbsolute(n)||(n=Yr.join(t,n)),Of(e,n,n,r).then(i=>pT.isParent(n,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>Of(e,fT(r),t,r))):Of(e,fT(r),t,r)}Yn.resolveModulePath=VU});var mT=N((DZ,Xw)=>{"use strict";Xw.exports=$t()});var Jw=N(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});Mf.InlineCompletionFeature=void 0;var WU=$t(),zU=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(WU.InlineCompletionRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n)))}}};Mf.InlineCompletionFeature=zU});var eE=N(Nn=>{"use strict";var GU=Nn&&Nn.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),Zw=Nn&&Nn.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&GU(e,t,n)};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.ProposedFeatures=Nn.NotebookDocuments=Nn.TextDocuments=Nn.SemanticTokensBuilder=void 0;var YU=Jy();Object.defineProperty(Nn,"SemanticTokensBuilder",{enumerable:!0,get:function(){return YU.SemanticTokensBuilder}});var KU=Jw();Zw($t(),Nn);var XU=tT();Object.defineProperty(Nn,"TextDocuments",{enumerable:!0,get:function(){return XU.TextDocuments}});var JU=rT();Object.defineProperty(Nn,"NotebookDocuments",{enumerable:!0,get:function(){return JU.NotebookDocuments}});Zw(lT(),Nn);var Qw;(function(t){t.all={__brand:"features",languages:KU.InlineCompletionFeature}})(Qw||(Nn.ProposedFeatures=Qw={}))});var U=N(Nr=>{"use strict";var QU=Nr&&Nr.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),iE=Nr&&Nr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&QU(e,t,n)};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.createConnection=Nr.Files=void 0;var tE=require("node:util"),gT=vd(),ZU=lT(),Uc=Kw(),oo=mT();iE(mT(),Nr);iE(eE(),Nr);var nE;(function(t){t.uriToFilePath=Uc.uriToFilePath,t.resolveGlobalNodePath=Uc.resolveGlobalNodePath,t.resolveGlobalYarnPath=Uc.resolveGlobalYarnPath,t.resolve=Uc.resolve,t.resolveModulePath=Uc.resolveModulePath})(nE||(Nr.Files=nE={}));var rE;function xf(){if(rE!==void 0)try{rE.end()}catch{}}var la=!1,sE;function eH(){let t="--clientProcessId";function e(n){try{let r=parseInt(n);isNaN(r)||(sE=setInterval(()=>{try{process.kill(r,0)}catch{xf(),process.exit(la?0:1)}},3e3))}catch{}}for(let n=2;n<process.argv.length;n++){let r=process.argv[n];if(r===t&&n+1<process.argv.length){e(process.argv[n+1]);return}else{let i=r.split("=");i[0]===t&&e(i[1])}}}eH();var tH={initialize:t=>{let e=t.processId;gT.number(e)&&sE===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(la?0:1)}},3e3)},get shutdownReceived(){return la},set shutdownReceived(t){la=t},exit:t=>{xf(),process.exit(t)}};function nH(t,e,n,r){let i,s,o,a;return t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=n,n=r),oo.ConnectionStrategy.is(t)||oo.ConnectionOptions.is(t)?a=t:(s=t,o=e,a=n),rH(s,o,a,i)}Nr.createConnection=nH;function rH(t,e,n,r){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 oo.IPCMessageReader(process),e=new oo.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,oo.createServerSocketTransport)(c);t=d[0],e=d[1]}else if(l){let d=(0,oo.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(gT.func(t.read)&&gT.func(t.on)){let c=t;c.on("end",()=>{xf(),process.exit(la?0:1)}),c.on("close",()=>{xf(),process.exit(la?0:1)})}let a=c=>{let l=(0,oo.createProtocolConnection)(t,e,c,n);return i&&iH(c),l};return(0,ZU.createConnection)(a,tH,r)}function iH(t){function e(r){return r.map(i=>typeof i=="string"?i:(0,tE.inspect)(i)).join(" ")}let n=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=n.get(s)??0;o+=1,n.set(s,o),t.log(`${s}: ${s}`)},console.countReset=function(i){i===void 0?n.clear():n.delete(String(i))},console.debug=function(...i){t.log(e(i))},console.dir=function(i,s){t.log((0,tE.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++}_&&C.length>0&&E.push(C.length),this._lineOffsets=E}return this._lineOffsets},T.prototype.positionAt=function(E){E=Math.max(Math.min(E,this._content.length),0);var C=this.getLineOffsets(),_=0,g=C.length;if(g===0)return o.create(0,E);for(;_<g;){var D=Math.floor((_+g)/2);C[D]>E?g=D:_=D+1}var j=_-1;return o.create(j,E-C[j])},T.prototype.offsetAt=function(E){var C=this.getLineOffsets();if(E.line>=C.length)return this._content.length;if(E.line<0)return 0;var _=C[E.line],g=E.line+1<C.length?C[E.line+1]:this._content.length;return Math.max(Math.min(_+E.character,g),_)},Object.defineProperty(T.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),T})(),A;(function(T){var E=Object.prototype.toString;function C(xe){return typeof xe<"u"}T.defined=C;function _(xe){return typeof xe>"u"}T.undefined=_;function g(xe){return xe===!0||xe===!1}T.boolean=g;function D(xe){return E.call(xe)==="[object String]"}T.string=D;function j(xe){return E.call(xe)==="[object Number]"}T.number=j;function Te(xe,jo,Td){return E.call(xe)==="[object Number]"&&jo<=xe&&xe<=Td}T.numberRange=Te;function Ot(xe){return E.call(xe)==="[object Number]"&&-2147483648<=xe&&xe<=2147483647}T.integer=Ot;function gt(xe){return E.call(xe)==="[object Number]"&&0<=xe&&xe<=2147483647}T.uinteger=gt;function Vr(xe){return E.call(xe)==="[object Function]"}T.func=Vr;function Wr(xe){return xe!==null&&typeof xe=="object"}T.objectLiteral=Wr;function Bi(xe,jo){return Array.isArray(xe)&&xe.every(jo)}T.typedArray=Bi})(A||(A={}))})});var Nt=N(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.ProtocolNotificationType=Wn.ProtocolNotificationType0=Wn.ProtocolRequestType=Wn.ProtocolRequestType0=Wn.RegistrationType=Wn.MessageDirection=void 0;var Xo=no(),vk;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(vk||(Wn.MessageDirection=vk={}));var Dy=class{constructor(e){this.method=e}};Wn.RegistrationType=Dy;var Ay=class extends Xo.RequestType0{constructor(e){super(e)}};Wn.ProtocolRequestType0=Ay;var Iy=class extends Xo.RequestType{constructor(e){super(e,Xo.ParameterStructures.byName)}};Wn.ProtocolRequestType=Iy;var Oy=class extends Xo.NotificationType0{constructor(e){super(e)}};Wn.ProtocolNotificationType0=Oy;var My=class extends Xo.NotificationType{constructor(e){super(e,Xo.ParameterStructures.byName)}};Wn.ProtocolNotificationType=My});var Hd=N(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.objectLiteral=Wt.typedArray=Wt.stringArray=Wt.array=Wt.func=Wt.error=Wt.number=Wt.string=Wt.boolean=void 0;function Dj(t){return t===!0||t===!1}Wt.boolean=Dj;function bk(t){return typeof t=="string"||t instanceof String}Wt.string=bk;function Aj(t){return typeof t=="number"||t instanceof Number}Wt.number=Aj;function Ij(t){return t instanceof Error}Wt.error=Ij;function Oj(t){return typeof t=="function"}Wt.func=Oj;function Sk(t){return Array.isArray(t)}Wt.array=Sk;function Mj(t){return Sk(t)&&t.every(e=>bk(e))}Wt.stringArray=Mj;function xj(t,e){return Array.isArray(t)&&t.every(e)}Wt.typedArray=xj;function Lj(t){return t!==null&&typeof t=="object"}Wt.objectLiteral=Lj});var kk=N(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.ImplementationRequest=void 0;var _k=Nt(),Pk;(function(t){t.method="textDocument/implementation",t.messageDirection=_k.MessageDirection.clientToServer,t.type=new _k.ProtocolRequestType(t.method)})(Pk||(Vd.ImplementationRequest=Pk={}))});var wk=N(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.TypeDefinitionRequest=void 0;var Nk=Nt(),Rk;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=Nk.MessageDirection.clientToServer,t.type=new Nk.ProtocolRequestType(t.method)})(Rk||(Wd.TypeDefinitionRequest=Rk={}))});var Dk=N(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.DidChangeWorkspaceFoldersNotification=Jo.WorkspaceFoldersRequest=void 0;var zd=Nt(),Ek;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=zd.MessageDirection.serverToClient,t.type=new zd.ProtocolRequestType0(t.method)})(Ek||(Jo.WorkspaceFoldersRequest=Ek={}));var Ck;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=zd.MessageDirection.clientToServer,t.type=new zd.ProtocolNotificationType(t.method)})(Ck||(Jo.DidChangeWorkspaceFoldersNotification=Ck={}))});var Ok=N(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.ConfigurationRequest=void 0;var Ak=Nt(),Ik;(function(t){t.method="workspace/configuration",t.messageDirection=Ak.MessageDirection.serverToClient,t.type=new Ak.ProtocolRequestType(t.method)})(Ik||(Gd.ConfigurationRequest=Ik={}))});var Lk=N(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.ColorPresentationRequest=Qo.DocumentColorRequest=void 0;var Yd=Nt(),Mk;(function(t){t.method="textDocument/documentColor",t.messageDirection=Yd.MessageDirection.clientToServer,t.type=new Yd.ProtocolRequestType(t.method)})(Mk||(Qo.DocumentColorRequest=Mk={}));var xk;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=Yd.MessageDirection.clientToServer,t.type=new Yd.ProtocolRequestType(t.method)})(xk||(Qo.ColorPresentationRequest=xk={}))});var Fk=N(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.FoldingRangeRefreshRequest=Zo.FoldingRangeRequest=void 0;var Kd=Nt(),qk;(function(t){t.method="textDocument/foldingRange",t.messageDirection=Kd.MessageDirection.clientToServer,t.type=new Kd.ProtocolRequestType(t.method)})(qk||(Zo.FoldingRangeRequest=qk={}));var $k;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=Kd.MessageDirection.serverToClient,t.type=new Kd.ProtocolRequestType0(t.method)})($k||(Zo.FoldingRangeRefreshRequest=$k={}))});var Uk=N(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.DeclarationRequest=void 0;var Bk=Nt(),jk;(function(t){t.method="textDocument/declaration",t.messageDirection=Bk.MessageDirection.clientToServer,t.type=new Bk.ProtocolRequestType(t.method)})(jk||(Xd.DeclarationRequest=jk={}))});var Wk=N(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.SelectionRangeRequest=void 0;var Hk=Nt(),Vk;(function(t){t.method="textDocument/selectionRange",t.messageDirection=Hk.MessageDirection.clientToServer,t.type=new Hk.ProtocolRequestType(t.method)})(Vk||(Jd.SelectionRangeRequest=Vk={}))});var Kk=N(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.WorkDoneProgressCancelNotification=cs.WorkDoneProgressCreateRequest=cs.WorkDoneProgress=void 0;var qj=no(),Qd=Nt(),zk;(function(t){t.type=new qj.ProgressType;function e(n){return n===t.type}t.is=e})(zk||(cs.WorkDoneProgress=zk={}));var Gk;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=Qd.MessageDirection.serverToClient,t.type=new Qd.ProtocolRequestType(t.method)})(Gk||(cs.WorkDoneProgressCreateRequest=Gk={}));var Yk;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=Qd.MessageDirection.clientToServer,t.type=new Qd.ProtocolNotificationType(t.method)})(Yk||(cs.WorkDoneProgressCancelNotification=Yk={}))});var Zk=N(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.CallHierarchyOutgoingCallsRequest=ls.CallHierarchyIncomingCallsRequest=ls.CallHierarchyPrepareRequest=void 0;var ea=Nt(),Xk;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=ea.MessageDirection.clientToServer,t.type=new ea.ProtocolRequestType(t.method)})(Xk||(ls.CallHierarchyPrepareRequest=Xk={}));var Jk;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=ea.MessageDirection.clientToServer,t.type=new ea.ProtocolRequestType(t.method)})(Jk||(ls.CallHierarchyIncomingCallsRequest=Jk={}));var Qk;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=ea.MessageDirection.clientToServer,t.type=new ea.ProtocolRequestType(t.method)})(Qk||(ls.CallHierarchyOutgoingCallsRequest=Qk={}))});var sN=N(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.SemanticTokensRefreshRequest=zn.SemanticTokensRangeRequest=zn.SemanticTokensDeltaRequest=zn.SemanticTokensRequest=zn.SemanticTokensRegistrationType=zn.TokenFormat=void 0;var Ui=Nt(),eN;(function(t){t.Relative="relative"})(eN||(zn.TokenFormat=eN={}));var Mc;(function(t){t.method="textDocument/semanticTokens",t.type=new Ui.RegistrationType(t.method)})(Mc||(zn.SemanticTokensRegistrationType=Mc={}));var tN;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=Ui.MessageDirection.clientToServer,t.type=new Ui.ProtocolRequestType(t.method),t.registrationMethod=Mc.method})(tN||(zn.SemanticTokensRequest=tN={}));var nN;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=Ui.MessageDirection.clientToServer,t.type=new Ui.ProtocolRequestType(t.method),t.registrationMethod=Mc.method})(nN||(zn.SemanticTokensDeltaRequest=nN={}));var rN;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=Ui.MessageDirection.clientToServer,t.type=new Ui.ProtocolRequestType(t.method),t.registrationMethod=Mc.method})(rN||(zn.SemanticTokensRangeRequest=rN={}));var iN;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=Ui.MessageDirection.serverToClient,t.type=new Ui.ProtocolRequestType0(t.method)})(iN||(zn.SemanticTokensRefreshRequest=iN={}))});var cN=N(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.ShowDocumentRequest=void 0;var oN=Nt(),aN;(function(t){t.method="window/showDocument",t.messageDirection=oN.MessageDirection.serverToClient,t.type=new oN.ProtocolRequestType(t.method)})(aN||(Zd.ShowDocumentRequest=aN={}))});var dN=N(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.LinkedEditingRangeRequest=void 0;var lN=Nt(),uN;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=lN.MessageDirection.clientToServer,t.type=new lN.ProtocolRequestType(t.method)})(uN||(ef.LinkedEditingRangeRequest=uN={}))});var vN=N(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.WillDeleteFilesRequest=kn.DidDeleteFilesNotification=kn.DidRenameFilesNotification=kn.WillRenameFilesRequest=kn.DidCreateFilesNotification=kn.WillCreateFilesRequest=kn.FileOperationPatternKind=void 0;var br=Nt(),fN;(function(t){t.file="file",t.folder="folder"})(fN||(kn.FileOperationPatternKind=fN={}));var pN;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolRequestType(t.method)})(pN||(kn.WillCreateFilesRequest=pN={}));var hN;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolNotificationType(t.method)})(hN||(kn.DidCreateFilesNotification=hN={}));var mN;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolRequestType(t.method)})(mN||(kn.WillRenameFilesRequest=mN={}));var gN;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolNotificationType(t.method)})(gN||(kn.DidRenameFilesNotification=gN={}));var yN;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolNotificationType(t.method)})(yN||(kn.DidDeleteFilesNotification=yN={}));var TN;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=br.MessageDirection.clientToServer,t.type=new br.ProtocolRequestType(t.method)})(TN||(kn.WillDeleteFilesRequest=TN={}))});var kN=N(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.MonikerRequest=us.MonikerKind=us.UniquenessLevel=void 0;var bN=Nt(),SN;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(SN||(us.UniquenessLevel=SN={}));var _N;(function(t){t.$import="import",t.$export="export",t.local="local"})(_N||(us.MonikerKind=_N={}));var PN;(function(t){t.method="textDocument/moniker",t.messageDirection=bN.MessageDirection.clientToServer,t.type=new bN.ProtocolRequestType(t.method)})(PN||(us.MonikerRequest=PN={}))});var EN=N(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.TypeHierarchySubtypesRequest=ds.TypeHierarchySupertypesRequest=ds.TypeHierarchyPrepareRequest=void 0;var ta=Nt(),NN;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=ta.MessageDirection.clientToServer,t.type=new ta.ProtocolRequestType(t.method)})(NN||(ds.TypeHierarchyPrepareRequest=NN={}));var RN;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=ta.MessageDirection.clientToServer,t.type=new ta.ProtocolRequestType(t.method)})(RN||(ds.TypeHierarchySupertypesRequest=RN={}));var wN;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=ta.MessageDirection.clientToServer,t.type=new ta.ProtocolRequestType(t.method)})(wN||(ds.TypeHierarchySubtypesRequest=wN={}))});var AN=N(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.InlineValueRefreshRequest=na.InlineValueRequest=void 0;var tf=Nt(),CN;(function(t){t.method="textDocument/inlineValue",t.messageDirection=tf.MessageDirection.clientToServer,t.type=new tf.ProtocolRequestType(t.method)})(CN||(na.InlineValueRequest=CN={}));var DN;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=tf.MessageDirection.serverToClient,t.type=new tf.ProtocolRequestType0(t.method)})(DN||(na.InlineValueRefreshRequest=DN={}))});var xN=N(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.InlayHintRefreshRequest=fs.InlayHintResolveRequest=fs.InlayHintRequest=void 0;var ra=Nt(),IN;(function(t){t.method="textDocument/inlayHint",t.messageDirection=ra.MessageDirection.clientToServer,t.type=new ra.ProtocolRequestType(t.method)})(IN||(fs.InlayHintRequest=IN={}));var ON;(function(t){t.method="inlayHint/resolve",t.messageDirection=ra.MessageDirection.clientToServer,t.type=new ra.ProtocolRequestType(t.method)})(ON||(fs.InlayHintResolveRequest=ON={}));var MN;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=ra.MessageDirection.serverToClient,t.type=new ra.ProtocolRequestType0(t.method)})(MN||(fs.InlayHintRefreshRequest=MN={}))});var UN=N(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.DiagnosticRefreshRequest=Sr.WorkspaceDiagnosticRequest=Sr.DocumentDiagnosticRequest=Sr.DocumentDiagnosticReportKind=Sr.DiagnosticServerCancellationData=void 0;var jN=no(),$j=Hd(),ia=Nt(),LN;(function(t){function e(n){let r=n;return r&&$j.boolean(r.retriggerRequest)}t.is=e})(LN||(Sr.DiagnosticServerCancellationData=LN={}));var qN;(function(t){t.Full="full",t.Unchanged="unchanged"})(qN||(Sr.DocumentDiagnosticReportKind=qN={}));var $N;(function(t){t.method="textDocument/diagnostic",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method),t.partialResult=new jN.ProgressType})($N||(Sr.DocumentDiagnosticRequest=$N={}));var FN;(function(t){t.method="workspace/diagnostic",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method),t.partialResult=new jN.ProgressType})(FN||(Sr.WorkspaceDiagnosticRequest=FN={}));var BN;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=ia.MessageDirection.serverToClient,t.type=new ia.ProtocolRequestType0(t.method)})(BN||(Sr.DiagnosticRefreshRequest=BN={}))});var KN=N(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.DidCloseNotebookDocumentNotification=Mt.DidSaveNotebookDocumentNotification=Mt.DidChangeNotebookDocumentNotification=Mt.NotebookCellArrayChange=Mt.DidOpenNotebookDocumentNotification=Mt.NotebookDocumentSyncRegistrationType=Mt.NotebookDocument=Mt.NotebookCell=Mt.ExecutionSummary=Mt.NotebookCellKind=void 0;var xc=Ud(),Gr=Hd(),gi=Nt(),xy;(function(t){t.Markup=1,t.Code=2;function e(n){return n===1||n===2}t.is=e})(xy||(Mt.NotebookCellKind=xy={}));var Ly;(function(t){function e(i,s){let o={executionOrder:i};return(s===!0||s===!1)&&(o.success=s),o}t.create=e;function n(i){let s=i;return Gr.objectLiteral(s)&&xc.uinteger.is(s.executionOrder)&&(s.success===void 0||Gr.boolean(s.success))}t.is=n;function r(i,s){return i===s?!0:i==null||s===null||s===void 0?!1:i.executionOrder===s.executionOrder&&i.success===s.success}t.equals=r})(Ly||(Mt.ExecutionSummary=Ly={}));var nf;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function n(s){let o=s;return Gr.objectLiteral(o)&&xy.is(o.kind)&&xc.DocumentUri.is(o.document)&&(o.metadata===void 0||Gr.objectLiteral(o.metadata))}t.is=n;function r(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)&&!Ly.equals(s.executionSummary,o.executionSummary)&&a.add("executionSummary"),a}t.diff=r;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(Gr.objectLiteral(s)&&Gr.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}})(nf||(Mt.NotebookCell=nf={}));var HN;(function(t){function e(r,i,s,o){return{uri:r,notebookType:i,version:s,cells:o}}t.create=e;function n(r){let i=r;return Gr.objectLiteral(i)&&Gr.string(i.uri)&&xc.integer.is(i.version)&&Gr.typedArray(i.cells,nf.is)}t.is=n})(HN||(Mt.NotebookDocument=HN={}));var sa;(function(t){t.method="notebookDocument/sync",t.messageDirection=gi.MessageDirection.clientToServer,t.type=new gi.RegistrationType(t.method)})(sa||(Mt.NotebookDocumentSyncRegistrationType=sa={}));var VN;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=gi.MessageDirection.clientToServer,t.type=new gi.ProtocolNotificationType(t.method),t.registrationMethod=sa.method})(VN||(Mt.DidOpenNotebookDocumentNotification=VN={}));var WN;(function(t){function e(r){let i=r;return Gr.objectLiteral(i)&&xc.uinteger.is(i.start)&&xc.uinteger.is(i.deleteCount)&&(i.cells===void 0||Gr.typedArray(i.cells,nf.is))}t.is=e;function n(r,i,s){let o={start:r,deleteCount:i};return s!==void 0&&(o.cells=s),o}t.create=n})(WN||(Mt.NotebookCellArrayChange=WN={}));var zN;(function(t){t.method="notebookDocument/didChange",t.messageDirection=gi.MessageDirection.clientToServer,t.type=new gi.ProtocolNotificationType(t.method),t.registrationMethod=sa.method})(zN||(Mt.DidChangeNotebookDocumentNotification=zN={}));var GN;(function(t){t.method="notebookDocument/didSave",t.messageDirection=gi.MessageDirection.clientToServer,t.type=new gi.ProtocolNotificationType(t.method),t.registrationMethod=sa.method})(GN||(Mt.DidSaveNotebookDocumentNotification=GN={}));var YN;(function(t){t.method="notebookDocument/didClose",t.messageDirection=gi.MessageDirection.clientToServer,t.type=new gi.ProtocolNotificationType(t.method),t.registrationMethod=sa.method})(YN||(Mt.DidCloseNotebookDocumentNotification=YN={}))});var QN=N(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.InlineCompletionRequest=void 0;var XN=Nt(),JN;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=XN.MessageDirection.clientToServer,t.type=new XN.ProtocolRequestType(t.method)})(JN||(rf.InlineCompletionRequest=JN={}))});var dw=N(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.WorkspaceSymbolRequest=P.CodeActionResolveRequest=P.CodeActionRequest=P.DocumentSymbolRequest=P.DocumentHighlightRequest=P.ReferencesRequest=P.DefinitionRequest=P.SignatureHelpRequest=P.SignatureHelpTriggerKind=P.HoverRequest=P.CompletionResolveRequest=P.CompletionRequest=P.CompletionTriggerKind=P.PublishDiagnosticsNotification=P.WatchKind=P.RelativePattern=P.FileChangeType=P.DidChangeWatchedFilesNotification=P.WillSaveTextDocumentWaitUntilRequest=P.WillSaveTextDocumentNotification=P.TextDocumentSaveReason=P.DidSaveTextDocumentNotification=P.DidCloseTextDocumentNotification=P.DidChangeTextDocumentNotification=P.TextDocumentContentChangeEvent=P.DidOpenTextDocumentNotification=P.TextDocumentSyncKind=P.TelemetryEventNotification=P.LogMessageNotification=P.ShowMessageRequest=P.ShowMessageNotification=P.MessageType=P.DidChangeConfigurationNotification=P.ExitNotification=P.ShutdownRequest=P.InitializedNotification=P.InitializeErrorCodes=P.InitializeRequest=P.WorkDoneProgressOptions=P.TextDocumentRegistrationOptions=P.StaticRegistrationOptions=P.PositionEncodingKind=P.FailureHandlingKind=P.ResourceOperationKind=P.UnregistrationRequest=P.RegistrationRequest=P.DocumentSelector=P.NotebookCellTextDocumentFilter=P.NotebookDocumentFilter=P.TextDocumentFilter=void 0;P.MonikerRequest=P.MonikerKind=P.UniquenessLevel=P.WillDeleteFilesRequest=P.DidDeleteFilesNotification=P.WillRenameFilesRequest=P.DidRenameFilesNotification=P.WillCreateFilesRequest=P.DidCreateFilesNotification=P.FileOperationPatternKind=P.LinkedEditingRangeRequest=P.ShowDocumentRequest=P.SemanticTokensRegistrationType=P.SemanticTokensRefreshRequest=P.SemanticTokensRangeRequest=P.SemanticTokensDeltaRequest=P.SemanticTokensRequest=P.TokenFormat=P.CallHierarchyPrepareRequest=P.CallHierarchyOutgoingCallsRequest=P.CallHierarchyIncomingCallsRequest=P.WorkDoneProgressCancelNotification=P.WorkDoneProgressCreateRequest=P.WorkDoneProgress=P.SelectionRangeRequest=P.DeclarationRequest=P.FoldingRangeRefreshRequest=P.FoldingRangeRequest=P.ColorPresentationRequest=P.DocumentColorRequest=P.ConfigurationRequest=P.DidChangeWorkspaceFoldersNotification=P.WorkspaceFoldersRequest=P.TypeDefinitionRequest=P.ImplementationRequest=P.ApplyWorkspaceEditRequest=P.ExecuteCommandRequest=P.PrepareRenameRequest=P.RenameRequest=P.PrepareSupportDefaultBehavior=P.DocumentOnTypeFormattingRequest=P.DocumentRangesFormattingRequest=P.DocumentRangeFormattingRequest=P.DocumentFormattingRequest=P.DocumentLinkResolveRequest=P.DocumentLinkRequest=P.CodeLensRefreshRequest=P.CodeLensResolveRequest=P.CodeLensRequest=P.WorkspaceSymbolResolveRequest=void 0;P.InlineCompletionRequest=P.DidCloseNotebookDocumentNotification=P.DidSaveNotebookDocumentNotification=P.DidChangeNotebookDocumentNotification=P.NotebookCellArrayChange=P.DidOpenNotebookDocumentNotification=P.NotebookDocumentSyncRegistrationType=P.NotebookDocument=P.NotebookCell=P.ExecutionSummary=P.NotebookCellKind=P.DiagnosticRefreshRequest=P.WorkspaceDiagnosticRequest=P.DocumentDiagnosticRequest=P.DocumentDiagnosticReportKind=P.DiagnosticServerCancellationData=P.InlayHintRefreshRequest=P.InlayHintResolveRequest=P.InlayHintRequest=P.InlineValueRefreshRequest=P.InlineValueRequest=P.TypeHierarchySupertypesRequest=P.TypeHierarchySubtypesRequest=P.TypeHierarchyPrepareRequest=void 0;var z=Nt(),ZN=Ud(),nn=Hd(),Fj=kk();Object.defineProperty(P,"ImplementationRequest",{enumerable:!0,get:function(){return Fj.ImplementationRequest}});var Bj=wk();Object.defineProperty(P,"TypeDefinitionRequest",{enumerable:!0,get:function(){return Bj.TypeDefinitionRequest}});var aw=Dk();Object.defineProperty(P,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return aw.WorkspaceFoldersRequest}});Object.defineProperty(P,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return aw.DidChangeWorkspaceFoldersNotification}});var jj=Ok();Object.defineProperty(P,"ConfigurationRequest",{enumerable:!0,get:function(){return jj.ConfigurationRequest}});var cw=Lk();Object.defineProperty(P,"DocumentColorRequest",{enumerable:!0,get:function(){return cw.DocumentColorRequest}});Object.defineProperty(P,"ColorPresentationRequest",{enumerable:!0,get:function(){return cw.ColorPresentationRequest}});var lw=Fk();Object.defineProperty(P,"FoldingRangeRequest",{enumerable:!0,get:function(){return lw.FoldingRangeRequest}});Object.defineProperty(P,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return lw.FoldingRangeRefreshRequest}});var Uj=Uk();Object.defineProperty(P,"DeclarationRequest",{enumerable:!0,get:function(){return Uj.DeclarationRequest}});var Hj=Wk();Object.defineProperty(P,"SelectionRangeRequest",{enumerable:!0,get:function(){return Hj.SelectionRangeRequest}});var jy=Kk();Object.defineProperty(P,"WorkDoneProgress",{enumerable:!0,get:function(){return jy.WorkDoneProgress}});Object.defineProperty(P,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return jy.WorkDoneProgressCreateRequest}});Object.defineProperty(P,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return jy.WorkDoneProgressCancelNotification}});var Uy=Zk();Object.defineProperty(P,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return Uy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(P,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return Uy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(P,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return Uy.CallHierarchyPrepareRequest}});var oa=sN();Object.defineProperty(P,"TokenFormat",{enumerable:!0,get:function(){return oa.TokenFormat}});Object.defineProperty(P,"SemanticTokensRequest",{enumerable:!0,get:function(){return oa.SemanticTokensRequest}});Object.defineProperty(P,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return oa.SemanticTokensDeltaRequest}});Object.defineProperty(P,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return oa.SemanticTokensRangeRequest}});Object.defineProperty(P,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return oa.SemanticTokensRefreshRequest}});Object.defineProperty(P,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return oa.SemanticTokensRegistrationType}});var Vj=cN();Object.defineProperty(P,"ShowDocumentRequest",{enumerable:!0,get:function(){return Vj.ShowDocumentRequest}});var Wj=dN();Object.defineProperty(P,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return Wj.LinkedEditingRangeRequest}});var ro=vN();Object.defineProperty(P,"FileOperationPatternKind",{enumerable:!0,get:function(){return ro.FileOperationPatternKind}});Object.defineProperty(P,"DidCreateFilesNotification",{enumerable:!0,get:function(){return ro.DidCreateFilesNotification}});Object.defineProperty(P,"WillCreateFilesRequest",{enumerable:!0,get:function(){return ro.WillCreateFilesRequest}});Object.defineProperty(P,"DidRenameFilesNotification",{enumerable:!0,get:function(){return ro.DidRenameFilesNotification}});Object.defineProperty(P,"WillRenameFilesRequest",{enumerable:!0,get:function(){return ro.WillRenameFilesRequest}});Object.defineProperty(P,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return ro.DidDeleteFilesNotification}});Object.defineProperty(P,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return ro.WillDeleteFilesRequest}});var Hy=kN();Object.defineProperty(P,"UniquenessLevel",{enumerable:!0,get:function(){return Hy.UniquenessLevel}});Object.defineProperty(P,"MonikerKind",{enumerable:!0,get:function(){return Hy.MonikerKind}});Object.defineProperty(P,"MonikerRequest",{enumerable:!0,get:function(){return Hy.MonikerRequest}});var Vy=EN();Object.defineProperty(P,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return Vy.TypeHierarchyPrepareRequest}});Object.defineProperty(P,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return Vy.TypeHierarchySubtypesRequest}});Object.defineProperty(P,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return Vy.TypeHierarchySupertypesRequest}});var uw=AN();Object.defineProperty(P,"InlineValueRequest",{enumerable:!0,get:function(){return uw.InlineValueRequest}});Object.defineProperty(P,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return uw.InlineValueRefreshRequest}});var Wy=xN();Object.defineProperty(P,"InlayHintRequest",{enumerable:!0,get:function(){return Wy.InlayHintRequest}});Object.defineProperty(P,"InlayHintResolveRequest",{enumerable:!0,get:function(){return Wy.InlayHintResolveRequest}});Object.defineProperty(P,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return Wy.InlayHintRefreshRequest}});var Lc=UN();Object.defineProperty(P,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return Lc.DiagnosticServerCancellationData}});Object.defineProperty(P,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return Lc.DocumentDiagnosticReportKind}});Object.defineProperty(P,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return Lc.DocumentDiagnosticRequest}});Object.defineProperty(P,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return Lc.WorkspaceDiagnosticRequest}});Object.defineProperty(P,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return Lc.DiagnosticRefreshRequest}});var yi=KN();Object.defineProperty(P,"NotebookCellKind",{enumerable:!0,get:function(){return yi.NotebookCellKind}});Object.defineProperty(P,"ExecutionSummary",{enumerable:!0,get:function(){return yi.ExecutionSummary}});Object.defineProperty(P,"NotebookCell",{enumerable:!0,get:function(){return yi.NotebookCell}});Object.defineProperty(P,"NotebookDocument",{enumerable:!0,get:function(){return yi.NotebookDocument}});Object.defineProperty(P,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return yi.NotebookDocumentSyncRegistrationType}});Object.defineProperty(P,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return yi.DidOpenNotebookDocumentNotification}});Object.defineProperty(P,"NotebookCellArrayChange",{enumerable:!0,get:function(){return yi.NotebookCellArrayChange}});Object.defineProperty(P,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return yi.DidChangeNotebookDocumentNotification}});Object.defineProperty(P,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return yi.DidSaveNotebookDocumentNotification}});Object.defineProperty(P,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return yi.DidCloseNotebookDocumentNotification}});var zj=QN();Object.defineProperty(P,"InlineCompletionRequest",{enumerable:!0,get:function(){return zj.InlineCompletionRequest}});var qy;(function(t){function e(n){let r=n;return nn.string(r)||nn.string(r.language)||nn.string(r.scheme)||nn.string(r.pattern)}t.is=e})(qy||(P.TextDocumentFilter=qy={}));var $y;(function(t){function e(n){let r=n;return nn.objectLiteral(r)&&(nn.string(r.notebookType)||nn.string(r.scheme)||nn.string(r.pattern))}t.is=e})($y||(P.NotebookDocumentFilter=$y={}));var Fy;(function(t){function e(n){let r=n;return nn.objectLiteral(r)&&(nn.string(r.notebook)||$y.is(r.notebook))&&(r.language===void 0||nn.string(r.language))}t.is=e})(Fy||(P.NotebookCellTextDocumentFilter=Fy={}));var By;(function(t){function e(n){if(!Array.isArray(n))return!1;for(let r of n)if(!nn.string(r)&&!qy.is(r)&&!Fy.is(r))return!1;return!0}t.is=e})(By||(P.DocumentSelector=By={}));var eR;(function(t){t.method="client/registerCapability",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(eR||(P.RegistrationRequest=eR={}));var tR;(function(t){t.method="client/unregisterCapability",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(tR||(P.UnregistrationRequest=tR={}));var nR;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(nR||(P.ResourceOperationKind=nR={}));var rR;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(rR||(P.FailureHandlingKind=rR={}));var iR;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(iR||(P.PositionEncodingKind=iR={}));var sR;(function(t){function e(n){let r=n;return r&&nn.string(r.id)&&r.id.length>0}t.hasId=e})(sR||(P.StaticRegistrationOptions=sR={}));var oR;(function(t){function e(n){let r=n;return r&&(r.documentSelector===null||By.is(r.documentSelector))}t.is=e})(oR||(P.TextDocumentRegistrationOptions=oR={}));var aR;(function(t){function e(r){let i=r;return nn.objectLiteral(i)&&(i.workDoneProgress===void 0||nn.boolean(i.workDoneProgress))}t.is=e;function n(r){let i=r;return i&&nn.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=n})(aR||(P.WorkDoneProgressOptions=aR={}));var cR;(function(t){t.method="initialize",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(cR||(P.InitializeRequest=cR={}));var lR;(function(t){t.unknownProtocolVersion=1})(lR||(P.InitializeErrorCodes=lR={}));var uR;(function(t){t.method="initialized",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(uR||(P.InitializedNotification=uR={}));var dR;(function(t){t.method="shutdown",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType0(t.method)})(dR||(P.ShutdownRequest=dR={}));var fR;(function(t){t.method="exit",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType0(t.method)})(fR||(P.ExitNotification=fR={}));var pR;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(pR||(P.DidChangeConfigurationNotification=pR={}));var hR;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(hR||(P.MessageType=hR={}));var mR;(function(t){t.method="window/showMessage",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(mR||(P.ShowMessageNotification=mR={}));var gR;(function(t){t.method="window/showMessageRequest",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(gR||(P.ShowMessageRequest=gR={}));var yR;(function(t){t.method="window/logMessage",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(yR||(P.LogMessageNotification=yR={}));var TR;(function(t){t.method="telemetry/event",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(TR||(P.TelemetryEventNotification=TR={}));var vR;(function(t){t.None=0,t.Full=1,t.Incremental=2})(vR||(P.TextDocumentSyncKind=vR={}));var bR;(function(t){t.method="textDocument/didOpen",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(bR||(P.DidOpenTextDocumentNotification=bR={}));var SR;(function(t){function e(r){let i=r;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}t.isIncremental=e;function n(r){let i=r;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}t.isFull=n})(SR||(P.TextDocumentContentChangeEvent=SR={}));var _R;(function(t){t.method="textDocument/didChange",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(_R||(P.DidChangeTextDocumentNotification=_R={}));var PR;(function(t){t.method="textDocument/didClose",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(PR||(P.DidCloseTextDocumentNotification=PR={}));var kR;(function(t){t.method="textDocument/didSave",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(kR||(P.DidSaveTextDocumentNotification=kR={}));var NR;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(NR||(P.TextDocumentSaveReason=NR={}));var RR;(function(t){t.method="textDocument/willSave",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(RR||(P.WillSaveTextDocumentNotification=RR={}));var wR;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(wR||(P.WillSaveTextDocumentWaitUntilRequest=wR={}));var ER;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(ER||(P.DidChangeWatchedFilesNotification=ER={}));var CR;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(CR||(P.FileChangeType=CR={}));var DR;(function(t){function e(n){let r=n;return nn.objectLiteral(r)&&(ZN.URI.is(r.baseUri)||ZN.WorkspaceFolder.is(r.baseUri))&&nn.string(r.pattern)}t.is=e})(DR||(P.RelativePattern=DR={}));var AR;(function(t){t.Create=1,t.Change=2,t.Delete=4})(AR||(P.WatchKind=AR={}));var IR;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(IR||(P.PublishDiagnosticsNotification=IR={}));var OR;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(OR||(P.CompletionTriggerKind=OR={}));var MR;(function(t){t.method="textDocument/completion",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(MR||(P.CompletionRequest=MR={}));var xR;(function(t){t.method="completionItem/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(xR||(P.CompletionResolveRequest=xR={}));var LR;(function(t){t.method="textDocument/hover",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(LR||(P.HoverRequest=LR={}));var qR;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(qR||(P.SignatureHelpTriggerKind=qR={}));var $R;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})($R||(P.SignatureHelpRequest=$R={}));var FR;(function(t){t.method="textDocument/definition",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(FR||(P.DefinitionRequest=FR={}));var BR;(function(t){t.method="textDocument/references",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(BR||(P.ReferencesRequest=BR={}));var jR;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(jR||(P.DocumentHighlightRequest=jR={}));var UR;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(UR||(P.DocumentSymbolRequest=UR={}));var HR;(function(t){t.method="textDocument/codeAction",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(HR||(P.CodeActionRequest=HR={}));var VR;(function(t){t.method="codeAction/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(VR||(P.CodeActionResolveRequest=VR={}));var WR;(function(t){t.method="workspace/symbol",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(WR||(P.WorkspaceSymbolRequest=WR={}));var zR;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(zR||(P.WorkspaceSymbolResolveRequest=zR={}));var GR;(function(t){t.method="textDocument/codeLens",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(GR||(P.CodeLensRequest=GR={}));var YR;(function(t){t.method="codeLens/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(YR||(P.CodeLensResolveRequest=YR={}));var KR;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType0(t.method)})(KR||(P.CodeLensRefreshRequest=KR={}));var XR;(function(t){t.method="textDocument/documentLink",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(XR||(P.DocumentLinkRequest=XR={}));var JR;(function(t){t.method="documentLink/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(JR||(P.DocumentLinkResolveRequest=JR={}));var QR;(function(t){t.method="textDocument/formatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(QR||(P.DocumentFormattingRequest=QR={}));var ZR;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(ZR||(P.DocumentRangeFormattingRequest=ZR={}));var ew;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(ew||(P.DocumentRangesFormattingRequest=ew={}));var tw;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(tw||(P.DocumentOnTypeFormattingRequest=tw={}));var nw;(function(t){t.Identifier=1})(nw||(P.PrepareSupportDefaultBehavior=nw={}));var rw;(function(t){t.method="textDocument/rename",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(rw||(P.RenameRequest=rw={}));var iw;(function(t){t.method="textDocument/prepareRename",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(iw||(P.PrepareRenameRequest=iw={}));var sw;(function(t){t.method="workspace/executeCommand",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(sw||(P.ExecuteCommandRequest=sw={}));var ow;(function(t){t.method="workspace/applyEdit",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType("workspace/applyEdit")})(ow||(P.ApplyWorkspaceEditRequest=ow={}))});var pw=N(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.createProtocolConnection=void 0;var fw=no();function Gj(t,e,n,r){return fw.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,fw.createMessageConnection)(t,e,n,r)}sf.createProtocolConnection=Gj});var mw=N(Gn=>{"use strict";var Yj=Gn&&Gn.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),of=Gn&&Gn.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Yj(e,t,n)};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.LSPErrorCodes=Gn.createProtocolConnection=void 0;of(no(),Gn);of(Ud(),Gn);of(Nt(),Gn);of(dw(),Gn);var Kj=pw();Object.defineProperty(Gn,"createProtocolConnection",{enumerable:!0,get:function(){return Kj.createProtocolConnection}});var hw;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(hw||(Gn.LSPErrorCodes=hw={}))});var $t=N(Ti=>{"use strict";var Xj=Ti&&Ti.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),gw=Ti&&Ti.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Xj(e,t,n)};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.createProtocolConnection=void 0;var Jj=Cy();gw(Cy(),Ti);gw(mw(),Ti);function Qj(t,e,n,r){return(0,Jj.createMessageConnection)(t,e,n,r)}Ti.createProtocolConnection=Qj});var zy=N(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.generateUuid=_r.parse=_r.isUUID=_r.v4=_r.empty=void 0;var qc=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},$c=class t extends qc{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(""))}};$c._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];$c._timeHighBits=["8","9","a","b"];_r.empty=new qc("00000000-0000-0000-0000-000000000000");function yw(){return new $c}_r.v4=yw;var Zj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Tw(t){return Zj.test(t)}_r.isUUID=Tw;function eU(t){if(!Tw(t))throw new Error("invalid uuid");return new qc(t)}_r.parse=eU;function tU(){return yw().asHex()}_r.generateUuid=tU});var vw=N(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.attachPartialResult=hs.ProgressFeature=hs.attachWorkDone=void 0;var ps=$t(),nU=zy(),io=class t{constructor(e,n){this._connection=e,this._token=n,t.Instances.set(this._token,this)}begin(e,n,r,i){let s={kind:"begin",title:e,percentage:n,message:r,cancellable:i};this._connection.sendProgress(ps.WorkDoneProgress.type,this._token,s)}report(e,n){let r={kind:"report"};typeof e=="number"?(r.percentage=e,n!==void 0&&(r.message=n)):r.message=e,this._connection.sendProgress(ps.WorkDoneProgress.type,this._token,r)}done(){t.Instances.delete(this._token),this._connection.sendProgress(ps.WorkDoneProgress.type,this._token,{kind:"end"})}};io.Instances=new Map;var af=class extends io{constructor(e,n){super(e,n),this._source=new ps.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Fc=class{constructor(){}begin(){}report(){}done(){}},cf=class extends Fc{constructor(){super(),this._source=new ps.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function rU(t,e){if(e===void 0||e.workDoneToken===void 0)return new Fc;let n=e.workDoneToken;return delete e.workDoneToken,new io(t,n)}hs.attachWorkDone=rU;var iU=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(ps.WorkDoneProgressCancelNotification.type,n=>{let r=io.Instances.get(n.token);(r instanceof af||r instanceof cf)&&r.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Fc:new io(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,nU.generateUuid)();return this.connection.sendRequest(ps.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new af(this.connection,e))}else return Promise.resolve(new cf)}};hs.ProgressFeature=iU;var Gy;(function(t){t.type=new ps.ProgressType})(Gy||(Gy={}));var Yy=class{constructor(e,n){this._connection=e,this._token=n}report(e){this._connection.sendProgress(Gy.type,this._token,e)}};function sU(t,e){if(e===void 0||e.partialResultToken===void 0)return;let n=e.partialResultToken;return delete e.partialResultToken,new Yy(t,n)}hs.attachPartialResult=sU});var bw=N(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.ConfigurationFeature=void 0;var oU=$t(),aU=vd(),cU=t=>class extends t{getConfiguration(e){return e?aU.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let n={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(oU.ConfigurationRequest.type,n).then(r=>Array.isArray(r)?Array.isArray(e)?r:r[0]:Array.isArray(e)?[]:null)}};lf.ConfigurationFeature=cU});var Sw=N(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});df.WorkspaceFoldersFeature=void 0;var uf=$t(),lU=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let n=e.workspace;n&&n.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new uf.Emitter,this.connection.onNotification(uf.DidChangeWorkspaceFoldersNotification.type,r=>{this._onDidChangeWorkspaceFolders.fire(r.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let n=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=n===!0||typeof n=="string"}getWorkspaceFolders(){return this.connection.sendRequest(uf.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(uf.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};df.WorkspaceFoldersFeature=lU});var _w=N(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});ff.CallHierarchyFeature=void 0;var Ky=$t(),uU=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(Ky.CallHierarchyPrepareRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0)),onIncomingCalls:e=>{let n=Ky.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onOutgoingCalls:e=>{let n=Ky.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};ff.CallHierarchyFeature=uU});var Jy=N(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.SemanticTokensBuilder=ms.SemanticTokensDiff=ms.SemanticTokensFeature=void 0;var pf=$t(),dU=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(pf.SemanticTokensRefreshRequest.type),on:e=>{let n=pf.SemanticTokensRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onDelta:e=>{let n=pf.SemanticTokensDeltaRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onRange:e=>{let n=pf.SemanticTokensRangeRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};ms.SemanticTokensFeature=dU;var hf=class{constructor(e,n){this.originalSequence=e,this.modifiedSequence=n}computeDiff(){let e=this.originalSequence.length,n=this.modifiedSequence.length,r=0;for(;r<n&&r<e&&this.originalSequence[r]===this.modifiedSequence[r];)r++;if(r<n&&r<e){let i=e-1,s=n-1;for(;i>=r&&s>=r&&this.originalSequence[i]===this.modifiedSequence[s];)i--,s--;(i<r||s<r)&&(i++,s++);let o=i-r+1,a=this.modifiedSequence.slice(r,s+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:r,deleteCount:o-1}]:[{start:r,deleteCount:o,data:a}]}else return r<n?[{start:r,deleteCount:0,data:this.modifiedSequence.slice(r)}]:r<e?[{start:r,deleteCount:e-r}]:[]}};ms.SemanticTokensDiff=hf;var Xy=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,n,r,i,s){let o=e,a=n;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++]=r,this._data[this._dataLen++]=i,this._data[this._dataLen++]=s,this._prevLine=e,this._prevChar=n}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 hf(this._prevData,this._data).computeDiff()}:this.build()}};ms.SemanticTokensBuilder=Xy});var Pw=N(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});mf.ShowDocumentFeature=void 0;var fU=$t(),pU=t=>class extends t{showDocument(e){return this.connection.sendRequest(fU.ShowDocumentRequest.type,e)}};mf.ShowDocumentFeature=pU});var kw=N(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.FileOperationsFeature=void 0;var aa=$t(),hU=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(aa.DidCreateFilesNotification.type,n=>{e(n)})}onDidRenameFiles(e){return this.connection.onNotification(aa.DidRenameFilesNotification.type,n=>{e(n)})}onDidDeleteFiles(e){return this.connection.onNotification(aa.DidDeleteFilesNotification.type,n=>{e(n)})}onWillCreateFiles(e){return this.connection.onRequest(aa.WillCreateFilesRequest.type,(n,r)=>e(n,r))}onWillRenameFiles(e){return this.connection.onRequest(aa.WillRenameFilesRequest.type,(n,r)=>e(n,r))}onWillDeleteFiles(e){return this.connection.onRequest(aa.WillDeleteFilesRequest.type,(n,r)=>e(n,r))}};gf.FileOperationsFeature=hU});var Nw=N(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});yf.LinkedEditingRangeFeature=void 0;var mU=$t(),gU=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(mU.LinkedEditingRangeRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0))}};yf.LinkedEditingRangeFeature=gU});var Rw=N(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.TypeHierarchyFeature=void 0;var Qy=$t(),yU=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(Qy.TypeHierarchyPrepareRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0)),onSupertypes:e=>{let n=Qy.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onSubtypes:e=>{let n=Qy.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Tf.TypeHierarchyFeature=yU});var Ew=N(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.InlineValueFeature=void 0;var ww=$t(),TU=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(ww.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(ww.InlineValueRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n)))}}};vf.InlineValueFeature=TU});var Dw=N(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.FoldingRangeFeature=void 0;var Cw=$t(),vU=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(Cw.FoldingRangeRefreshRequest.type),on:e=>{let n=Cw.FoldingRangeRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};bf.FoldingRangeFeature=vU});var Aw=N(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.InlayHintFeature=void 0;var Zy=$t(),bU=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Zy.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Zy.InlayHintRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n))),resolve:e=>this.connection.onRequest(Zy.InlayHintResolveRequest.type,(n,r)=>e(n,r))}}};Sf.InlayHintFeature=bU});var Iw=N(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.DiagnosticFeature=void 0;var Bc=$t(),SU=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Bc.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Bc.DocumentDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(Bc.DocumentDiagnosticRequest.partialResult,n))),onWorkspace:e=>this.connection.onRequest(Bc.WorkspaceDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(Bc.WorkspaceDiagnosticRequest.partialResult,n)))}}};_f.DiagnosticFeature=SU});var tT=N(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.TextDocuments=void 0;var so=$t(),eT=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new so.Emitter,this._onDidOpen=new so.Emitter,this._onDidClose=new so.Emitter,this._onDidSave=new so.Emitter,this._onWillSave=new so.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=so.TextDocumentSyncKind.Incremental;let n=[];return n.push(e.onDidOpenTextDocument(r=>{let i=r.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)})),n.push(e.onDidChangeTextDocument(r=>{let i=r.textDocument,s=r.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})))})),n.push(e.onDidCloseTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(r.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),n.push(e.onWillSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:r.reason}))})),n.push(e.onWillSaveTextDocumentWaitUntil((r,i)=>{let s=this._syncedDocuments.get(r.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:r.reason}),i):[]})),n.push(e.onDidSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),so.Disposable.create(()=>{n.forEach(r=>r.dispose())})}};Pf.TextDocuments=eT});var rT=N(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.NotebookDocuments=ca.NotebookSyncFeature=void 0;var Pr=$t(),Ow=tT(),_U=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(Pr.DidOpenNotebookDocumentNotification.type,n=>{e(n)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(Pr.DidChangeNotebookDocumentNotification.type,n=>{e(n)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(Pr.DidSaveNotebookDocumentNotification.type,n=>{e(n)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(Pr.DidCloseNotebookDocumentNotification.type,n=>{e(n)})}}};ca.NotebookSyncFeature=_U;var kf=class t{onDidOpenTextDocument(e){return this.openHandler=e,Pr.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,Pr.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,Pr.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}};kf.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var nT=class{constructor(e){e instanceof Ow.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new Ow.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Pr.Emitter,this._onDidChange=new Pr.Emitter,this._onDidSave=new Pr.Emitter,this._onDidClose=new Pr.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let n=this.notebookCellMap.get(e);return n&&n[0]}findNotebookDocumentForCell(e){let n=typeof e=="string"?e:e.document,r=this.notebookCellMap.get(n);return r&&r[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 n=new kf,r=[];return r.push(this.cellTextDocuments.listen(n)),r.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let s of i.cellTextDocuments)n.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),r.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 S=c.cells;if(S.structure!==void 0){let b=S.structure.array;if(s.cells.splice(b.start,b.deleteCount,...b.cells!==void 0?b.cells:[]),S.structure.didOpen!==void 0)for(let v of S.structure.didOpen)n.openTextDocument({textDocument:v}),l.push(v.uri);if(S.structure.didClose)for(let v of S.structure.didClose)n.closeTextDocument({textDocument:v}),u.push(v.uri)}if(S.data!==void 0){let b=new Map(S.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 R=s.cells.splice(v,1,k);if(d.push({old:R[0],new:k}),b.delete(k.document),b.size===0)break}}}if(S.textContent!==void 0)for(let b of S.textContent)n.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 S of l)m.push(this.getNotebookCell(S));let h=[];for(let S of u)h.push(this.getNotebookCell(S));let y=[];for(let S of f)y.push(this.getNotebookCell(S));(m.length>0||h.length>0||d.length>0||y.length>0)&&(p.cells={added:m,removed:h,changed:{data:d,textContent:y}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),r.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),r.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)n.closeTextDocument({textDocument:o});this.notebookDocuments.delete(i.notebookDocument.uri);for(let o of s.cells)this.notebookCellMap.delete(o.document)}})),Pr.Disposable.create(()=>{r.forEach(i=>i.dispose())})}updateCellMap(e){for(let n of e.cells)this.notebookCellMap.set(n.document,[n,e])}};ca.NotebookDocuments=nT});var Mw=N(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.MonikerFeature=void 0;var PU=$t(),kU=t=>class extends t{get moniker(){return{on:e=>{let n=PU.MonikerRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Nf.MonikerFeature=kU});var lT=N(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.createConnection=Ye.combineFeatures=Ye.combineNotebooksFeatures=Ye.combineLanguagesFeatures=Ye.combineWorkspaceFeatures=Ye.combineWindowFeatures=Ye.combineClientFeatures=Ye.combineTracerFeatures=Ye.combineTelemetryFeatures=Ye.combineConsoleFeatures=Ye._NotebooksImpl=Ye._LanguagesImpl=Ye.BulkUnregistration=Ye.BulkRegistration=Ye.ErrorMessageTracker=void 0;var K=$t(),kr=vd(),sT=zy(),ye=vw(),NU=bw(),RU=Sw(),wU=_w(),EU=Jy(),CU=Pw(),DU=kw(),AU=Nw(),IU=Rw(),OU=Ew(),MU=Dw(),xU=Aw(),LU=Iw(),qU=rT(),$U=Mw();function iT(t){if(t!==null)return t}var oT=class{constructor(){this._messages=Object.create(null)}add(e){let n=this._messages[e];n||(n=0),n++,this._messages[e]=n}sendErrors(e){Object.keys(this._messages).forEach(n=>{e.window.showErrorMessage(n)})}};Ye.ErrorMessageTracker=oT;var Rf=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,n){this._rawConnection&&this._rawConnection.sendNotification(K.LogMessageNotification.type,{type:e,message:n}).catch(()=>{(0,K.RAL)().console.error("Sending log message failed")})}},aT=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,...n){let r={type:K.MessageType.Error,message:e,actions:n};return this.connection.sendRequest(K.ShowMessageRequest.type,r).then(iT)}showWarningMessage(e,...n){let r={type:K.MessageType.Warning,message:e,actions:n};return this.connection.sendRequest(K.ShowMessageRequest.type,r).then(iT)}showInformationMessage(e,...n){let r={type:K.MessageType.Info,message:e,actions:n};return this.connection.sendRequest(K.ShowMessageRequest.type,r).then(iT)}},xw=(0,CU.ShowDocumentFeature)((0,ye.ProgressFeature)(aT)),Lw;(function(t){function e(){return new wf}t.create=e})(Lw||(Ye.BulkRegistration=Lw={}));var wf=class{constructor(){this._registrations=[],this._registered=new Set}add(e,n){let r=kr.string(e)?e:e.method;if(this._registered.has(r))throw new Error(`${r} is already added to this registration`);let i=sT.generateUuid();this._registrations.push({id:i,method:r,registerOptions:n||{}}),this._registered.add(r)}asRegistrationParams(){return{registrations:this._registrations}}},qw;(function(t){function e(){return new jc(void 0,[])}t.create=e})(qw||(Ye.BulkUnregistration=qw={}));var jc=class{constructor(e,n){this._connection=e,this._unregistrations=new Map,n.forEach(r=>{this._unregistrations.set(r.method,r)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let r of this._unregistrations.values())e.push(r);let n={unregisterations:e};this._connection.sendRequest(K.UnregistrationRequest.type,n).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let n=kr.string(e)?e:e.method,r=this._unregistrations.get(n);if(!r)return!1;let i={unregisterations:[r]};return this._connection.sendRequest(K.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(n)},s=>{this._connection.console.info(`Un-registering request handler for ${r.id} failed.`)}),!0}},Ef=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,n,r){return e instanceof wf?this.registerMany(e):e instanceof jc?this.registerSingle1(e,n,r):this.registerSingle2(e,n)}registerSingle1(e,n,r){let i=kr.string(n)?n:n.method,s=sT.generateUuid(),o={registrations:[{id:s,method:i,registerOptions:r||{}}]};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,n){let r=kr.string(e)?e:e.method,i=sT.generateUuid(),s={registrations:[{id:i,method:r,registerOptions:n||{}}]};return this.connection.sendRequest(K.RegistrationRequest.type,s).then(o=>K.Disposable.create(()=>{this.unregisterSingle(i,r).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),o=>(this.connection.console.info(`Registering request handler for ${r} failed.`),Promise.reject(o)))}unregisterSingle(e,n){let r={unregisterations:[{id:e,method:n}]};return this.connection.sendRequest(K.UnregistrationRequest.type,r).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let n=e.asRegistrationParams();return this.connection.sendRequest(K.RegistrationRequest.type,n).then(()=>new jc(this._connection,n.registrations.map(r=>({id:r.id,method:r.method}))),r=>(this.connection.console.info("Bulk registration failed."),Promise.reject(r)))}},cT=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 n(i){return i&&!!i.edit}let r=n(e)?e:{edit:e};return this.connection.sendRequest(K.ApplyWorkspaceEditRequest.type,r)}},$w=(0,DU.FileOperationsFeature)((0,RU.WorkspaceFoldersFeature)((0,NU.ConfigurationFeature)(cT))),Cf=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,n){this._trace!==K.Trace.Off&&this.connection.sendNotification(K.LogTraceNotification.type,{message:e,verbose:this._trace===K.Trace.Verbose?n:void 0}).catch(()=>{})}},Df=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")})}},Af=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,ye.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,n){return(0,ye.attachPartialResult)(this.connection,n)}};Ye._LanguagesImpl=Af;var Fw=(0,MU.FoldingRangeFeature)((0,$U.MonikerFeature)((0,LU.DiagnosticFeature)((0,xU.InlayHintFeature)((0,OU.InlineValueFeature)((0,IU.TypeHierarchyFeature)((0,AU.LinkedEditingRangeFeature)((0,EU.SemanticTokensFeature)((0,wU.CallHierarchyFeature)(Af))))))))),If=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,ye.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,n){return(0,ye.attachPartialResult)(this.connection,n)}};Ye._NotebooksImpl=If;var Bw=(0,qU.NotebookSyncFeature)(If);function jw(t,e){return function(n){return e(t(n))}}Ye.combineConsoleFeatures=jw;function Uw(t,e){return function(n){return e(t(n))}}Ye.combineTelemetryFeatures=Uw;function Hw(t,e){return function(n){return e(t(n))}}Ye.combineTracerFeatures=Hw;function Vw(t,e){return function(n){return e(t(n))}}Ye.combineClientFeatures=Vw;function Ww(t,e){return function(n){return e(t(n))}}Ye.combineWindowFeatures=Ww;function zw(t,e){return function(n){return e(t(n))}}Ye.combineWorkspaceFeatures=zw;function Gw(t,e){return function(n){return e(t(n))}}Ye.combineLanguagesFeatures=Gw;function Yw(t,e){return function(n){return e(t(n))}}Ye.combineNotebooksFeatures=Yw;function FU(t,e){function n(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:n(t.console,e.console,jw),tracer:n(t.tracer,e.tracer,Hw),telemetry:n(t.telemetry,e.telemetry,Uw),client:n(t.client,e.client,Vw),window:n(t.window,e.window,Ww),workspace:n(t.workspace,e.workspace,zw),languages:n(t.languages,e.languages,Gw),notebooks:n(t.notebooks,e.notebooks,Yw)}}Ye.combineFeatures=FU;function BU(t,e,n){let r=n&&n.console?new(n.console(Rf)):new Rf,i=t(r);r.rawAttach(i);let s=n&&n.tracer?new(n.tracer(Cf)):new Cf,o=n&&n.telemetry?new(n.telemetry(Df)):new Df,a=n&&n.client?new(n.client(Ef)):new Ef,c=n&&n.window?new(n.window(xw)):new xw,l=n&&n.workspace?new(n.workspace($w)):new $w,u=n&&n.languages?new(n.languages(Fw)):new Fw,d=n&&n.notebooks?new(n.notebooks(Bw)):new Bw,f=[r,s,o,a,c,l,u,d];function p(b){return b instanceof Promise?b:kr.thenable(b)?new Promise((v,k)=>{b.then(R=>v(R),R=>k(R))}):Promise.resolve(b)}let m,h,y,S={listen:()=>i.listen(),sendRequest:(b,...v)=>i.sendRequest(kr.string(b)?b:b.method,...v),onRequest:(b,v)=>i.onRequest(b,v),sendNotification:(b,v)=>{let k=kr.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=>(y=b,{dispose:()=>{y=void 0}}),get console(){return r},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,ye.attachWorkDone)(i,v),void 0)),onCompletion:b=>i.onRequest(K.CompletionRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onCompletionResolve:b=>i.onRequest(K.CompletionResolveRequest.type,b),onSignatureHelp:b=>i.onRequest(K.SignatureHelpRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),void 0)),onDeclaration:b=>i.onRequest(K.DeclarationRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onDefinition:b=>i.onRequest(K.DefinitionRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onTypeDefinition:b=>i.onRequest(K.TypeDefinitionRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onImplementation:b=>i.onRequest(K.ImplementationRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onReferences:b=>i.onRequest(K.ReferencesRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onDocumentHighlight:b=>i.onRequest(K.DocumentHighlightRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onDocumentSymbol:b=>i.onRequest(K.DocumentSymbolRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onWorkspaceSymbol:b=>i.onRequest(K.WorkspaceSymbolRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onWorkspaceSymbolResolve:b=>i.onRequest(K.WorkspaceSymbolResolveRequest.type,b),onCodeAction:b=>i.onRequest(K.CodeActionRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.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,ye.attachWorkDone)(i,v),(0,ye.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,ye.attachWorkDone)(i,v),void 0)),onDocumentRangeFormatting:b=>i.onRequest(K.DocumentRangeFormattingRequest.type,(v,k)=>b(v,k,(0,ye.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,ye.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,ye.attachWorkDone)(i,v),(0,ye.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,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onColorPresentation:b=>i.onRequest(K.ColorPresentationRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onFoldingRanges:b=>i.onRequest(K.FoldingRangeRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onSelectionRanges:b=>i.onRequest(K.SelectionRangeRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),(0,ye.attachPartialResult)(i,v))),onExecuteCommand:b=>i.onRequest(K.ExecuteCommandRequest.type,(v,k)=>b(v,k,(0,ye.attachWorkDone)(i,v),void 0)),dispose:()=>i.dispose()};for(let b of f)b.attach(S);return i.onRequest(K.InitializeRequest.type,b=>{e.initialize(b),kr.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,ye.attachWorkDone)(i,b),void 0);return p(v).then(k=>{if(k instanceof K.ResponseError)return k;let R=k;R||(R={capabilities:{}});let q=R.capabilities;q||(q={},R.capabilities=q),q.textDocumentSync===void 0||q.textDocumentSync===null?q.textDocumentSync=kr.number(S.__textDocumentSync)?S.__textDocumentSync:K.TextDocumentSyncKind.None:!kr.number(q.textDocumentSync)&&!kr.number(q.textDocumentSync.change)&&(q.textDocumentSync.change=kr.number(S.__textDocumentSync)?S.__textDocumentSync:K.TextDocumentSyncKind.None);for(let O of f)O.fillServerCapabilities(q);return R})}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{y&&y()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(K.SetTraceNotification.type,b=>{s.trace=K.Trace.fromString(b.value)}),S}Ye.createConnection=BU});var Kw=N(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.resolveModulePath=Yn.FileSystem=Yn.resolveGlobalYarnPath=Yn.resolveGlobalNodePath=Yn.resolve=Yn.uriToFilePath=void 0;var jU=require("url"),Yr=require("path"),uT=require("fs"),hT=require("child_process");function UU(t){let e=jU.parse(t);if(e.protocol!=="file:"||!e.path)return;let n=e.path.split("/");for(var r=0,i=n.length;r<i;r++)n[r]=decodeURIComponent(n[r]);if(process.platform==="win32"&&n.length>1){let s=n[0],o=n[1];s.length===0&&o.length>1&&o[1]===":"&&n.shift()}return Yr.normalize(n.join("/"))}Yn.uriToFilePath=UU;function dT(){return process.platform==="win32"}function Of(t,e,n,r){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&&uT.existsSync(e)&&(l[i]?l[i]=e+Yr.delimiter+l[i]:l[i]=e,r&&r(`NODE_PATH value is: ${l[i]}`)),l.ELECTRON_RUN_AS_NODE="1";try{let u=(0,hT.fork)("",[],{cwd:n,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)}})}Yn.resolve=Of;function fT(t){let e="npm",n=Object.create(null);Object.keys(process.env).forEach(s=>n[s]=process.env[s]),n.NO_UPDATE_NOTIFIER="true";let r={encoding:"utf8",env:n};dT()&&(e="npm.cmd",r.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,hT.spawnSync)(e,["config","get","prefix"],r).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?dT()?Yr.join(o,"node_modules"):Yr.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}Yn.resolveGlobalNodePath=fT;function HU(t){let e="yarn",n={encoding:"utf8"};dT()&&(e="yarn.cmd",n.shell=!0);let r=()=>{};try{process.on("SIGPIPE",r);let i=(0,hT.spawnSync)(e,["global","dir","--json"],n),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 Yr.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",r)}}Yn.resolveGlobalYarnPath=HU;var pT;(function(t){let e;function n(){return e!==void 0||(process.platform==="win32"?e=!1:e=!uT.existsSync(__filename.toUpperCase())||!uT.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=n;function r(i,s){return n()?Yr.normalize(s).indexOf(Yr.normalize(i))===0:Yr.normalize(s).toLowerCase().indexOf(Yr.normalize(i).toLowerCase())===0}t.isParent=r})(pT||(Yn.FileSystem=pT={}));function VU(t,e,n,r){return n?(Yr.isAbsolute(n)||(n=Yr.join(t,n)),Of(e,n,n,r).then(i=>pT.isParent(n,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>Of(e,fT(r),t,r))):Of(e,fT(r),t,r)}Yn.resolveModulePath=VU});var mT=N((DZ,Xw)=>{"use strict";Xw.exports=$t()});var Jw=N(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});Mf.InlineCompletionFeature=void 0;var WU=$t(),zU=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(WU.InlineCompletionRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n)))}}};Mf.InlineCompletionFeature=zU});var eE=N(Nn=>{"use strict";var GU=Nn&&Nn.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),Zw=Nn&&Nn.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&GU(e,t,n)};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.ProposedFeatures=Nn.NotebookDocuments=Nn.TextDocuments=Nn.SemanticTokensBuilder=void 0;var YU=Jy();Object.defineProperty(Nn,"SemanticTokensBuilder",{enumerable:!0,get:function(){return YU.SemanticTokensBuilder}});var KU=Jw();Zw($t(),Nn);var XU=tT();Object.defineProperty(Nn,"TextDocuments",{enumerable:!0,get:function(){return XU.TextDocuments}});var JU=rT();Object.defineProperty(Nn,"NotebookDocuments",{enumerable:!0,get:function(){return JU.NotebookDocuments}});Zw(lT(),Nn);var Qw;(function(t){t.all={__brand:"features",languages:KU.InlineCompletionFeature}})(Qw||(Nn.ProposedFeatures=Qw={}))});var U=N(Nr=>{"use strict";var QU=Nr&&Nr.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),iE=Nr&&Nr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&QU(e,t,n)};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.createConnection=Nr.Files=void 0;var tE=require("node:util"),gT=vd(),ZU=lT(),Uc=Kw(),oo=mT();iE(mT(),Nr);iE(eE(),Nr);var nE;(function(t){t.uriToFilePath=Uc.uriToFilePath,t.resolveGlobalNodePath=Uc.resolveGlobalNodePath,t.resolveGlobalYarnPath=Uc.resolveGlobalYarnPath,t.resolve=Uc.resolve,t.resolveModulePath=Uc.resolveModulePath})(nE||(Nr.Files=nE={}));var rE;function xf(){if(rE!==void 0)try{rE.end()}catch{}}var la=!1,sE;function eH(){let t="--clientProcessId";function e(n){try{let r=parseInt(n);isNaN(r)||(sE=setInterval(()=>{try{process.kill(r,0)}catch{xf(),process.exit(la?0:1)}},3e3))}catch{}}for(let n=2;n<process.argv.length;n++){let r=process.argv[n];if(r===t&&n+1<process.argv.length){e(process.argv[n+1]);return}else{let i=r.split("=");i[0]===t&&e(i[1])}}}eH();var tH={initialize:t=>{let e=t.processId;gT.number(e)&&sE===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(la?0:1)}},3e3)},get shutdownReceived(){return la},set shutdownReceived(t){la=t},exit:t=>{xf(),process.exit(t)}};function nH(t,e,n,r){let i,s,o,a;return t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=n,n=r),oo.ConnectionStrategy.is(t)||oo.ConnectionOptions.is(t)?a=t:(s=t,o=e,a=n),rH(s,o,a,i)}Nr.createConnection=nH;function rH(t,e,n,r){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 oo.IPCMessageReader(process),e=new oo.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,oo.createServerSocketTransport)(c);t=d[0],e=d[1]}else if(l){let d=(0,oo.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(gT.func(t.read)&&gT.func(t.on)){let c=t;c.on("end",()=>{xf(),process.exit(la?0:1)}),c.on("close",()=>{xf(),process.exit(la?0:1)})}let a=c=>{let l=(0,oo.createProtocolConnection)(t,e,c,n);return i&&iH(c),l};return(0,ZU.createConnection)(a,tH,r)}function iH(t){function e(r){return r.map(i=>typeof i=="string"?i:(0,tE.inspect)(i)).join(" ")}let n=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=n.get(s)??0;o+=1,n.set(s,o),t.log(`${s}: ${s}`)},console.countReset=function(i){i===void 0?n.clear():n.delete(String(i))},console.debug=function(...i){t.log(e(i))},console.dir=function(i,s){t.log((0,tE.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 aE=N((xZ,oE)=>{"use strict";oE.exports=U()});var je=N(yn=>{"use strict";var Iv=Symbol.for("yaml.alias"),ex=Symbol.for("yaml.document"),Ih=Symbol.for("yaml.map"),tx=Symbol.for("yaml.pair"),Ov=Symbol.for("yaml.scalar"),Oh=Symbol.for("yaml.seq"),Qi=Symbol.for("yaml.node.type"),uz=t=>!!t&&typeof t=="object"&&t[Qi]===Iv,dz=t=>!!t&&typeof t=="object"&&t[Qi]===ex,fz=t=>!!t&&typeof t=="object"&&t[Qi]===Ih,pz=t=>!!t&&typeof t=="object"&&t[Qi]===tx,nx=t=>!!t&&typeof t=="object"&&t[Qi]===Ov,hz=t=>!!t&&typeof t=="object"&&t[Qi]===Oh;function rx(t){if(t&&typeof t=="object")switch(t[Qi]){case Ih:case Oh:return!0}return!1}function mz(t){if(t&&typeof t=="object")switch(t[Qi]){case Iv:case Ih:case Ov:case Oh:return!0}return!1}var gz=t=>(nx(t)||rx(t))&&!!t.anchor;yn.ALIAS=Iv;yn.DOC=ex;yn.MAP=Ih;yn.NODE_TYPE=Qi;yn.PAIR=tx;yn.SCALAR=Ov;yn.SEQ=Oh;yn.hasAnchor=gz;yn.isAlias=uz;yn.isCollection=rx;yn.isDocument=dz;yn.isMap=fz;yn.isNode=mz;yn.isPair=pz;yn.isScalar=nx;yn.isSeq=hz});var $l=N(Mv=>{"use strict";var en=je(),rr=Symbol("break visit"),ix=Symbol("skip children"),Ai=Symbol("remove node");function Mh(t,e){let n=sx(e);en.isDocument(t)?Wa(null,t.contents,n,Object.freeze([t]))===Ai&&(t.contents=null):Wa(null,t,n,Object.freeze([]))}Mh.BREAK=rr;Mh.SKIP=ix;Mh.REMOVE=Ai;function Wa(t,e,n,r){let i=ox(t,e,n,r);if(en.isNode(i)||en.isPair(i))return ax(t,r,i),Wa(t,i,n,r);if(typeof i!="symbol"){if(en.isCollection(e)){r=Object.freeze(r.concat(e));for(let s=0;s<e.items.length;++s){let o=Wa(s,e.items[s],n,r);if(typeof o=="number")s=o-1;else{if(o===rr)return rr;o===Ai&&(e.items.splice(s,1),s-=1)}}}else if(en.isPair(e)){r=Object.freeze(r.concat(e));let s=Wa("key",e.key,n,r);if(s===rr)return rr;s===Ai&&(e.key=null);let o=Wa("value",e.value,n,r);if(o===rr)return rr;o===Ai&&(e.value=null)}}return i}async function xh(t,e){let n=sx(e);en.isDocument(t)?await za(null,t.contents,n,Object.freeze([t]))===Ai&&(t.contents=null):await za(null,t,n,Object.freeze([]))}xh.BREAK=rr;xh.SKIP=ix;xh.REMOVE=Ai;async function za(t,e,n,r){let i=await ox(t,e,n,r);if(en.isNode(i)||en.isPair(i))return ax(t,r,i),za(t,i,n,r);if(typeof i!="symbol"){if(en.isCollection(e)){r=Object.freeze(r.concat(e));for(let s=0;s<e.items.length;++s){let o=await za(s,e.items[s],n,r);if(typeof o=="number")s=o-1;else{if(o===rr)return rr;o===Ai&&(e.items.splice(s,1),s-=1)}}}else if(en.isPair(e)){r=Object.freeze(r.concat(e));let s=await za("key",e.key,n,r);if(s===rr)return rr;s===Ai&&(e.key=null);let o=await za("value",e.value,n,r);if(o===rr)return rr;o===Ai&&(e.value=null)}}return i}function sx(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 ox(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(en.isMap(e))return n.Map?.(t,e,r);if(en.isSeq(e))return n.Seq?.(t,e,r);if(en.isPair(e))return n.Pair?.(t,e,r);if(en.isScalar(e))return n.Scalar?.(t,e,r);if(en.isAlias(e))return n.Alias?.(t,e,r)}function ax(t,e,n){let r=e[e.length-1];if(en.isCollection(r))r.items[t]=n;else if(en.isPair(r))t==="key"?r.key=n:r.value=n;else if(en.isDocument(r))r.contents=n;else{let i=en.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}Mv.visit=Mh;Mv.visitAsync=xh});var xv=N(lx=>{"use strict";var cx=je(),yz=$l(),Tz={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},vz=t=>t.replace(/[!,[\]{}]/g,e=>Tz[e]),Fl=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}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,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,o]=r;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(i)}catch(o){return n(String(o)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+vz(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&cx.isNode(e.contents)){let s={};yz.visit(e.contents,(o,a)=>{cx.isNode(a)&&a.tag&&(s[a.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of r)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(`
|
|
38
|
-
`)}};Fl.defaultYaml={explicit:!1,version:"1.2"};Fl.defaultTags={"!!":"tag:yaml.org,2002:"};lx.Directives=Fl});var Lh=N(Bl=>{"use strict";var ux=je(),bz=$l();function Sz(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function dx(t){let e=new Set;return bz.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function fx(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function _z(t,e){let n=[],r=new Map,i=null;return{onAnchor:s=>{n.push(s),i??(i=dx(t));let o=fx(e,i);return i.add(o),o},setAnchors:()=>{for(let s of n){let o=r.get(s);if(typeof o=="object"&&o.anchor&&(ux.isScalar(o.node)||ux.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:r}}Bl.anchorIsValid=Sz;Bl.anchorNames=dx;Bl.createNodeAnchors=_z;Bl.findNewAnchor=fx});var Lv=N(px=>{"use strict";function jl(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;i<s;++i){let o=r[i],a=jl(t,r,String(i),o);a===void 0?delete r[i]:a!==o&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let s=r.get(i),o=jl(t,r,i,s);o===void 0?r.delete(i):o!==s&&r.set(i,o)}else if(r instanceof Set)for(let i of Array.from(r)){let s=jl(t,r,i,i);s===void 0?r.delete(i):s!==i&&(r.delete(i),r.add(s))}else for(let[i,s]of Object.entries(r)){let o=jl(t,r,i,s);o===void 0?delete r[i]:o!==s&&(r[i]=o)}return t.call(e,n,r)}px.applyReviver=jl});var ws=N(mx=>{"use strict";var Pz=je();function hx(t,e,n){if(Array.isArray(t))return t.map((r,i)=>hx(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!Pz.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}mx.toJS=hx});var qh=N(yx=>{"use strict";var kz=Lv(),gx=je(),Nz=ws(),qv=class{constructor(e){Object.defineProperty(this,gx.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:n,maxAliasCount:r,onAnchor:i,reviver:s}={}){if(!gx.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Nz.toJS(this,"",o);if(typeof i=="function")for(let{count:c,res:l}of o.anchors.values())i(l,c);return typeof s=="function"?kz.applyReviver(s,{"":a},"",a):a}};yx.NodeBase=qv});var Ul=N(Tx=>{"use strict";var Rz=Lh(),wz=$l(),Ga=je(),Ez=qh(),Cz=ws(),$v=class extends Ez.NodeBase{constructor(e){super(Ga.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],wz.visit(e,{Node:(s,o)=>{(Ga.isAlias(o)||Ga.hasAnchor(o))&&r.push(o)}}),n&&(n.aliasResolveCache=r));let i;for(let s of r){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:s}=n,o=this.resolve(i,n);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(o);if(a||(Cz.toJS(o,null,n),a=r.get(o)),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=$h(i,o,r)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(Rz.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 $h(t,e,n){if(Ga.isAlias(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Ga.isCollection(e)){let r=0;for(let i of e.items){let s=$h(t,i,n);s>r&&(r=s)}return r}else if(Ga.isPair(e)){let r=$h(t,e.key,n),i=$h(t,e.value,n);return Math.max(r,i)}return 1}Tx.Alias=$v});var
|
|
38
|
+
`)}};Fl.defaultYaml={explicit:!1,version:"1.2"};Fl.defaultTags={"!!":"tag:yaml.org,2002:"};lx.Directives=Fl});var Lh=N(Bl=>{"use strict";var ux=je(),bz=$l();function Sz(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function dx(t){let e=new Set;return bz.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function fx(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function _z(t,e){let n=[],r=new Map,i=null;return{onAnchor:s=>{n.push(s),i??(i=dx(t));let o=fx(e,i);return i.add(o),o},setAnchors:()=>{for(let s of n){let o=r.get(s);if(typeof o=="object"&&o.anchor&&(ux.isScalar(o.node)||ux.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:r}}Bl.anchorIsValid=Sz;Bl.anchorNames=dx;Bl.createNodeAnchors=_z;Bl.findNewAnchor=fx});var Lv=N(px=>{"use strict";function jl(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;i<s;++i){let o=r[i],a=jl(t,r,String(i),o);a===void 0?delete r[i]:a!==o&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let s=r.get(i),o=jl(t,r,i,s);o===void 0?r.delete(i):o!==s&&r.set(i,o)}else if(r instanceof Set)for(let i of Array.from(r)){let s=jl(t,r,i,i);s===void 0?r.delete(i):s!==i&&(r.delete(i),r.add(s))}else for(let[i,s]of Object.entries(r)){let o=jl(t,r,i,s);o===void 0?delete r[i]:o!==s&&(r[i]=o)}return t.call(e,n,r)}px.applyReviver=jl});var ws=N(mx=>{"use strict";var Pz=je();function hx(t,e,n){if(Array.isArray(t))return t.map((r,i)=>hx(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!Pz.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}mx.toJS=hx});var qh=N(yx=>{"use strict";var kz=Lv(),gx=je(),Nz=ws(),qv=class{constructor(e){Object.defineProperty(this,gx.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:n,maxAliasCount:r,onAnchor:i,reviver:s}={}){if(!gx.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Nz.toJS(this,"",o);if(typeof i=="function")for(let{count:c,res:l}of o.anchors.values())i(l,c);return typeof s=="function"?kz.applyReviver(s,{"":a},"",a):a}};yx.NodeBase=qv});var Ul=N(Tx=>{"use strict";var Rz=Lh(),wz=$l(),Ga=je(),Ez=qh(),Cz=ws(),$v=class extends Ez.NodeBase{constructor(e){super(Ga.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],wz.visit(e,{Node:(s,o)=>{(Ga.isAlias(o)||Ga.hasAnchor(o))&&r.push(o)}}),n&&(n.aliasResolveCache=r));let i;for(let s of r){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:s}=n,o=this.resolve(i,n);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(o);if(a||(Cz.toJS(o,null,n),a=r.get(o)),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=$h(i,o,r)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(Rz.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 $h(t,e,n){if(Ga.isAlias(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Ga.isCollection(e)){let r=0;for(let i of e.items){let s=$h(t,i,n);s>r&&(r=s)}return r}else if(Ga.isPair(e)){let r=$h(t,e.key,n),i=$h(t,e.value,n);return Math.max(r,i)}return 1}Tx.Alias=$v});var Jt=N(Fv=>{"use strict";var Dz=je(),Az=qh(),Iz=ws(),Oz=t=>!t||typeof t!="function"&&typeof t!="object",Es=class extends Az.NodeBase{constructor(e){super(Dz.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Iz.toJS(this.value,e,n)}toString(){return String(this.value)}};Es.BLOCK_FOLDED="BLOCK_FOLDED";Es.BLOCK_LITERAL="BLOCK_LITERAL";Es.PLAIN="PLAIN";Es.QUOTE_DOUBLE="QUOTE_DOUBLE";Es.QUOTE_SINGLE="QUOTE_SINGLE";Fv.Scalar=Es;Fv.isScalarValue=Oz});var Hl=N(bx=>{"use strict";var Mz=Ul(),To=je(),vx=Jt(),xz="tag:yaml.org,2002:";function Lz(t,e,n){if(e){let r=n.filter(s=>s.tag===e),i=r.find(s=>!s.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(r=>r.identify?.(t)&&!r.format)}function qz(t,e,n){if(To.isDocument(t)&&(t=t.contents),To.isNode(t))return t;if(To.isPair(t)){let d=n.schema[To.MAP].createNode?.(n.schema,null,n);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:r,onAnchor:i,onTagObj:s,schema:o,sourceObjects:a}=n,c;if(r&&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=xz+e.slice(2));let l=Lz(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new vx.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?o[To.MAP]:Symbol.iterator in Object(t)?o[To.SEQ]:o[To.MAP]}s&&(s(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,t,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,t,n):new vx.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}bx.createNode=qz});var Bh=N(Fh=>{"use strict";var $z=Hl(),Ii=je(),Fz=qh();function Bv(t,e,n){let r=n;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]=r,r=o}else r=new Map([[s,r]])}return $z.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Sx=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,jv=class extends Fz.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>Ii.isNode(r)||Ii.isPair(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Sx(e))this.add(n);else{let[r,...i]=e,s=this.get(r,!0);if(Ii.isCollection(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,Bv(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(Ii.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,s=this.get(r,!0);return i.length===0?!n&&Ii.isScalar(s)?s.value:s:Ii.isCollection(s)?s.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!Ii.isPair(n))return!1;let r=n.value;return r==null||e&&Ii.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return Ii.isCollection(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let s=this.get(r,!0);if(Ii.isCollection(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,Bv(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};Fh.Collection=jv;Fh.collectionFromPath=Bv;Fh.isEmptyPath=Sx});var Vl=N(jh=>{"use strict";var Bz=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Uv(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var jz=(t,e,n)=>t.endsWith(`
|
|
39
39
|
`)?Uv(n,e):n.includes(`
|
|
40
40
|
`)?`
|
|
41
41
|
`+Uv(n,e):(t.endsWith(" ")?"":" ")+n;jh.indentComment=Uv;jh.lineComment=jz;jh.stringifyComment=Bz});var Px=N(Wl=>{"use strict";var Uz="flow",Hv="block",Uh="quoted";function Hz(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return t;i<s&&(s=0);let c=Math.max(1+s,1+i-e.length);if(t.length<=c)return t;let l=[],u={},d=i-e.length;typeof r=="number"&&(r>i-Math.max(2,s)?l.push(0):d=i-r);let f,p,m=!1,h=-1,y=-1,S=-1;n===Hv&&(h=_x(t,h,e.length),h!==-1&&(d=h+c));for(let v;v=t[h+=1];){if(n===Uh&&v==="\\"){switch(y=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}S=h}if(v===`
|
|
@@ -44,7 +44,7 @@ ${s}`)},console.warn=function(...i){t.warn(e(i))}}});var aE=N((xZ,oE)=>{"use str
|
|
|
44
44
|
`&&k!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(n===Uh){for(;p===" "||p===" ";)p=v,v=t[h+=1],m=!0;let k=h>S+1?h-2:y-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],R=l[v+1]||t.length;k===0?b=`
|
|
45
45
|
${e}${t.slice(0,R)}`:(n===Uh&&u[k]&&(b+=`${t[k]}\\`),b+=`
|
|
46
46
|
${e}${t.slice(k+1,R)}`)}return b}function _x(t,e,n){let r=e,i=e+1,s=t[i];for(;s===" "||s===" ";)if(e<i+n)s=t[++e];else{do s=t[++e];while(s&&s!==`
|
|
47
|
-
`);r=e,i=e+1,s=t[i]}return r}Wl.FOLD_BLOCK=Hv;Wl.FOLD_FLOW=Uz;Wl.FOLD_QUOTED=Uh;Wl.foldFlowLines=Hz});var Gl=N(kx=>{"use strict";var ci=
|
|
47
|
+
`);r=e,i=e+1,s=t[i]}return r}Wl.FOLD_BLOCK=Hv;Wl.FOLD_FLOW=Uz;Wl.FOLD_QUOTED=Uh;Wl.foldFlowLines=Hz});var Gl=N(kx=>{"use strict";var ci=Jt(),Cs=Px(),Vh=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Wh=t=>/^(%|---|\.\.\.)/m.test(t);function Vz(t,e,n){if(!e||e<0)return!1;let r=e-n,i=t.length;if(i<=r)return!1;for(let s=0,o=0;s<i;++s)if(t[s]===`
|
|
48
48
|
`){if(s-o>r)return!0;if(o=s+1,i-o<=r)return!1}return!0}function zl(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(Wh(t)?" ":""),o="",a=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{o+=n.slice(a,c);let u=n.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+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<i)c+=1;else{for(o+=n.slice(a,c)+`
|
|
49
49
|
|
|
50
50
|
`;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)o+=`
|
|
@@ -67,7 +67,7 @@ ${l}${b}${n}${p}`}function Wz(t,e,n,r){let{type:i,value:s}=t,{actualString:o,imp
|
|
|
67
67
|
`)?Ya(s,e):Hh(t,e,n,r);if(!a&&!u&&i!==ci.Scalar.PLAIN&&s.includes(`
|
|
68
68
|
`))return Hh(t,e,n,r);if(Wh(s)){if(c==="")return e.forceBlockIndent=!0,Hh(t,e,n,r);if(a&&c===l)return Ya(s,e)}let d=s.replace(/\n+/g,`$&
|
|
69
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 Ya(s,e)}return a?d:Cs.foldFlowLines(d,c,Cs.FOLD_FLOW,Vh(e,!1))}function zz(t,e,n,r){let{implicitKey:i,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==ci.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=ci.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ci.Scalar.BLOCK_FOLDED:case ci.Scalar.BLOCK_LITERAL:return i||s?Ya(o.value,e):Hh(o,e,n,r);case ci.Scalar.QUOTE_DOUBLE:return zl(o.value,e);case ci.Scalar.QUOTE_SINGLE:return Vv(o.value,e);case ci.Scalar.PLAIN:return Wz(o,e,n,r);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}kx.stringifyString=zz});var Yl=N(zv=>{"use strict";var Gz=Lh(),Ds=je(),Yz=Vl(),Kz=Gl();function Xz(t,e){let n=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,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Jz(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 n,r;if(Ds.isScalar(e)){r=e.value;let i=t.filter(s=>s.identify?.(r));if(i.length>1){let s=i.filter(o=>o.test);s.length>0&&(i=s)}n=i.find(s=>s.format===e.format)??i.find(s=>!s.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Qz(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],s=(Ds.isScalar(t)||Ds.isCollection(t))&&t.anchor;s&&Gz.anchorIsValid(s)&&(n.add(s),i.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&i.push(r.directives.tagString(o)),i.join(" ")}function Zz(t,e,n,r){if(Ds.isPair(t))return t.toString(e,n,r);if(Ds.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=Ds.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Jz(e.doc.schema.tags,s));let o=Qz(s,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(s,e,n,r):Ds.isScalar(s)?Kz.stringifyString(s,e,n,r):s.toString(e,n,r);return o?Ds.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
70
|
-
${e.indent}${a}`:a}zv.createStringifyContext=Xz;zv.stringify=Zz});var Ex=N(wx=>{"use strict";var Zi=je(),Nx=
|
|
70
|
+
${e.indent}${a}`:a}zv.createStringifyContext=Xz;zv.stringify=Zz});var Ex=N(wx=>{"use strict";var Zi=je(),Nx=Jt(),Rx=Yl(),Kl=Vl();function e2({key:t,value:e},n,r,i){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=Zi.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Zi.isCollection(t)||!Zi.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&&!n.inFlow||Zi.isCollection(t)||(Zi.isScalar(t)?t.type===Nx.Scalar.BLOCK_FOLDED||t.type===Nx.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!s),indent:a+c});let m=!1,h=!1,y=Rx.stringify(t,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&y.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(s||e==null)return m&&r&&r(),y===""?"?":p?`? ${y}`:y}else if(s&&!d||e==null&&p)return y=`? ${y}`,f&&!m?y+=Kl.lineComment(y,n.indent,l(f)):h&&i&&i(),y;m&&(f=null),p?(f&&(y+=Kl.lineComment(y,n.indent,l(f))),y=`? ${y}
|
|
71
71
|
${a}:`):(y=`${y}:`,f&&(y+=Kl.lineComment(y,n.indent,l(f))));let S,b,v;Zi.isNode(e)?(S=!!e.spaceBefore,b=e.commentBefore,v=e.comment):(S=!1,b=null,v=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!p&&!f&&Zi.isScalar(e)&&(n.indentAtStart=y.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Zi.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let k=!1,R=Rx.stringify(e,n,()=>k=!0,()=>h=!0),q=" ";if(f||S||b){if(q=S?`
|
|
72
72
|
`:"",b){let O=l(b);q+=`
|
|
73
73
|
${Kl.indentComment(O,n.indent)}`}R===""&&!n.inFlow?q===`
|
|
@@ -77,17 +77,17 @@ ${Kl.indentComment(O,n.indent)}`}R===""&&!n.inFlow?q===`
|
|
|
77
77
|
${n.indent}`}else if(!p&&Zi.isCollection(e)){let O=R[0],B=R.indexOf(`
|
|
78
78
|
`),Pe=B!==-1,Qe=n.inFlow??e.flow??e.items.length===0;if(Pe||!Qe){let Et=!1;if(Pe&&(O==="&"||O==="!")){let ke=R.indexOf(" ");O==="&"&&ke!==-1&&ke<B&&R[ke+1]==="!"&&(ke=R.indexOf(" ",ke+1)),(ke===-1||B<ke)&&(Et=!0)}Et||(q=`
|
|
79
79
|
${n.indent}`)}}else(R===""||R[0]===`
|
|
80
|
-
`)&&(q="");return y+=q+R,n.inFlow?k&&r&&r():v&&!k?y+=Kl.lineComment(y,n.indent,l(v)):h&&i&&i(),y}wx.stringifyPair=e2});var Yv=N(Gv=>{"use strict";var Cx=require("process");function t2(t,...e){t==="debug"&&console.log(...e)}function n2(t,e){(t==="debug"||t==="warn")&&(typeof Cx.emitWarning=="function"?Cx.emitWarning(e):console.warn(e))}Gv.debug=t2;Gv.warn=n2});var Kh=N(Yh=>{"use strict";var Xl=je(),Dx=
|
|
80
|
+
`)&&(q="");return y+=q+R,n.inFlow?k&&r&&r():v&&!k?y+=Kl.lineComment(y,n.indent,l(v)):h&&i&&i(),y}wx.stringifyPair=e2});var Yv=N(Gv=>{"use strict";var Cx=require("process");function t2(t,...e){t==="debug"&&console.log(...e)}function n2(t,e){(t==="debug"||t==="warn")&&(typeof Cx.emitWarning=="function"?Cx.emitWarning(e):console.warn(e))}Gv.debug=t2;Gv.warn=n2});var Kh=N(Yh=>{"use strict";var Xl=je(),Dx=Jt(),zh="<<",Gh={identify:t=>t===zh||typeof t=="symbol"&&t.description===zh,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Dx.Scalar(Symbol(zh)),{addToJSMap:Ax}),stringify:()=>zh},r2=(t,e)=>(Gh.identify(e)||Xl.isScalar(e)&&(!e.type||e.type===Dx.Scalar.PLAIN)&&Gh.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Gh.tag&&n.default);function Ax(t,e,n){if(n=t&&Xl.isAlias(n)?n.resolve(t.doc):n,Xl.isSeq(n))for(let r of n.items)Kv(t,e,r);else if(Array.isArray(n))for(let r of n)Kv(t,e,r);else Kv(t,e,n)}function Kv(t,e,n){let r=t&&Xl.isAlias(n)?n.resolve(t.doc):n;if(!Xl.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[s,o]of i)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}Yh.addMergeToJSMap=Ax;Yh.isMergeKey=r2;Yh.merge=Gh});var Jv=N(Mx=>{"use strict";var i2=Yv(),Ix=Kh(),s2=Yl(),Ox=je(),Xv=ws();function o2(t,e,{key:n,value:r}){if(Ox.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(Ix.isMergeKey(t,n))Ix.addMergeToJSMap(t,e,r);else{let i=Xv.toJS(n,"",t);if(e instanceof Map)e.set(i,Xv.toJS(r,i,t));else if(e instanceof Set)e.add(i);else{let s=a2(n,i,t),o=Xv.toJS(r,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function a2(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(Ox.isNode(t)&&n?.doc){let r=s2.createStringifyContext(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),i2.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}Mx.addPairToJSMap=o2});var As=N(Qv=>{"use strict";var xx=Hl(),c2=Ex(),l2=Jv(),Xh=je();function u2(t,e,n){let r=xx.createNode(t,void 0,n),i=xx.createNode(e,void 0,n);return new Jh(r,i)}var Jh=class t{constructor(e,n=null){Object.defineProperty(this,Xh.NODE_TYPE,{value:Xh.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return Xh.isNode(n)&&(n=n.clone(e)),Xh.isNode(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return l2.addPairToJSMap(n,r,this)}toString(e,n,r){return e?.doc?c2.stringifyPair(this,e,n,r):JSON.stringify(this)}};Qv.Pair=Jh;Qv.createPair=u2});var Zv=N(qx=>{"use strict";var vo=je(),Lx=Yl(),Qh=Vl();function d2(t,e,n){return(e.inFlow??t.flow?p2:f2)(t,e,n)}function f2({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:s,type:null}),d=!1,f=[];for(let m=0;m<e.length;++m){let h=e[m],y=null;if(vo.isNode(h))!d&&h.spaceBefore&&f.push(""),Zh(n,f,h.commentBefore,d),h.comment&&(y=h.comment);else if(vo.isPair(h)){let b=vo.isNode(h.key)?h.key:null;b&&(!d&&b.spaceBefore&&f.push(""),Zh(n,f,b.commentBefore,d))}d=!1;let S=Lx.stringify(h,u,()=>y=null,()=>d=!0);y&&(S+=Qh.lineComment(S,s,l(y))),d&&y&&(d=!1),f.push(r+S)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m<f.length;++m){let h=f[m];p+=h?`
|
|
81
81
|
${c}${h}`:`
|
|
82
82
|
`}}return t?(p+=`
|
|
83
83
|
`+Qh.indentComment(l(t),c),a&&a()):d&&o&&o(),p}function p2({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:s,flowCollectionPadding:o,options:{commentString:a}}=e;r+=s;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;m<t.length;++m){let h=t[m],y=null;if(vo.isNode(h))h.spaceBefore&&d.push(""),Zh(e,d,h.commentBefore,!1),h.comment&&(y=h.comment);else if(vo.isPair(h)){let b=vo.isNode(h.key)?h.key:null;b&&(b.spaceBefore&&d.push(""),Zh(e,d,b.commentBefore,!1),b.comment&&(l=!0));let v=vo.isNode(h.value)?h.value:null;v?(v.comment&&(y=v.comment),v.commentBefore&&(l=!0)):h.value==null&&b?.comment&&(y=b.comment)}y&&(l=!0);let S=Lx.stringify(h,c,()=>y=null);l||(l=d.length>u||S.includes(`
|
|
84
84
|
`)),m<t.length-1?S+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=d.reduce((b,v)=>b+v.length+2,2)+(S.length+2)>e.options.lineWidth)),l&&(S+=",")),y&&(S+=Qh.lineComment(S,r,a(y))),d.push(S),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,y)=>h+y.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?`
|
|
85
85
|
${s}${i}${h}`:`
|
|
86
86
|
`;return`${m}
|
|
87
|
-
${i}${p}`}else return`${f}${o}${d.join(" ")}${o}${p}`}function Zh({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let s=Qh.indentComment(e(r),t);n.push(s.trimStart())}}qx.stringifyCollection=d2});var Os=N(tb=>{"use strict";var h2=Zv(),m2=Jv(),g2=Bh(),Is=je(),em=As(),y2=
|
|
88
|
-
`:" ")}return X2.stringifyString({comment:t,type:e,value:a},r,i,s)}};rL.binary=J2});var um=N(lm=>{"use strict";var cm=je(),fb=As(),Q2=
|
|
87
|
+
${i}${p}`}else return`${f}${o}${d.join(" ")}${o}${p}`}function Zh({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let s=Qh.indentComment(e(r),t);n.push(s.trimStart())}}qx.stringifyCollection=d2});var Os=N(tb=>{"use strict";var h2=Zv(),m2=Jv(),g2=Bh(),Is=je(),em=As(),y2=Jt();function Jl(t,e){let n=Is.isScalar(e)?e.value:e;for(let r of t)if(Is.isPair(r)&&(r.key===e||r.key===n||Is.isScalar(r.key)&&r.key.value===n))return r}var eb=class extends g2.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Is.MAP,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:s}=r,o=new this(e),a=(c,l)=>{if(typeof s=="function")l=s.call(n,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||i)&&o.items.push(em.createPair(c,l,r))};if(n instanceof Map)for(let[c,l]of n)a(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let r;Is.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new em.Pair(e,e?.value):r=new em.Pair(e.key,e.value);let i=Jl(this.items,r.key),s=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Is.isScalar(i.value)&&y2.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(s){let o=this.items.findIndex(a=>s(r,a)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let n=Jl(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=Jl(this.items,e)?.value;return(!n&&Is.isScalar(i)?i.value:i)??void 0}has(e){return!!Jl(this.items,e)}set(e,n){this.add(new em.Pair(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let s of this.items)m2.addPairToJSMap(n,i,s);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Is.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),h2.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};tb.YAMLMap=eb;tb.findPair=Jl});var Ka=N(Fx=>{"use strict";var T2=je(),$x=Os(),v2={collection:"map",default:!0,nodeClass:$x.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return T2.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>$x.YAMLMap.from(t,e,n)};Fx.map=v2});var Ms=N(Bx=>{"use strict";var b2=Hl(),S2=Zv(),_2=Bh(),nm=je(),P2=Jt(),k2=ws(),nb=class extends _2.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(nm.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=tm(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=tm(e);if(typeof r!="number")return;let i=this.items[r];return!n&&nm.isScalar(i)?i.value:i}has(e){let n=tm(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=tm(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];nm.isScalar(i)&&P2.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let s of this.items)r.push(k2.toJS(s,String(i++),n));return r}toString(e,n,r){return e?S2.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,s=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof i=="function"){let c=n instanceof Set?a:String(o++);a=i.call(n,c,a)}s.items.push(b2.createNode(a,void 0,r))}}return s}};function tm(t){let e=nm.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Bx.YAMLSeq=nb});var Xa=N(Ux=>{"use strict";var N2=je(),jx=Ms(),R2={collection:"seq",default:!0,nodeClass:jx.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return N2.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>jx.YAMLSeq.from(t,e,n)};Ux.seq=R2});var Ql=N(Hx=>{"use strict";var w2=Gl(),E2={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),w2.stringifyString(t,e,n,r)}};Hx.string=E2});var rm=N(zx=>{"use strict";var Vx=Jt(),Wx={identify:t=>t==null,createNode:()=>new Vx.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Vx.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Wx.test.test(t)?t:e.options.nullStr};zx.nullTag=Wx});var rb=N(Yx=>{"use strict";var C2=Jt(),Gx={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new C2.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Gx.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};Yx.boolTag=Gx});var Ja=N(Kx=>{"use strict";function D2({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(s)){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}Kx.stringifyNumber=D2});var sb=N(im=>{"use strict";var A2=Jt(),ib=Ja(),I2={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:ib.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),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():ib.stringifyNumber(t)}},M2={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 A2.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:ib.stringifyNumber};im.float=M2;im.floatExp=O2;im.floatNaN=I2});var ab=N(om=>{"use strict";var Xx=Ja(),sm=t=>typeof t=="bigint"||Number.isInteger(t),ob=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function Jx(t,e,n){let{value:r}=t;return sm(r)&&r>=0?n+r.toString(e):Xx.stringifyNumber(t)}var x2={identify:t=>sm(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>ob(t,2,8,n),stringify:t=>Jx(t,8,"0o")},L2={identify:sm,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>ob(t,0,10,n),stringify:Xx.stringifyNumber},q2={identify:t=>sm(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>ob(t,2,16,n),stringify:t=>Jx(t,16,"0x")};om.int=L2;om.intHex=q2;om.intOct=x2});var Zx=N(Qx=>{"use strict";var $2=Ka(),F2=rm(),B2=Xa(),j2=Ql(),U2=rb(),cb=sb(),lb=ab(),H2=[$2.map,B2.seq,j2.string,F2.nullTag,U2.boolTag,lb.intOct,lb.int,lb.intHex,cb.floatNaN,cb.floatExp,cb.float];Qx.schema=H2});var nL=N(tL=>{"use strict";var V2=Jt(),W2=Ka(),z2=Xa();function eL(t){return typeof t=="bigint"||Number.isInteger(t)}var am=({value:t})=>JSON.stringify(t),G2=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:am},{identify:t=>t==null,createNode:()=>new V2.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:am},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:am},{identify:eL,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>eL(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:am}],Y2={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},K2=[W2.map,z2.seq].concat(G2,Y2);tL.schema=K2});var db=N(rL=>{"use strict";var Zl=require("buffer"),ub=Jt(),X2=Gl(),J2={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Zl.Buffer=="function")return Zl.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},r,i,s){if(!n)return"";let o=n,a;if(typeof Zl.Buffer=="function")a=o instanceof Zl.Buffer?o.toString("base64"):Zl.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=ub.Scalar.BLOCK_LITERAL),e!==ub.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=a.substr(f,c);a=u.join(e===ub.Scalar.BLOCK_LITERAL?`
|
|
88
|
+
`:" ")}return X2.stringifyString({comment:t,type:e,value:a},r,i,s)}};rL.binary=J2});var um=N(lm=>{"use strict";var cm=je(),fb=As(),Q2=Jt(),Z2=Ms();function iL(t,e){if(cm.isSeq(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!cm.isPair(r)){if(cm.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new fb.Pair(new Q2.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
|
|
89
89
|
${i.key.commentBefore}`:r.commentBefore),r.comment){let s=i.value??i.key;s.comment=s.comment?`${r.comment}
|
|
90
|
-
${s.comment}`:r.comment}r=i}t.items[n]=cm.isPair(r)?r:new fb.Pair(r)}}else e("Expected a sequence for this tag");return t}function sL(t,e,n){let{replacer:r}=n,i=new Z2.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 r=="function"&&(o=r.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(fb.createPair(a,c,n))}return i}var eG={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:iL,createNode:sL};lm.createPairs=sL;lm.pairs=eG;lm.resolvePairs=iL});var mb=N(hb=>{"use strict";var oL=je(),pb=ws(),eu=Os(),tG=Ms(),aL=um(),bo=class t extends tG.YAMLSeq{constructor(){super(),this.add=eu.YAMLMap.prototype.add.bind(this),this.delete=eu.YAMLMap.prototype.delete.bind(this),this.get=eu.YAMLMap.prototype.get.bind(this),this.has=eu.YAMLMap.prototype.has.bind(this),this.set=eu.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let s,o;if(oL.isPair(i)?(s=pb.toJS(i.key,"",n),o=pb.toJS(i.value,s,n)):s=pb.toJS(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,o)}return r}static from(e,n,r){let i=aL.createPairs(e,n,r),s=new this;return s.items=i.items,s}};bo.tag="tag:yaml.org,2002:omap";var nG={collection:"seq",identify:t=>t instanceof Map,nodeClass:bo,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=aL.resolvePairs(t,e),r=[];for(let{key:i}of n.items)oL.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new bo,n)},createNode:(t,e,n)=>bo.from(t,e,n)};hb.YAMLOMap=bo;hb.omap=nG});var fL=N(gb=>{"use strict";var cL=Xt();function lL({value:t,source:e},n){return e&&(t?uL:dL).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var uL={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 cL.Scalar(!0),stringify:lL},dL={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 cL.Scalar(!1),stringify:lL};gb.falseTag=dL;gb.trueTag=uL});var pL=N(dm=>{"use strict";var rG=Xt(),yb=Ja(),iG={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:yb.stringifyNumber},sG={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():yb.stringifyNumber(t)}},oG={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 rG.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:yb.stringifyNumber};dm.float=oG;dm.floatExp=sG;dm.floatNaN=iG});var mL=N(nu=>{"use strict";var hL=Ja(),tu=t=>typeof t=="bigint"||Number.isInteger(t);function fm(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){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,n);return i==="-"?-1*s:s}function Tb(t,e,n){let{value:r}=t;if(tu(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return hL.stringifyNumber(t)}var aG={identify:tu,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>fm(t,2,2,n),stringify:t=>Tb(t,2,"0b")},cG={identify:tu,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>fm(t,1,8,n),stringify:t=>Tb(t,8,"0")},lG={identify:tu,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>fm(t,0,10,n),stringify:hL.stringifyNumber},uG={identify:tu,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>fm(t,2,16,n),stringify:t=>Tb(t,16,"0x")};nu.int=lG;nu.intBin=aG;nu.intHex=uG;nu.intOct=cG});var bb=N(vb=>{"use strict";var mm=je(),pm=As(),hm=Os(),So=class t extends hm.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;mm.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new pm.Pair(e.key,null):n=new pm.Pair(e,null),hm.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=hm.findPair(this.items,e);return!n&&mm.isPair(r)?mm.isScalar(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=hm.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new pm.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),s.items.push(pm.createPair(o,null,r));return s}};So.tag="tag:yaml.org,2002:set";var dG={collection:"map",identify:t=>t instanceof Set,nodeClass:So,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>So.from(t,e,n),resolve(t,e){if(mm.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new So,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};vb.YAMLSet=So;vb.set=dG});var _b=N(gm=>{"use strict";var fG=Ja();function Sb(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=r.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*s:s}function gL(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return fG.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(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))),r+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var pG={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:n})=>Sb(t,n),stringify:gL},hG={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=>Sb(t,!1),stringify:gL},yL={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(yL.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,s||0,o||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=Sb(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$/,"")??""};gm.floatTime=hG;gm.intTime=pG;gm.timestamp=yL});var bL=N(vL=>{"use strict";var mG=Ka(),gG=rm(),yG=Xa(),TG=Ql(),vG=db(),TL=fL(),Pb=pL(),ym=mL(),bG=Kh(),SG=mb(),_G=um(),PG=bb(),kb=_b(),kG=[mG.map,yG.seq,TG.string,gG.nullTag,TL.trueTag,TL.falseTag,ym.intBin,ym.intOct,ym.int,ym.intHex,Pb.floatNaN,Pb.floatExp,Pb.float,vG.binary,bG.merge,SG.omap,_G.pairs,PG.set,kb.intTime,kb.floatTime,kb.timestamp];vL.schema=kG});var DL=N(wb=>{"use strict";var kL=Ka(),NG=rm(),NL=Xa(),RG=Ql(),wG=rb(),Nb=sb(),Rb=ab(),EG=Zx(),CG=nL(),RL=db(),ru=Kh(),wL=mb(),EL=um(),SL=bL(),CL=bb(),Tm=_b(),_L=new Map([["core",EG.schema],["failsafe",[kL.map,NL.seq,RG.string]],["json",CG.schema],["yaml11",SL.schema],["yaml-1.1",SL.schema]]),PL={binary:RL.binary,bool:wG.boolTag,float:Nb.float,floatExp:Nb.floatExp,floatNaN:Nb.floatNaN,floatTime:Tm.floatTime,int:Rb.int,intHex:Rb.intHex,intOct:Rb.intOct,intTime:Tm.intTime,map:kL.map,merge:ru.merge,null:NG.nullTag,omap:wL.omap,pairs:EL.pairs,seq:NL.seq,set:CL.set,timestamp:Tm.timestamp},DG={"tag:yaml.org,2002:binary":RL.binary,"tag:yaml.org,2002:merge":ru.merge,"tag:yaml.org,2002:omap":wL.omap,"tag:yaml.org,2002:pairs":EL.pairs,"tag:yaml.org,2002:set":CL.set,"tag:yaml.org,2002:timestamp":Tm.timestamp};function AG(t,e,n){let r=_L.get(e);if(r&&!t)return n&&!r.includes(ru.merge)?r.concat(ru.merge):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let s=Array.from(_L.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 n&&(i=i.concat(ru.merge)),i.reduce((s,o)=>{let a=typeof o=="string"?PL[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(PL).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},[])}wb.coreKnownTags=DG;wb.getTags=AG});var Db=N(AL=>{"use strict";var Eb=je(),IG=Ka(),OG=Xa(),MG=Ql(),vm=DL(),xG=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Cb=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?vm.getTags(e,"compat"):e?vm.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?vm.coreKnownTags:{},this.tags=vm.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Eb.MAP,{value:IG.map}),Object.defineProperty(this,Eb.SCALAR,{value:MG.string}),Object.defineProperty(this,Eb.SEQ,{value:OG.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?xG:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};AL.Schema=Cb});var OL=N(IL=>{"use strict";var LG=je(),Ab=Yl(),iu=Vl();function qG(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=Ab.createStringifyContext(t,e),{commentString:s}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(iu.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(LG.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let u=s(t.contents.commentBefore);n.push(iu.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=Ab.stringify(t.contents,i,()=>a=null,c);a&&(l+=iu.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(Ab.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
|
|
90
|
+
${s.comment}`:r.comment}r=i}t.items[n]=cm.isPair(r)?r:new fb.Pair(r)}}else e("Expected a sequence for this tag");return t}function sL(t,e,n){let{replacer:r}=n,i=new Z2.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 r=="function"&&(o=r.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(fb.createPair(a,c,n))}return i}var eG={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:iL,createNode:sL};lm.createPairs=sL;lm.pairs=eG;lm.resolvePairs=iL});var mb=N(hb=>{"use strict";var oL=je(),pb=ws(),eu=Os(),tG=Ms(),aL=um(),bo=class t extends tG.YAMLSeq{constructor(){super(),this.add=eu.YAMLMap.prototype.add.bind(this),this.delete=eu.YAMLMap.prototype.delete.bind(this),this.get=eu.YAMLMap.prototype.get.bind(this),this.has=eu.YAMLMap.prototype.has.bind(this),this.set=eu.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let s,o;if(oL.isPair(i)?(s=pb.toJS(i.key,"",n),o=pb.toJS(i.value,s,n)):s=pb.toJS(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,o)}return r}static from(e,n,r){let i=aL.createPairs(e,n,r),s=new this;return s.items=i.items,s}};bo.tag="tag:yaml.org,2002:omap";var nG={collection:"seq",identify:t=>t instanceof Map,nodeClass:bo,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=aL.resolvePairs(t,e),r=[];for(let{key:i}of n.items)oL.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new bo,n)},createNode:(t,e,n)=>bo.from(t,e,n)};hb.YAMLOMap=bo;hb.omap=nG});var fL=N(gb=>{"use strict";var cL=Jt();function lL({value:t,source:e},n){return e&&(t?uL:dL).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var uL={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 cL.Scalar(!0),stringify:lL},dL={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 cL.Scalar(!1),stringify:lL};gb.falseTag=dL;gb.trueTag=uL});var pL=N(dm=>{"use strict";var rG=Jt(),yb=Ja(),iG={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:yb.stringifyNumber},sG={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():yb.stringifyNumber(t)}},oG={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 rG.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:yb.stringifyNumber};dm.float=oG;dm.floatExp=sG;dm.floatNaN=iG});var mL=N(nu=>{"use strict";var hL=Ja(),tu=t=>typeof t=="bigint"||Number.isInteger(t);function fm(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){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,n);return i==="-"?-1*s:s}function Tb(t,e,n){let{value:r}=t;if(tu(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return hL.stringifyNumber(t)}var aG={identify:tu,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>fm(t,2,2,n),stringify:t=>Tb(t,2,"0b")},cG={identify:tu,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>fm(t,1,8,n),stringify:t=>Tb(t,8,"0")},lG={identify:tu,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>fm(t,0,10,n),stringify:hL.stringifyNumber},uG={identify:tu,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>fm(t,2,16,n),stringify:t=>Tb(t,16,"0x")};nu.int=lG;nu.intBin=aG;nu.intHex=uG;nu.intOct=cG});var bb=N(vb=>{"use strict";var mm=je(),pm=As(),hm=Os(),So=class t extends hm.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;mm.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new pm.Pair(e.key,null):n=new pm.Pair(e,null),hm.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=hm.findPair(this.items,e);return!n&&mm.isPair(r)?mm.isScalar(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=hm.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new pm.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),s.items.push(pm.createPair(o,null,r));return s}};So.tag="tag:yaml.org,2002:set";var dG={collection:"map",identify:t=>t instanceof Set,nodeClass:So,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>So.from(t,e,n),resolve(t,e){if(mm.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new So,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};vb.YAMLSet=So;vb.set=dG});var _b=N(gm=>{"use strict";var fG=Ja();function Sb(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=r.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*s:s}function gL(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return fG.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(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))),r+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var pG={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:n})=>Sb(t,n),stringify:gL},hG={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=>Sb(t,!1),stringify:gL},yL={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(yL.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,s||0,o||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=Sb(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$/,"")??""};gm.floatTime=hG;gm.intTime=pG;gm.timestamp=yL});var bL=N(vL=>{"use strict";var mG=Ka(),gG=rm(),yG=Xa(),TG=Ql(),vG=db(),TL=fL(),Pb=pL(),ym=mL(),bG=Kh(),SG=mb(),_G=um(),PG=bb(),kb=_b(),kG=[mG.map,yG.seq,TG.string,gG.nullTag,TL.trueTag,TL.falseTag,ym.intBin,ym.intOct,ym.int,ym.intHex,Pb.floatNaN,Pb.floatExp,Pb.float,vG.binary,bG.merge,SG.omap,_G.pairs,PG.set,kb.intTime,kb.floatTime,kb.timestamp];vL.schema=kG});var DL=N(wb=>{"use strict";var kL=Ka(),NG=rm(),NL=Xa(),RG=Ql(),wG=rb(),Nb=sb(),Rb=ab(),EG=Zx(),CG=nL(),RL=db(),ru=Kh(),wL=mb(),EL=um(),SL=bL(),CL=bb(),Tm=_b(),_L=new Map([["core",EG.schema],["failsafe",[kL.map,NL.seq,RG.string]],["json",CG.schema],["yaml11",SL.schema],["yaml-1.1",SL.schema]]),PL={binary:RL.binary,bool:wG.boolTag,float:Nb.float,floatExp:Nb.floatExp,floatNaN:Nb.floatNaN,floatTime:Tm.floatTime,int:Rb.int,intHex:Rb.intHex,intOct:Rb.intOct,intTime:Tm.intTime,map:kL.map,merge:ru.merge,null:NG.nullTag,omap:wL.omap,pairs:EL.pairs,seq:NL.seq,set:CL.set,timestamp:Tm.timestamp},DG={"tag:yaml.org,2002:binary":RL.binary,"tag:yaml.org,2002:merge":ru.merge,"tag:yaml.org,2002:omap":wL.omap,"tag:yaml.org,2002:pairs":EL.pairs,"tag:yaml.org,2002:set":CL.set,"tag:yaml.org,2002:timestamp":Tm.timestamp};function AG(t,e,n){let r=_L.get(e);if(r&&!t)return n&&!r.includes(ru.merge)?r.concat(ru.merge):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let s=Array.from(_L.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 n&&(i=i.concat(ru.merge)),i.reduce((s,o)=>{let a=typeof o=="string"?PL[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(PL).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},[])}wb.coreKnownTags=DG;wb.getTags=AG});var Db=N(AL=>{"use strict";var Eb=je(),IG=Ka(),OG=Xa(),MG=Ql(),vm=DL(),xG=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Cb=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?vm.getTags(e,"compat"):e?vm.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?vm.coreKnownTags:{},this.tags=vm.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Eb.MAP,{value:IG.map}),Object.defineProperty(this,Eb.SCALAR,{value:MG.string}),Object.defineProperty(this,Eb.SEQ,{value:OG.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?xG:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};AL.Schema=Cb});var OL=N(IL=>{"use strict";var LG=je(),Ab=Yl(),iu=Vl();function qG(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=Ab.createStringifyContext(t,e),{commentString:s}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(iu.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(LG.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let u=s(t.contents.commentBefore);n.push(iu.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=Ab.stringify(t.contents,i,()=>a=null,c);a&&(l+=iu.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(Ab.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
|
|
91
91
|
`)?(n.push("..."),n.push(iu.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(iu.indentComment(s(c),"")))}return n.join(`
|
|
92
92
|
`)+`
|
|
93
93
|
`}IL.stringifyDocument=qG});var su=N(ML=>{"use strict";var $G=Ul(),Qa=Bh(),xr=je(),FG=As(),BG=ws(),jG=Db(),UG=OL(),Ib=Lh(),HG=Lv(),VG=Hl(),Ob=xv(),Mb=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,xr.NODE_TYPE,{value:xr.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:o}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Ob.Directives({version:o}),this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[xr.NODE_TYPE]:{value:xr.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=xr.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Za(this.contents)&&this.contents.add(e)}addIn(e,n){Za(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=Ib.anchorNames(this);e.anchor=!n||r.has(n)?Ib.findNewAnchor(n||"a",r):n}return new $G.Alias(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let y=b=>typeof b=="number"||b instanceof String||b instanceof Number,S=n.filter(y).map(String);S.length>0&&(n=n.concat(S)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=Ib.createNodeAnchors(this,o||"a"),m={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=VG.createNode(e,u,m);return a&&xr.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,n,r={}){let i=this.createNode(e,null,r),s=this.createNode(n,null,r);return new FG.Pair(i,s)}delete(e){return Za(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Qa.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Za(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return xr.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return Qa.isEmptyPath(e)?!n&&xr.isScalar(this.contents)?this.contents.value:this.contents:xr.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return xr.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Qa.isEmptyPath(e)?this.contents!==void 0:xr.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=Qa.collectionFromPath(this.schema,[e],n):Za(this.contents)&&this.contents.set(e,n)}setIn(e,n){Qa.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=Qa.collectionFromPath(this.schema,Array.from(e),n):Za(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ob.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Ob.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=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(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new jG.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:s,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=BG.toJS(this.contents,n??"",a);if(typeof s=="function")for(let{count:l,res:u}of a.anchors.values())s(u,l);return typeof o=="function"?HG.applyReviver(o,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}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 n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return UG.stringifyDocument(this,e)}};function Za(t){if(xr.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}ML.Document=Mb});var cu=N(au=>{"use strict";var ou=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},xb=class extends ou{constructor(e,n,r){super("YAMLParseError",e,n,r)}},Lb=class extends ou{constructor(e,n,r){super("YAMLWarning",e,n,r)}},WG=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let s=i-1,o=t.substring(e.lineStarts[r-1],e.lineStarts[r]).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"),r>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
@@ -102,7 +102,7 @@ ${l}
|
|
|
102
102
|
`+q.comment:l.comment=q.comment),d=q.end;continue}!o&&n.options.strict&&lY.containsNewline(v)&&i(v,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)q.comma&&i(q.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(q.comma||i(q.start,"MISSING_CHAR",`Missing , between ${a} items`),q.comment){let O="";e:for(let B of b)switch(B.type){case"comma":case"space":break;case"comment":O=B.source.substring(1);break e;default:break e}if(O){let B=l.items[l.items.length-1];sY.isPair(B)&&(B=B.value??B.key),B.comment?B.comment+=`
|
|
103
103
|
`+O:B.comment=O,q.comment=q.comment.substring(O.length+1)}}if(!o&&!k&&!q.found){let O=R?t(n,R,q,i):e(n,q.end,k,null,q,i);l.items.push(O),d=O.range[2],jb(R)&&i(O.range,"BLOCK_IN_FLOW",Bb)}else{n.atKey=!0;let O=q.end,B=v?t(n,v,q,i):e(n,O,b,null,q,i);jb(v)&&i(B.range,"BLOCK_IN_FLOW",Bb),n.atKey=!1;let Pe=XL.resolveProps(k??[],{flow:a,indicator:"map-value-ind",next:R,offset:B.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(Pe.found){if(!o&&!q.found&&n.options.strict){if(k)for(let ke of k){if(ke===Pe.found)break;if(ke.type==="newline"){i(ke,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}q.start<Pe.found.offset-1024&&i(Pe.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else R&&("source"in R&&R.source?.[0]===":"?i(R,"MISSING_CHAR",`Missing space after : in ${a}`):i(Pe.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Qe=R?t(n,R,Pe,i):Pe.found?e(n,Pe.end,k,null,Pe,i):null;Qe?jb(R)&&i(Qe.range,"BLOCK_IN_FLOW",Bb):Pe.comment&&(B.comment?B.comment+=`
|
|
104
104
|
`+Pe.comment:B.comment=Pe.comment);let Et=new oY.Pair(B,Qe);if(n.options.keepSourceTokens&&(Et.srcToken=S),o){let ke=l;uY.mapIncludes(n,ke.items,B)&&i(O,"DUPLICATE_KEY","Map keys must be unique"),ke.items.push(Et)}else{let ke=new KL.YAMLMap(n.schema);ke.flow=!0,ke.items.push(Et);let dn=(Qe??B).range;ke.range=[B.range[0],dn[1],dn[2]],l.items.push(ke)}d=Qe?Qe.range[2]:Pe.end}}let f=o?"}":"]",[p,...m]=r.end,h=d;if(p?.source===f)h=p.offset+p.source.length;else{let y=a[0].toUpperCase()+a.substring(1),S=u?`${y} must end with a ${f}`:`${y} in block collection must be sufficiently indented and end with a ${f}`;i(d,u?"MISSING_CHAR":"BAD_INDENT",S),p&&p.source.length!==1&&m.unshift(p)}if(m.length>0){let y=cY.resolveEnd(m,h,n.options.strict,i);y.comment&&(l.comment?l.comment+=`
|
|
105
|
-
`+y.comment:l.comment=y.comment),l.range=[r.offset,h,y.offset]}else l.range=[r.offset,h,h];return l}JL.resolveFlowCollection=dY});var e1=N(ZL=>{"use strict";var fY=je(),pY=
|
|
105
|
+
`+y.comment:l.comment=y.comment),l.range=[r.offset,h,y.offset]}else l.range=[r.offset,h,h];return l}JL.resolveFlowCollection=dY});var e1=N(ZL=>{"use strict";var fY=je(),pY=Jt(),hY=Os(),mY=Ms(),gY=WL(),yY=GL(),TY=QL();function Ub(t,e,n,r,i,s){let o=n.type==="block-map"?gY.resolveBlockMap(t,e,n,r,s):n.type==="block-seq"?yY.resolveBlockSeq(t,e,n,r,s):TY.resolveFlowCollection(t,e,n,r,s),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function vY(t,e,n,r,i){let s=r.tag,o=s?e.directives.tagName(s.source,f=>i(s,"TAG_RESOLVE_FAILED",f)):null;if(n.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=r,m=f&&s?f.offset>s.offset?f:s:f??s;m&&(!p||p.offset<m.offset)&&i(m,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!o||o==="!"||o===hY.YAMLMap.tagName&&a==="map"||o===mY.YAMLSeq.tagName&&a==="seq")return Ub(t,e,n,i,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===a);if(!c){let f=e.schema.knownTags[o];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(s,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Ub(t,e,n,i,o)}let l=Ub(t,e,n,i,o,c),u=c.resolve?.(l,f=>i(s,"TAG_RESOLVE_FAILED",f),e.options)??l,d=fY.isNode(u)?u:new pY.Scalar(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}ZL.composeCollection=vY});var Vb=N(t1=>{"use strict";var Hb=Jt();function bY(t,e,n){let r=e.offset,i=SY(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let s=i.mode===">"?Hb.Scalar.BLOCK_FOLDED:Hb.Scalar.BLOCK_LITERAL,o=e.source?_Y(e.source):[],a=o.length;for(let h=o.length-1;h>=0;--h){let y=o[h][1];if(y===""||y==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&o.length>0?`
|
|
106
106
|
`.repeat(Math.max(1,o.length-1)):"",y=r+i.length;return e.source&&(y+=e.source.length),{value:h,type:s,comment:i.comment,range:[r,y,y]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;h<a;++h){let[y,S]=o[h];if(S===""||S==="\r")i.indent===0&&y.length>c&&(c=y.length);else{y.length<c&&n(l+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=y.length),u=h,c===0&&!t.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=y.length+S.length+1}for(let h=o.length-1;h>=a;--h)o[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;h<u;++h)d+=o[h][0].slice(c)+`
|
|
107
107
|
`;for(let h=u;h<a;++h){let[y,S]=o[h];l+=y.length+S.length+1;let b=S[S.length-1]==="\r";if(b&&(S=S.slice(0,-1)),S&&y.length<c){let k=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-S.length-(b?2:1),"BAD_INDENT",k),y=""}s===Hb.Scalar.BLOCK_LITERAL?(d+=f+y.slice(c)+S,f=`
|
|
108
108
|
`):y.length>c||S[0]===" "?(f===" "?f=`
|
|
@@ -117,7 +117,7 @@ ${l}
|
|
|
117
117
|
`+o[h][0].slice(c);d[d.length-1]!==`
|
|
118
118
|
`&&(d+=`
|
|
119
119
|
`);break;default:d+=`
|
|
120
|
-
`}let m=r+i.length+e.source.length;return{value:d,type:s,comment:i.comment,range:[r,m,m]}}function SY({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],s=i[0],o=0,a="",c=-1;for(let f=1;f<i.length;++f){let p=i[f];if(!a&&(p==="-"||p==="+"))a=p;else{let m=Number(p);!o&&m?o=m:c===-1&&(c=t+f)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",d=i.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":l=!0;case"newline":d+=p.source.length;break;case"comment":n&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,u=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let m=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",m);let h=p.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:s,indent:o,chomp:a,comment:u,length:d}}function _Y(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}t1.resolveBlockScalar=bY});var zb=N(r1=>{"use strict";var Wb=
|
|
120
|
+
`}let m=r+i.length+e.source.length;return{value:d,type:s,comment:i.comment,range:[r,m,m]}}function SY({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],s=i[0],o=0,a="",c=-1;for(let f=1;f<i.length;++f){let p=i[f];if(!a&&(p==="-"||p==="+"))a=p;else{let m=Number(p);!o&&m?o=m:c===-1&&(c=t+f)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",d=i.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":l=!0;case"newline":d+=p.source.length;break;case"comment":n&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,u=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let m=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",m);let h=p.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:s,indent:o,chomp:a,comment:u,length:d}}function _Y(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}t1.resolveBlockScalar=bY});var zb=N(r1=>{"use strict";var Wb=Jt(),PY=ec();function kY(t,e,n){let{offset:r,type:i,source:s,end:o}=t,a,c,l=(f,p,m)=>n(r+f,p,m);switch(i){case"scalar":a=Wb.Scalar.PLAIN,c=NY(s,l);break;case"single-quoted-scalar":a=Wb.Scalar.QUOTE_SINGLE,c=RY(s,l);break;case"double-quoted-scalar":a=Wb.Scalar.QUOTE_DOUBLE,c=wY(s,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let u=r+s.length,d=PY.resolveEnd(o,u,e,n);return{value:c,type:a,comment:d.comment,range:[r,u,d.offset]}}function NY(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),n1(t)}function RY(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),n1(t.slice(1,-1)).replace(/''/g,"'")}function n1(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
121
121
|
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
122
122
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let i=r[1],s=" ",o=e.lastIndex;for(n.lastIndex=o;r=n.exec(t);)r[1]===""?s===`
|
|
123
123
|
`?i+=s:s=`
|
|
@@ -132,7 +132,7 @@ ${l}
|
|
|
132
132
|
`);)r===`
|
|
133
133
|
`&&(n+=`
|
|
134
134
|
`),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var CY={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
135
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function DY(t,e,n,r){let i=t.substr(e,n),o=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}r1.resolveFlowScalar=kY});var o1=N(s1=>{"use strict";var _o=je(),i1=
|
|
135
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function DY(t,e,n,r){let i=t.substr(e,n),o=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}r1.resolveFlowScalar=kY});var o1=N(s1=>{"use strict";var _o=je(),i1=Jt(),AY=Vb(),IY=zb();function OY(t,e,n,r){let{value:i,type:s,comment:o,range:a}=e.type==="block-scalar"?AY.resolveBlockScalar(t,e,r):IY.resolveFlowScalar(e,t.options.strict,r),c=n?t.directives.tagName(n.source,d=>r(n,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[_o.SCALAR]:c?l=MY(t.schema,i,c,n,r):e.type==="scalar"?l=xY(t,i,e,r):l=t.schema[_o.SCALAR];let u;try{let d=l.resolve(i,f=>r(n??e,"TAG_RESOLVE_FAILED",f),t.options);u=_o.isScalar(d)?d:new i1.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);r(n??e,"TAG_RESOLVE_FAILED",f),u=new i1.Scalar(i)}return u.range=a,u.source=i,s&&(u.type=s),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function MY(t,e,n,r,i){if(n==="!")return t[_o.SCALAR];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[_o.SCALAR])}function xY({atKey:t,directives:e,schema:n},r,i,s){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[_o.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(r))??n[_o.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;s(i,"TAG_RESOLVE_FAILED",u,!0)}}return o}s1.composeScalar=OY});var c1=N(a1=>{"use strict";function LY(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}a1.emptyScalarPosition=LY});var d1=N(Yb=>{"use strict";var qY=Ul(),$Y=je(),FY=e1(),l1=o1(),BY=ec(),jY=c1(),UY={composeNode:u1,composeEmptyNode:Gb};function u1(t,e,n,r){let i=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=n,l,u=!0;switch(e.type){case"alias":l=HY(t,e,r),(a||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=l1.composeScalar(t,e,c,r),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=FY.composeCollection(UY,t,e,n,r),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);r(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=Gb(t,e.offset,void 0,null,n,r)),a&&l.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!$Y.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function Gb(t,e,n,r,{spaceBefore:i,comment:s,anchor:o,tag:a,end:c},l){let u={type:"scalar",offset:jY.emptyScalarPosition(e,n,r),indent:-1,source:""},d=l1.composeScalar(t,u,a,l);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),s&&(d.comment=s,d.range[2]=c),d}function HY({options:t},{offset:e,source:n,end:r},i){let s=new qY.Alias(n.substring(1));s.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=BY.resolveEnd(r,o,t.strict,i);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}Yb.composeEmptyNode=Gb;Yb.composeNode=u1});var h1=N(p1=>{"use strict";var VY=su(),f1=d1(),WY=ec(),zY=lu();function GY(t,e,{offset:n,start:r,value:i,end:s},o){let a=Object.assign({_directives:e},t),c=new VY.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=zY.resolveProps(r,{indicator:"doc-start",next:i??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?f1.composeNode(l,i,u,o):f1.composeEmptyNode(l,u.end,r,null,u,o);let d=c.contents.range[2],f=WY.resolveEnd(s,d,!1,o);return f.comment&&(c.comment=f.comment),c.range=[n,d,f.offset],c}p1.composeDoc=GY});var Xb=N(y1=>{"use strict";var YY=require("process"),KY=xv(),XY=su(),uu=cu(),m1=je(),JY=h1(),QY=ec();function du(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function g1(t){let e="",n=!1,r=!1;for(let i=0;i<t.length;++i){let s=t[i];switch(s[0]){case"#":e+=(e===""?"":r?`
|
|
136
136
|
|
|
137
137
|
`:`
|
|
138
138
|
`)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var Kb=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,s)=>{let o=du(n);s?this.warnings.push(new uu.YAMLWarning(o,r,i)):this.errors.push(new uu.YAMLParseError(o,r,i))},this.directives=new KY.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=g1(this.prelude);if(r){let s=e.contents;if(n)e.comment=e.comment?`${e.comment}
|
|
@@ -172,16 +172,16 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
172
172
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
173
173
|
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(i&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let c=n.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=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.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(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(xs(n.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(O1(n.key)&&!xs(n.sep,"newline")){let o=tc(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(xs(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=tc(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):xs(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{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||n.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!xs(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||xs(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=Rm(r),s=tc(i);I1(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 n=this.source.indexOf(`
|
|
174
174
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
175
|
-
`,n)+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 n=Rm(e),r=tc(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Rm(e),r=tc(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.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())}}};M1.Parser=lS});var F1=N(hu=>{"use strict";var x1=Xb(),TK=su(),pu=cu(),vK=Yv(),bK=je(),SK=cS(),L1=uS();function q1(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new SK.LineCounter||null,prettyErrors:e}}function _K(t,e={}){let{lineCounter:n,prettyErrors:r}=q1(e),i=new L1.Parser(n?.addNewLine),s=new x1.Composer(e),o=Array.from(s.compose(i.parse(t)));if(r&&n)for(let a of o)a.errors.forEach(pu.prettifyError(t,n)),a.warnings.forEach(pu.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function $1(t,e={}){let{lineCounter:n,prettyErrors:r}=q1(e),i=new L1.Parser(n?.addNewLine),s=new x1.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 pu.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(pu.prettifyError(t,n)),o.warnings.forEach(pu.prettifyError(t,n))),o}function PK(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=$1(t,n);if(!i)return null;if(i.warnings.forEach(s=>vK.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:r},n))}function kK(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return bK.isDocument(t)&&!r?t.toString(n):new TK.Document(t,r,n).toString(n)}hu.parse=PK;hu.parseAllDocuments=_K;hu.parseDocument=$1;hu.stringify=kK});var fS=N(tt=>{"use strict";var NK=Xb(),RK=su(),wK=Db(),dS=cu(),EK=Ul(),Ls=je(),CK=As(),DK=Xt(),AK=Os(),IK=Ms(),OK=km(),MK=oS(),xK=cS(),LK=uS(),wm=F1(),B1=$l();tt.Composer=NK.Composer;tt.Document=RK.Document;tt.Schema=wK.Schema;tt.YAMLError=dS.YAMLError;tt.YAMLParseError=dS.YAMLParseError;tt.YAMLWarning=dS.YAMLWarning;tt.Alias=EK.Alias;tt.isAlias=Ls.isAlias;tt.isCollection=Ls.isCollection;tt.isDocument=Ls.isDocument;tt.isMap=Ls.isMap;tt.isNode=Ls.isNode;tt.isPair=Ls.isPair;tt.isScalar=Ls.isScalar;tt.isSeq=Ls.isSeq;tt.Pair=CK.Pair;tt.Scalar=DK.Scalar;tt.YAMLMap=AK.YAMLMap;tt.YAMLSeq=IK.YAMLSeq;tt.CST=OK;tt.Lexer=MK.Lexer;tt.LineCounter=xK.LineCounter;tt.Parser=LK.Parser;tt.parse=wm.parse;tt.parseAllDocuments=wm.parseAllDocuments;tt.parseDocument=wm.parseDocument;tt.stringify=wm.stringify;tt.visit=B1.visit;tt.visitAsync=B1.visitAsync});var yu=N(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.regexpCode=ze.getEsmExportName=ze.getProperty=ze.safeStringify=ze.stringify=ze.strConcat=ze.addCodeArg=ze.str=ze._=ze.nil=ze._Code=ze.Name=ze.IDENTIFIER=ze._CodeOrName=void 0;var mu=class{};ze._CodeOrName=mu;ze.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var ko=class extends mu{constructor(e){if(super(),!ze.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}}};ze.Name=ko;var Lr=class extends mu{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((n,r)=>`${n}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((n,r)=>(r instanceof ko&&(n[r.str]=(n[r.str]||0)+1),n),{})}};ze._Code=Lr;ze.nil=new Lr("");function j1(t,...e){let n=[t[0]],r=0;for(;r<e.length;)hS(n,e[r]),n.push(t[++r]);return new Lr(n)}ze._=j1;var pS=new Lr("+");function U1(t,...e){let n=[gu(t[0])],r=0;for(;r<e.length;)n.push(pS),hS(n,e[r]),n.push(pS,gu(t[++r]));return qK(n),new Lr(n)}ze.str=U1;function hS(t,e){e instanceof Lr?t.push(...e._items):e instanceof ko?t.push(e):t.push(BK(e))}ze.addCodeArg=hS;function qK(t){let e=1;for(;e<t.length-1;){if(t[e]===pS){let n=$K(t[e-1],t[e+1]);if(n!==void 0){t.splice(e-1,3,n);continue}t[e++]="+"}e++}}function $K(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof ko||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 ko))return`"${t}${e.slice(1)}`}function FK(t,e){return e.emptyStr()?t:t.emptyStr()?e:U1`${t}${e}`}ze.strConcat=FK;function BK(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:gu(Array.isArray(t)?t.join(","):t)}function jK(t){return new Lr(gu(t))}ze.stringify=jK;function gu(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ze.safeStringify=gu;function UK(t){return typeof t=="string"&&ze.IDENTIFIER.test(t)?new Lr(`.${t}`):j1`[${t}]`}ze.getProperty=UK;function HK(t){if(typeof t=="string"&&ze.IDENTIFIER.test(t))return new Lr(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ze.getEsmExportName=HK;function VK(t){return new Lr(t.toString())}ze.regexpCode=VK});var yS=N(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.ValueScope=or.ValueScopeName=or.Scope=or.varKinds=or.UsedValueState=void 0;var sr=yu(),mS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Em;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Em||(or.UsedValueState=Em={}));or.varKinds={const:new sr.Name("const"),let:new sr.Name("let"),var:new sr.Name("var")};var Cm=class{constructor({prefixes:e,parent:n}={}){this._names={},this._prefixes=e,this._parent=n}toName(e){return e instanceof sr.Name?e:this.name(e)}name(e){return new sr.Name(this._newName(e))}_newName(e){let n=this._names[e]||this._nameGroup(e);return`${e}${n.index++}`}_nameGroup(e){var n,r;if(!((r=(n=this._parent)===null||n===void 0?void 0:n._prefixes)===null||r===void 0)&&r.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}}};or.Scope=Cm;var Dm=class extends sr.Name{constructor(e,n){super(n),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,sr._)`.${new sr.Name(n)}[${r}]`}};or.ValueScopeName=Dm;var WK=(0,sr._)`\n`,gS=class extends Cm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?WK:sr.nil}}get(){return this._scope}name(e){return new Dm(e,this._newName(e))}value(e,n){var r;if(n.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(r=n.key)!==null&&r!==void 0?r:n.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]=n.ref,i.setValue(n,{property:s,itemIndex:l}),i}getValue(e,n){let r=this._values[e];if(r)return r.get(n)}scopeRefs(e,n=this._values){return this._reduceValues(n,r=>{if(r.scopePath===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return(0,sr._)`${e}${r.scopePath}`})}scopeCode(e=this._values,n,r){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},n,r)}_reduceValues(e,n,r={},i){let s=sr.nil;for(let o in e){let a=e[o];if(!a)continue;let c=r[o]=r[o]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,Em.Started);let u=n(l);if(u){let d=this.opts.es5?or.varKinds.var:or.varKinds.const;s=(0,sr._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=i?.(l))s=(0,sr._)`${s}${u}${this.opts._n}`;else throw new mS(l);c.set(l,Em.Completed)})}return s}};or.ValueScope=gS});var be=N(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.or=Re.and=Re.not=Re.CodeGen=Re.operators=Re.varKinds=Re.ValueScopeName=Re.ValueScope=Re.Scope=Re.Name=Re.regexpCode=Re.stringify=Re.getProperty=Re.nil=Re.strConcat=Re.str=Re._=void 0;var qe=yu(),ui=yS(),qs=yu();Object.defineProperty(Re,"_",{enumerable:!0,get:function(){return qs._}});Object.defineProperty(Re,"str",{enumerable:!0,get:function(){return qs.str}});Object.defineProperty(Re,"strConcat",{enumerable:!0,get:function(){return qs.strConcat}});Object.defineProperty(Re,"nil",{enumerable:!0,get:function(){return qs.nil}});Object.defineProperty(Re,"getProperty",{enumerable:!0,get:function(){return qs.getProperty}});Object.defineProperty(Re,"stringify",{enumerable:!0,get:function(){return qs.stringify}});Object.defineProperty(Re,"regexpCode",{enumerable:!0,get:function(){return qs.regexpCode}});Object.defineProperty(Re,"Name",{enumerable:!0,get:function(){return qs.Name}});var Mm=yS();Object.defineProperty(Re,"Scope",{enumerable:!0,get:function(){return Mm.Scope}});Object.defineProperty(Re,"ValueScope",{enumerable:!0,get:function(){return Mm.ValueScope}});Object.defineProperty(Re,"ValueScopeName",{enumerable:!0,get:function(){return Mm.ValueScopeName}});Object.defineProperty(Re,"varKinds",{enumerable:!0,get:function(){return Mm.varKinds}});Re.operators={GT:new qe._Code(">"),GTE:new qe._Code(">="),LT:new qe._Code("<"),LTE:new qe._Code("<="),EQ:new qe._Code("==="),NEQ:new qe._Code("!=="),NOT:new qe._Code("!"),OR:new qe._Code("||"),AND:new qe._Code("&&"),ADD:new qe._Code("+")};var es=class{optimizeNodes(){return this}optimizeNames(e,n){return this}},TS=class extends es{constructor(e,n,r){super(),this.varKind=e,this.name=n,this.rhs=r}render({es5:e,_n:n}){let r=e?ui.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${i};`+n}optimizeNames(e,n){if(e[this.name.str])return this.rhs&&(this.rhs=rc(this.rhs,e,n)),this}get names(){return this.rhs instanceof qe._CodeOrName?this.rhs.names:{}}},Am=class extends es{constructor(e,n,r){super(),this.lhs=e,this.rhs=n,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof qe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=rc(this.rhs,e,n),this}get names(){let e=this.lhs instanceof qe.Name?{}:{...this.lhs.names};return Om(e,this.rhs)}},vS=class extends Am{constructor(e,n,r,i){super(e,r,i),this.op=n}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},bS=class extends es{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},SS=class extends es{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},_S=class extends es{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},PS=class extends es{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,n){return this.code=rc(this.code,e,n),this}get names(){return this.code instanceof qe._CodeOrName?this.code.names:{}}},Tu=class extends es{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,r)=>n+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let r=e[n].optimizeNodes();Array.isArray(r)?e.splice(n,1,...r):r?e[n]=r:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:r}=this,i=r.length;for(;i--;){let s=r[i];s.optimizeNames(e,n)||(zK(e,s.names),r.splice(i,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>wo(e,n.names),{})}},ts=class extends Tu{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},kS=class extends Tu{},nc=class extends ts{};nc.kind="else";var No=class t extends ts{constructor(e,n){super(n),this.condition=e}render(e){let n=`if(${this.condition})`+super.render(e);return this.else&&(n+="else "+this.else.render(e)),n}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let n=this.else;if(n){let r=n.optimizeNodes();n=this.else=Array.isArray(r)?new nc(r):r}if(n)return e===!1?n instanceof t?n:n.nodes:this.nodes.length?this:new t(H1(e),n instanceof t?[n]:n.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,n){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,n),!!(super.optimizeNames(e,n)||this.else))return this.condition=rc(this.condition,e,n),this}get names(){let e=super.names;return Om(e,this.condition),this.else&&wo(e,this.else.names),e}};No.kind="if";var Ro=class extends ts{};Ro.kind="for";var NS=class extends Ro{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iteration=rc(this.iteration,e,n),this}get names(){return wo(super.names,this.iteration.names)}},RS=class extends Ro{constructor(e,n,r,i){super(),this.varKind=e,this.name=n,this.from=r,this.to=i}render(e){let n=e.es5?ui.varKinds.var:this.varKind,{name:r,from:i,to:s}=this;return`for(${n} ${r}=${i}; ${r}<${s}; ${r}++)`+super.render(e)}get names(){let e=Om(super.names,this.from);return Om(e,this.to)}},Im=class extends Ro{constructor(e,n,r,i){super(),this.loop=e,this.varKind=n,this.name=r,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iterable=rc(this.iterable,e,n),this}get names(){return wo(super.names,this.iterable.names)}},vu=class extends ts{constructor(e,n,r){super(),this.name=e,this.args=n,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};vu.kind="func";var bu=class extends Tu{render(e){return"return "+super.render(e)}};bu.kind="return";var wS=class extends ts{render(e){let n="try"+super.render(e);return this.catch&&(n+=this.catch.render(e)),this.finally&&(n+=this.finally.render(e)),n}optimizeNodes(){var e,n;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(n=this.finally)===null||n===void 0||n.optimizeNodes(),this}optimizeNames(e,n){var r,i;return super.optimizeNames(e,n),(r=this.catch)===null||r===void 0||r.optimizeNames(e,n),(i=this.finally)===null||i===void 0||i.optimizeNames(e,n),this}get names(){let e=super.names;return this.catch&&wo(e,this.catch.names),this.finally&&wo(e,this.finally.names),e}},Su=class extends ts{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Su.kind="catch";var _u=class extends ts{render(e){return"finally"+super.render(e)}};_u.kind="finally";var ES=class{constructor(e,n={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...n,_n:n.lines?`
|
|
175
|
+
`,n)+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 n=Rm(e),r=tc(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Rm(e),r=tc(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.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;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};M1.Parser=lS});var F1=N(hu=>{"use strict";var x1=Xb(),TK=su(),pu=cu(),vK=Yv(),bK=je(),SK=cS(),L1=uS();function q1(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new SK.LineCounter||null,prettyErrors:e}}function _K(t,e={}){let{lineCounter:n,prettyErrors:r}=q1(e),i=new L1.Parser(n?.addNewLine),s=new x1.Composer(e),o=Array.from(s.compose(i.parse(t)));if(r&&n)for(let a of o)a.errors.forEach(pu.prettifyError(t,n)),a.warnings.forEach(pu.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function $1(t,e={}){let{lineCounter:n,prettyErrors:r}=q1(e),i=new L1.Parser(n?.addNewLine),s=new x1.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 pu.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(pu.prettifyError(t,n)),o.warnings.forEach(pu.prettifyError(t,n))),o}function PK(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=$1(t,n);if(!i)return null;if(i.warnings.forEach(s=>vK.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:r},n))}function kK(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return bK.isDocument(t)&&!r?t.toString(n):new TK.Document(t,r,n).toString(n)}hu.parse=PK;hu.parseAllDocuments=_K;hu.parseDocument=$1;hu.stringify=kK});var fS=N(tt=>{"use strict";var NK=Xb(),RK=su(),wK=Db(),dS=cu(),EK=Ul(),Ls=je(),CK=As(),DK=Jt(),AK=Os(),IK=Ms(),OK=km(),MK=oS(),xK=cS(),LK=uS(),wm=F1(),B1=$l();tt.Composer=NK.Composer;tt.Document=RK.Document;tt.Schema=wK.Schema;tt.YAMLError=dS.YAMLError;tt.YAMLParseError=dS.YAMLParseError;tt.YAMLWarning=dS.YAMLWarning;tt.Alias=EK.Alias;tt.isAlias=Ls.isAlias;tt.isCollection=Ls.isCollection;tt.isDocument=Ls.isDocument;tt.isMap=Ls.isMap;tt.isNode=Ls.isNode;tt.isPair=Ls.isPair;tt.isScalar=Ls.isScalar;tt.isSeq=Ls.isSeq;tt.Pair=CK.Pair;tt.Scalar=DK.Scalar;tt.YAMLMap=AK.YAMLMap;tt.YAMLSeq=IK.YAMLSeq;tt.CST=OK;tt.Lexer=MK.Lexer;tt.LineCounter=xK.LineCounter;tt.Parser=LK.Parser;tt.parse=wm.parse;tt.parseAllDocuments=wm.parseAllDocuments;tt.parseDocument=wm.parseDocument;tt.stringify=wm.stringify;tt.visit=B1.visit;tt.visitAsync=B1.visitAsync});var yu=N(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.regexpCode=ze.getEsmExportName=ze.getProperty=ze.safeStringify=ze.stringify=ze.strConcat=ze.addCodeArg=ze.str=ze._=ze.nil=ze._Code=ze.Name=ze.IDENTIFIER=ze._CodeOrName=void 0;var mu=class{};ze._CodeOrName=mu;ze.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var ko=class extends mu{constructor(e){if(super(),!ze.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}}};ze.Name=ko;var Lr=class extends mu{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((n,r)=>`${n}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((n,r)=>(r instanceof ko&&(n[r.str]=(n[r.str]||0)+1),n),{})}};ze._Code=Lr;ze.nil=new Lr("");function j1(t,...e){let n=[t[0]],r=0;for(;r<e.length;)hS(n,e[r]),n.push(t[++r]);return new Lr(n)}ze._=j1;var pS=new Lr("+");function U1(t,...e){let n=[gu(t[0])],r=0;for(;r<e.length;)n.push(pS),hS(n,e[r]),n.push(pS,gu(t[++r]));return qK(n),new Lr(n)}ze.str=U1;function hS(t,e){e instanceof Lr?t.push(...e._items):e instanceof ko?t.push(e):t.push(BK(e))}ze.addCodeArg=hS;function qK(t){let e=1;for(;e<t.length-1;){if(t[e]===pS){let n=$K(t[e-1],t[e+1]);if(n!==void 0){t.splice(e-1,3,n);continue}t[e++]="+"}e++}}function $K(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof ko||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 ko))return`"${t}${e.slice(1)}`}function FK(t,e){return e.emptyStr()?t:t.emptyStr()?e:U1`${t}${e}`}ze.strConcat=FK;function BK(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:gu(Array.isArray(t)?t.join(","):t)}function jK(t){return new Lr(gu(t))}ze.stringify=jK;function gu(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ze.safeStringify=gu;function UK(t){return typeof t=="string"&&ze.IDENTIFIER.test(t)?new Lr(`.${t}`):j1`[${t}]`}ze.getProperty=UK;function HK(t){if(typeof t=="string"&&ze.IDENTIFIER.test(t))return new Lr(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ze.getEsmExportName=HK;function VK(t){return new Lr(t.toString())}ze.regexpCode=VK});var yS=N(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.ValueScope=or.ValueScopeName=or.Scope=or.varKinds=or.UsedValueState=void 0;var sr=yu(),mS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Em;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Em||(or.UsedValueState=Em={}));or.varKinds={const:new sr.Name("const"),let:new sr.Name("let"),var:new sr.Name("var")};var Cm=class{constructor({prefixes:e,parent:n}={}){this._names={},this._prefixes=e,this._parent=n}toName(e){return e instanceof sr.Name?e:this.name(e)}name(e){return new sr.Name(this._newName(e))}_newName(e){let n=this._names[e]||this._nameGroup(e);return`${e}${n.index++}`}_nameGroup(e){var n,r;if(!((r=(n=this._parent)===null||n===void 0?void 0:n._prefixes)===null||r===void 0)&&r.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}}};or.Scope=Cm;var Dm=class extends sr.Name{constructor(e,n){super(n),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,sr._)`.${new sr.Name(n)}[${r}]`}};or.ValueScopeName=Dm;var WK=(0,sr._)`\n`,gS=class extends Cm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?WK:sr.nil}}get(){return this._scope}name(e){return new Dm(e,this._newName(e))}value(e,n){var r;if(n.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(r=n.key)!==null&&r!==void 0?r:n.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]=n.ref,i.setValue(n,{property:s,itemIndex:l}),i}getValue(e,n){let r=this._values[e];if(r)return r.get(n)}scopeRefs(e,n=this._values){return this._reduceValues(n,r=>{if(r.scopePath===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return(0,sr._)`${e}${r.scopePath}`})}scopeCode(e=this._values,n,r){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},n,r)}_reduceValues(e,n,r={},i){let s=sr.nil;for(let o in e){let a=e[o];if(!a)continue;let c=r[o]=r[o]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,Em.Started);let u=n(l);if(u){let d=this.opts.es5?or.varKinds.var:or.varKinds.const;s=(0,sr._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=i?.(l))s=(0,sr._)`${s}${u}${this.opts._n}`;else throw new mS(l);c.set(l,Em.Completed)})}return s}};or.ValueScope=gS});var be=N(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.or=Re.and=Re.not=Re.CodeGen=Re.operators=Re.varKinds=Re.ValueScopeName=Re.ValueScope=Re.Scope=Re.Name=Re.regexpCode=Re.stringify=Re.getProperty=Re.nil=Re.strConcat=Re.str=Re._=void 0;var qe=yu(),ui=yS(),qs=yu();Object.defineProperty(Re,"_",{enumerable:!0,get:function(){return qs._}});Object.defineProperty(Re,"str",{enumerable:!0,get:function(){return qs.str}});Object.defineProperty(Re,"strConcat",{enumerable:!0,get:function(){return qs.strConcat}});Object.defineProperty(Re,"nil",{enumerable:!0,get:function(){return qs.nil}});Object.defineProperty(Re,"getProperty",{enumerable:!0,get:function(){return qs.getProperty}});Object.defineProperty(Re,"stringify",{enumerable:!0,get:function(){return qs.stringify}});Object.defineProperty(Re,"regexpCode",{enumerable:!0,get:function(){return qs.regexpCode}});Object.defineProperty(Re,"Name",{enumerable:!0,get:function(){return qs.Name}});var Mm=yS();Object.defineProperty(Re,"Scope",{enumerable:!0,get:function(){return Mm.Scope}});Object.defineProperty(Re,"ValueScope",{enumerable:!0,get:function(){return Mm.ValueScope}});Object.defineProperty(Re,"ValueScopeName",{enumerable:!0,get:function(){return Mm.ValueScopeName}});Object.defineProperty(Re,"varKinds",{enumerable:!0,get:function(){return Mm.varKinds}});Re.operators={GT:new qe._Code(">"),GTE:new qe._Code(">="),LT:new qe._Code("<"),LTE:new qe._Code("<="),EQ:new qe._Code("==="),NEQ:new qe._Code("!=="),NOT:new qe._Code("!"),OR:new qe._Code("||"),AND:new qe._Code("&&"),ADD:new qe._Code("+")};var es=class{optimizeNodes(){return this}optimizeNames(e,n){return this}},TS=class extends es{constructor(e,n,r){super(),this.varKind=e,this.name=n,this.rhs=r}render({es5:e,_n:n}){let r=e?ui.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${i};`+n}optimizeNames(e,n){if(e[this.name.str])return this.rhs&&(this.rhs=rc(this.rhs,e,n)),this}get names(){return this.rhs instanceof qe._CodeOrName?this.rhs.names:{}}},Am=class extends es{constructor(e,n,r){super(),this.lhs=e,this.rhs=n,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof qe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=rc(this.rhs,e,n),this}get names(){let e=this.lhs instanceof qe.Name?{}:{...this.lhs.names};return Om(e,this.rhs)}},vS=class extends Am{constructor(e,n,r,i){super(e,r,i),this.op=n}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},bS=class extends es{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},SS=class extends es{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},_S=class extends es{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},PS=class extends es{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,n){return this.code=rc(this.code,e,n),this}get names(){return this.code instanceof qe._CodeOrName?this.code.names:{}}},Tu=class extends es{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,r)=>n+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let r=e[n].optimizeNodes();Array.isArray(r)?e.splice(n,1,...r):r?e[n]=r:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:r}=this,i=r.length;for(;i--;){let s=r[i];s.optimizeNames(e,n)||(zK(e,s.names),r.splice(i,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>wo(e,n.names),{})}},ts=class extends Tu{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},kS=class extends Tu{},nc=class extends ts{};nc.kind="else";var No=class t extends ts{constructor(e,n){super(n),this.condition=e}render(e){let n=`if(${this.condition})`+super.render(e);return this.else&&(n+="else "+this.else.render(e)),n}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let n=this.else;if(n){let r=n.optimizeNodes();n=this.else=Array.isArray(r)?new nc(r):r}if(n)return e===!1?n instanceof t?n:n.nodes:this.nodes.length?this:new t(H1(e),n instanceof t?[n]:n.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,n){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,n),!!(super.optimizeNames(e,n)||this.else))return this.condition=rc(this.condition,e,n),this}get names(){let e=super.names;return Om(e,this.condition),this.else&&wo(e,this.else.names),e}};No.kind="if";var Ro=class extends ts{};Ro.kind="for";var NS=class extends Ro{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iteration=rc(this.iteration,e,n),this}get names(){return wo(super.names,this.iteration.names)}},RS=class extends Ro{constructor(e,n,r,i){super(),this.varKind=e,this.name=n,this.from=r,this.to=i}render(e){let n=e.es5?ui.varKinds.var:this.varKind,{name:r,from:i,to:s}=this;return`for(${n} ${r}=${i}; ${r}<${s}; ${r}++)`+super.render(e)}get names(){let e=Om(super.names,this.from);return Om(e,this.to)}},Im=class extends Ro{constructor(e,n,r,i){super(),this.loop=e,this.varKind=n,this.name=r,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iterable=rc(this.iterable,e,n),this}get names(){return wo(super.names,this.iterable.names)}},vu=class extends ts{constructor(e,n,r){super(),this.name=e,this.args=n,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};vu.kind="func";var bu=class extends Tu{render(e){return"return "+super.render(e)}};bu.kind="return";var wS=class extends ts{render(e){let n="try"+super.render(e);return this.catch&&(n+=this.catch.render(e)),this.finally&&(n+=this.finally.render(e)),n}optimizeNodes(){var e,n;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(n=this.finally)===null||n===void 0||n.optimizeNodes(),this}optimizeNames(e,n){var r,i;return super.optimizeNames(e,n),(r=this.catch)===null||r===void 0||r.optimizeNames(e,n),(i=this.finally)===null||i===void 0||i.optimizeNames(e,n),this}get names(){let e=super.names;return this.catch&&wo(e,this.catch.names),this.finally&&wo(e,this.finally.names),e}},Su=class extends ts{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Su.kind="catch";var _u=class extends ts{render(e){return"finally"+super.render(e)}};_u.kind="finally";var ES=class{constructor(e,n={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...n,_n:n.lines?`
|
|
176
176
|
`:""},this._extScope=e,this._scope=new ui.Scope({parent:e}),this._nodes=[new kS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,n){let r=this._extScope.value(e,n);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,n){return this._extScope.getValue(e,n)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,n,r,i){let s=this._scope.toName(n);return r!==void 0&&i&&(this._constants[s.str]=r),this._leafNode(new TS(e,s,r)),s}const(e,n,r){return this._def(ui.varKinds.const,e,n,r)}let(e,n,r){return this._def(ui.varKinds.let,e,n,r)}var(e,n,r){return this._def(ui.varKinds.var,e,n,r)}assign(e,n,r){return this._leafNode(new Am(e,n,r))}add(e,n){return this._leafNode(new vS(e,Re.operators.ADD,n))}code(e){return typeof e=="function"?e():e!==qe.nil&&this._leafNode(new PS(e)),this}object(...e){let n=["{"];for(let[r,i]of e)n.length>1&&n.push(","),n.push(r),(r!==i||this.opts.es5)&&(n.push(":"),(0,qe.addCodeArg)(n,i));return n.push("}"),new qe._Code(n)}if(e,n,r){if(this._blockNode(new No(e)),n&&r)this.code(n).else().code(r).endIf();else if(n)this.code(n).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new No(e))}else(){return this._elseNode(new nc)}endIf(){return this._endBlockNode(No,nc)}_for(e,n){return this._blockNode(e),n&&this.code(n).endFor(),this}for(e,n){return this._for(new NS(e),n)}forRange(e,n,r,i,s=this.opts.es5?ui.varKinds.var:ui.varKinds.let){let o=this._scope.toName(e);return this._for(new RS(s,o,n,r),()=>i(o))}forOf(e,n,r,i=ui.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=n instanceof qe.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,qe._)`${o}.length`,a=>{this.var(s,(0,qe._)`${o}[${a}]`),r(s)})}return this._for(new Im("of",i,s,n),()=>r(s))}forIn(e,n,r,i=this.opts.es5?ui.varKinds.var:ui.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,qe._)`Object.keys(${n})`,r);let s=this._scope.toName(e);return this._for(new Im("in",i,s,n),()=>r(s))}endFor(){return this._endBlockNode(Ro)}label(e){return this._leafNode(new bS(e))}break(e){return this._leafNode(new SS(e))}return(e){let n=new bu;if(this._blockNode(n),this.code(e),n.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(bu)}try(e,n,r){if(!n&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new wS;if(this._blockNode(i),this.code(e),n){let s=this.name("e");this._currNode=i.catch=new Su(s),n(s)}return r&&(this._currNode=i.finally=new _u,this.code(r)),this._endBlockNode(Su,_u)}throw(e){return this._leafNode(new _S(e))}block(e,n){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(n),this}endBlock(e){let n=this._blockStarts.pop();if(n===void 0)throw new Error("CodeGen: not in self-balancing block");let r=this._nodes.length-n;if(r<0||e!==void 0&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=n,this}func(e,n=qe.nil,r,i){return this._blockNode(new vu(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(vu)}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,n){let r=this._currNode;if(r instanceof e||n&&r instanceof n)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${n?`${e.kind}/${n.kind}`:e.kind}"`)}_elseNode(e){let n=this._currNode;if(!(n instanceof No))throw new Error('CodeGen: "else" without "if"');return this._currNode=n.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let n=this._nodes;n[n.length-1]=e}};Re.CodeGen=ES;function wo(t,e){for(let n in e)t[n]=(t[n]||0)+(e[n]||0);return t}function Om(t,e){return e instanceof qe._CodeOrName?wo(t,e.names):t}function rc(t,e,n){if(t instanceof qe.Name)return r(t);if(!i(t))return t;return new qe._Code(t._items.reduce((s,o)=>(o instanceof qe.Name&&(o=r(o)),o instanceof qe._Code?s.push(...o._items):s.push(o),s),[]));function r(s){let o=n[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof qe._Code&&s._items.some(o=>o instanceof qe.Name&&e[o.str]===1&&n[o.str]!==void 0)}}function zK(t,e){for(let n in e)t[n]=(t[n]||0)-(e[n]||0)}function H1(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,qe._)`!${CS(t)}`}Re.not=H1;var GK=V1(Re.operators.AND);function YK(...t){return t.reduce(GK)}Re.and=YK;var KK=V1(Re.operators.OR);function XK(...t){return t.reduce(KK)}Re.or=XK;function V1(t){return(e,n)=>e===qe.nil?n:n===qe.nil?e:(0,qe._)`${CS(e)} ${t} ${CS(n)}`}function CS(t){return t instanceof qe.Name?t:(0,qe._)`(${t})`}});var De=N(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.checkStrictMode=Ce.getErrorPath=Ce.Type=Ce.useFunc=Ce.setEvaluated=Ce.evaluatedPropsToName=Ce.mergeEvaluated=Ce.eachItem=Ce.unescapeJsonPointer=Ce.escapeJsonPointer=Ce.escapeFragment=Ce.unescapeFragment=Ce.schemaRefOrVal=Ce.schemaHasRulesButRef=Ce.schemaHasRules=Ce.checkUnknownRules=Ce.alwaysValidSchema=Ce.toHash=void 0;var mt=be(),JK=yu();function QK(t){let e={};for(let n of t)e[n]=!0;return e}Ce.toHash=QK;function ZK(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(G1(t,e),!Y1(e,t.self.RULES.all))}Ce.alwaysValidSchema=ZK;function G1(t,e=t.schema){let{opts:n,self:r}=t;if(!n.strictSchema||typeof e=="boolean")return;let i=r.RULES.keywords;for(let s in e)i[s]||J1(t,`unknown keyword: "${s}"`)}Ce.checkUnknownRules=G1;function Y1(t,e){if(typeof t=="boolean")return!t;for(let n in t)if(e[n])return!0;return!1}Ce.schemaHasRules=Y1;function e3(t,e){if(typeof t=="boolean")return!t;for(let n in t)if(n!=="$ref"&&e.all[n])return!0;return!1}Ce.schemaHasRulesButRef=e3;function t3({topSchemaRef:t,schemaPath:e},n,r,i){if(!i){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return(0,mt._)`${n}`}return(0,mt._)`${t}${e}${(0,mt.getProperty)(r)}`}Ce.schemaRefOrVal=t3;function n3(t){return K1(decodeURIComponent(t))}Ce.unescapeFragment=n3;function r3(t){return encodeURIComponent(AS(t))}Ce.escapeFragment=r3;function AS(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ce.escapeJsonPointer=AS;function K1(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ce.unescapeJsonPointer=K1;function i3(t,e){if(Array.isArray(t))for(let n of t)e(n);else e(t)}Ce.eachItem=i3;function W1({mergeNames:t,mergeToName:e,mergeValues:n,resultToName:r}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof mt.Name?(s instanceof mt.Name?t(i,s,o):e(i,s,o),o):s instanceof mt.Name?(e(i,o,s),s):n(s,o);return a===mt.Name&&!(c instanceof mt.Name)?r(i,c):c}}Ce.mergeEvaluated={props:W1({mergeNames:(t,e,n)=>t.if((0,mt._)`${n} !== true && ${e} !== undefined`,()=>{t.if((0,mt._)`${e} === true`,()=>t.assign(n,!0),()=>t.assign(n,(0,mt._)`${n} || {}`).code((0,mt._)`Object.assign(${n}, ${e})`))}),mergeToName:(t,e,n)=>t.if((0,mt._)`${n} !== true`,()=>{e===!0?t.assign(n,!0):(t.assign(n,(0,mt._)`${n} || {}`),IS(t,n,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:X1}),items:W1({mergeNames:(t,e,n)=>t.if((0,mt._)`${n} !== true && ${e} !== undefined`,()=>t.assign(n,(0,mt._)`${e} === true ? true : ${n} > ${e} ? ${n} : ${e}`)),mergeToName:(t,e,n)=>t.if((0,mt._)`${n} !== true`,()=>t.assign(n,e===!0?!0:(0,mt._)`${n} > ${e} ? ${n} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function X1(t,e){if(e===!0)return t.var("props",!0);let n=t.var("props",(0,mt._)`{}`);return e!==void 0&&IS(t,n,e),n}Ce.evaluatedPropsToName=X1;function IS(t,e,n){Object.keys(n).forEach(r=>t.assign((0,mt._)`${e}${(0,mt.getProperty)(r)}`,!0))}Ce.setEvaluated=IS;var z1={};function s3(t,e){return t.scopeValue("func",{ref:e,code:z1[e.code]||(z1[e.code]=new JK._Code(e.code))})}Ce.useFunc=s3;var DS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(DS||(Ce.Type=DS={}));function o3(t,e,n){if(t instanceof mt.Name){let r=e===DS.Num;return n?r?(0,mt._)`"[" + ${t} + "]"`:(0,mt._)`"['" + ${t} + "']"`:r?(0,mt._)`"/" + ${t}`:(0,mt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,mt.getProperty)(t).toString():"/"+AS(t)}Ce.getErrorPath=o3;function J1(t,e,n=t.opts.strictSchema){if(n){if(e=`strict mode: ${e}`,n===!0)throw new Error(e);t.self.logger.warn(e)}}Ce.checkStrictMode=J1});var qr=N(OS=>{"use strict";Object.defineProperty(OS,"__esModule",{value:!0});var Dn=be(),a3={data:new Dn.Name("data"),valCxt:new Dn.Name("valCxt"),instancePath:new Dn.Name("instancePath"),parentData:new Dn.Name("parentData"),parentDataProperty:new Dn.Name("parentDataProperty"),rootData:new Dn.Name("rootData"),dynamicAnchors:new Dn.Name("dynamicAnchors"),vErrors:new Dn.Name("vErrors"),errors:new Dn.Name("errors"),this:new Dn.Name("this"),self:new Dn.Name("self"),scope:new Dn.Name("scope"),json:new Dn.Name("json"),jsonPos:new Dn.Name("jsonPos"),jsonLen:new Dn.Name("jsonLen"),jsonPart:new Dn.Name("jsonPart")};OS.default=a3});var Pu=N(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.extendErrors=An.resetErrorsCount=An.reportExtraError=An.reportError=An.keyword$DataError=An.keywordError=void 0;var Ue=be(),xm=De(),jn=qr();An.keywordError={message:({keyword:t})=>(0,Ue.str)`must pass "${t}" keyword validation`};An.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ue.str)`"${t}" keyword must be ${e} ($data)`:(0,Ue.str)`"${t}" keyword is invalid ($data)`};function c3(t,e=An.keywordError,n,r){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=eq(t,e,n);r??(o||a)?Q1(s,c):Z1(i,(0,Ue._)`[${c}]`)}An.reportError=c3;function l3(t,e=An.keywordError,n){let{it:r}=t,{gen:i,compositeRule:s,allErrors:o}=r,a=eq(t,e,n);Q1(i,a),s||o||Z1(r,jn.default.vErrors)}An.reportExtraError=l3;function u3(t,e){t.assign(jn.default.errors,e),t.if((0,Ue._)`${jn.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ue._)`${jn.default.vErrors}.length`,e),()=>t.assign(jn.default.vErrors,null)))}An.resetErrorsCount=u3;function d3({gen:t,keyword:e,schemaValue:n,data:r,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,jn.default.errors,a=>{t.const(o,(0,Ue._)`${jn.default.vErrors}[${a}]`),t.if((0,Ue._)`${o}.instancePath === undefined`,()=>t.assign((0,Ue._)`${o}.instancePath`,(0,Ue.strConcat)(jn.default.instancePath,s.errorPath))),t.assign((0,Ue._)`${o}.schemaPath`,(0,Ue.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,Ue._)`${o}.schema`,n),t.assign((0,Ue._)`${o}.data`,r))})}An.extendErrors=d3;function Q1(t,e){let n=t.const("err",e);t.if((0,Ue._)`${jn.default.vErrors} === null`,()=>t.assign(jn.default.vErrors,(0,Ue._)`[${n}]`),(0,Ue._)`${jn.default.vErrors}.push(${n})`),t.code((0,Ue._)`${jn.default.errors}++`)}function Z1(t,e){let{gen:n,validateName:r,schemaEnv:i}=t;i.$async?n.throw((0,Ue._)`new ${t.ValidationError}(${e})`):(n.assign((0,Ue._)`${r}.errors`,e),n.return(!1))}var Eo={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function eq(t,e,n){let{createErrors:r}=t.it;return r===!1?(0,Ue._)`{}`:f3(t,e,n)}function f3(t,e,n={}){let{gen:r,it:i}=t,s=[p3(i,n),h3(t,n)];return m3(t,e,s),r.object(...s)}function p3({errorPath:t},{instancePath:e}){let n=e?(0,Ue.str)`${t}${(0,xm.getErrorPath)(e,xm.Type.Str)}`:t;return[jn.default.instancePath,(0,Ue.strConcat)(jn.default.instancePath,n)]}function h3({keyword:t,it:{errSchemaPath:e}},{schemaPath:n,parentSchema:r}){let i=r?e:(0,Ue.str)`${e}/${t}`;return n&&(i=(0,Ue.str)`${i}${(0,xm.getErrorPath)(n,xm.Type.Str)}`),[Eo.schemaPath,i]}function m3(t,{params:e,message:n},r){let{keyword:i,data:s,schemaValue:o,it:a}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;r.push([Eo.keyword,i],[Eo.params,typeof e=="function"?e(t):e||(0,Ue._)`{}`]),c.messages&&r.push([Eo.message,typeof n=="function"?n(t):n]),c.verbose&&r.push([Eo.schema,o],[Eo.parentSchema,(0,Ue._)`${u}${d}`],[jn.default.data,s]),l&&r.push([Eo.propertyName,l])}});var nq=N(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.boolOrEmptySchema=ic.topBoolOrEmptySchema=void 0;var g3=Pu(),y3=be(),T3=qr(),v3={message:"boolean schema is false"};function b3(t){let{gen:e,schema:n,validateName:r}=t;n===!1?tq(t,!1):typeof n=="object"&&n.$async===!0?e.return(T3.default.data):(e.assign((0,y3._)`${r}.errors`,null),e.return(!0))}ic.topBoolOrEmptySchema=b3;function S3(t,e){let{gen:n,schema:r}=t;r===!1?(n.var(e,!1),tq(t)):n.var(e,!0)}ic.boolOrEmptySchema=S3;function tq(t,e){let{gen:n,data:r}=t,i={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,g3.reportError)(i,v3,void 0,e)}});var MS=N(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.getRules=sc.isJSONType=void 0;var _3=["string","number","integer","boolean","null","object","array"],P3=new Set(_3);function k3(t){return typeof t=="string"&&P3.has(t)}sc.isJSONType=k3;function N3(){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:{}}}sc.getRules=N3});var xS=N($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.shouldUseRule=$s.shouldUseGroup=$s.schemaHasRulesForType=void 0;function R3({schema:t,self:e},n){let r=e.RULES.types[n];return r&&r!==!0&&rq(t,r)}$s.schemaHasRulesForType=R3;function rq(t,e){return e.rules.some(n=>iq(t,n))}$s.shouldUseGroup=rq;function iq(t,e){var n;return t[e.keyword]!==void 0||((n=e.definition.implements)===null||n===void 0?void 0:n.some(r=>t[r]!==void 0))}$s.shouldUseRule=iq});var ku=N(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.reportTypeError=In.checkDataTypes=In.checkDataType=In.coerceAndCheckDataType=In.getJSONTypes=In.getSchemaTypes=In.DataType=void 0;var w3=MS(),E3=xS(),C3=Pu(),Se=be(),sq=De(),oc;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(oc||(In.DataType=oc={}));function D3(t){let e=oq(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}In.getSchemaTypes=D3;function oq(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(w3.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}In.getJSONTypes=oq;function A3(t,e){let{gen:n,data:r,opts:i}=t,s=I3(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,E3.schemaHasRulesForType)(t,e[0]));if(o){let a=qS(e,r,i.strictNumbers,oc.Wrong);n.if(a,()=>{s.length?O3(t,e,s):$S(t)})}return o}In.coerceAndCheckDataType=A3;var aq=new Set(["string","number","integer","boolean","null"]);function I3(t,e){return e?t.filter(n=>aq.has(n)||e==="array"&&n==="array"):[]}function O3(t,e,n){let{gen:r,data:i,opts:s}=t,o=r.let("dataType",(0,Se._)`typeof ${i}`),a=r.let("coerced",(0,Se._)`undefined`);s.coerceTypes==="array"&&r.if((0,Se._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>r.assign(i,(0,Se._)`${i}[0]`).assign(o,(0,Se._)`typeof ${i}`).if(qS(e,i,s.strictNumbers),()=>r.assign(a,i))),r.if((0,Se._)`${a} !== undefined`);for(let l of n)(aq.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);r.else(),$S(t),r.endIf(),r.if((0,Se._)`${a} !== undefined`,()=>{r.assign(i,a),M3(t,a)});function c(l){switch(l){case"string":r.elseIf((0,Se._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,Se._)`"" + ${i}`).elseIf((0,Se._)`${i} === null`).assign(a,(0,Se._)`""`);return;case"number":r.elseIf((0,Se._)`${o} == "boolean" || ${i} === null
|
|
177
177
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,Se._)`+${i}`);return;case"integer":r.elseIf((0,Se._)`${o} === "boolean" || ${i} === null
|
|
178
178
|
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,Se._)`+${i}`);return;case"boolean":r.elseIf((0,Se._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,Se._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":r.elseIf((0,Se._)`${i} === "" || ${i} === 0 || ${i} === false`),r.assign(a,null);return;case"array":r.elseIf((0,Se._)`${o} === "string" || ${o} === "number"
|
|
179
|
-
|| ${o} === "boolean" || ${i} === null`).assign(a,(0,Se._)`[${i}]`)}}}function M3({gen:t,parentData:e,parentDataProperty:n},r){t.if((0,Se._)`${e} !== undefined`,()=>t.assign((0,Se._)`${e}[${n}]`,r))}function LS(t,e,n,r=oc.Correct){let i=r===oc.Correct?Se.operators.EQ:Se.operators.NEQ,s;switch(t){case"null":return(0,Se._)`${e} ${i} null`;case"array":s=(0,Se._)`Array.isArray(${e})`;break;case"object":s=(0,Se._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,Se._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,Se._)`typeof ${e} ${i} ${t}`}return r===oc.Correct?s:(0,Se.not)(s);function o(a=Se.nil){return(0,Se.and)((0,Se._)`typeof ${e} == "number"`,a,n?(0,Se._)`isFinite(${e})`:Se.nil)}}In.checkDataType=LS;function qS(t,e,n,r){if(t.length===1)return LS(t[0],e,n,r);let i,s=(0,sq.toHash)(t);if(s.array&&s.object){let o=(0,Se._)`typeof ${e} != "object"`;i=s.null?o:(0,Se._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=Se.nil;s.number&&delete s.integer;for(let o in s)i=(0,Se.and)(i,LS(o,e,n,r));return i}In.checkDataTypes=qS;var x3={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Se._)`{type: ${t}}`:(0,Se._)`{type: ${e}}`};function $S(t){let e=L3(t);(0,C3.reportError)(e,x3)}In.reportTypeError=$S;function L3(t){let{gen:e,data:n,schema:r}=t,i=(0,sq.schemaRefOrVal)(t,r,"type");return{gen:e,keyword:"type",data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:t}}});var lq=N(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});Lm.assignDefaults=void 0;var ac=be(),q3=De();function $3(t,e){let{properties:n,items:r}=t.schema;if(e==="object"&&n)for(let i in n)cq(t,i,n[i].default);else e==="array"&&Array.isArray(r)&&r.forEach((i,s)=>cq(t,s,i.default))}Lm.assignDefaults=$3;function cq(t,e,n){let{gen:r,compositeRule:i,data:s,opts:o}=t;if(n===void 0)return;let a=(0,ac._)`${s}${(0,ac.getProperty)(e)}`;if(i){(0,q3.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,ac._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,ac._)`${c} || ${a} === null || ${a} === ""`),r.if(c,(0,ac._)`${a} = ${(0,ac.stringify)(n)}`)}});var $r=N(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.validateUnion=ot.validateArray=ot.usePattern=ot.callValidateCode=ot.schemaProperties=ot.allSchemaProperties=ot.noPropertyInData=ot.propertyInData=ot.isOwnProperty=ot.hasPropFunc=ot.reportMissingProp=ot.checkMissingProp=ot.checkReportMissingProp=void 0;var _t=be(),FS=De(),Fs=qr(),F3=De();function B3(t,e){let{gen:n,data:r,it:i}=t;n.if(jS(n,r,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,_t._)`${e}`},!0),t.error()})}ot.checkReportMissingProp=B3;function j3({gen:t,data:e,it:{opts:n}},r,i){return(0,_t.or)(...r.map(s=>(0,_t.and)(jS(t,e,s,n.ownProperties),(0,_t._)`${i} = ${s}`)))}ot.checkMissingProp=j3;function U3(t,e){t.setParams({missingProperty:e},!0),t.error()}ot.reportMissingProp=U3;function uq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,_t._)`Object.prototype.hasOwnProperty`})}ot.hasPropFunc=uq;function BS(t,e,n){return(0,_t._)`${uq(t)}.call(${e}, ${n})`}ot.isOwnProperty=BS;function H3(t,e,n,r){let i=(0,_t._)`${e}${(0,_t.getProperty)(n)} !== undefined`;return r?(0,_t._)`${i} && ${BS(t,e,n)}`:i}ot.propertyInData=H3;function jS(t,e,n,r){let i=(0,_t._)`${e}${(0,_t.getProperty)(n)} === undefined`;return r?(0,_t.or)(i,(0,_t.not)(BS(t,e,n))):i}ot.noPropertyInData=jS;function dq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ot.allSchemaProperties=dq;function V3(t,e){return dq(e).filter(n=>!(0,FS.alwaysValidSchema)(t,e[n]))}ot.schemaProperties=V3;function W3({schemaCode:t,data:e,it:{gen:n,topSchemaRef:r,schemaPath:i,errorPath:s},it:o},a,c,l){let u=l?(0,_t._)`${t}, ${e}, ${r}${i}`:e,d=[[Fs.default.instancePath,(0,_t.strConcat)(Fs.default.instancePath,s)],[Fs.default.parentData,o.parentData],[Fs.default.parentDataProperty,o.parentDataProperty],[Fs.default.rootData,Fs.default.rootData]];o.opts.dynamicRef&&d.push([Fs.default.dynamicAnchors,Fs.default.dynamicAnchors]);let f=(0,_t._)`${u}, ${n.object(...d)}`;return c!==_t.nil?(0,_t._)`${a}.call(${c}, ${f})`:(0,_t._)`${a}(${f})`}ot.callValidateCode=W3;var z3=(0,_t._)`new RegExp`;function G3({gen:t,it:{opts:e}},n){let r=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(n,r);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,_t._)`${i.code==="new RegExp"?z3:(0,F3.useFunc)(t,i)}(${n}, ${r})`})}ot.usePattern=G3;function Y3(t){let{gen:e,data:n,keyword:r,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,_t._)`${n}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:r,dataProp:l,dataPropType:FS.Type.Num},s),e.if((0,_t.not)(s),a)})}}ot.validateArray=Y3;function K3(t){let{gen:e,schema:n,keyword:r,it:i}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(c=>(0,FS.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),a=e.name("_valid");e.block(()=>n.forEach((c,l)=>{let u=t.subschema({keyword:r,schemaProp:l,compositeRule:!0},a);e.assign(o,(0,_t._)`${o} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,_t.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}ot.validateUnion=K3});var hq=N(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.validateKeywordUsage=Oi.validSchemaType=Oi.funcKeywordCode=Oi.macroKeywordCode=void 0;var Un=be(),Co=qr(),X3=$r(),J3=Pu();function Q3(t,e){let{gen:n,keyword:r,schema:i,parentSchema:s,it:o}=t,a=e.macro.call(o.self,i,s,o),c=pq(n,r,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let l=n.name("valid");t.subschema({schema:a,schemaPath:Un.nil,errSchemaPath:`${o.errSchemaPath}/${r}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}Oi.macroKeywordCode=Q3;function Z3(t,e){var n;let{gen:r,keyword:i,schema:s,parentSchema:o,$data:a,it:c}=t;tX(c,e);let l=!a&&e.compile?e.compile.call(c.self,s,o,c):e.validate,u=pq(r,i,l),d=r.let("valid");t.block$data(d,f),t.ok((n=e.valid)!==null&&n!==void 0?n:d);function f(){if(e.errors===!1)h(),e.modifying&&fq(t),y(()=>t.error());else{let S=e.async?p():m();e.modifying&&fq(t),y(()=>eX(t,S))}}function p(){let S=r.let("ruleErrs",null);return r.try(()=>h((0,Un._)`await `),b=>r.assign(d,!1).if((0,Un._)`${b} instanceof ${c.ValidationError}`,()=>r.assign(S,(0,Un._)`${b}.errors`),()=>r.throw(b))),S}function m(){let S=(0,Un._)`${u}.errors`;return r.assign(S,null),h(Un.nil),S}function h(S=e.async?(0,Un._)`await `:Un.nil){let b=c.opts.passContext?Co.default.this:Co.default.self,v=!("compile"in e&&!a||e.schema===!1);r.assign(d,(0,Un._)`${S}${(0,X3.callValidateCode)(t,u,b,v)}`,e.modifying)}function y(S){var b;r.if((0,Un.not)((b=e.valid)!==null&&b!==void 0?b:d),S)}}Oi.funcKeywordCode=Z3;function fq(t){let{gen:e,data:n,it:r}=t;e.if(r.parentData,()=>e.assign(n,(0,Un._)`${r.parentData}[${r.parentDataProperty}]`))}function eX(t,e){let{gen:n}=t;n.if((0,Un._)`Array.isArray(${e})`,()=>{n.assign(Co.default.vErrors,(0,Un._)`${Co.default.vErrors} === null ? ${e} : ${Co.default.vErrors}.concat(${e})`).assign(Co.default.errors,(0,Un._)`${Co.default.vErrors}.length`),(0,J3.extendErrors)(t)},()=>t.error())}function tX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function pq(t,e,n){if(n===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,Un.stringify)(n)})}function nX(t,e,n=!1){return!e.length||e.some(r=>r==="array"?Array.isArray(t):r==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==r||n&&typeof t>"u")}Oi.validSchemaType=nX;function rX({schema:t,opts:e,self:n,errSchemaPath:r},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 "${r}": `+n.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")n.logger.error(c);else throw new Error(c)}}Oi.validateKeywordUsage=rX});var gq=N(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.extendSubschemaMode=Bs.extendSubschemaData=Bs.getSubschema=void 0;var Mi=be(),mq=De();function iX(t,{keyword:e,schemaProp:n,schema:r,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return n===void 0?{schema:a,schemaPath:(0,Mi._)`${t.schemaPath}${(0,Mi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[n],schemaPath:(0,Mi._)`${t.schemaPath}${(0,Mi.getProperty)(e)}${(0,Mi.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,mq.escapeFragment)(n)}`}}if(r!==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:r,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Bs.getSubschema=iX;function sX(t,e,{dataProp:n,dataPropType:r,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(n!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,f=a.let("data",(0,Mi._)`${e.data}${(0,Mi.getProperty)(n)}`,!0);c(f),t.errorPath=(0,Mi.str)`${l}${(0,mq.getErrorPath)(n,r,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Mi._)`${n}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let l=i instanceof Mi.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]}}Bs.extendSubschemaData=sX;function oX(t,{jtdDiscriminator:e,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:s}){r!==void 0&&(t.compositeRule=r),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=n}Bs.extendSubschemaMode=oX});var US=N((iCe,yq)=>{"use strict";yq.exports=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}});var vq=N((sCe,Tq)=>{"use strict";var js=Tq.exports=function(t,e,n){typeof e=="function"&&(n=e,e={}),n=e.cb||n;var r=typeof n=="function"?n:n.pre||function(){},i=n.post||function(){};qm(e,r,i,t,"",t)};js.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};js.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};js.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};js.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 qm(t,e,n,r,i,s,o,a,c,l){if(r&&typeof r=="object"&&!Array.isArray(r)){e(r,i,s,o,a,c,l);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in js.arrayKeywords)for(var f=0;f<d.length;f++)qm(t,e,n,d[f],i+"/"+u+"/"+f,s,i,u,r,f)}else if(u in js.propsKeywords){if(d&&typeof d=="object")for(var p in d)qm(t,e,n,d[p],i+"/"+u+"/"+aX(p),s,i,u,r,p)}else(u in js.keywords||t.allKeys&&!(u in js.skipKeywords))&&qm(t,e,n,d,i+"/"+u,s,i,u,r)}n(r,i,s,o,a,c,l)}}function aX(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Nu=N(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.getSchemaRefs=ar.resolveUrl=ar.normalizeId=ar._getFullPath=ar.getFullPath=ar.inlineRef=void 0;var cX=De(),lX=US(),uX=vq(),dX=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function fX(t,e=!0){return typeof t=="boolean"?!0:e===!0?!HS(t):e?bq(t)<=e:!1}ar.inlineRef=fX;var pX=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function HS(t){for(let e in t){if(pX.has(e))return!0;let n=t[e];if(Array.isArray(n)&&n.some(HS)||typeof n=="object"&&HS(n))return!0}return!1}function bq(t){let e=0;for(let n in t){if(n==="$ref")return 1/0;if(e++,!dX.has(n)&&(typeof t[n]=="object"&&(0,cX.eachItem)(t[n],r=>e+=bq(r)),e===1/0))return 1/0}return e}function Sq(t,e="",n){n!==!1&&(e=cc(e));let r=t.parse(e);return _q(t,r)}ar.getFullPath=Sq;function _q(t,e){return t.serialize(e).split("#")[0]+"#"}ar._getFullPath=_q;var hX=/#\/?$/;function cc(t){return t?t.replace(hX,""):""}ar.normalizeId=cc;function mX(t,e,n){return n=cc(n),t.resolve(e,n)}ar.resolveUrl=mX;var gX=/^[a-z_][-a-z0-9._]*$/i;function yX(t,e){if(typeof t=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,i=cc(t[n]||e),s={"":i},o=Sq(r,i,!1),a={},c=new Set;return uX(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=o+f,y=s[m];typeof d[n]=="string"&&(y=S.call(this,d[n])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),s[f]=y;function S(v){let k=this.opts.uriResolver.resolve;if(v=cc(y?k(y,v):v),c.has(v))throw u(v);c.add(v);let R=this.refs[v];return typeof R=="string"&&(R=this.refs[R]),typeof R=="object"?l(d,R.schema,v):v!==cc(h)&&(v[0]==="#"?(l(d,a[v],v),a[v]=d):this.refs[v]=h),v}function b(v){if(typeof v=="string"){if(!gX.test(v))throw new Error(`invalid anchor "${v}"`);S.call(this,`#${v}`)}}}),a;function l(d,f,p){if(f!==void 0&&!lX(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}ar.getSchemaRefs=yX});var Eu=N(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.getData=Us.KeywordCxt=Us.validateFunctionCode=void 0;var wq=nq(),Pq=ku(),WS=xS(),$m=ku(),TX=lq(),wu=hq(),VS=gq(),oe=be(),ge=qr(),vX=Nu(),ns=De(),Ru=Pu();function bX(t){if(Dq(t)&&(Aq(t),Cq(t))){PX(t);return}Eq(t,()=>(0,wq.topBoolOrEmptySchema)(t))}Us.validateFunctionCode=bX;function Eq({gen:t,validateName:e,schema:n,schemaEnv:r,opts:i},s){i.code.es5?t.func(e,(0,oe._)`${ge.default.data}, ${ge.default.valCxt}`,r.$async,()=>{t.code((0,oe._)`"use strict"; ${kq(n,i)}`),_X(t,i),t.code(s)}):t.func(e,(0,oe._)`${ge.default.data}, ${SX(i)}`,r.$async,()=>t.code(kq(n,i)).code(s))}function SX(t){return(0,oe._)`{${ge.default.instancePath}="", ${ge.default.parentData}, ${ge.default.parentDataProperty}, ${ge.default.rootData}=${ge.default.data}${t.dynamicRef?(0,oe._)`, ${ge.default.dynamicAnchors}={}`:oe.nil}}={}`}function _X(t,e){t.if(ge.default.valCxt,()=>{t.var(ge.default.instancePath,(0,oe._)`${ge.default.valCxt}.${ge.default.instancePath}`),t.var(ge.default.parentData,(0,oe._)`${ge.default.valCxt}.${ge.default.parentData}`),t.var(ge.default.parentDataProperty,(0,oe._)`${ge.default.valCxt}.${ge.default.parentDataProperty}`),t.var(ge.default.rootData,(0,oe._)`${ge.default.valCxt}.${ge.default.rootData}`),e.dynamicRef&&t.var(ge.default.dynamicAnchors,(0,oe._)`${ge.default.valCxt}.${ge.default.dynamicAnchors}`)},()=>{t.var(ge.default.instancePath,(0,oe._)`""`),t.var(ge.default.parentData,(0,oe._)`undefined`),t.var(ge.default.parentDataProperty,(0,oe._)`undefined`),t.var(ge.default.rootData,ge.default.data),e.dynamicRef&&t.var(ge.default.dynamicAnchors,(0,oe._)`{}`)})}function PX(t){let{schema:e,opts:n,gen:r}=t;Eq(t,()=>{n.$comment&&e.$comment&&Oq(t),EX(t),r.let(ge.default.vErrors,null),r.let(ge.default.errors,0),n.unevaluated&&kX(t),Iq(t),AX(t)})}function kX(t){let{gen:e,validateName:n}=t;t.evaluated=e.const("evaluated",(0,oe._)`${n}.evaluated`),e.if((0,oe._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,oe._)`${t.evaluated}.props`,(0,oe._)`undefined`)),e.if((0,oe._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,oe._)`${t.evaluated}.items`,(0,oe._)`undefined`))}function kq(t,e){let n=typeof t=="object"&&t[e.schemaId];return n&&(e.code.source||e.code.process)?(0,oe._)`/*# sourceURL=${n} */`:oe.nil}function NX(t,e){if(Dq(t)&&(Aq(t),Cq(t))){RX(t,e);return}(0,wq.boolOrEmptySchema)(t,e)}function Cq({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let n in t)if(e.RULES.all[n])return!0;return!1}function Dq(t){return typeof t.schema!="boolean"}function RX(t,e){let{schema:n,gen:r,opts:i}=t;i.$comment&&n.$comment&&Oq(t),CX(t),DX(t);let s=r.const("_errs",ge.default.errors);Iq(t,s),r.var(e,(0,oe._)`${s} === ${ge.default.errors}`)}function Aq(t){(0,ns.checkUnknownRules)(t),wX(t)}function Iq(t,e){if(t.opts.jtd)return Nq(t,[],!1,e);let n=(0,Pq.getSchemaTypes)(t.schema),r=(0,Pq.coerceAndCheckDataType)(t,n);Nq(t,n,!r,e)}function wX(t){let{schema:e,errSchemaPath:n,opts:r,self:i}=t;e.$ref&&r.ignoreKeywordsWithRef&&(0,ns.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function EX(t){let{schema:e,opts:n}=t;e.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,ns.checkStrictMode)(t,"default is ignored in the schema root")}function CX(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,vX.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function DX(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Oq({gen:t,schemaEnv:e,schema:n,errSchemaPath:r,opts:i}){let s=n.$comment;if(i.$comment===!0)t.code((0,oe._)`${ge.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,oe.str)`${r}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,oe._)`${ge.default.self}.opts.$comment(${s}, ${o}, ${a}.schema)`)}}function AX(t){let{gen:e,schemaEnv:n,validateName:r,ValidationError:i,opts:s}=t;n.$async?e.if((0,oe._)`${ge.default.errors} === 0`,()=>e.return(ge.default.data),()=>e.throw((0,oe._)`new ${i}(${ge.default.vErrors})`)):(e.assign((0,oe._)`${r}.errors`,ge.default.vErrors),s.unevaluated&&IX(t),e.return((0,oe._)`${ge.default.errors} === 0`))}function IX({gen:t,evaluated:e,props:n,items:r}){n instanceof oe.Name&&t.assign((0,oe._)`${e}.props`,n),r instanceof oe.Name&&t.assign((0,oe._)`${e}.items`,r)}function Nq(t,e,n,r){let{gen:i,schema:s,data:o,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ns.schemaHasRulesButRef)(s,u))){i.block(()=>xq(t,"$ref",u.all.$ref.definition));return}c.jtd||OX(t,e),i.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,WS.shouldUseGroup)(s,f)&&(f.type?(i.if((0,$m.checkDataType)(f.type,o,c.strictNumbers)),Rq(t,f),e.length===1&&e[0]===f.type&&n&&(i.else(),(0,$m.reportTypeError)(t)),i.endIf()):Rq(t,f),a||i.if((0,oe._)`${ge.default.errors} === ${r||0}`))}}function Rq(t,e){let{gen:n,schema:r,opts:{useDefaults:i}}=t;i&&(0,TX.assignDefaults)(t,e.type),n.block(()=>{for(let s of e.rules)(0,WS.shouldUseRule)(r,s)&&xq(t,s.keyword,s.definition,e.type)})}function OX(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(MX(t,e),t.opts.allowUnionTypes||xX(t,e),LX(t,t.dataTypes))}function MX(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(n=>{Mq(t.dataTypes,n)||zS(t,`type "${n}" not allowed by context "${t.dataTypes.join(",")}"`)}),$X(t,e)}}function xX(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&zS(t,"use allowUnionTypes to allow union type keyword")}function LX(t,e){let n=t.self.RULES.all;for(let r in n){let i=n[r];if(typeof i=="object"&&(0,WS.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>qX(e,o))&&zS(t,`missing type "${s.join(",")}" for keyword "${r}"`)}}}function qX(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Mq(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function $X(t,e){let n=[];for(let r of t.dataTypes)Mq(e,r)?n.push(r):e.includes("integer")&&r==="number"&&n.push("integer");t.dataTypes=n}function zS(t,e){let n=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${n}" (strictTypes)`,(0,ns.checkStrictMode)(t,e,t.opts.strictTypes)}var Fm=class{constructor(e,n,r){if((0,wu.validateKeywordUsage)(e,n,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=n.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ns.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=n,this.$data)this.schemaCode=e.gen.const("vSchema",Lq(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,wu.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=e.gen.const("_errs",ge.default.errors))}result(e,n,r){this.failResult((0,oe.not)(e),n,r)}failResult(e,n,r){this.gen.if(e),r?r():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,n){this.failResult((0,oe.not)(e),void 0,n)}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:n}=this;this.fail((0,oe._)`${n} !== undefined && (${(0,oe.or)(this.invalid$data(),e)})`)}error(e,n,r){if(n){this.setParams(n),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,n){(e?Ru.reportExtraError:Ru.reportError)(this,this.def.error,n)}$dataError(){(0,Ru.reportError)(this,this.def.$dataError||Ru.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ru.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,n){n?Object.assign(this.params,e):this.params=e}block$data(e,n,r=oe.nil){this.gen.block(()=>{this.check$data(e,r),n()})}check$data(e=oe.nil,n=oe.nil){if(!this.$data)return;let{gen:r,schemaCode:i,schemaType:s,def:o}=this;r.if((0,oe.or)((0,oe._)`${i} === undefined`,n)),e!==oe.nil&&r.assign(e,!0),(s.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==oe.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:n,schemaType:r,def:i,it:s}=this;return(0,oe.or)(o(),a());function o(){if(r.length){if(!(n instanceof oe.Name))throw new Error("ajv implementation error");let c=Array.isArray(r)?r:[r];return(0,oe._)`${(0,$m.checkDataTypes)(c,n,s.opts.strictNumbers,$m.DataType.Wrong)}`}return oe.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,oe._)`!${c}(${n})`}return oe.nil}}subschema(e,n){let r=(0,VS.getSubschema)(this.it,e);(0,VS.extendSubschemaData)(r,this.it,e),(0,VS.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return NX(i,n),i}mergeEvaluated(e,n){let{it:r,gen:i}=this;r.opts.unevaluated&&(r.props!==!0&&e.props!==void 0&&(r.props=ns.mergeEvaluated.props(i,e.props,r.props,n)),r.items!==!0&&e.items!==void 0&&(r.items=ns.mergeEvaluated.items(i,e.items,r.items,n)))}mergeValidEvaluated(e,n){let{it:r,gen:i}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return i.if(n,()=>this.mergeEvaluated(e,oe.Name)),!0}};Us.KeywordCxt=Fm;function xq(t,e,n,r){let i=new Fm(t,n,e);"code"in n?n.code(i,r):i.$data&&n.validate?(0,wu.funcKeywordCode)(i,n):"macro"in n?(0,wu.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,wu.funcKeywordCode)(i,n)}var FX=/^\/(?:[^~]|~0|~1)*$/,BX=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Lq(t,{dataLevel:e,dataNames:n,dataPathArr:r}){let i,s;if(t==="")return ge.default.rootData;if(t[0]==="/"){if(!FX.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=ge.default.rootData}else{let l=BX.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 r[e-u]}if(u>e)throw new Error(c("data",u));if(s=n[e-u],!i)return s}let o=s,a=i.split("/");for(let l of a)l&&(s=(0,oe._)`${s}${(0,oe.getProperty)((0,ns.unescapeJsonPointer)(l))}`,o=(0,oe._)`${o} && ${s}`);return o;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}Us.getData=Lq});var Bm=N(YS=>{"use strict";Object.defineProperty(YS,"__esModule",{value:!0});var GS=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};YS.default=GS});var Cu=N(JS=>{"use strict";Object.defineProperty(JS,"__esModule",{value:!0});var KS=Nu(),XS=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,KS.resolveUrl)(e,n,r),this.missingSchema=(0,KS.normalizeId)((0,KS.getFullPath)(e,this.missingRef))}};JS.default=XS});var Du=N(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.resolveSchema=Fr.getCompilingSchema=Fr.resolveRef=Fr.compileSchema=Fr.SchemaEnv=void 0;var di=be(),jX=Bm(),Do=qr(),fi=Nu(),qq=De(),UX=Eu(),lc=class{constructor(e){var n;this.refs={},this.dynamicAnchors={};let r;typeof e.schema=="object"&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(n=e.baseId)!==null&&n!==void 0?n:(0,fi.normalizeId)(r?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r?.$async,this.refs={}}};Fr.SchemaEnv=lc;function ZS(t){let e=$q.call(this,t);if(e)return e;let n=(0,fi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:r,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new di.CodeGen(this.scope,{es5:r,lines:i,ownProperties:s}),a;t.$async&&(a=o.scopeValue("Error",{ref:jX.default,code:(0,di._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let l={gen:o,allErrors:this.opts.allErrors,data:Do.default.data,parentData:Do.default.parentData,parentDataProperty:Do.default.parentDataProperty,dataNames:[Do.default.data],dataPathArr:[di.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,di.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:n,baseId:t.baseId||n,schemaPath:di.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,di._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,UX.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(Do.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${Do.default.self}`,`${Do.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 di.Name?void 0:m,items:h instanceof di.Name?void 0:h,dynamicProps:m instanceof di.Name,dynamicItems:h instanceof di.Name},p.source&&(p.source.evaluated=(0,di.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)}}Fr.compileSchema=ZS;function HX(t,e,n){var r;n=(0,fi.resolveUrl)(this.opts.uriResolver,e,n);let i=t.refs[n];if(i)return i;let s=zX.call(this,t,n);if(s===void 0){let o=(r=t.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;o&&(s=new lc({schema:o,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[n]=VX.call(this,s)}Fr.resolveRef=HX;function VX(t){return(0,fi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:ZS.call(this,t)}function $q(t){for(let e of this._compilations)if(WX(e,t))return e}Fr.getCompilingSchema=$q;function WX(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function zX(t,e){let n;for(;typeof(n=this.refs[e])=="string";)e=n;return n||this.schemas[e]||jm.call(this,t,e)}function jm(t,e){let n=this.opts.uriResolver.parse(e),r=(0,fi._getFullPath)(this.opts.uriResolver,n),i=(0,fi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&r===i)return QS.call(this,n,t);let s=(0,fi.normalizeId)(r),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let a=jm.call(this,t,o);return typeof a?.schema!="object"?void 0:QS.call(this,n,a)}if(typeof o?.schema=="object"){if(o.validate||ZS.call(this,o),s===(0,fi.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,l=a[c];return l&&(i=(0,fi.resolveUrl)(this.opts.uriResolver,i,l)),new lc({schema:a,schemaId:c,root:t,baseId:i})}return QS.call(this,n,o)}}Fr.resolveSchema=jm;var GX=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function QS(t,{baseId:e,schema:n,root:r}){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 n=="boolean")return;let c=n[(0,qq.unescapeFragment)(a)];if(c===void 0)return;n=c;let l=typeof n=="object"&&n[this.opts.schemaId];!GX.has(a)&&l&&(e=(0,fi.resolveUrl)(this.opts.uriResolver,e,l))}let s;if(typeof n!="boolean"&&n.$ref&&!(0,qq.schemaHasRulesButRef)(n,this.RULES)){let a=(0,fi.resolveUrl)(this.opts.uriResolver,e,n.$ref);s=jm.call(this,r,a)}let{schemaId:o}=this.opts;if(s=s||new lc({schema:n,schemaId:o,root:r,baseId:e}),s.schema!==s.root.schema)return s}});var Fq=N((dCe,YX)=>{YX.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 n_=N((fCe,Wq)=>{"use strict";var KX=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),jq=RegExp.prototype.test.bind(/^(?:(?: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),e_=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Uq=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),XX=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function t_(t){let e="",n=0,r=0;for(r=0;r<t.length;r++)if(n=t[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";e+=t[r];break}for(r+=1;r<t.length;r++){if(n=t[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";e+=t[r]}return e}var JX=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Bq(t){return t.length=0,!0}function QX(t,e,n){if(t.length){let r=t_(t);if(r!=="")e.push(r);else return n.error=!0,!1;t.length=0}return!0}function ZX(t){let e=0,n={error:!1,address:"",zone:""},r=[],i=[],s=!1,o=!1,a=QX;for(let c=0;c<t.length;c++){let l=t[c];if(!(l==="["||l==="]"))if(l===":"){if(s===!0&&(o=!0),!a(i,r,n))break;if(++e>7){n.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),r.push(":");continue}else if(l==="%"){if(!a(i,r,n))break;a=Bq}else{i.push(l);continue}}return i.length&&(a===Bq?n.zone=i.join(""):o?r.push(i.join("")):r.push(t_(i))),n.address=r.join(""),n}function Hq(t){if(e4(t,":")<2)return{host:t,isIPV6:!1};let e=ZX(t);if(e.error)return{host:t,isIPV6:!1};{let n=e.address,r=e.address;return e.zone&&(n+="%"+e.zone,r+="%25"+e.zone),{host:n,isIPV6:!0,escapedHost:r}}}function e4(t,e){let n=0;for(let r=0;r<t.length;r++)t[r]===e&&n++;return n}function t4(t){let e=t,n=[],r=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){n.push("/");break}else{n.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){n.push("/");break}}else if(i===3&&e==="/.."){n.length!==0&&n.pop(),n.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),n.length!==0&&n.pop();continue}}if((r=e.indexOf("/",1))===-1){n.push(e);break}else n.push(e.slice(0,r)),e=e.slice(r)}return n.join("")}var n4={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},r4=/[@/?#:]/g,i4=/[@/?#]/g;function Vq(t,e){let n=e?i4:r4;return n.lastIndex=0,t.replace(n,r=>n4[r])}function s4(t,e=!1){if(t.indexOf("%")===-1)return t;let n="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let i=t.slice(r+1,r+3);if(e_(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));e&&Uq(o)?n+=o:n+="%"+s,r+=2;continue}}n+=t[r]}return n}function o4(t){let e="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let r=t.slice(n+1,n+3);if(e_(r)){let i=r.toUpperCase(),s=String.fromCharCode(parseInt(i,16));s!=="."&&Uq(s)?e+=s:e+="%"+i,n+=2;continue}}XX(t[n])?e+=t[n]:e+=escape(t[n])}return e}function a4(t){let e="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let r=t.slice(n+1,n+3);if(e_(r)){e+="%"+r.toUpperCase(),n+=2;continue}}e+=escape(t[n])}return e}function c4(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let n=unescape(t.host);if(!jq(n)){let r=Hq(n);r.isIPV6===!0?n=`[${r.escapedHost}]`:n=Vq(n,!1)}e.push(n)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Wq.exports={nonSimpleDomain:JX,recomposeAuthority:c4,reescapeHostDelimiters:Vq,normalizePercentEncoding:s4,normalizePathEncoding:o4,escapePreservingEscapes:a4,removeDotSegments:t4,isIPv4:jq,isUUID:KX,normalizeIPv6:Hq,stringArrayToHexStripped:t_}});var Xq=N((pCe,Kq)=>{"use strict";var{isUUID:l4}=n_(),u4=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,d4=["http","https","ws","wss","urn","urn:uuid"];function f4(t){return d4.indexOf(t)!==-1}function r_(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function zq(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Gq(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 p4(t){return t.secure=r_(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function h4(t){if((t.port===(r_(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,n]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=n,t.resourceName=void 0}return t.fragment=void 0,t}function m4(t,e){if(!t.path)return t.error="URN can not be parsed",t;let n=t.path.match(u4);if(n){let r=e.scheme||t.scheme||"urn";t.nid=n[1].toLowerCase(),t.nss=n[2];let i=`${r}:${e.nid||t.nid}`,s=i_(i);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function g4(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let n=e.scheme||t.scheme||"urn",r=t.nid.toLowerCase(),i=`${n}:${e.nid||r}`,s=i_(i);s&&(t=s.serialize(t,e));let o=t,a=t.nss;return o.path=`${r||e.nid}:${a}`,e.skipEscape=!0,o}function y4(t,e){let n=t;return n.uuid=n.nss,n.nss=void 0,!e.tolerant&&(!n.uuid||!l4(n.uuid))&&(n.error=n.error||"UUID is not valid."),n}function T4(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Yq={scheme:"http",domainHost:!0,parse:zq,serialize:Gq},v4={scheme:"https",domainHost:Yq.domainHost,parse:zq,serialize:Gq},Um={scheme:"ws",domainHost:!0,parse:p4,serialize:h4},b4={scheme:"wss",domainHost:Um.domainHost,parse:Um.parse,serialize:Um.serialize},S4={scheme:"urn",parse:m4,serialize:g4,skipNormalize:!0},_4={scheme:"urn:uuid",parse:y4,serialize:T4,skipNormalize:!0},Hm={http:Yq,https:v4,ws:Um,wss:b4,urn:S4,"urn:uuid":_4};Object.setPrototypeOf(Hm,null);function i_(t){return t&&(Hm[t]||Hm[t.toLowerCase()])||void 0}Kq.exports={wsIsSecure:r_,SCHEMES:Hm,isValidSchemeName:f4,getSchemeHandler:i_}});var n$=N((hCe,Vm)=>{"use strict";var{normalizeIPv6:P4,removeDotSegments:Au,recomposeAuthority:k4,normalizePercentEncoding:N4,normalizePathEncoding:R4,escapePreservingEscapes:w4,reescapeHostDelimiters:E4,isIPv4:C4,nonSimpleDomain:D4}=n_(),{SCHEMES:A4,getSchemeHandler:Qq}=Xq();function I4(t,e){return typeof t=="string"?t=q4(t,e):typeof t=="object"&&(t=uc(Ao(t,e),e)),t}function O4(t,e,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},i=Zq(uc(t,r),uc(e,r),r,!0);return r.skipEscape=!0,Ao(i,r)}function Zq(t,e,n,r){let i={};return r||(t=uc(Ao(t,n),n),e=uc(Ao(e,n),n)),n=n||{},!n.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Au(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=Au(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=Au(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=Au(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 M4(t,e,n){let r=Jq(t,n),i=Jq(e,n);return r!==void 0&&i!==void 0&&r.toLowerCase()===i.toLowerCase()}function Ao(t,e){let n={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:""},r=Object.assign({},e),i=[],s=Qq(r.scheme||n.scheme);s&&s.serialize&&s.serialize(n,r),n.path!==void 0&&(r.skipEscape?n.path=N4(n.path):(n.path=w4(n.path),n.scheme!==void 0&&(n.path=n.path.split("%3A").join(":")))),r.reference!=="suffix"&&n.scheme&&i.push(n.scheme,":");let o=k4(n);if(o!==void 0&&(r.reference!=="suffix"&&i.push("//"),i.push(o),n.path&&n.path[0]!=="/"&&i.push("/")),n.path!==void 0){let a=n.path;!r.absolutePath&&(!s||!s.absolutePath)&&(a=Au(a)),o===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),i.push(a)}return n.query!==void 0&&i.push("?",n.query),n.fragment!==void 0&&i.push("#",n.fragment),i.join("")}var x4=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function L4(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function e$(t,e){let n=Object.assign({},e),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,s=!1;n.reference==="suffix"&&(n.scheme?t=n.scheme+":"+t:t="//"+t);let o=t.match(x4);if(o){r.scheme=o[1],r.userinfo=o[3],r.host=o[4],r.port=parseInt(o[5],10),r.path=o[6]||"",r.query=o[7],r.fragment=o[8],isNaN(r.port)&&(r.port=o[5]);let a=L4(r,o);if(a!==void 0&&(r.error=r.error||a,i=!0),r.host)if(C4(r.host)===!1){let u=P4(r.host);r.host=u.host.toLowerCase(),s=u.isIPV6}else s=!0;r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path?r.reference="same-document":r.scheme===void 0?r.reference="relative":r.fragment===void 0?r.reference="absolute":r.reference="uri",n.reference&&n.reference!=="suffix"&&n.reference!==r.reference&&(r.error=r.error||"URI is not a "+n.reference+" reference.");let c=Qq(n.scheme||r.scheme);if(!n.unicodeSupport&&(!c||!c.unicodeSupport)&&r.host&&(n.domainHost||c&&c.domainHost)&&s===!1&&D4(r.host))try{r.host=URL.domainToASCII(r.host.toLowerCase())}catch(l){r.error=r.error||"Host's domain name can not be converted to ASCII: "+l}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(r.scheme!==void 0&&(r.scheme=unescape(r.scheme)),r.host!==void 0&&(r.host=E4(unescape(r.host),s))),r.path&&(r.path=R4(r.path)),r.fragment))try{r.fragment=encodeURI(decodeURIComponent(r.fragment))}catch{r.error=r.error||"URI malformed"}c&&c.parse&&c.parse(r,n)}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:i}}function uc(t,e){return e$(t,e).parsed}function q4(t,e){return t$(t,e).normalized}function t$(t,e){let{parsed:n,malformedAuthorityOrPort:r}=e$(t,e);return{normalized:r?t:Ao(n,e),malformedAuthorityOrPort:r}}function Jq(t,e){if(typeof t=="string"){let{normalized:n,malformedAuthorityOrPort:r}=t$(t,e);return r?void 0:n}if(typeof t=="object")return Ao(t,e)}var s_={SCHEMES:A4,normalize:I4,resolve:O4,resolveComponent:Zq,equal:M4,serialize:Ao,parse:uc};Vm.exports=s_;Vm.exports.default=s_;Vm.exports.fastUri=s_});var i$=N(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var r$=n$();r$.code='require("ajv/dist/runtime/uri").default';o_.default=r$});var f$=N(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.CodeGen=Tn.Name=Tn.nil=Tn.stringify=Tn.str=Tn._=Tn.KeywordCxt=void 0;var $4=Eu();Object.defineProperty(Tn,"KeywordCxt",{enumerable:!0,get:function(){return $4.KeywordCxt}});var dc=be();Object.defineProperty(Tn,"_",{enumerable:!0,get:function(){return dc._}});Object.defineProperty(Tn,"str",{enumerable:!0,get:function(){return dc.str}});Object.defineProperty(Tn,"stringify",{enumerable:!0,get:function(){return dc.stringify}});Object.defineProperty(Tn,"nil",{enumerable:!0,get:function(){return dc.nil}});Object.defineProperty(Tn,"Name",{enumerable:!0,get:function(){return dc.Name}});Object.defineProperty(Tn,"CodeGen",{enumerable:!0,get:function(){return dc.CodeGen}});var F4=Bm(),l$=Cu(),B4=MS(),Iu=Du(),j4=be(),Ou=Nu(),Wm=ku(),c_=De(),s$=Fq(),U4=i$(),u$=(t,e)=>new RegExp(t,e);u$.code="new RegExp";var H4=["removeAdditional","useDefaults","coerceTypes"],V4=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),W4={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."},z4={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},o$=200;function G4(t){var e,n,r,i,s,o,a,c,l,u,d,f,p,m,h,y,S,b,v,k,R,q,O,B,Pe;let Qe=t.strict,Et=(e=t.code)===null||e===void 0?void 0:e.optimize,ke=Et===!0||Et===void 0?1:Et||0,dn=(r=(n=t.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:u$,Sn=(i=t.uriResolver)!==null&&i!==void 0?i:U4.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:Qe)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:Qe)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:Qe)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:Qe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:Qe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:ke,regExp:dn}:{optimize:ke,regExp:dn},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:o$,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:o$,meta:(S=t.meta)!==null&&S!==void 0?S:!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:(R=t.addUsedSchema)!==null&&R!==void 0?R:!0,validateSchema:(q=t.validateSchema)!==null&&q!==void 0?q:!0,validateFormats:(O=t.validateFormats)!==null&&O!==void 0?O:!0,unicodeRegExp:(B=t.unicodeRegExp)!==null&&B!==void 0?B:!0,int32range:(Pe=t.int32range)!==null&&Pe!==void 0?Pe:!0,uriResolver:Sn}}var Mu=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...G4(e)};let{es5:n,lines:r}=this.opts.code;this.scope=new j4.ValueScope({scope:{},prefixes:V4,es5:n,lines:r}),this.logger=Z4(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,B4.getRules)(),a$.call(this,W4,e,"NOT SUPPORTED"),a$.call(this,z4,e,"DEPRECATED","warn"),this._metaOpts=J4.call(this),e.formats&&K4.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&X4.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Y4.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:n,schemaId:r}=this.opts,i=s$;r==="id"&&(i={...s$},i.id=i.$id,delete i.$id),n&&e&&this.addMetaSchema(i,i[r],!1)}defaultMeta(){let{meta:e,schemaId:n}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[n]||e:void 0}validate(e,n){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let i=r(n);return"$async"in r||(this.errors=r.errors),i}compile(e,n){let r=this._addSchema(e,n);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,n){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return i.call(this,e,n);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 l$.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,n)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,n,r,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,r,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 n=(0,Ou.normalizeId)(n||s),this._checkUnique(n),this.schemas[n]=this._addSchema(e,r,n,i,!0),this}addMetaSchema(e,n,r=this.opts.validateSchema){return this.addSchema(e,n,!0,r),this}validateSchema(e,n){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(r,e);if(!i&&n){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 n;for(;typeof(n=c$.call(this,e))=="string";)e=n;if(n===void 0){let{schemaId:r}=this.opts,i=new Iu.SchemaEnv({schema:{},schemaId:r});if(n=Iu.resolveSchema.call(this,i,e),!n)return;this.refs[e]=n}return n.validate||this._compileSchemaEnv(n)}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 n=c$.call(this,e);return typeof n=="object"&&this._cache.delete(n.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let n=e;this._cache.delete(n);let r=e[this.opts.schemaId];return r&&(r=(0,Ou.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let n of e)this.addKeyword(n);return this}addKeyword(e,n){let r;if(typeof e=="string")r=e,typeof n=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),n.keyword=r);else if(typeof e=="object"&&n===void 0){if(n=e,r=n.keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(t9.call(this,r,n),!n)return(0,c_.eachItem)(r,s=>a_.call(this,s)),this;r9.call(this,n);let i={...n,type:(0,Wm.getJSONTypes)(n.type),schemaType:(0,Wm.getJSONTypes)(n.schemaType)};return(0,c_.eachItem)(r,i.type.length===0?s=>a_.call(this,s,i):s=>i.type.forEach(o=>a_.call(this,s,i,o))),this}getKeyword(e){let n=this.RULES.all[e];return typeof n=="object"?n.definition:!!n}removeKeyword(e){let{RULES:n}=this;delete n.keywords[e],delete n.all[e];for(let r of n.rules){let i=r.rules.findIndex(s=>s.keyword===e);i>=0&&r.rules.splice(i,1)}return this}addFormat(e,n){return typeof n=="string"&&(n=new RegExp(n)),this.formats[e]=n,this}errorsText(e=this.errors,{separator:n=", ",dataVar:r="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${r}${i.instancePath} ${i.message}`).reduce((i,s)=>i+n+s)}$dataMetaSchema(e,n){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of n){let s=i.split("/").slice(1),o=e;for(let a of s)o=o[a];for(let a in r){let c=r[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=o[a];l&&u&&(o[a]=d$(u))}}return e}_removeAllSchemas(e,n){for(let r in e){let i=e[r];(!n||n.test(r))&&(typeof i=="string"?delete e[r]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[r]))}}_addSchema(e,n,r,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;r=(0,Ou.normalizeId)(o||r);let l=Ou.getSchemaRefs.call(this,e,r);return c=new Iu.SchemaEnv({schema:e,schemaId:a,meta:n,baseId:r,localRefs:l}),this._cache.set(c.schema,c),s&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=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):Iu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let n=this.opts;this.opts=this._metaOpts;try{Iu.compileSchema.call(this,e)}finally{this.opts=n}}};Mu.ValidationError=F4.default;Mu.MissingRefError=l$.default;Tn.default=Mu;function a$(t,e,n,r="error"){for(let i in t){let s=i;s in e&&this.logger[r](`${n}: option ${i}. ${t[s]}`)}}function c$(t){return t=(0,Ou.normalizeId)(t),this.schemas[t]||this.refs[t]}function Y4(){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 K4(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function X4(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 n=t[e];n.keyword||(n.keyword=e),this.addKeyword(n)}}function J4(){let t={...this.opts};for(let e of H4)delete t[e];return t}var Q4={log(){},warn(){},error(){}};function Z4(t){if(t===!1)return Q4;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 e9=/^[a-z_$][a-z0-9_$:-]*$/i;function t9(t,e){let{RULES:n}=this;if((0,c_.eachItem)(t,r=>{if(n.keywords[r])throw new Error(`Keyword ${r} is already defined`);if(!e9.test(r))throw new Error(`Keyword ${r} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function a_(t,e,n){var r;let i=e?.post;if(n&&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===n);if(o||(o={type:n,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Wm.getJSONTypes)(e.type),schemaType:(0,Wm.getJSONTypes)(e.schemaType)}};e.before?n9.call(this,o,a,e.before):o.rules.push(a),s.all[t]=a,(r=e.implements)===null||r===void 0||r.forEach(c=>this.addKeyword(c))}function n9(t,e,n){let r=t.rules.findIndex(i=>i.keyword===n);r>=0?t.rules.splice(r,0,e):(t.rules.push(e),this.logger.warn(`rule ${n} is not defined`))}function r9(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=d$(e)),t.validateSchema=this.compile(e,!0))}var i9={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function d$(t){return{anyOf:[t,i9]}}});var p$=N(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var s9={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};l_.default=s9});var Ym=N(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.callRef=Io.getValidate=void 0;var o9=Cu(),h$=$r(),cr=be(),fc=qr(),m$=Du(),zm=De(),a9={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:n,it:r}=t,{baseId:i,schemaEnv:s,validateName:o,opts:a,self:c}=r,{root:l}=s;if((n==="#"||n==="#/")&&i===l.baseId)return d();let u=m$.resolveRef.call(c,l,i,n);if(u===void 0)throw new o9.default(r.opts.uriResolver,i,n);if(u instanceof m$.SchemaEnv)return f(u);return p(u);function d(){if(s===l)return Gm(t,o,s,s.$async);let m=e.scopeValue("root",{ref:l});return Gm(t,(0,cr._)`${m}.validate`,l,l.$async)}function f(m){let h=g$(t,m);Gm(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,cr.stringify)(m)}:{ref:m}),y=e.name("valid"),S=t.subschema({schema:m,dataTypes:[],schemaPath:cr.nil,topSchemaRef:h,errSchemaPath:n},y);t.mergeEvaluated(S),t.ok(y)}}};function g$(t,e){let{gen:n}=t;return e.validate?n.scopeValue("validate",{ref:e.validate}):(0,cr._)`${n.scopeValue("wrapper",{ref:e})}.validate`}Io.getValidate=g$;function Gm(t,e,n,r){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:a,opts:c}=s,l=c.passContext?fc.default.this:cr.nil;r?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,cr._)`await ${(0,h$.callValidateCode)(t,e,l)}`),p(e),o||i.assign(m,!0)},h=>{i.if((0,cr._)`!(${h} instanceof ${s.ValidationError})`,()=>i.throw(h)),f(h),o||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,h$.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,cr._)`${m}.errors`;i.assign(fc.default.vErrors,(0,cr._)`${fc.default.vErrors} === null ? ${h} : ${fc.default.vErrors}.concat(${h})`),i.assign(fc.default.errors,(0,cr._)`${fc.default.vErrors}.length`)}function p(m){var h;if(!s.opts.unevaluated)return;let y=(h=n?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=zm.mergeEvaluated.props(i,y.props,s.props));else{let S=i.var("props",(0,cr._)`${m}.evaluated.props`);s.props=zm.mergeEvaluated.props(i,S,s.props,cr.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=zm.mergeEvaluated.items(i,y.items,s.items));else{let S=i.var("items",(0,cr._)`${m}.evaluated.items`);s.items=zm.mergeEvaluated.items(i,S,s.items,cr.Name)}}}Io.callRef=Gm;Io.default=a9});var y$=N(u_=>{"use strict";Object.defineProperty(u_,"__esModule",{value:!0});var c9=p$(),l9=Ym(),u9=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",c9.default,l9.default];u_.default=u9});var T$=N(d_=>{"use strict";Object.defineProperty(d_,"__esModule",{value:!0});var Km=be(),Hs=Km.operators,Xm={maximum:{okStr:"<=",ok:Hs.LTE,fail:Hs.GT},minimum:{okStr:">=",ok:Hs.GTE,fail:Hs.LT},exclusiveMaximum:{okStr:"<",ok:Hs.LT,fail:Hs.GTE},exclusiveMinimum:{okStr:">",ok:Hs.GT,fail:Hs.LTE}},d9={message:({keyword:t,schemaCode:e})=>(0,Km.str)`must be ${Xm[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Km._)`{comparison: ${Xm[t].okStr}, limit: ${e}}`},f9={keyword:Object.keys(Xm),type:"number",schemaType:"number",$data:!0,error:d9,code(t){let{keyword:e,data:n,schemaCode:r}=t;t.fail$data((0,Km._)`${n} ${Xm[e].fail} ${r} || isNaN(${n})`)}};d_.default=f9});var v$=N(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});var xu=be(),p9={message:({schemaCode:t})=>(0,xu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,xu._)`{multipleOf: ${t}}`},h9={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:p9,code(t){let{gen:e,data:n,schemaCode:r,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),a=s?(0,xu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,xu._)`${o} !== parseInt(${o})`;t.fail$data((0,xu._)`(${r} === 0 || (${o} = ${n}/${r}, ${a}))`)}};f_.default=h9});var S$=N(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});function b$(t){let e=t.length,n=0,r=0,i;for(;r<e;)n++,i=t.charCodeAt(r++),i>=55296&&i<=56319&&r<e&&(i=t.charCodeAt(r),(i&64512)===56320&&r++);return n}p_.default=b$;b$.code='require("ajv/dist/runtime/ucs2length").default'});var _$=N(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});var Oo=be(),m9=De(),g9=S$(),y9={message({keyword:t,schemaCode:e}){let n=t==="maxLength"?"more":"fewer";return(0,Oo.str)`must NOT have ${n} than ${e} characters`},params:({schemaCode:t})=>(0,Oo._)`{limit: ${t}}`},T9={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:y9,code(t){let{keyword:e,data:n,schemaCode:r,it:i}=t,s=e==="maxLength"?Oo.operators.GT:Oo.operators.LT,o=i.opts.unicode===!1?(0,Oo._)`${n}.length`:(0,Oo._)`${(0,m9.useFunc)(t.gen,g9.default)}(${n})`;t.fail$data((0,Oo._)`${o} ${s} ${r}`)}};h_.default=T9});var P$=N(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});var v9=$r(),b9=De(),pc=be(),S9={message:({schemaCode:t})=>(0,pc.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,pc._)`{pattern: ${t}}`},_9={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:S9,code(t){let{gen:e,data:n,$data:r,schema:i,schemaCode:s,it:o}=t,a=o.opts.unicodeRegExp?"u":"";if(r){let{regExp:c}=o.opts.code,l=c.code==="new RegExp"?(0,pc._)`new RegExp`:(0,b9.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0,pc._)`${l}(${s}, ${a}).test(${n})`),()=>e.assign(u,!1)),t.fail$data((0,pc._)`!${u}`)}else{let c=(0,v9.usePattern)(t,i);t.fail$data((0,pc._)`!${c}.test(${n})`)}}};m_.default=_9});var k$=N(g_=>{"use strict";Object.defineProperty(g_,"__esModule",{value:!0});var Lu=be(),P9={message({keyword:t,schemaCode:e}){let n=t==="maxProperties"?"more":"fewer";return(0,Lu.str)`must NOT have ${n} than ${e} properties`},params:({schemaCode:t})=>(0,Lu._)`{limit: ${t}}`},k9={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:P9,code(t){let{keyword:e,data:n,schemaCode:r}=t,i=e==="maxProperties"?Lu.operators.GT:Lu.operators.LT;t.fail$data((0,Lu._)`Object.keys(${n}).length ${i} ${r}`)}};g_.default=k9});var N$=N(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var qu=$r(),$u=be(),N9=De(),R9={message:({params:{missingProperty:t}})=>(0,$u.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,$u._)`{missingProperty: ${t}}`},w9={keyword:"required",type:"object",schemaType:"array",$data:!0,error:R9,code(t){let{gen:e,schema:n,schemaCode:r,data:i,$data:s,it:o}=t,{opts:a}=o;if(!s&&n.length===0)return;let c=n.length>=a.loopRequired;if(o.allErrors?l():u(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of n)if(p?.[h]===void 0&&!m.has(h)){let y=o.schemaEnv.baseId+o.errSchemaPath,S=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,N9.checkStrictMode)(o,S,o.opts.strictRequired)}}function l(){if(c||s)t.block$data($u.nil,d);else for(let p of n)(0,qu.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,qu.checkMissingProp)(t,n,p)),(0,qu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",r,p=>{t.setParams({missingProperty:p}),e.if((0,qu.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,r,()=>{e.assign(m,(0,qu.propertyInData)(e,i,p,a.ownProperties)),e.if((0,$u.not)(m),()=>{t.error(),e.break()})},$u.nil)}}};y_.default=w9});var R$=N(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});var Fu=be(),E9={message({keyword:t,schemaCode:e}){let n=t==="maxItems"?"more":"fewer";return(0,Fu.str)`must NOT have ${n} than ${e} items`},params:({schemaCode:t})=>(0,Fu._)`{limit: ${t}}`},C9={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:E9,code(t){let{keyword:e,data:n,schemaCode:r}=t,i=e==="maxItems"?Fu.operators.GT:Fu.operators.LT;t.fail$data((0,Fu._)`${n}.length ${i} ${r}`)}};T_.default=C9});var Jm=N(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});var w$=US();w$.code='require("ajv/dist/runtime/equal").default';v_.default=w$});var E$=N(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});var b_=ku(),vn=be(),D9=De(),A9=Jm(),I9={message:({params:{i:t,j:e}})=>(0,vn.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,vn._)`{i: ${t}, j: ${e}}`},O9={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:I9,code(t){let{gen:e,data:n,$data:r,schema:i,parentSchema:s,schemaCode:o,it:a}=t;if(!r&&!i)return;let c=e.let("valid"),l=s.items?(0,b_.getSchemaTypes)(s.items):[];t.block$data(c,u,(0,vn._)`${o} === false`),t.ok(c);function u(){let m=e.let("i",(0,vn._)`${n}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,vn._)`${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 y=e.name("item"),S=(0,b_.checkDataTypes)(l,y,a.opts.strictNumbers,b_.DataType.Wrong),b=e.const("indices",(0,vn._)`{}`);e.for((0,vn._)`;${m}--;`,()=>{e.let(y,(0,vn._)`${n}[${m}]`),e.if(S,(0,vn._)`continue`),l.length>1&&e.if((0,vn._)`typeof ${y} == "string"`,(0,vn._)`${y} += "_"`),e.if((0,vn._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(h,(0,vn._)`${b}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,vn._)`${b}[${y}] = ${m}`)})}function p(m,h){let y=(0,D9.useFunc)(e,A9.default),S=e.name("outer");e.label(S).for((0,vn._)`;${m}--;`,()=>e.for((0,vn._)`${h} = ${m}; ${h}--;`,()=>e.if((0,vn._)`${y}(${n}[${m}], ${n}[${h}])`,()=>{t.error(),e.assign(c,!1).break(S)})))}}};S_.default=O9});var C$=N(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});var __=be(),M9=De(),x9=Jm(),L9={message:"must be equal to constant",params:({schemaCode:t})=>(0,__._)`{allowedValue: ${t}}`},q9={keyword:"const",$data:!0,error:L9,code(t){let{gen:e,data:n,$data:r,schemaCode:i,schema:s}=t;r||s&&typeof s=="object"?t.fail$data((0,__._)`!${(0,M9.useFunc)(e,x9.default)}(${n}, ${i})`):t.fail((0,__._)`${s} !== ${n}`)}};P_.default=q9});var D$=N(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var Bu=be(),$9=De(),F9=Jm(),B9={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Bu._)`{allowedValues: ${t}}`},j9={keyword:"enum",schemaType:"array",$data:!0,error:B9,code(t){let{gen:e,data:n,$data:r,schema:i,schemaCode:s,it:o}=t;if(!r&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=o.opts.loopEnum,c,l=()=>c??(c=(0,$9.useFunc)(e,F9.default)),u;if(a||r)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,Bu.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,Bu._)`${l()}(${n}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,Bu._)`${l()}(${n}, ${p}[${m}])`:(0,Bu._)`${n} === ${h}`}}};k_.default=j9});var A$=N(N_=>{"use strict";Object.defineProperty(N_,"__esModule",{value:!0});var U9=T$(),H9=v$(),V9=_$(),W9=P$(),z9=k$(),G9=N$(),Y9=R$(),K9=E$(),X9=C$(),J9=D$(),Q9=[U9.default,H9.default,V9.default,W9.default,z9.default,G9.default,Y9.default,K9.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},X9.default,J9.default];N_.default=Q9});var w_=N(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.validateAdditionalItems=void 0;var Mo=be(),R_=De(),Z9={message:({params:{len:t}})=>(0,Mo.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Mo._)`{limit: ${t}}`},eJ={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Z9,code(t){let{parentSchema:e,it:n}=t,{items:r}=e;if(!Array.isArray(r)){(0,R_.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}I$(t,r)}};function I$(t,e){let{gen:n,schema:r,data:i,keyword:s,it:o}=t;o.items=!0;let a=n.const("len",(0,Mo._)`${i}.length`);if(r===!1)t.setParams({len:e.length}),t.pass((0,Mo._)`${a} <= ${e.length}`);else if(typeof r=="object"&&!(0,R_.alwaysValidSchema)(o,r)){let l=n.var("valid",(0,Mo._)`${a} <= ${e.length}`);n.if((0,Mo.not)(l),()=>c(l)),t.ok(l)}function c(l){n.forRange("i",e.length,a,u=>{t.subschema({keyword:s,dataProp:u,dataPropType:R_.Type.Num},l),o.allErrors||n.if((0,Mo.not)(l),()=>n.break())})}}ju.validateAdditionalItems=I$;ju.default=eJ});var E_=N(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.validateTuple=void 0;var O$=be(),Qm=De(),tJ=$r(),nJ={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:n}=t;if(Array.isArray(e))return M$(t,"additionalItems",e);n.items=!0,!(0,Qm.alwaysValidSchema)(n,e)&&t.ok((0,tJ.validateArray)(t))}};function M$(t,e,n=t.schema){let{gen:r,parentSchema:i,data:s,keyword:o,it:a}=t;u(i),a.opts.unevaluated&&n.length&&a.items!==!0&&(a.items=Qm.mergeEvaluated.items(r,n.length,a.items));let c=r.name("valid"),l=r.const("len",(0,O$._)`${s}.length`);n.forEach((d,f)=>{(0,Qm.alwaysValidSchema)(a,d)||(r.if((0,O$._)`${l} > ${f}`,()=>t.subschema({keyword:o,schemaProp:f,dataProp:f},c)),t.ok(c))});function u(d){let{opts:f,errSchemaPath:p}=a,m=n.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let y=`"${o}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,Qm.checkStrictMode)(a,y,f.strictTuples)}}}Uu.validateTuple=M$;Uu.default=nJ});var x$=N(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});var rJ=E_(),iJ={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,rJ.validateTuple)(t,"items")};C_.default=iJ});var q$=N(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});var L$=be(),sJ=De(),oJ=$r(),aJ=w_(),cJ={message:({params:{len:t}})=>(0,L$.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,L$._)`{limit: ${t}}`},lJ={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:cJ,code(t){let{schema:e,parentSchema:n,it:r}=t,{prefixItems:i}=n;r.items=!0,!(0,sJ.alwaysValidSchema)(r,e)&&(i?(0,aJ.validateAdditionalItems)(t,i):t.ok((0,oJ.validateArray)(t)))}};D_.default=lJ});var $$=N(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});var Br=be(),Zm=De(),uJ={message:({params:{min:t,max:e}})=>e===void 0?(0,Br.str)`must contain at least ${t} valid item(s)`:(0,Br.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Br._)`{minContains: ${t}}`:(0,Br._)`{minContains: ${t}, maxContains: ${e}}`},dJ={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:uJ,code(t){let{gen:e,schema:n,parentSchema:r,data:i,it:s}=t,o,a,{minContains:c,maxContains:l}=r;s.opts.next?(o=c===void 0?1:c,a=l):o=1;let u=e.const("len",(0,Br._)`${i}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,Zm.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,Zm.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Zm.alwaysValidSchema)(s,n)){let h=(0,Br._)`${u} >= ${o}`;a!==void 0&&(h=(0,Br._)`${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,Br._)`${i}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),y=e.let("count",0);p(h,()=>e.if(h,()=>m(y)))}function p(h,y){e.forRange("i",0,u,S=>{t.subschema({keyword:"contains",dataProp:S,dataPropType:Zm.Type.Num,compositeRule:!0},h),y()})}function m(h){e.code((0,Br._)`${h}++`),a===void 0?e.if((0,Br._)`${h} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,Br._)`${h} > ${a}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,Br._)`${h} >= ${o}`,()=>e.assign(d,!0)))}}};A_.default=dJ});var eg=N(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.validateSchemaDeps=xi.validatePropertyDeps=xi.error=void 0;var I_=be(),fJ=De(),Hu=$r();xi.error={message:({params:{property:t,depsCount:e,deps:n}})=>{let r=e===1?"property":"properties";return(0,I_.str)`must have ${r} ${n} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:n,missingProperty:r}})=>(0,I_._)`{property: ${t},
|
|
179
|
+
|| ${o} === "boolean" || ${i} === null`).assign(a,(0,Se._)`[${i}]`)}}}function M3({gen:t,parentData:e,parentDataProperty:n},r){t.if((0,Se._)`${e} !== undefined`,()=>t.assign((0,Se._)`${e}[${n}]`,r))}function LS(t,e,n,r=oc.Correct){let i=r===oc.Correct?Se.operators.EQ:Se.operators.NEQ,s;switch(t){case"null":return(0,Se._)`${e} ${i} null`;case"array":s=(0,Se._)`Array.isArray(${e})`;break;case"object":s=(0,Se._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,Se._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,Se._)`typeof ${e} ${i} ${t}`}return r===oc.Correct?s:(0,Se.not)(s);function o(a=Se.nil){return(0,Se.and)((0,Se._)`typeof ${e} == "number"`,a,n?(0,Se._)`isFinite(${e})`:Se.nil)}}In.checkDataType=LS;function qS(t,e,n,r){if(t.length===1)return LS(t[0],e,n,r);let i,s=(0,sq.toHash)(t);if(s.array&&s.object){let o=(0,Se._)`typeof ${e} != "object"`;i=s.null?o:(0,Se._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=Se.nil;s.number&&delete s.integer;for(let o in s)i=(0,Se.and)(i,LS(o,e,n,r));return i}In.checkDataTypes=qS;var x3={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Se._)`{type: ${t}}`:(0,Se._)`{type: ${e}}`};function $S(t){let e=L3(t);(0,C3.reportError)(e,x3)}In.reportTypeError=$S;function L3(t){let{gen:e,data:n,schema:r}=t,i=(0,sq.schemaRefOrVal)(t,r,"type");return{gen:e,keyword:"type",data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:t}}});var lq=N(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});Lm.assignDefaults=void 0;var ac=be(),q3=De();function $3(t,e){let{properties:n,items:r}=t.schema;if(e==="object"&&n)for(let i in n)cq(t,i,n[i].default);else e==="array"&&Array.isArray(r)&&r.forEach((i,s)=>cq(t,s,i.default))}Lm.assignDefaults=$3;function cq(t,e,n){let{gen:r,compositeRule:i,data:s,opts:o}=t;if(n===void 0)return;let a=(0,ac._)`${s}${(0,ac.getProperty)(e)}`;if(i){(0,q3.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,ac._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,ac._)`${c} || ${a} === null || ${a} === ""`),r.if(c,(0,ac._)`${a} = ${(0,ac.stringify)(n)}`)}});var $r=N(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.validateUnion=ot.validateArray=ot.usePattern=ot.callValidateCode=ot.schemaProperties=ot.allSchemaProperties=ot.noPropertyInData=ot.propertyInData=ot.isOwnProperty=ot.hasPropFunc=ot.reportMissingProp=ot.checkMissingProp=ot.checkReportMissingProp=void 0;var _t=be(),FS=De(),Fs=qr(),F3=De();function B3(t,e){let{gen:n,data:r,it:i}=t;n.if(jS(n,r,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,_t._)`${e}`},!0),t.error()})}ot.checkReportMissingProp=B3;function j3({gen:t,data:e,it:{opts:n}},r,i){return(0,_t.or)(...r.map(s=>(0,_t.and)(jS(t,e,s,n.ownProperties),(0,_t._)`${i} = ${s}`)))}ot.checkMissingProp=j3;function U3(t,e){t.setParams({missingProperty:e},!0),t.error()}ot.reportMissingProp=U3;function uq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,_t._)`Object.prototype.hasOwnProperty`})}ot.hasPropFunc=uq;function BS(t,e,n){return(0,_t._)`${uq(t)}.call(${e}, ${n})`}ot.isOwnProperty=BS;function H3(t,e,n,r){let i=(0,_t._)`${e}${(0,_t.getProperty)(n)} !== undefined`;return r?(0,_t._)`${i} && ${BS(t,e,n)}`:i}ot.propertyInData=H3;function jS(t,e,n,r){let i=(0,_t._)`${e}${(0,_t.getProperty)(n)} === undefined`;return r?(0,_t.or)(i,(0,_t.not)(BS(t,e,n))):i}ot.noPropertyInData=jS;function dq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ot.allSchemaProperties=dq;function V3(t,e){return dq(e).filter(n=>!(0,FS.alwaysValidSchema)(t,e[n]))}ot.schemaProperties=V3;function W3({schemaCode:t,data:e,it:{gen:n,topSchemaRef:r,schemaPath:i,errorPath:s},it:o},a,c,l){let u=l?(0,_t._)`${t}, ${e}, ${r}${i}`:e,d=[[Fs.default.instancePath,(0,_t.strConcat)(Fs.default.instancePath,s)],[Fs.default.parentData,o.parentData],[Fs.default.parentDataProperty,o.parentDataProperty],[Fs.default.rootData,Fs.default.rootData]];o.opts.dynamicRef&&d.push([Fs.default.dynamicAnchors,Fs.default.dynamicAnchors]);let f=(0,_t._)`${u}, ${n.object(...d)}`;return c!==_t.nil?(0,_t._)`${a}.call(${c}, ${f})`:(0,_t._)`${a}(${f})`}ot.callValidateCode=W3;var z3=(0,_t._)`new RegExp`;function G3({gen:t,it:{opts:e}},n){let r=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(n,r);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,_t._)`${i.code==="new RegExp"?z3:(0,F3.useFunc)(t,i)}(${n}, ${r})`})}ot.usePattern=G3;function Y3(t){let{gen:e,data:n,keyword:r,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,_t._)`${n}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:r,dataProp:l,dataPropType:FS.Type.Num},s),e.if((0,_t.not)(s),a)})}}ot.validateArray=Y3;function K3(t){let{gen:e,schema:n,keyword:r,it:i}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(c=>(0,FS.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),a=e.name("_valid");e.block(()=>n.forEach((c,l)=>{let u=t.subschema({keyword:r,schemaProp:l,compositeRule:!0},a);e.assign(o,(0,_t._)`${o} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,_t.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}ot.validateUnion=K3});var hq=N(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.validateKeywordUsage=Oi.validSchemaType=Oi.funcKeywordCode=Oi.macroKeywordCode=void 0;var Un=be(),Co=qr(),X3=$r(),J3=Pu();function Q3(t,e){let{gen:n,keyword:r,schema:i,parentSchema:s,it:o}=t,a=e.macro.call(o.self,i,s,o),c=pq(n,r,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let l=n.name("valid");t.subschema({schema:a,schemaPath:Un.nil,errSchemaPath:`${o.errSchemaPath}/${r}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}Oi.macroKeywordCode=Q3;function Z3(t,e){var n;let{gen:r,keyword:i,schema:s,parentSchema:o,$data:a,it:c}=t;tX(c,e);let l=!a&&e.compile?e.compile.call(c.self,s,o,c):e.validate,u=pq(r,i,l),d=r.let("valid");t.block$data(d,f),t.ok((n=e.valid)!==null&&n!==void 0?n:d);function f(){if(e.errors===!1)h(),e.modifying&&fq(t),y(()=>t.error());else{let S=e.async?p():m();e.modifying&&fq(t),y(()=>eX(t,S))}}function p(){let S=r.let("ruleErrs",null);return r.try(()=>h((0,Un._)`await `),b=>r.assign(d,!1).if((0,Un._)`${b} instanceof ${c.ValidationError}`,()=>r.assign(S,(0,Un._)`${b}.errors`),()=>r.throw(b))),S}function m(){let S=(0,Un._)`${u}.errors`;return r.assign(S,null),h(Un.nil),S}function h(S=e.async?(0,Un._)`await `:Un.nil){let b=c.opts.passContext?Co.default.this:Co.default.self,v=!("compile"in e&&!a||e.schema===!1);r.assign(d,(0,Un._)`${S}${(0,X3.callValidateCode)(t,u,b,v)}`,e.modifying)}function y(S){var b;r.if((0,Un.not)((b=e.valid)!==null&&b!==void 0?b:d),S)}}Oi.funcKeywordCode=Z3;function fq(t){let{gen:e,data:n,it:r}=t;e.if(r.parentData,()=>e.assign(n,(0,Un._)`${r.parentData}[${r.parentDataProperty}]`))}function eX(t,e){let{gen:n}=t;n.if((0,Un._)`Array.isArray(${e})`,()=>{n.assign(Co.default.vErrors,(0,Un._)`${Co.default.vErrors} === null ? ${e} : ${Co.default.vErrors}.concat(${e})`).assign(Co.default.errors,(0,Un._)`${Co.default.vErrors}.length`),(0,J3.extendErrors)(t)},()=>t.error())}function tX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function pq(t,e,n){if(n===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,Un.stringify)(n)})}function nX(t,e,n=!1){return!e.length||e.some(r=>r==="array"?Array.isArray(t):r==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==r||n&&typeof t>"u")}Oi.validSchemaType=nX;function rX({schema:t,opts:e,self:n,errSchemaPath:r},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 "${r}": `+n.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")n.logger.error(c);else throw new Error(c)}}Oi.validateKeywordUsage=rX});var gq=N(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.extendSubschemaMode=Bs.extendSubschemaData=Bs.getSubschema=void 0;var Mi=be(),mq=De();function iX(t,{keyword:e,schemaProp:n,schema:r,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return n===void 0?{schema:a,schemaPath:(0,Mi._)`${t.schemaPath}${(0,Mi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[n],schemaPath:(0,Mi._)`${t.schemaPath}${(0,Mi.getProperty)(e)}${(0,Mi.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,mq.escapeFragment)(n)}`}}if(r!==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:r,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Bs.getSubschema=iX;function sX(t,e,{dataProp:n,dataPropType:r,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(n!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,f=a.let("data",(0,Mi._)`${e.data}${(0,Mi.getProperty)(n)}`,!0);c(f),t.errorPath=(0,Mi.str)`${l}${(0,mq.getErrorPath)(n,r,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Mi._)`${n}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let l=i instanceof Mi.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]}}Bs.extendSubschemaData=sX;function oX(t,{jtdDiscriminator:e,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:s}){r!==void 0&&(t.compositeRule=r),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=n}Bs.extendSubschemaMode=oX});var US=N((rCe,yq)=>{"use strict";yq.exports=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}});var vq=N((iCe,Tq)=>{"use strict";var js=Tq.exports=function(t,e,n){typeof e=="function"&&(n=e,e={}),n=e.cb||n;var r=typeof n=="function"?n:n.pre||function(){},i=n.post||function(){};qm(e,r,i,t,"",t)};js.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};js.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};js.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};js.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 qm(t,e,n,r,i,s,o,a,c,l){if(r&&typeof r=="object"&&!Array.isArray(r)){e(r,i,s,o,a,c,l);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in js.arrayKeywords)for(var f=0;f<d.length;f++)qm(t,e,n,d[f],i+"/"+u+"/"+f,s,i,u,r,f)}else if(u in js.propsKeywords){if(d&&typeof d=="object")for(var p in d)qm(t,e,n,d[p],i+"/"+u+"/"+aX(p),s,i,u,r,p)}else(u in js.keywords||t.allKeys&&!(u in js.skipKeywords))&&qm(t,e,n,d,i+"/"+u,s,i,u,r)}n(r,i,s,o,a,c,l)}}function aX(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Nu=N(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.getSchemaRefs=ar.resolveUrl=ar.normalizeId=ar._getFullPath=ar.getFullPath=ar.inlineRef=void 0;var cX=De(),lX=US(),uX=vq(),dX=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function fX(t,e=!0){return typeof t=="boolean"?!0:e===!0?!HS(t):e?bq(t)<=e:!1}ar.inlineRef=fX;var pX=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function HS(t){for(let e in t){if(pX.has(e))return!0;let n=t[e];if(Array.isArray(n)&&n.some(HS)||typeof n=="object"&&HS(n))return!0}return!1}function bq(t){let e=0;for(let n in t){if(n==="$ref")return 1/0;if(e++,!dX.has(n)&&(typeof t[n]=="object"&&(0,cX.eachItem)(t[n],r=>e+=bq(r)),e===1/0))return 1/0}return e}function Sq(t,e="",n){n!==!1&&(e=cc(e));let r=t.parse(e);return _q(t,r)}ar.getFullPath=Sq;function _q(t,e){return t.serialize(e).split("#")[0]+"#"}ar._getFullPath=_q;var hX=/#\/?$/;function cc(t){return t?t.replace(hX,""):""}ar.normalizeId=cc;function mX(t,e,n){return n=cc(n),t.resolve(e,n)}ar.resolveUrl=mX;var gX=/^[a-z_][-a-z0-9._]*$/i;function yX(t,e){if(typeof t=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,i=cc(t[n]||e),s={"":i},o=Sq(r,i,!1),a={},c=new Set;return uX(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=o+f,y=s[m];typeof d[n]=="string"&&(y=S.call(this,d[n])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),s[f]=y;function S(v){let k=this.opts.uriResolver.resolve;if(v=cc(y?k(y,v):v),c.has(v))throw u(v);c.add(v);let R=this.refs[v];return typeof R=="string"&&(R=this.refs[R]),typeof R=="object"?l(d,R.schema,v):v!==cc(h)&&(v[0]==="#"?(l(d,a[v],v),a[v]=d):this.refs[v]=h),v}function b(v){if(typeof v=="string"){if(!gX.test(v))throw new Error(`invalid anchor "${v}"`);S.call(this,`#${v}`)}}}),a;function l(d,f,p){if(f!==void 0&&!lX(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}ar.getSchemaRefs=yX});var Eu=N(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.getData=Us.KeywordCxt=Us.validateFunctionCode=void 0;var wq=nq(),Pq=ku(),WS=xS(),$m=ku(),TX=lq(),wu=hq(),VS=gq(),oe=be(),ge=qr(),vX=Nu(),ns=De(),Ru=Pu();function bX(t){if(Dq(t)&&(Aq(t),Cq(t))){PX(t);return}Eq(t,()=>(0,wq.topBoolOrEmptySchema)(t))}Us.validateFunctionCode=bX;function Eq({gen:t,validateName:e,schema:n,schemaEnv:r,opts:i},s){i.code.es5?t.func(e,(0,oe._)`${ge.default.data}, ${ge.default.valCxt}`,r.$async,()=>{t.code((0,oe._)`"use strict"; ${kq(n,i)}`),_X(t,i),t.code(s)}):t.func(e,(0,oe._)`${ge.default.data}, ${SX(i)}`,r.$async,()=>t.code(kq(n,i)).code(s))}function SX(t){return(0,oe._)`{${ge.default.instancePath}="", ${ge.default.parentData}, ${ge.default.parentDataProperty}, ${ge.default.rootData}=${ge.default.data}${t.dynamicRef?(0,oe._)`, ${ge.default.dynamicAnchors}={}`:oe.nil}}={}`}function _X(t,e){t.if(ge.default.valCxt,()=>{t.var(ge.default.instancePath,(0,oe._)`${ge.default.valCxt}.${ge.default.instancePath}`),t.var(ge.default.parentData,(0,oe._)`${ge.default.valCxt}.${ge.default.parentData}`),t.var(ge.default.parentDataProperty,(0,oe._)`${ge.default.valCxt}.${ge.default.parentDataProperty}`),t.var(ge.default.rootData,(0,oe._)`${ge.default.valCxt}.${ge.default.rootData}`),e.dynamicRef&&t.var(ge.default.dynamicAnchors,(0,oe._)`${ge.default.valCxt}.${ge.default.dynamicAnchors}`)},()=>{t.var(ge.default.instancePath,(0,oe._)`""`),t.var(ge.default.parentData,(0,oe._)`undefined`),t.var(ge.default.parentDataProperty,(0,oe._)`undefined`),t.var(ge.default.rootData,ge.default.data),e.dynamicRef&&t.var(ge.default.dynamicAnchors,(0,oe._)`{}`)})}function PX(t){let{schema:e,opts:n,gen:r}=t;Eq(t,()=>{n.$comment&&e.$comment&&Oq(t),EX(t),r.let(ge.default.vErrors,null),r.let(ge.default.errors,0),n.unevaluated&&kX(t),Iq(t),AX(t)})}function kX(t){let{gen:e,validateName:n}=t;t.evaluated=e.const("evaluated",(0,oe._)`${n}.evaluated`),e.if((0,oe._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,oe._)`${t.evaluated}.props`,(0,oe._)`undefined`)),e.if((0,oe._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,oe._)`${t.evaluated}.items`,(0,oe._)`undefined`))}function kq(t,e){let n=typeof t=="object"&&t[e.schemaId];return n&&(e.code.source||e.code.process)?(0,oe._)`/*# sourceURL=${n} */`:oe.nil}function NX(t,e){if(Dq(t)&&(Aq(t),Cq(t))){RX(t,e);return}(0,wq.boolOrEmptySchema)(t,e)}function Cq({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let n in t)if(e.RULES.all[n])return!0;return!1}function Dq(t){return typeof t.schema!="boolean"}function RX(t,e){let{schema:n,gen:r,opts:i}=t;i.$comment&&n.$comment&&Oq(t),CX(t),DX(t);let s=r.const("_errs",ge.default.errors);Iq(t,s),r.var(e,(0,oe._)`${s} === ${ge.default.errors}`)}function Aq(t){(0,ns.checkUnknownRules)(t),wX(t)}function Iq(t,e){if(t.opts.jtd)return Nq(t,[],!1,e);let n=(0,Pq.getSchemaTypes)(t.schema),r=(0,Pq.coerceAndCheckDataType)(t,n);Nq(t,n,!r,e)}function wX(t){let{schema:e,errSchemaPath:n,opts:r,self:i}=t;e.$ref&&r.ignoreKeywordsWithRef&&(0,ns.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function EX(t){let{schema:e,opts:n}=t;e.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,ns.checkStrictMode)(t,"default is ignored in the schema root")}function CX(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,vX.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function DX(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Oq({gen:t,schemaEnv:e,schema:n,errSchemaPath:r,opts:i}){let s=n.$comment;if(i.$comment===!0)t.code((0,oe._)`${ge.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,oe.str)`${r}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,oe._)`${ge.default.self}.opts.$comment(${s}, ${o}, ${a}.schema)`)}}function AX(t){let{gen:e,schemaEnv:n,validateName:r,ValidationError:i,opts:s}=t;n.$async?e.if((0,oe._)`${ge.default.errors} === 0`,()=>e.return(ge.default.data),()=>e.throw((0,oe._)`new ${i}(${ge.default.vErrors})`)):(e.assign((0,oe._)`${r}.errors`,ge.default.vErrors),s.unevaluated&&IX(t),e.return((0,oe._)`${ge.default.errors} === 0`))}function IX({gen:t,evaluated:e,props:n,items:r}){n instanceof oe.Name&&t.assign((0,oe._)`${e}.props`,n),r instanceof oe.Name&&t.assign((0,oe._)`${e}.items`,r)}function Nq(t,e,n,r){let{gen:i,schema:s,data:o,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ns.schemaHasRulesButRef)(s,u))){i.block(()=>xq(t,"$ref",u.all.$ref.definition));return}c.jtd||OX(t,e),i.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,WS.shouldUseGroup)(s,f)&&(f.type?(i.if((0,$m.checkDataType)(f.type,o,c.strictNumbers)),Rq(t,f),e.length===1&&e[0]===f.type&&n&&(i.else(),(0,$m.reportTypeError)(t)),i.endIf()):Rq(t,f),a||i.if((0,oe._)`${ge.default.errors} === ${r||0}`))}}function Rq(t,e){let{gen:n,schema:r,opts:{useDefaults:i}}=t;i&&(0,TX.assignDefaults)(t,e.type),n.block(()=>{for(let s of e.rules)(0,WS.shouldUseRule)(r,s)&&xq(t,s.keyword,s.definition,e.type)})}function OX(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(MX(t,e),t.opts.allowUnionTypes||xX(t,e),LX(t,t.dataTypes))}function MX(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(n=>{Mq(t.dataTypes,n)||zS(t,`type "${n}" not allowed by context "${t.dataTypes.join(",")}"`)}),$X(t,e)}}function xX(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&zS(t,"use allowUnionTypes to allow union type keyword")}function LX(t,e){let n=t.self.RULES.all;for(let r in n){let i=n[r];if(typeof i=="object"&&(0,WS.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>qX(e,o))&&zS(t,`missing type "${s.join(",")}" for keyword "${r}"`)}}}function qX(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Mq(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function $X(t,e){let n=[];for(let r of t.dataTypes)Mq(e,r)?n.push(r):e.includes("integer")&&r==="number"&&n.push("integer");t.dataTypes=n}function zS(t,e){let n=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${n}" (strictTypes)`,(0,ns.checkStrictMode)(t,e,t.opts.strictTypes)}var Fm=class{constructor(e,n,r){if((0,wu.validateKeywordUsage)(e,n,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=n.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ns.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=n,this.$data)this.schemaCode=e.gen.const("vSchema",Lq(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,wu.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=e.gen.const("_errs",ge.default.errors))}result(e,n,r){this.failResult((0,oe.not)(e),n,r)}failResult(e,n,r){this.gen.if(e),r?r():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,n){this.failResult((0,oe.not)(e),void 0,n)}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:n}=this;this.fail((0,oe._)`${n} !== undefined && (${(0,oe.or)(this.invalid$data(),e)})`)}error(e,n,r){if(n){this.setParams(n),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,n){(e?Ru.reportExtraError:Ru.reportError)(this,this.def.error,n)}$dataError(){(0,Ru.reportError)(this,this.def.$dataError||Ru.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ru.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,n){n?Object.assign(this.params,e):this.params=e}block$data(e,n,r=oe.nil){this.gen.block(()=>{this.check$data(e,r),n()})}check$data(e=oe.nil,n=oe.nil){if(!this.$data)return;let{gen:r,schemaCode:i,schemaType:s,def:o}=this;r.if((0,oe.or)((0,oe._)`${i} === undefined`,n)),e!==oe.nil&&r.assign(e,!0),(s.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==oe.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:n,schemaType:r,def:i,it:s}=this;return(0,oe.or)(o(),a());function o(){if(r.length){if(!(n instanceof oe.Name))throw new Error("ajv implementation error");let c=Array.isArray(r)?r:[r];return(0,oe._)`${(0,$m.checkDataTypes)(c,n,s.opts.strictNumbers,$m.DataType.Wrong)}`}return oe.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,oe._)`!${c}(${n})`}return oe.nil}}subschema(e,n){let r=(0,VS.getSubschema)(this.it,e);(0,VS.extendSubschemaData)(r,this.it,e),(0,VS.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return NX(i,n),i}mergeEvaluated(e,n){let{it:r,gen:i}=this;r.opts.unevaluated&&(r.props!==!0&&e.props!==void 0&&(r.props=ns.mergeEvaluated.props(i,e.props,r.props,n)),r.items!==!0&&e.items!==void 0&&(r.items=ns.mergeEvaluated.items(i,e.items,r.items,n)))}mergeValidEvaluated(e,n){let{it:r,gen:i}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return i.if(n,()=>this.mergeEvaluated(e,oe.Name)),!0}};Us.KeywordCxt=Fm;function xq(t,e,n,r){let i=new Fm(t,n,e);"code"in n?n.code(i,r):i.$data&&n.validate?(0,wu.funcKeywordCode)(i,n):"macro"in n?(0,wu.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,wu.funcKeywordCode)(i,n)}var FX=/^\/(?:[^~]|~0|~1)*$/,BX=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Lq(t,{dataLevel:e,dataNames:n,dataPathArr:r}){let i,s;if(t==="")return ge.default.rootData;if(t[0]==="/"){if(!FX.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=ge.default.rootData}else{let l=BX.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 r[e-u]}if(u>e)throw new Error(c("data",u));if(s=n[e-u],!i)return s}let o=s,a=i.split("/");for(let l of a)l&&(s=(0,oe._)`${s}${(0,oe.getProperty)((0,ns.unescapeJsonPointer)(l))}`,o=(0,oe._)`${o} && ${s}`);return o;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}Us.getData=Lq});var Bm=N(YS=>{"use strict";Object.defineProperty(YS,"__esModule",{value:!0});var GS=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};YS.default=GS});var Cu=N(JS=>{"use strict";Object.defineProperty(JS,"__esModule",{value:!0});var KS=Nu(),XS=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,KS.resolveUrl)(e,n,r),this.missingSchema=(0,KS.normalizeId)((0,KS.getFullPath)(e,this.missingRef))}};JS.default=XS});var Du=N(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.resolveSchema=Fr.getCompilingSchema=Fr.resolveRef=Fr.compileSchema=Fr.SchemaEnv=void 0;var di=be(),jX=Bm(),Do=qr(),fi=Nu(),qq=De(),UX=Eu(),lc=class{constructor(e){var n;this.refs={},this.dynamicAnchors={};let r;typeof e.schema=="object"&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(n=e.baseId)!==null&&n!==void 0?n:(0,fi.normalizeId)(r?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r?.$async,this.refs={}}};Fr.SchemaEnv=lc;function ZS(t){let e=$q.call(this,t);if(e)return e;let n=(0,fi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:r,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new di.CodeGen(this.scope,{es5:r,lines:i,ownProperties:s}),a;t.$async&&(a=o.scopeValue("Error",{ref:jX.default,code:(0,di._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let l={gen:o,allErrors:this.opts.allErrors,data:Do.default.data,parentData:Do.default.parentData,parentDataProperty:Do.default.parentDataProperty,dataNames:[Do.default.data],dataPathArr:[di.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,di.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:n,baseId:t.baseId||n,schemaPath:di.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,di._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,UX.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(Do.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${Do.default.self}`,`${Do.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 di.Name?void 0:m,items:h instanceof di.Name?void 0:h,dynamicProps:m instanceof di.Name,dynamicItems:h instanceof di.Name},p.source&&(p.source.evaluated=(0,di.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)}}Fr.compileSchema=ZS;function HX(t,e,n){var r;n=(0,fi.resolveUrl)(this.opts.uriResolver,e,n);let i=t.refs[n];if(i)return i;let s=zX.call(this,t,n);if(s===void 0){let o=(r=t.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;o&&(s=new lc({schema:o,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[n]=VX.call(this,s)}Fr.resolveRef=HX;function VX(t){return(0,fi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:ZS.call(this,t)}function $q(t){for(let e of this._compilations)if(WX(e,t))return e}Fr.getCompilingSchema=$q;function WX(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function zX(t,e){let n;for(;typeof(n=this.refs[e])=="string";)e=n;return n||this.schemas[e]||jm.call(this,t,e)}function jm(t,e){let n=this.opts.uriResolver.parse(e),r=(0,fi._getFullPath)(this.opts.uriResolver,n),i=(0,fi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&r===i)return QS.call(this,n,t);let s=(0,fi.normalizeId)(r),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let a=jm.call(this,t,o);return typeof a?.schema!="object"?void 0:QS.call(this,n,a)}if(typeof o?.schema=="object"){if(o.validate||ZS.call(this,o),s===(0,fi.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,l=a[c];return l&&(i=(0,fi.resolveUrl)(this.opts.uriResolver,i,l)),new lc({schema:a,schemaId:c,root:t,baseId:i})}return QS.call(this,n,o)}}Fr.resolveSchema=jm;var GX=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function QS(t,{baseId:e,schema:n,root:r}){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 n=="boolean")return;let c=n[(0,qq.unescapeFragment)(a)];if(c===void 0)return;n=c;let l=typeof n=="object"&&n[this.opts.schemaId];!GX.has(a)&&l&&(e=(0,fi.resolveUrl)(this.opts.uriResolver,e,l))}let s;if(typeof n!="boolean"&&n.$ref&&!(0,qq.schemaHasRulesButRef)(n,this.RULES)){let a=(0,fi.resolveUrl)(this.opts.uriResolver,e,n.$ref);s=jm.call(this,r,a)}let{schemaId:o}=this.opts;if(s=s||new lc({schema:n,schemaId:o,root:r,baseId:e}),s.schema!==s.root.schema)return s}});var Fq=N((uCe,YX)=>{YX.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 n_=N((dCe,Wq)=>{"use strict";var KX=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),jq=RegExp.prototype.test.bind(/^(?:(?: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),e_=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Uq=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),XX=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function t_(t){let e="",n=0,r=0;for(r=0;r<t.length;r++)if(n=t[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";e+=t[r];break}for(r+=1;r<t.length;r++){if(n=t[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";e+=t[r]}return e}var JX=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Bq(t){return t.length=0,!0}function QX(t,e,n){if(t.length){let r=t_(t);if(r!=="")e.push(r);else return n.error=!0,!1;t.length=0}return!0}function ZX(t){let e=0,n={error:!1,address:"",zone:""},r=[],i=[],s=!1,o=!1,a=QX;for(let c=0;c<t.length;c++){let l=t[c];if(!(l==="["||l==="]"))if(l===":"){if(s===!0&&(o=!0),!a(i,r,n))break;if(++e>7){n.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),r.push(":");continue}else if(l==="%"){if(!a(i,r,n))break;a=Bq}else{i.push(l);continue}}return i.length&&(a===Bq?n.zone=i.join(""):o?r.push(i.join("")):r.push(t_(i))),n.address=r.join(""),n}function Hq(t){if(e4(t,":")<2)return{host:t,isIPV6:!1};let e=ZX(t);if(e.error)return{host:t,isIPV6:!1};{let n=e.address,r=e.address;return e.zone&&(n+="%"+e.zone,r+="%25"+e.zone),{host:n,isIPV6:!0,escapedHost:r}}}function e4(t,e){let n=0;for(let r=0;r<t.length;r++)t[r]===e&&n++;return n}function t4(t){let e=t,n=[],r=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){n.push("/");break}else{n.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){n.push("/");break}}else if(i===3&&e==="/.."){n.length!==0&&n.pop(),n.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),n.length!==0&&n.pop();continue}}if((r=e.indexOf("/",1))===-1){n.push(e);break}else n.push(e.slice(0,r)),e=e.slice(r)}return n.join("")}var n4={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},r4=/[@/?#:]/g,i4=/[@/?#]/g;function Vq(t,e){let n=e?i4:r4;return n.lastIndex=0,t.replace(n,r=>n4[r])}function s4(t,e=!1){if(t.indexOf("%")===-1)return t;let n="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let i=t.slice(r+1,r+3);if(e_(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));e&&Uq(o)?n+=o:n+="%"+s,r+=2;continue}}n+=t[r]}return n}function o4(t){let e="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let r=t.slice(n+1,n+3);if(e_(r)){let i=r.toUpperCase(),s=String.fromCharCode(parseInt(i,16));s!=="."&&Uq(s)?e+=s:e+="%"+i,n+=2;continue}}XX(t[n])?e+=t[n]:e+=escape(t[n])}return e}function a4(t){let e="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let r=t.slice(n+1,n+3);if(e_(r)){e+="%"+r.toUpperCase(),n+=2;continue}}e+=escape(t[n])}return e}function c4(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let n=unescape(t.host);if(!jq(n)){let r=Hq(n);r.isIPV6===!0?n=`[${r.escapedHost}]`:n=Vq(n,!1)}e.push(n)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Wq.exports={nonSimpleDomain:JX,recomposeAuthority:c4,reescapeHostDelimiters:Vq,normalizePercentEncoding:s4,normalizePathEncoding:o4,escapePreservingEscapes:a4,removeDotSegments:t4,isIPv4:jq,isUUID:KX,normalizeIPv6:Hq,stringArrayToHexStripped:t_}});var Xq=N((fCe,Kq)=>{"use strict";var{isUUID:l4}=n_(),u4=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,d4=["http","https","ws","wss","urn","urn:uuid"];function f4(t){return d4.indexOf(t)!==-1}function r_(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function zq(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Gq(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 p4(t){return t.secure=r_(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function h4(t){if((t.port===(r_(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,n]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=n,t.resourceName=void 0}return t.fragment=void 0,t}function m4(t,e){if(!t.path)return t.error="URN can not be parsed",t;let n=t.path.match(u4);if(n){let r=e.scheme||t.scheme||"urn";t.nid=n[1].toLowerCase(),t.nss=n[2];let i=`${r}:${e.nid||t.nid}`,s=i_(i);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function g4(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let n=e.scheme||t.scheme||"urn",r=t.nid.toLowerCase(),i=`${n}:${e.nid||r}`,s=i_(i);s&&(t=s.serialize(t,e));let o=t,a=t.nss;return o.path=`${r||e.nid}:${a}`,e.skipEscape=!0,o}function y4(t,e){let n=t;return n.uuid=n.nss,n.nss=void 0,!e.tolerant&&(!n.uuid||!l4(n.uuid))&&(n.error=n.error||"UUID is not valid."),n}function T4(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Yq={scheme:"http",domainHost:!0,parse:zq,serialize:Gq},v4={scheme:"https",domainHost:Yq.domainHost,parse:zq,serialize:Gq},Um={scheme:"ws",domainHost:!0,parse:p4,serialize:h4},b4={scheme:"wss",domainHost:Um.domainHost,parse:Um.parse,serialize:Um.serialize},S4={scheme:"urn",parse:m4,serialize:g4,skipNormalize:!0},_4={scheme:"urn:uuid",parse:y4,serialize:T4,skipNormalize:!0},Hm={http:Yq,https:v4,ws:Um,wss:b4,urn:S4,"urn:uuid":_4};Object.setPrototypeOf(Hm,null);function i_(t){return t&&(Hm[t]||Hm[t.toLowerCase()])||void 0}Kq.exports={wsIsSecure:r_,SCHEMES:Hm,isValidSchemeName:f4,getSchemeHandler:i_}});var n$=N((pCe,Vm)=>{"use strict";var{normalizeIPv6:P4,removeDotSegments:Au,recomposeAuthority:k4,normalizePercentEncoding:N4,normalizePathEncoding:R4,escapePreservingEscapes:w4,reescapeHostDelimiters:E4,isIPv4:C4,nonSimpleDomain:D4}=n_(),{SCHEMES:A4,getSchemeHandler:Qq}=Xq();function I4(t,e){return typeof t=="string"?t=q4(t,e):typeof t=="object"&&(t=uc(Ao(t,e),e)),t}function O4(t,e,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},i=Zq(uc(t,r),uc(e,r),r,!0);return r.skipEscape=!0,Ao(i,r)}function Zq(t,e,n,r){let i={};return r||(t=uc(Ao(t,n),n),e=uc(Ao(e,n),n)),n=n||{},!n.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Au(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=Au(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=Au(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=Au(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 M4(t,e,n){let r=Jq(t,n),i=Jq(e,n);return r!==void 0&&i!==void 0&&r.toLowerCase()===i.toLowerCase()}function Ao(t,e){let n={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:""},r=Object.assign({},e),i=[],s=Qq(r.scheme||n.scheme);s&&s.serialize&&s.serialize(n,r),n.path!==void 0&&(r.skipEscape?n.path=N4(n.path):(n.path=w4(n.path),n.scheme!==void 0&&(n.path=n.path.split("%3A").join(":")))),r.reference!=="suffix"&&n.scheme&&i.push(n.scheme,":");let o=k4(n);if(o!==void 0&&(r.reference!=="suffix"&&i.push("//"),i.push(o),n.path&&n.path[0]!=="/"&&i.push("/")),n.path!==void 0){let a=n.path;!r.absolutePath&&(!s||!s.absolutePath)&&(a=Au(a)),o===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),i.push(a)}return n.query!==void 0&&i.push("?",n.query),n.fragment!==void 0&&i.push("#",n.fragment),i.join("")}var x4=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function L4(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function e$(t,e){let n=Object.assign({},e),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,s=!1;n.reference==="suffix"&&(n.scheme?t=n.scheme+":"+t:t="//"+t);let o=t.match(x4);if(o){r.scheme=o[1],r.userinfo=o[3],r.host=o[4],r.port=parseInt(o[5],10),r.path=o[6]||"",r.query=o[7],r.fragment=o[8],isNaN(r.port)&&(r.port=o[5]);let a=L4(r,o);if(a!==void 0&&(r.error=r.error||a,i=!0),r.host)if(C4(r.host)===!1){let u=P4(r.host);r.host=u.host.toLowerCase(),s=u.isIPV6}else s=!0;r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path?r.reference="same-document":r.scheme===void 0?r.reference="relative":r.fragment===void 0?r.reference="absolute":r.reference="uri",n.reference&&n.reference!=="suffix"&&n.reference!==r.reference&&(r.error=r.error||"URI is not a "+n.reference+" reference.");let c=Qq(n.scheme||r.scheme);if(!n.unicodeSupport&&(!c||!c.unicodeSupport)&&r.host&&(n.domainHost||c&&c.domainHost)&&s===!1&&D4(r.host))try{r.host=URL.domainToASCII(r.host.toLowerCase())}catch(l){r.error=r.error||"Host's domain name can not be converted to ASCII: "+l}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(r.scheme!==void 0&&(r.scheme=unescape(r.scheme)),r.host!==void 0&&(r.host=E4(unescape(r.host),s))),r.path&&(r.path=R4(r.path)),r.fragment))try{r.fragment=encodeURI(decodeURIComponent(r.fragment))}catch{r.error=r.error||"URI malformed"}c&&c.parse&&c.parse(r,n)}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:i}}function uc(t,e){return e$(t,e).parsed}function q4(t,e){return t$(t,e).normalized}function t$(t,e){let{parsed:n,malformedAuthorityOrPort:r}=e$(t,e);return{normalized:r?t:Ao(n,e),malformedAuthorityOrPort:r}}function Jq(t,e){if(typeof t=="string"){let{normalized:n,malformedAuthorityOrPort:r}=t$(t,e);return r?void 0:n}if(typeof t=="object")return Ao(t,e)}var s_={SCHEMES:A4,normalize:I4,resolve:O4,resolveComponent:Zq,equal:M4,serialize:Ao,parse:uc};Vm.exports=s_;Vm.exports.default=s_;Vm.exports.fastUri=s_});var i$=N(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var r$=n$();r$.code='require("ajv/dist/runtime/uri").default';o_.default=r$});var f$=N(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.CodeGen=Tn.Name=Tn.nil=Tn.stringify=Tn.str=Tn._=Tn.KeywordCxt=void 0;var $4=Eu();Object.defineProperty(Tn,"KeywordCxt",{enumerable:!0,get:function(){return $4.KeywordCxt}});var dc=be();Object.defineProperty(Tn,"_",{enumerable:!0,get:function(){return dc._}});Object.defineProperty(Tn,"str",{enumerable:!0,get:function(){return dc.str}});Object.defineProperty(Tn,"stringify",{enumerable:!0,get:function(){return dc.stringify}});Object.defineProperty(Tn,"nil",{enumerable:!0,get:function(){return dc.nil}});Object.defineProperty(Tn,"Name",{enumerable:!0,get:function(){return dc.Name}});Object.defineProperty(Tn,"CodeGen",{enumerable:!0,get:function(){return dc.CodeGen}});var F4=Bm(),l$=Cu(),B4=MS(),Iu=Du(),j4=be(),Ou=Nu(),Wm=ku(),c_=De(),s$=Fq(),U4=i$(),u$=(t,e)=>new RegExp(t,e);u$.code="new RegExp";var H4=["removeAdditional","useDefaults","coerceTypes"],V4=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),W4={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."},z4={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},o$=200;function G4(t){var e,n,r,i,s,o,a,c,l,u,d,f,p,m,h,y,S,b,v,k,R,q,O,B,Pe;let Qe=t.strict,Et=(e=t.code)===null||e===void 0?void 0:e.optimize,ke=Et===!0||Et===void 0?1:Et||0,dn=(r=(n=t.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:u$,Sn=(i=t.uriResolver)!==null&&i!==void 0?i:U4.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:Qe)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:Qe)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:Qe)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:Qe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:Qe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:ke,regExp:dn}:{optimize:ke,regExp:dn},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:o$,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:o$,meta:(S=t.meta)!==null&&S!==void 0?S:!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:(R=t.addUsedSchema)!==null&&R!==void 0?R:!0,validateSchema:(q=t.validateSchema)!==null&&q!==void 0?q:!0,validateFormats:(O=t.validateFormats)!==null&&O!==void 0?O:!0,unicodeRegExp:(B=t.unicodeRegExp)!==null&&B!==void 0?B:!0,int32range:(Pe=t.int32range)!==null&&Pe!==void 0?Pe:!0,uriResolver:Sn}}var Mu=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...G4(e)};let{es5:n,lines:r}=this.opts.code;this.scope=new j4.ValueScope({scope:{},prefixes:V4,es5:n,lines:r}),this.logger=Z4(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,B4.getRules)(),a$.call(this,W4,e,"NOT SUPPORTED"),a$.call(this,z4,e,"DEPRECATED","warn"),this._metaOpts=J4.call(this),e.formats&&K4.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&X4.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Y4.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:n,schemaId:r}=this.opts,i=s$;r==="id"&&(i={...s$},i.id=i.$id,delete i.$id),n&&e&&this.addMetaSchema(i,i[r],!1)}defaultMeta(){let{meta:e,schemaId:n}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[n]||e:void 0}validate(e,n){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let i=r(n);return"$async"in r||(this.errors=r.errors),i}compile(e,n){let r=this._addSchema(e,n);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,n){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return i.call(this,e,n);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 l$.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,n)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,n,r,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,r,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 n=(0,Ou.normalizeId)(n||s),this._checkUnique(n),this.schemas[n]=this._addSchema(e,r,n,i,!0),this}addMetaSchema(e,n,r=this.opts.validateSchema){return this.addSchema(e,n,!0,r),this}validateSchema(e,n){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(r,e);if(!i&&n){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 n;for(;typeof(n=c$.call(this,e))=="string";)e=n;if(n===void 0){let{schemaId:r}=this.opts,i=new Iu.SchemaEnv({schema:{},schemaId:r});if(n=Iu.resolveSchema.call(this,i,e),!n)return;this.refs[e]=n}return n.validate||this._compileSchemaEnv(n)}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 n=c$.call(this,e);return typeof n=="object"&&this._cache.delete(n.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let n=e;this._cache.delete(n);let r=e[this.opts.schemaId];return r&&(r=(0,Ou.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let n of e)this.addKeyword(n);return this}addKeyword(e,n){let r;if(typeof e=="string")r=e,typeof n=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),n.keyword=r);else if(typeof e=="object"&&n===void 0){if(n=e,r=n.keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(t9.call(this,r,n),!n)return(0,c_.eachItem)(r,s=>a_.call(this,s)),this;r9.call(this,n);let i={...n,type:(0,Wm.getJSONTypes)(n.type),schemaType:(0,Wm.getJSONTypes)(n.schemaType)};return(0,c_.eachItem)(r,i.type.length===0?s=>a_.call(this,s,i):s=>i.type.forEach(o=>a_.call(this,s,i,o))),this}getKeyword(e){let n=this.RULES.all[e];return typeof n=="object"?n.definition:!!n}removeKeyword(e){let{RULES:n}=this;delete n.keywords[e],delete n.all[e];for(let r of n.rules){let i=r.rules.findIndex(s=>s.keyword===e);i>=0&&r.rules.splice(i,1)}return this}addFormat(e,n){return typeof n=="string"&&(n=new RegExp(n)),this.formats[e]=n,this}errorsText(e=this.errors,{separator:n=", ",dataVar:r="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${r}${i.instancePath} ${i.message}`).reduce((i,s)=>i+n+s)}$dataMetaSchema(e,n){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of n){let s=i.split("/").slice(1),o=e;for(let a of s)o=o[a];for(let a in r){let c=r[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=o[a];l&&u&&(o[a]=d$(u))}}return e}_removeAllSchemas(e,n){for(let r in e){let i=e[r];(!n||n.test(r))&&(typeof i=="string"?delete e[r]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[r]))}}_addSchema(e,n,r,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;r=(0,Ou.normalizeId)(o||r);let l=Ou.getSchemaRefs.call(this,e,r);return c=new Iu.SchemaEnv({schema:e,schemaId:a,meta:n,baseId:r,localRefs:l}),this._cache.set(c.schema,c),s&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=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):Iu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let n=this.opts;this.opts=this._metaOpts;try{Iu.compileSchema.call(this,e)}finally{this.opts=n}}};Mu.ValidationError=F4.default;Mu.MissingRefError=l$.default;Tn.default=Mu;function a$(t,e,n,r="error"){for(let i in t){let s=i;s in e&&this.logger[r](`${n}: option ${i}. ${t[s]}`)}}function c$(t){return t=(0,Ou.normalizeId)(t),this.schemas[t]||this.refs[t]}function Y4(){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 K4(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function X4(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 n=t[e];n.keyword||(n.keyword=e),this.addKeyword(n)}}function J4(){let t={...this.opts};for(let e of H4)delete t[e];return t}var Q4={log(){},warn(){},error(){}};function Z4(t){if(t===!1)return Q4;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 e9=/^[a-z_$][a-z0-9_$:-]*$/i;function t9(t,e){let{RULES:n}=this;if((0,c_.eachItem)(t,r=>{if(n.keywords[r])throw new Error(`Keyword ${r} is already defined`);if(!e9.test(r))throw new Error(`Keyword ${r} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function a_(t,e,n){var r;let i=e?.post;if(n&&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===n);if(o||(o={type:n,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Wm.getJSONTypes)(e.type),schemaType:(0,Wm.getJSONTypes)(e.schemaType)}};e.before?n9.call(this,o,a,e.before):o.rules.push(a),s.all[t]=a,(r=e.implements)===null||r===void 0||r.forEach(c=>this.addKeyword(c))}function n9(t,e,n){let r=t.rules.findIndex(i=>i.keyword===n);r>=0?t.rules.splice(r,0,e):(t.rules.push(e),this.logger.warn(`rule ${n} is not defined`))}function r9(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=d$(e)),t.validateSchema=this.compile(e,!0))}var i9={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function d$(t){return{anyOf:[t,i9]}}});var p$=N(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var s9={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};l_.default=s9});var Ym=N(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.callRef=Io.getValidate=void 0;var o9=Cu(),h$=$r(),cr=be(),fc=qr(),m$=Du(),zm=De(),a9={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:n,it:r}=t,{baseId:i,schemaEnv:s,validateName:o,opts:a,self:c}=r,{root:l}=s;if((n==="#"||n==="#/")&&i===l.baseId)return d();let u=m$.resolveRef.call(c,l,i,n);if(u===void 0)throw new o9.default(r.opts.uriResolver,i,n);if(u instanceof m$.SchemaEnv)return f(u);return p(u);function d(){if(s===l)return Gm(t,o,s,s.$async);let m=e.scopeValue("root",{ref:l});return Gm(t,(0,cr._)`${m}.validate`,l,l.$async)}function f(m){let h=g$(t,m);Gm(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,cr.stringify)(m)}:{ref:m}),y=e.name("valid"),S=t.subschema({schema:m,dataTypes:[],schemaPath:cr.nil,topSchemaRef:h,errSchemaPath:n},y);t.mergeEvaluated(S),t.ok(y)}}};function g$(t,e){let{gen:n}=t;return e.validate?n.scopeValue("validate",{ref:e.validate}):(0,cr._)`${n.scopeValue("wrapper",{ref:e})}.validate`}Io.getValidate=g$;function Gm(t,e,n,r){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:a,opts:c}=s,l=c.passContext?fc.default.this:cr.nil;r?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,cr._)`await ${(0,h$.callValidateCode)(t,e,l)}`),p(e),o||i.assign(m,!0)},h=>{i.if((0,cr._)`!(${h} instanceof ${s.ValidationError})`,()=>i.throw(h)),f(h),o||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,h$.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,cr._)`${m}.errors`;i.assign(fc.default.vErrors,(0,cr._)`${fc.default.vErrors} === null ? ${h} : ${fc.default.vErrors}.concat(${h})`),i.assign(fc.default.errors,(0,cr._)`${fc.default.vErrors}.length`)}function p(m){var h;if(!s.opts.unevaluated)return;let y=(h=n?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=zm.mergeEvaluated.props(i,y.props,s.props));else{let S=i.var("props",(0,cr._)`${m}.evaluated.props`);s.props=zm.mergeEvaluated.props(i,S,s.props,cr.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=zm.mergeEvaluated.items(i,y.items,s.items));else{let S=i.var("items",(0,cr._)`${m}.evaluated.items`);s.items=zm.mergeEvaluated.items(i,S,s.items,cr.Name)}}}Io.callRef=Gm;Io.default=a9});var y$=N(u_=>{"use strict";Object.defineProperty(u_,"__esModule",{value:!0});var c9=p$(),l9=Ym(),u9=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",c9.default,l9.default];u_.default=u9});var T$=N(d_=>{"use strict";Object.defineProperty(d_,"__esModule",{value:!0});var Km=be(),Hs=Km.operators,Xm={maximum:{okStr:"<=",ok:Hs.LTE,fail:Hs.GT},minimum:{okStr:">=",ok:Hs.GTE,fail:Hs.LT},exclusiveMaximum:{okStr:"<",ok:Hs.LT,fail:Hs.GTE},exclusiveMinimum:{okStr:">",ok:Hs.GT,fail:Hs.LTE}},d9={message:({keyword:t,schemaCode:e})=>(0,Km.str)`must be ${Xm[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Km._)`{comparison: ${Xm[t].okStr}, limit: ${e}}`},f9={keyword:Object.keys(Xm),type:"number",schemaType:"number",$data:!0,error:d9,code(t){let{keyword:e,data:n,schemaCode:r}=t;t.fail$data((0,Km._)`${n} ${Xm[e].fail} ${r} || isNaN(${n})`)}};d_.default=f9});var v$=N(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});var xu=be(),p9={message:({schemaCode:t})=>(0,xu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,xu._)`{multipleOf: ${t}}`},h9={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:p9,code(t){let{gen:e,data:n,schemaCode:r,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),a=s?(0,xu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,xu._)`${o} !== parseInt(${o})`;t.fail$data((0,xu._)`(${r} === 0 || (${o} = ${n}/${r}, ${a}))`)}};f_.default=h9});var S$=N(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});function b$(t){let e=t.length,n=0,r=0,i;for(;r<e;)n++,i=t.charCodeAt(r++),i>=55296&&i<=56319&&r<e&&(i=t.charCodeAt(r),(i&64512)===56320&&r++);return n}p_.default=b$;b$.code='require("ajv/dist/runtime/ucs2length").default'});var _$=N(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});var Oo=be(),m9=De(),g9=S$(),y9={message({keyword:t,schemaCode:e}){let n=t==="maxLength"?"more":"fewer";return(0,Oo.str)`must NOT have ${n} than ${e} characters`},params:({schemaCode:t})=>(0,Oo._)`{limit: ${t}}`},T9={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:y9,code(t){let{keyword:e,data:n,schemaCode:r,it:i}=t,s=e==="maxLength"?Oo.operators.GT:Oo.operators.LT,o=i.opts.unicode===!1?(0,Oo._)`${n}.length`:(0,Oo._)`${(0,m9.useFunc)(t.gen,g9.default)}(${n})`;t.fail$data((0,Oo._)`${o} ${s} ${r}`)}};h_.default=T9});var P$=N(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});var v9=$r(),b9=De(),pc=be(),S9={message:({schemaCode:t})=>(0,pc.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,pc._)`{pattern: ${t}}`},_9={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:S9,code(t){let{gen:e,data:n,$data:r,schema:i,schemaCode:s,it:o}=t,a=o.opts.unicodeRegExp?"u":"";if(r){let{regExp:c}=o.opts.code,l=c.code==="new RegExp"?(0,pc._)`new RegExp`:(0,b9.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0,pc._)`${l}(${s}, ${a}).test(${n})`),()=>e.assign(u,!1)),t.fail$data((0,pc._)`!${u}`)}else{let c=(0,v9.usePattern)(t,i);t.fail$data((0,pc._)`!${c}.test(${n})`)}}};m_.default=_9});var k$=N(g_=>{"use strict";Object.defineProperty(g_,"__esModule",{value:!0});var Lu=be(),P9={message({keyword:t,schemaCode:e}){let n=t==="maxProperties"?"more":"fewer";return(0,Lu.str)`must NOT have ${n} than ${e} properties`},params:({schemaCode:t})=>(0,Lu._)`{limit: ${t}}`},k9={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:P9,code(t){let{keyword:e,data:n,schemaCode:r}=t,i=e==="maxProperties"?Lu.operators.GT:Lu.operators.LT;t.fail$data((0,Lu._)`Object.keys(${n}).length ${i} ${r}`)}};g_.default=k9});var N$=N(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var qu=$r(),$u=be(),N9=De(),R9={message:({params:{missingProperty:t}})=>(0,$u.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,$u._)`{missingProperty: ${t}}`},w9={keyword:"required",type:"object",schemaType:"array",$data:!0,error:R9,code(t){let{gen:e,schema:n,schemaCode:r,data:i,$data:s,it:o}=t,{opts:a}=o;if(!s&&n.length===0)return;let c=n.length>=a.loopRequired;if(o.allErrors?l():u(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of n)if(p?.[h]===void 0&&!m.has(h)){let y=o.schemaEnv.baseId+o.errSchemaPath,S=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,N9.checkStrictMode)(o,S,o.opts.strictRequired)}}function l(){if(c||s)t.block$data($u.nil,d);else for(let p of n)(0,qu.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,qu.checkMissingProp)(t,n,p)),(0,qu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",r,p=>{t.setParams({missingProperty:p}),e.if((0,qu.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,r,()=>{e.assign(m,(0,qu.propertyInData)(e,i,p,a.ownProperties)),e.if((0,$u.not)(m),()=>{t.error(),e.break()})},$u.nil)}}};y_.default=w9});var R$=N(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});var Fu=be(),E9={message({keyword:t,schemaCode:e}){let n=t==="maxItems"?"more":"fewer";return(0,Fu.str)`must NOT have ${n} than ${e} items`},params:({schemaCode:t})=>(0,Fu._)`{limit: ${t}}`},C9={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:E9,code(t){let{keyword:e,data:n,schemaCode:r}=t,i=e==="maxItems"?Fu.operators.GT:Fu.operators.LT;t.fail$data((0,Fu._)`${n}.length ${i} ${r}`)}};T_.default=C9});var Jm=N(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});var w$=US();w$.code='require("ajv/dist/runtime/equal").default';v_.default=w$});var E$=N(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});var b_=ku(),vn=be(),D9=De(),A9=Jm(),I9={message:({params:{i:t,j:e}})=>(0,vn.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,vn._)`{i: ${t}, j: ${e}}`},O9={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:I9,code(t){let{gen:e,data:n,$data:r,schema:i,parentSchema:s,schemaCode:o,it:a}=t;if(!r&&!i)return;let c=e.let("valid"),l=s.items?(0,b_.getSchemaTypes)(s.items):[];t.block$data(c,u,(0,vn._)`${o} === false`),t.ok(c);function u(){let m=e.let("i",(0,vn._)`${n}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,vn._)`${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 y=e.name("item"),S=(0,b_.checkDataTypes)(l,y,a.opts.strictNumbers,b_.DataType.Wrong),b=e.const("indices",(0,vn._)`{}`);e.for((0,vn._)`;${m}--;`,()=>{e.let(y,(0,vn._)`${n}[${m}]`),e.if(S,(0,vn._)`continue`),l.length>1&&e.if((0,vn._)`typeof ${y} == "string"`,(0,vn._)`${y} += "_"`),e.if((0,vn._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(h,(0,vn._)`${b}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,vn._)`${b}[${y}] = ${m}`)})}function p(m,h){let y=(0,D9.useFunc)(e,A9.default),S=e.name("outer");e.label(S).for((0,vn._)`;${m}--;`,()=>e.for((0,vn._)`${h} = ${m}; ${h}--;`,()=>e.if((0,vn._)`${y}(${n}[${m}], ${n}[${h}])`,()=>{t.error(),e.assign(c,!1).break(S)})))}}};S_.default=O9});var C$=N(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});var __=be(),M9=De(),x9=Jm(),L9={message:"must be equal to constant",params:({schemaCode:t})=>(0,__._)`{allowedValue: ${t}}`},q9={keyword:"const",$data:!0,error:L9,code(t){let{gen:e,data:n,$data:r,schemaCode:i,schema:s}=t;r||s&&typeof s=="object"?t.fail$data((0,__._)`!${(0,M9.useFunc)(e,x9.default)}(${n}, ${i})`):t.fail((0,__._)`${s} !== ${n}`)}};P_.default=q9});var D$=N(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var Bu=be(),$9=De(),F9=Jm(),B9={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Bu._)`{allowedValues: ${t}}`},j9={keyword:"enum",schemaType:"array",$data:!0,error:B9,code(t){let{gen:e,data:n,$data:r,schema:i,schemaCode:s,it:o}=t;if(!r&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=o.opts.loopEnum,c,l=()=>c??(c=(0,$9.useFunc)(e,F9.default)),u;if(a||r)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,Bu.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,Bu._)`${l()}(${n}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,Bu._)`${l()}(${n}, ${p}[${m}])`:(0,Bu._)`${n} === ${h}`}}};k_.default=j9});var A$=N(N_=>{"use strict";Object.defineProperty(N_,"__esModule",{value:!0});var U9=T$(),H9=v$(),V9=_$(),W9=P$(),z9=k$(),G9=N$(),Y9=R$(),K9=E$(),X9=C$(),J9=D$(),Q9=[U9.default,H9.default,V9.default,W9.default,z9.default,G9.default,Y9.default,K9.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},X9.default,J9.default];N_.default=Q9});var w_=N(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.validateAdditionalItems=void 0;var Mo=be(),R_=De(),Z9={message:({params:{len:t}})=>(0,Mo.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Mo._)`{limit: ${t}}`},eJ={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Z9,code(t){let{parentSchema:e,it:n}=t,{items:r}=e;if(!Array.isArray(r)){(0,R_.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}I$(t,r)}};function I$(t,e){let{gen:n,schema:r,data:i,keyword:s,it:o}=t;o.items=!0;let a=n.const("len",(0,Mo._)`${i}.length`);if(r===!1)t.setParams({len:e.length}),t.pass((0,Mo._)`${a} <= ${e.length}`);else if(typeof r=="object"&&!(0,R_.alwaysValidSchema)(o,r)){let l=n.var("valid",(0,Mo._)`${a} <= ${e.length}`);n.if((0,Mo.not)(l),()=>c(l)),t.ok(l)}function c(l){n.forRange("i",e.length,a,u=>{t.subschema({keyword:s,dataProp:u,dataPropType:R_.Type.Num},l),o.allErrors||n.if((0,Mo.not)(l),()=>n.break())})}}ju.validateAdditionalItems=I$;ju.default=eJ});var E_=N(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.validateTuple=void 0;var O$=be(),Qm=De(),tJ=$r(),nJ={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:n}=t;if(Array.isArray(e))return M$(t,"additionalItems",e);n.items=!0,!(0,Qm.alwaysValidSchema)(n,e)&&t.ok((0,tJ.validateArray)(t))}};function M$(t,e,n=t.schema){let{gen:r,parentSchema:i,data:s,keyword:o,it:a}=t;u(i),a.opts.unevaluated&&n.length&&a.items!==!0&&(a.items=Qm.mergeEvaluated.items(r,n.length,a.items));let c=r.name("valid"),l=r.const("len",(0,O$._)`${s}.length`);n.forEach((d,f)=>{(0,Qm.alwaysValidSchema)(a,d)||(r.if((0,O$._)`${l} > ${f}`,()=>t.subschema({keyword:o,schemaProp:f,dataProp:f},c)),t.ok(c))});function u(d){let{opts:f,errSchemaPath:p}=a,m=n.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let y=`"${o}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,Qm.checkStrictMode)(a,y,f.strictTuples)}}}Uu.validateTuple=M$;Uu.default=nJ});var x$=N(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});var rJ=E_(),iJ={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,rJ.validateTuple)(t,"items")};C_.default=iJ});var q$=N(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});var L$=be(),sJ=De(),oJ=$r(),aJ=w_(),cJ={message:({params:{len:t}})=>(0,L$.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,L$._)`{limit: ${t}}`},lJ={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:cJ,code(t){let{schema:e,parentSchema:n,it:r}=t,{prefixItems:i}=n;r.items=!0,!(0,sJ.alwaysValidSchema)(r,e)&&(i?(0,aJ.validateAdditionalItems)(t,i):t.ok((0,oJ.validateArray)(t)))}};D_.default=lJ});var $$=N(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});var Br=be(),Zm=De(),uJ={message:({params:{min:t,max:e}})=>e===void 0?(0,Br.str)`must contain at least ${t} valid item(s)`:(0,Br.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Br._)`{minContains: ${t}}`:(0,Br._)`{minContains: ${t}, maxContains: ${e}}`},dJ={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:uJ,code(t){let{gen:e,schema:n,parentSchema:r,data:i,it:s}=t,o,a,{minContains:c,maxContains:l}=r;s.opts.next?(o=c===void 0?1:c,a=l):o=1;let u=e.const("len",(0,Br._)`${i}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,Zm.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,Zm.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Zm.alwaysValidSchema)(s,n)){let h=(0,Br._)`${u} >= ${o}`;a!==void 0&&(h=(0,Br._)`${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,Br._)`${i}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),y=e.let("count",0);p(h,()=>e.if(h,()=>m(y)))}function p(h,y){e.forRange("i",0,u,S=>{t.subschema({keyword:"contains",dataProp:S,dataPropType:Zm.Type.Num,compositeRule:!0},h),y()})}function m(h){e.code((0,Br._)`${h}++`),a===void 0?e.if((0,Br._)`${h} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,Br._)`${h} > ${a}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,Br._)`${h} >= ${o}`,()=>e.assign(d,!0)))}}};A_.default=dJ});var eg=N(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.validateSchemaDeps=xi.validatePropertyDeps=xi.error=void 0;var I_=be(),fJ=De(),Hu=$r();xi.error={message:({params:{property:t,depsCount:e,deps:n}})=>{let r=e===1?"property":"properties";return(0,I_.str)`must have ${r} ${n} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:n,missingProperty:r}})=>(0,I_._)`{property: ${t},
|
|
180
180
|
missingProperty: ${r},
|
|
181
181
|
depsCount: ${e},
|
|
182
|
-
deps: ${n}}`};var pJ={keyword:"dependencies",type:"object",schemaType:"object",error:xi.error,code(t){let[e,n]=hJ(t);F$(t,e),B$(t,n)}};function hJ({schema:t}){let e={},n={};for(let r in t){if(r==="__proto__")continue;let i=Array.isArray(t[r])?e:n;i[r]=t[r]}return[e,n]}function F$(t,e=t.schema){let{gen:n,data:r,it:i}=t;if(Object.keys(e).length===0)return;let s=n.let("missing");for(let o in e){let a=e[o];if(a.length===0)continue;let c=(0,Hu.propertyInData)(n,r,o,i.opts.ownProperties);t.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),i.allErrors?n.if(c,()=>{for(let l of a)(0,Hu.checkReportMissingProp)(t,l)}):(n.if((0,I_._)`${c} && (${(0,Hu.checkMissingProp)(t,a,s)})`),(0,Hu.reportMissingProp)(t,s),n.else())}}xi.validatePropertyDeps=F$;function B$(t,e=t.schema){let{gen:n,data:r,keyword:i,it:s}=t,o=n.name("valid");for(let a in e)(0,fJ.alwaysValidSchema)(s,e[a])||(n.if((0,Hu.propertyInData)(n,r,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:a},o);t.mergeValidEvaluated(c,o)},()=>n.var(o,!0)),t.ok(o))}xi.validateSchemaDeps=B$;xi.default=pJ});var U$=N(O_=>{"use strict";Object.defineProperty(O_,"__esModule",{value:!0});var j$=be(),mJ=De(),gJ={message:"property name must be valid",params:({params:t})=>(0,j$._)`{propertyName: ${t.propertyName}}`},yJ={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:gJ,code(t){let{gen:e,schema:n,data:r,it:i}=t;if((0,mJ.alwaysValidSchema)(i,n))return;let s=e.name("valid");e.forIn("key",r,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,j$.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};O_.default=yJ});var x_=N(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});var tg=$r(),pi=be(),TJ=qr(),ng=De(),vJ={message:"must NOT have additional properties",params:({params:t})=>(0,pi._)`{additionalProperty: ${t.additionalProperty}}`},bJ={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:vJ,code(t){let{gen:e,schema:n,parentSchema:r,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,ng.alwaysValidSchema)(o,n))return;let l=(0,tg.allSchemaProperties)(r.properties),u=(0,tg.allSchemaProperties)(r.patternProperties);d(),t.ok((0,pi._)`${s} === ${TJ.default.errors}`);function d(){e.forIn("key",i,y=>{!l.length&&!u.length?m(y):e.if(f(y),()=>m(y))})}function f(y){let S;if(l.length>8){let b=(0,ng.schemaRefOrVal)(o,r.properties,"properties");S=(0,tg.isOwnProperty)(e,b,y)}else l.length?S=(0,pi.or)(...l.map(b=>(0,pi._)`${y} === ${b}`)):S=pi.nil;return u.length&&(S=(0,pi.or)(S,...u.map(b=>(0,pi._)`${(0,tg.usePattern)(t,b)}.test(${y})`))),(0,pi.not)(S)}function p(y){e.code((0,pi._)`delete ${i}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){p(y);return}if(n===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof n=="object"&&!(0,ng.alwaysValidSchema)(o,n)){let S=e.name("valid");c.removeAdditional==="failing"?(h(y,S,!1),e.if((0,pi.not)(S),()=>{t.reset(),p(y)})):(h(y,S),a||e.if((0,pi.not)(S),()=>e.break()))}}function h(y,S,b){let v={keyword:"additionalProperties",dataProp:y,dataPropType:ng.Type.Str};b===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,S)}}};M_.default=bJ});var W$=N(q_=>{"use strict";Object.defineProperty(q_,"__esModule",{value:!0});var SJ=Eu(),H$=$r(),L_=De(),V$=x_(),_J={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:n,parentSchema:r,data:i,it:s}=t;s.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&V$.default.code(new SJ.KeywordCxt(s,V$.default,"additionalProperties"));let o=(0,H$.allSchemaProperties)(n);for(let d of o)s.definedProperties.add(d);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=L_.mergeEvaluated.props(e,(0,L_.toHash)(o),s.props));let a=o.filter(d=>!(0,L_.alwaysValidSchema)(s,n[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,H$.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&&n[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};q_.default=_J});var K$=N($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});var z$=$r(),rg=be(),G$=De(),Y$=De(),PJ={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:n,data:r,parentSchema:i,it:s}=t,{opts:o}=s,a=(0,z$.allSchemaProperties)(n),c=a.filter(h=>(0,G$.alwaysValidSchema)(s,n[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 rg.Name)&&(s.props=(0,Y$.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 y in l)new RegExp(h).test(y)&&(0,G$.checkStrictMode)(s,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",r,y=>{e.if((0,rg._)`${(0,z$.usePattern)(t,h)}.test(${y})`,()=>{let S=c.includes(h);S||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:Y$.Type.Str},u),s.opts.unevaluated&&d!==!0?e.assign((0,rg._)`${d}[${y}]`,!0):!S&&!s.allErrors&&e.if((0,rg.not)(u),()=>e.break())})})}}};$_.default=PJ});var X$=N(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});var kJ=De(),NJ={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:n,it:r}=t;if((0,kJ.alwaysValidSchema)(r,n)){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"}};F_.default=NJ});var J$=N(B_=>{"use strict";Object.defineProperty(B_,"__esModule",{value:!0});var RJ=$r(),wJ={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:RJ.validateUnion,error:{message:"must match a schema in anyOf"}};B_.default=wJ});var Q$=N(j_=>{"use strict";Object.defineProperty(j_,"__esModule",{value:!0});var ig=be(),EJ=De(),CJ={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,ig._)`{passingSchemas: ${t.passing}}`},DJ={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:CJ,code(t){let{gen:e,schema:n,parentSchema:r,it:i}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(i.opts.discriminator&&r.discriminator)return;let s=n,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,EJ.alwaysValidSchema)(i,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,ig._)`${c} && ${o}`).assign(o,!1).assign(a,(0,ig._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,d),f&&t.mergeEvaluated(f,ig.Name)})})}}};j_.default=DJ});var Z$=N(U_=>{"use strict";Object.defineProperty(U_,"__esModule",{value:!0});var AJ=De(),IJ={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:n,it:r}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");let i=e.name("valid");n.forEach((s,o)=>{if((0,AJ.alwaysValidSchema)(r,s))return;let a=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(a)})}};U_.default=IJ});var nF=N(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});var sg=be(),tF=De(),OJ={message:({params:t})=>(0,sg.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,sg._)`{failingKeyword: ${t.ifClause}}`},MJ={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:OJ,code(t){let{gen:e,parentSchema:n,it:r}=t;n.then===void 0&&n.else===void 0&&(0,tF.checkStrictMode)(r,'"if" without "then" and "else" is ignored');let i=eF(r,"then"),s=eF(r,"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,sg.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,sg._)`${u}`):t.setParams({ifClause:u})}}}};function eF(t,e){let n=t.schema[e];return n!==void 0&&!(0,tF.alwaysValidSchema)(t,n)}H_.default=MJ});var rF=N(V_=>{"use strict";Object.defineProperty(V_,"__esModule",{value:!0});var xJ=De(),LJ={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:n}){e.if===void 0&&(0,xJ.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};V_.default=LJ});var iF=N(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});var qJ=w_(),$J=x$(),FJ=E_(),BJ=q$(),jJ=$$(),UJ=eg(),HJ=U$(),VJ=x_(),WJ=W$(),zJ=K$(),GJ=X$(),YJ=J$(),KJ=Q$(),XJ=Z$(),JJ=nF(),QJ=rF();function ZJ(t=!1){let e=[GJ.default,YJ.default,KJ.default,XJ.default,JJ.default,QJ.default,HJ.default,VJ.default,UJ.default,WJ.default,zJ.default];return t?e.push($J.default,BJ.default):e.push(qJ.default,FJ.default),e.push(jJ.default),e}W_.default=ZJ});var sF=N(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});var jt=be(),e6={message:({schemaCode:t})=>(0,jt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,jt._)`{format: ${t}}`},t6={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:e6,code(t,e){let{gen:n,data:r,$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=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=n.const("fDef",(0,jt._)`${m}[${o}]`),y=n.let("fType"),S=n.let("format");n.if((0,jt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>n.assign(y,(0,jt._)`${h}.type || "string"`).assign(S,(0,jt._)`${h}.validate`),()=>n.assign(y,(0,jt._)`"string"`).assign(S,h)),t.fail$data((0,jt.or)(b(),v()));function b(){return c.strictSchema===!1?jt.nil:(0,jt._)`${o} && !${S}`}function v(){let k=u.$async?(0,jt._)`(${h}.async ? await ${S}(${r}) : ${S}(${r}))`:(0,jt._)`${S}(${r})`,R=(0,jt._)`(typeof ${S} == "function" ? ${k} : ${S}.test(${r}))`;return(0,jt._)`${S} && ${S} !== true && ${y} === ${e} && !${R}`}}function p(){let m=d.formats[s];if(!m){b();return}if(m===!0)return;let[h,y,S]=v(m);h===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(R());return}throw new Error(R());function R(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function v(R){let q=R instanceof RegExp?(0,jt.regexpCode)(R):c.code.formats?(0,jt._)`${c.code.formats}${(0,jt.getProperty)(s)}`:void 0,O=n.scopeValue("formats",{key:s,ref:R,code:q});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,(0,jt._)`${O}.validate`]:["string",R,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,jt._)`await ${S}(${r})`}return typeof y=="function"?(0,jt._)`${S}(${r})`:(0,jt._)`${S}.test(${r})`}}}};z_.default=t6});var oF=N(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});var n6=sF(),r6=[n6.default];G_.default=r6});var aF=N(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.contentVocabulary=hc.metadataVocabulary=void 0;hc.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];hc.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var lF=N(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});var i6=y$(),s6=A$(),o6=iF(),a6=oF(),cF=aF(),c6=[i6.default,s6.default,(0,o6.default)(),a6.default,cF.metadataVocabulary,cF.contentVocabulary];Y_.default=c6});var X_=N(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.dynamicAnchor=void 0;var K_=be(),l6=qr(),uF=Du(),u6=Ym(),d6={keyword:"$dynamicAnchor",schemaType:"string",code:t=>dF(t,t.schema)};function dF(t,e){let{gen:n,it:r}=t;r.schemaEnv.root.dynamicAnchors[e]=!0;let i=(0,K_._)`${l6.default.dynamicAnchors}${(0,K_.getProperty)(e)}`,s=r.errSchemaPath==="#"?r.validateName:f6(t);n.if((0,K_._)`!${i}`,()=>n.assign(i,s))}Vu.dynamicAnchor=dF;function f6(t){let{schemaEnv:e,schema:n,self:r}=t.it,{root:i,baseId:s,localRefs:o,meta:a}=e.root,{schemaId:c}=r.opts,l=new uF.SchemaEnv({schema:n,schemaId:c,root:i,baseId:s,localRefs:o,meta:a});return uF.compileSchema.call(r,l),(0,u6.getValidate)(t,l)}Vu.default=d6});var J_=N(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.dynamicRef=void 0;var fF=be(),p6=qr(),pF=Ym(),h6={keyword:"$dynamicRef",schemaType:"string",code:t=>hF(t,t.schema)};function hF(t,e){let{gen:n,keyword:r,it:i}=t;if(e[0]!=="#")throw new Error(`"${r}" only supports hash fragment reference`);let s=e.slice(1);if(i.allErrors)o();else{let c=n.let("valid",!1);o(c),t.ok(c)}function o(c){if(i.schemaEnv.root.dynamicAnchors[s]){let l=n.let("_v",(0,fF._)`${p6.default.dynamicAnchors}${(0,fF.getProperty)(s)}`);n.if(l,a(l,c),a(i.validateName,c))}else a(i.validateName,c)()}function a(c,l){return l?()=>n.block(()=>{(0,pF.callRef)(t,c),n.let(l,!0)}):()=>(0,pF.callRef)(t,c)}}Wu.dynamicRef=hF;Wu.default=h6});var mF=N(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});var m6=X_(),g6=De(),y6={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,m6.dynamicAnchor)(t,""):(0,g6.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};Q_.default=y6});var gF=N(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});var T6=J_(),v6={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,T6.dynamicRef)(t,t.schema)};Z_.default=v6});var yF=N(eP=>{"use strict";Object.defineProperty(eP,"__esModule",{value:!0});var b6=X_(),S6=J_(),_6=mF(),P6=gF(),k6=[b6.default,S6.default,_6.default,P6.default];eP.default=k6});var vF=N(tP=>{"use strict";Object.defineProperty(tP,"__esModule",{value:!0});var TF=eg(),N6={keyword:"dependentRequired",type:"object",schemaType:"object",error:TF.error,code:t=>(0,TF.validatePropertyDeps)(t)};tP.default=N6});var bF=N(nP=>{"use strict";Object.defineProperty(nP,"__esModule",{value:!0});var R6=eg(),w6={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,R6.validateSchemaDeps)(t)};nP.default=w6});var SF=N(rP=>{"use strict";Object.defineProperty(rP,"__esModule",{value:!0});var E6=De(),C6={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:n}){e.contains===void 0&&(0,E6.checkStrictMode)(n,`"${t}" without "contains" is ignored`)}};rP.default=C6});var _F=N(iP=>{"use strict";Object.defineProperty(iP,"__esModule",{value:!0});var D6=vF(),A6=bF(),I6=SF(),O6=[D6.default,A6.default,I6.default];iP.default=O6});var kF=N(sP=>{"use strict";Object.defineProperty(sP,"__esModule",{value:!0});var Vs=be(),PF=De(),M6=qr(),x6={message:"must NOT have unevaluated properties",params:({params:t})=>(0,Vs._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},L6={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:x6,code(t){let{gen:e,schema:n,data:r,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:o,props:a}=s;a instanceof Vs.Name?e.if((0,Vs._)`${a} !== true`,()=>e.forIn("key",r,d=>e.if(l(a,d),()=>c(d)))):a!==!0&&e.forIn("key",r,d=>a===void 0?c(d):e.if(u(a,d),()=>c(d))),s.props=!0,t.ok((0,Vs._)`${i} === ${M6.default.errors}`);function c(d){if(n===!1){t.setParams({unevaluatedProperty:d}),t.error(),o||e.break();return}if(!(0,PF.alwaysValidSchema)(s,n)){let f=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:PF.Type.Str},f),o||e.if((0,Vs.not)(f),()=>e.break())}}function l(d,f){return(0,Vs._)`!${d} || !${d}[${f}]`}function u(d,f){let p=[];for(let m in d)d[m]===!0&&p.push((0,Vs._)`${f} !== ${m}`);return(0,Vs.and)(...p)}}};sP.default=L6});var RF=N(oP=>{"use strict";Object.defineProperty(oP,"__esModule",{value:!0});var xo=be(),NF=De(),q6={message:({params:{len:t}})=>(0,xo.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,xo._)`{limit: ${t}}`},$6={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:q6,code(t){let{gen:e,schema:n,data:r,it:i}=t,s=i.items||0;if(s===!0)return;let o=e.const("len",(0,xo._)`${r}.length`);if(n===!1)t.setParams({len:s}),t.fail((0,xo._)`${o} > ${s}`);else if(typeof n=="object"&&!(0,NF.alwaysValidSchema)(i,n)){let c=e.var("valid",(0,xo._)`${o} <= ${s}`);e.if((0,xo.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:NF.Type.Num},c),i.allErrors||e.if((0,xo.not)(c),()=>e.break())})}}};oP.default=$6});var wF=N(aP=>{"use strict";Object.defineProperty(aP,"__esModule",{value:!0});var F6=kF(),B6=RF(),j6=[F6.default,B6.default];aP.default=j6});var CF=N(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});og.DiscrError=void 0;var EF;(function(t){t.Tag="tag",t.Mapping="mapping"})(EF||(og.DiscrError=EF={}))});var AF=N(lP=>{"use strict";Object.defineProperty(lP,"__esModule",{value:!0});var mc=be(),cP=CF(),DF=Du(),U6=Cu(),H6=De(),V6={message:({params:{discrError:t,tagName:e}})=>t===cP.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:n}})=>(0,mc._)`{error: ${t}, tag: ${n}, tagValue: ${e}}`},W6={keyword:"discriminator",type:"object",schemaType:"object",error:V6,code(t){let{gen:e,data:n,schema:r,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(r.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,mc._)`${n}${(0,mc.getProperty)(a)}`);e.if((0,mc._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:cP.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,mc._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:cP.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,mc.Name),m}function f(){var p;let m={},h=S(i),y=!0;for(let k=0;k<o.length;k++){let R=o[k];if(R?.$ref&&!(0,H6.schemaHasRulesButRef)(R,s.self.RULES)){let O=R.$ref;if(R=DF.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,O),R instanceof DF.SchemaEnv&&(R=R.schema),R===void 0)throw new U6.default(s.opts.uriResolver,s.baseId,O)}let q=(p=R?.properties)===null||p===void 0?void 0:p[a];if(typeof q!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||S(R)),b(q,k)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function S({required:k}){return Array.isArray(k)&&k.includes(a)}function b(k,R){if(k.const)v(k.const,R);else if(k.enum)for(let q of k.enum)v(q,R);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(k,R){if(typeof k!="string"||k in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[k]=R}}}};lP.default=W6});var IF=N((hDe,z6)=>{z6.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 OF=N((mDe,G6)=>{G6.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 MF=N((gDe,Y6)=>{Y6.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 xF=N((yDe,K6)=>{K6.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 LF=N((TDe,X6)=>{X6.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 qF=N((vDe,J6)=>{J6.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 $F=N((bDe,Q6)=>{Q6.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 FF=N(uP=>{"use strict";Object.defineProperty(uP,"__esModule",{value:!0});var Z6=IF(),eQ=OF(),tQ=MF(),nQ=xF(),rQ=LF(),iQ=qF(),sQ=$F(),oQ=["/properties"];function aQ(t){return[Z6,eQ,tQ,nQ,e(this,rQ),iQ,e(this,sQ)].forEach(n=>this.addMetaSchema(n,void 0,!1)),this;function e(n,r){return t?n.$dataMetaSchema(r,oQ):r}}uP.default=aQ});var BF=N((Pt,fP)=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.MissingRefError=Pt.ValidationError=Pt.CodeGen=Pt.Name=Pt.nil=Pt.stringify=Pt.str=Pt._=Pt.KeywordCxt=Pt.Ajv2019=void 0;var cQ=f$(),lQ=lF(),uQ=yF(),dQ=_F(),fQ=wF(),pQ=AF(),hQ=FF(),dP="https://json-schema.org/draft/2019-09/schema",gc=class extends cQ.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(uQ.default),lQ.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(dQ.default),this.addVocabulary(fQ.default),this.opts.discriminator&&this.addKeyword(pQ.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:n}=this.opts;n&&(hQ.default.call(this,e),this.refs["http://json-schema.org/schema"]=dP)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(dP)?dP:void 0)}};Pt.Ajv2019=gc;fP.exports=Pt=gc;fP.exports.Ajv2019=gc;Object.defineProperty(Pt,"__esModule",{value:!0});Pt.default=gc;var mQ=Eu();Object.defineProperty(Pt,"KeywordCxt",{enumerable:!0,get:function(){return mQ.KeywordCxt}});var yc=be();Object.defineProperty(Pt,"_",{enumerable:!0,get:function(){return yc._}});Object.defineProperty(Pt,"str",{enumerable:!0,get:function(){return yc.str}});Object.defineProperty(Pt,"stringify",{enumerable:!0,get:function(){return yc.stringify}});Object.defineProperty(Pt,"nil",{enumerable:!0,get:function(){return yc.nil}});Object.defineProperty(Pt,"Name",{enumerable:!0,get:function(){return yc.Name}});Object.defineProperty(Pt,"CodeGen",{enumerable:!0,get:function(){return yc.CodeGen}});var gQ=Bm();Object.defineProperty(Pt,"ValidationError",{enumerable:!0,get:function(){return gQ.default}});var yQ=Cu();Object.defineProperty(Pt,"MissingRefError",{enumerable:!0,get:function(){return yQ.default}})});var Sc=require("path"),He=L(aE());var Lf=class t{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,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 n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(let r of e)if(t.isIncremental(r)){let i=lE(r.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.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=cE(r.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=r.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(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=cE(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){let o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}let s=r-1;return{line:s,character:e-n[s]}}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}},Lt;(function(t){function e(i,s,o,a){return new Lf(i,s,o,a)}t.create=e;function n(i,s,o){if(i instanceof Lf)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){let o=i.getText(),a=yT(s.map(sH),(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=r})(Lt||(Lt={}));function yT(t,e){if(t.length<=1)return t;let n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);yT(r,e),yT(i,e);let s=0,o=0,a=0;for(;s<r.length&&o<i.length;)e(r[s],i[o])<=0?t[a++]=r[s++]:t[a++]=i[o++];for(;s<r.length;)t[a++]=r[s++];for(;o<i.length;)t[a++]=i[o++];return t}function cE(t,e,n=0){let r=e?[n]:[];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++,r.push(n+i+1))}return r}function lE(t){let e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function sH(t){let e=lE(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var qf=["namespace","class","enum","interface","struct","typeParameter","type","parameter","variable","property","enumMember","decorator","event","function","method","macro","label","comment","string","keyword","number","regexp","operator"],$f=["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"];var vT=L(require("url")),TE=require("crypto"),fa=require("path"),zt=L(U());var TT=L(U());var Kn=L(U());var te=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 fsPath(){return this.firstToken.fsPath}getTopMostAstNodeForFile(e){return fe(e,this.fsPath)?[this]:this.children.flatMap(n=>n.getTopMostAstNodeForFile(e))}getDocumentSymbols(e){if(!this.docSymbolsMeta)return this.children.flatMap(r=>r.getDocumentSymbols(e)??[]);if(!fe(this.fsPath,e))return[];let n=ce(this);return[{name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind,range:n,selectionRange:n,children:[...this.children.flatMap(r=>r.getDocumentSymbols(e)??[])]}]}getWorkspaceSymbols(){if(!this.docSymbolsMeta)return this.children.flatMap(i=>i.getWorkspaceSymbols()??[]);let e=this.docSymbolsMeta.kind;if(![Kn.SymbolKind.File,Kn.SymbolKind.Class,Kn.SymbolKind.Constant].some(i=>i===e))return[];let n=pn(this.fsPath),r=n?.range??ce(this);return[{location:Kn.Location.create(ue(n?.fsPath??this.fsPath),r),name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind},...this.children.flatMap(i=>i.getWorkspaceSymbols()??[]).filter(i=>i.kind===Kn.SymbolKind.File||i.kind===Kn.SymbolKind.Class||i.kind===Kn.SymbolKind.Constant)]}buildSemanticTokens(e){this._children.forEach(n=>n.buildSemanticTokens(e)),!(!this.semanticTokenType||!this.semanticTokenModifiers)&&e(Hi(this.semanticTokenType),Vi(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(n=>n===e||n.isAncestorOf(e))}toPrettyString(e){return this.toString()}toString(e){return"TODO"}get range(){return Kn.Range.create(Kn.Position.create(this.firstToken.pos.line,this.firstToken.pos.col),Kn.Position.create(this.lastToken.pos.line,this.lastToken.pos.colEnd))}get serializeURL(){return ue(this.fsPath)}serialize(e){return{url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var me=class extends te{get firstToken(){return this.operator?this.operator.firstToken:super.firstToken}toJson(){return-1}#e;resolve(e){return this.#e??=Hc(this.toString(),e),this.#e}#n;evaluate(e){return this.#n??=Me(`${this.operator?this.operator.toString():""}${this.resolve(e)}`),this.#n}#r;isTrue(e){return this.#r??=Me(`!!(${this.operator?this.operator.toString():""}${this.resolve(e)})`),typeof this.#r=="boolean"&&this.#r}toPrettyString(e){let n=this.evaluate(e);return`${n.toString()} /* ${this.toString()}${typeof n=="number"?` = 0x${n.toString(16)}`:""} */`}serialize(e){return{type:"EXPRESSION",value:this.toString(),evaluated:this.evaluate(e),url:this.serializeURL,range:this.range,issues:this.serializeIssues}}},rn=class t extends me{constructor(n,r,i){super();this.expression=n;this.wrapped=r;this.addChild(n),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(n,r){this.addChild(n),this.addChild(r),this.join??=[],this.join?.push({operator:n,expression:r})}toString(){let n=this.children.map(r=>"radix"in r&&r.radix===16?`0x${r.toString()}`:r.toString()).join(" ");return this.wrapped?`(${n})`:`${n}`}isTrue(n){let r=`(${this.children.map(i=>i instanceof me?i.resolve(n):i.toString()).join(" ")})`;return Me(`!!(${this.operator?this.operator.toString():""}${r})`)}get flatJoin(){return this.wrapped?this.join??(this.expression instanceof t?this.expression.flatJoin:[]):[...this.expression instanceof t?this.expression.flatJoin:[],...this.join?.flatMap(n=>[{operator:n.operator,expression:n.expression instanceof t?n.expression.expression:n.expression},...n.expression instanceof t?n.expression.flatJoin:[]])??[]]}};var vi=class extends me{constructor(n,r,i){super(r);this.value=n;this.docSymbolsMeta={name:`param${i+1}`,kind:TT.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.value}},Wt=class extends me{constructor(n,r){super();this.functionName=n;this.params=r;this.addChild(n),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(n){return fe(this.fsPath,n)?[{name:this.functionName.name,kind:TT.SymbolKind.Function,range:ce(this),selectionRange:ce(this),children:this.params.flatMap(r=>r?.getDocumentSymbols(n)??[])}]:[]}toString(){return`${this.functionName.toString()}(${this.params.map(n=>n?.toString()??"").join(", ")})`}isTrue(n){if(this.functionName.name==="defined"){let r=!!(this.params.length===1&&this.params[0]&&n.has(this.params[0].value));return this.operator?Me(`!!(${this.operator}${r})`):r}return super.isTrue(n)}};var Kr=L(U());var hE=L(U());var uE=L(U());var re=class extends te{constructor(n,r){super(r);this.value=n;this.semanticTokenType="string",this.semanticTokenModifiers="declaration",this.docSymbolsMeta={name:this.value,kind:uE.SymbolKind.String}}toString(){return`"${this.value.toString()}"`}toJson(){return this.value}serialize(){return{type:"STRING",value:this.value,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var fE=L(U());var dE=L(U());var sn=class extends me{constructor(n,r,i=10){super(r);this.value=n;this.radix=i;this.docSymbolsMeta={name:this.value.toString(),kind:dE.SymbolKind.Number},this.semanticTokenType="number",this.semanticTokenModifiers="declaration"}resolve(n){return this.value.toString()}evaluate(n){return this.value}isTrue(n){return!!this.value}toString(n){return this.value.toString(n??this.radix)}toJson(){return this.value}toPrettyString(n){let r=this.value;return this.radix===16?`0x${r.toString(16)} /* ${typeof r=="number"?`${r.toString(10)}`:""} */`:`${r.toString(10)} /* ${typeof r=="number"?`0x${r.toString(16)}`:""} */`}serialize(){return{type:"NUMBER_VALUE",value:`${this.radix===16?"0x":""}${this.toString()}`,evaluated:this.value,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var ct=class extends te{constructor(n){super();this.values=n;this.docSymbolsMeta={name:"Cell Array",kind:fE.SymbolKind.Array},this.values.forEach(r=>this.addChild(r))}toString(){return`<${this.values.map(n=>n.toString()).join(" ")}>`}toPrettyString(n){return`<${this.values.map(r=>r.toPrettyString(n)).join(" ")}>`}toJson(){if(this.values.length===1)return this.values[0].value?.toJson();if(this.values.length===2&&this.values.every(n=>n.value instanceof sn)){let n=new ArrayBuffer(8),r=new DataView(n);return this.values.map(i=>i.value.value).forEach((i,s)=>{r.setUint32(s*4,i)}),r.getBigUint64(0)}return this.values.map(n=>n.value?.toJson()??NaN)}serialize(n){return{type:"ARRAY_VALUE",value:this.values.map(r=>r.value?.serialize(n)??null),url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var pE=L(U());var Mn=class extends te{constructor(n){super();this.values=n;this.docSymbolsMeta={name:"Byte String Value",kind:pE.SymbolKind.Array},this.values.forEach(r=>this.addChild(r))}toString(){return`[${this.values.map(n=>n.toString(16).padStart(2,"0")).join(" ")}]`}toJson(){return this.values.map(n=>n.value?.toJson()??NaN)}serialize(){return{type:"BYTESTRING",values:this.values.map(n=>n.value?.serialize()??null),url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var Xe=class extends te{constructor(n,r){super(r);this.name=n;this.semanticTokenType="property",this.semanticTokenModifiers="declaration"}toString(){return this.name}serialize(){return{value:this.name,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}},Ne=class extends te{constructor(n,r=[]){super();this.propertyName=n;this.labels=r;this._values=void 0;this.docSymbolsMeta={name:this.propertyName?.name??"Unknown",kind:hE.SymbolKind.Property},this.labels.forEach(i=>this.addChild(i)),this.addChild(n)}set values(n){if(this._values)throw new Error("Only one property name is allowed");this._values=n,this.addChild(n)}get values(){return this._values}get quickValues(){return this.values?.values.map(n=>n?n.value instanceof re?n.value.value:n.value instanceof ct?n.value.values.map(r=>r.value instanceof sn?r.value.value:NaN):n.value instanceof Mn?n.value.values.map(r=>r.value?.value??NaN):NaN:null)}getFlatAstValues(){return this.values?.values.flatMap(n=>n?n.value instanceof re?n.value:n.value instanceof ct?n.value.values.map(r=>r.value):n.value instanceof Mn?n.value.values.map(r=>r.value):n.value:null)}toString(){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(n=>n?.toString()??"NULL").join(", ")??"NULL"}`:""};`}toPrettyString(n,r){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(i=>i?.toPrettyString(n)??"NULL").join(r?`,
|
|
183
|
-
${" ".repeat(r)}`:", ")??"NULL"}`:""};${bi(this.fsPath)?" /* default value from binding */":""}`}serialize(n){return{name:this.propertyName?.serialize()??null,values:this.values===void 0?void 0:this.values?.values.map(r=>r?.value?.serialize(n)??null)??null,url:this.serializeURL,range:this.range,issues:[...this.serializeIssues,...this.values?.issues.map(r=>r())??[]]}}};var mE=L(U());var hn=class extends te{constructor(n,r){super();this.keyword=r;this.addChild(r),this.docSymbolsMeta={name:n,kind:mE.SymbolKind.Function}}};var Xn=class extends hn{constructor(n){super("Delete Node",n);this._nodeNameOrRef=null}set nodeNameOrRef(n){if(this._nodeNameOrRef)throw new Error("Only one property name is allowed");this._nodeNameOrRef=n,this.addChild(n)}get nodeNameOrRef(){return this._nodeNameOrRef}};var lt=class extends hn{constructor(n){super("Delete Property",n);this._propertyName=null}set propertyName(n){if(this._propertyName)throw new Error("Only only property name is allowed");this._propertyName=n,this.addChild(n)}get propertyName(){return this._propertyName}};var gE=L(U());var ie=class extends te{constructor(n){super();this.label=n;this.docSymbolsMeta={name:`&${this.label?.value??"NULL"}`,kind:gE.SymbolKind.Key},this.addChild(n)}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,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var we=class t extends te{constructor(){super()}get path(){if(!this.pathName)return["__UNDEFINED__"];if(!this.parentNode||this instanceof nt)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 Xn)}addNodeChild(e){this.addChild(e)}},nt=class extends we{constructor(){super(),this.docSymbolsMeta={name:"/",kind:Kr.SymbolKind.Class}}get properties(){return this.children.filter(e=>e instanceof Ne)}#e;get name(){return this.#e??=new $e("/",he(this.firstToken)),this.#e}get identifierAst(){return this.name}get deleteProperties(){return this.children.filter(e=>e instanceof lt)}get nodes(){return this.children.filter(e=>e instanceof Ee)}get pathName(){return"/"}serialize(e){return{type:"ROOT",properties:this.properties.map(n=>n.serialize(e)),nodes:this.nodes.map(n=>n.serialize(e)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},ut=class extends we{constructor(n=[]){super();this.labels=n;this._reference=null;this.docSymbolsMeta={name:"DTC Name",kind:Kr.SymbolKind.Class},n.forEach(r=>{super.addChild(r)})}get serializeIssues(){return[...this.issues,...this.reference?.issues??[]].map(n=>n())}get identifierAst(){return this.reference}set reference(n){if(this._reference)throw new Error("Only on label reference is allowed");this._reference=n;let r;n instanceof ie?r=n.value:r=n?.path?.pathParts.at(-1)?.name??"DTC Name",this.docSymbolsMeta={name:r??"DTC Name",kind:Kr.SymbolKind.Class},this.addChild(n)}get path(){return this.resolveNodePath?this.resolveNodePath:super.path}get reference(){return this._reference}get nodes(){return this.children.filter(n=>n instanceof Ee)}get pathName(){if(this.reference instanceof ie&&this.reference.label?.value)return`&${this.reference.label.value}`}get properties(){return this.children.filter(n=>n instanceof Ne)}get deleteProperties(){return this.children.filter(n=>n instanceof lt)}serialize(n){return{type:"REF",labels:this.labels.map(r=>r.serialize(n)),name:this.reference?.serialize()??null,properties:this.properties.map(r=>r.serialize(n)),nodes:this.nodes.map(r=>r.serialize(n)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},Ee=class t extends we{constructor(n=[],r){super();this.labels=n;this.omitIfNoRef=r;this._name=null;this.docSymbolsMeta={name:"DTC Name",kind:Kr.SymbolKind.Class},r&&this.addChild(r),n.forEach(i=>{this.addChild(i)})}get identifierAst(){return this.name}get serializeIssues(){return[...this.issues,...this.name?.issues??[]].map(n=>n())}set name(n){if(this._name)throw new Error("Only on label reference is allowed");this._name=n,this.docSymbolsMeta={name:this._name?.toString()??"DTC Name",kind:Kr.SymbolKind.Class},this.addChild(n)}get name(){return this._name}get nodes(){return this.children.filter(n=>n instanceof t)}get pathName(){return this._name?.toString()}get properties(){return this.children.filter(n=>n instanceof Ne)}get deleteProperties(){return this.children.filter(n=>n instanceof lt)}serialize(n){return{type:"CHILD",labels:this.labels.map(r=>r.serialize(n)),name:this.name?.serialize()??null,properties:this.properties.map(r=>r.serialize(n)),nodes:this.nodes.map(r=>r.serialize(n)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},Vc=class extends te{constructor(n,r){super(r);this.address=n;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.address?.map((n,r)=>n.toString(16).padStart(r?8:0,"0")).join("")??"NaN"}serialize(){return{address:this.address,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}},$e=class extends te{constructor(n,r,i){super(r);this.name=n;this._address=i;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}get value(){return this.name}get address(){return this._address}set address(n){if(this._address)throw new Error("Address can only be set once");n&&(this.lastToken=void 0,this._address=n,n.forEach(r=>this.addChild(r)))}get fullAddress(){return this._address?[...this._address.flatMap(n=>n.address)]:void 0}toString(){return this._address!==void 0?`${this.name}@${this._address.map(n=>n.toString()).join(",")}`:this.name}buildSemanticTokens(n){let r=this.firstToken;if(!r.value)return;let i={...r,pos:{...r.pos,len:this.name.length}};n(Hi("type"),Vi("declaration"),i,i),this.address!==void 0&&this.address.forEach(s=>{n(Hi("decorator"),Vi("declaration"),s.firstToken,s.lastToken),s.buildSemanticTokens(n)})}get serializeIssues(){return[...this.issues,...this._address?.flatMap(n=>n.issues)??[]].map(n=>n())}serialize(){let n=this.firstToken;return{fullName:this.toString(),name:{name:this.name,url:this.serializeURL,range:Kr.Range.create(Kr.Position.create(n.pos.line,n.pos.col),Kr.Position.create(n.pos.line,n.pos.colEnd)),issues:this.serializeIssues},address:this.address?.map(r=>r.serialize())??null,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var on=(t,e,n=!0,r=!0)=>({start:{line:t?.pos.line??0,character:n?t?.pos.col??0:(t?.pos.col??0)+(t?.pos.len??0)},end:{line:e?.pos.line??0,character:r?(e?.pos.col??0)+(e?.pos.len??0):e?.pos.col??0}});var se=(t,e=!0)=>zt.Position.create(t.pos.line,e?t.pos.colEnd:t.pos.col),ce=t=>on(t.firstToken,t.lastToken),Hi=t=>qf.findIndex(e=>e===t),Vi=t=>$f.findIndex(e=>e===t),gs=(t,e,n)=>!fe(t.fsPath,e)||n.line<t.pos.line?!1:n.line>t.pos.line?!0:n.character>=t.pos.colEnd,bT=(t,e,n)=>fe(t.fsPath,e)?n.line<t.pos.line?!0:n.line>t.pos.line?!1:n.character<t.pos.col:!1,Qt=(t,e,n)=>{let r=t.firstToken,i=t.lastToken;return!!((r.pos.line<n.line||r.pos.line===n.line&&r.pos.col<=n.character)&&(i.pos.line>n.line||i.pos.line===n.line&&i.pos.colEnd>=n.character)&&fe(t.fsPath,e))},ao=(t,e)=>{let n=(i,s)=>i.line<s.line||i.line===s.line&&i.character<=s.character,r=(i,s)=>i.line>s.line||i.line===s.line&&i.character>=s.character;return n(t.start,e.start)&&r(t.end,e.end)},vE=(t,e,n)=>{let r=t.firstToken,i=t.lastToken;return!!(t.lastToken.value!==";"&&(r.pos.line===n.line||i.pos.line===n.line)&&n.character>=i.pos.colEnd&&fe(t.fsPath,e))},bE=(t,e,n)=>{if(!t)return!1;let i=t.filter(s=>s.pos.line===n.line).at(-1);return i&&i.pos.col>=n.character?!1:e.lastToken===i};var Jr=(t,e,n)=>{let r=t,i=t;for(;i;)r=i,i=[...r.children].reverse().find(s=>Qt(s,e,n));return r},Wc=(t,e,n)=>{let r=t,i=t;for(;i;)r=i,i=[...r.children].find(s=>bT(s.lastToken,e,n));return r===t?void 0:r},zc=(t,e,n)=>{let r=t,i=t;for(;i;)r=i,i=[...r.children].reverse().find(s=>gs(s.firstToken,e,n));return r===t?void 0:r},ST="#virtual",bi=t=>t.includes(ST),jf=(t,e)=>`${t}?loc=${e.start.line}:${e.start.character}-${e.end.line}:${e.end.character}${ST}`,pn=t=>{if(!bi(t))return;let[e,n]=t.split("?"),[r,i]=n.replace("loc=","").replace(ST,"").split("-"),[s,o]=r.split(":"),[a,c]=i.split(":");return{fsPath:e,range:zt.Range.create(zt.Position.create(Number.parseInt(s),Number.parseInt(o)),zt.Position.create(Number.parseInt(a),Number.parseInt(c)))}},_T=t=>{let e=pn(t.fsPath);e&&(t.range=e.range,t.fsPath=e?.fsPath,t.virtual=!0,t.linkedTo=t.linkedTo.map(({range:n,fsPath:r})=>{let i=pn(r);return{range:i?.range??n,fsPath:i?.fsPath??r,templateStrings:[]}}))},Y=(t,e,n=e,r,{severity:i=zt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,inclusiveStart:u,inclusiveEnd:d}={severity:zt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let f={issues:Array.isArray(t)?t:[t],range:on(e,n,u,d),fsPath:e.fsPath,severity:i,linkedTo:s.map(({range:h,fsPath:y})=>{let S=pn(y);return S?{...S,templateStrings:[]}:{range:h,fsPath:y,templateStrings:[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};_T(f);let p,m=()=>(p??={severity:f.severity,range:f.range,message:f.issues?f.issues.map(lH).join(" or "):"",source:"devicetree",tags:f.tags,data:{firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:n.pos,tokens:n.tokens,value:n.value},type:"SyntaxIssue",items:f.issues,edit:f.edit,codeActionTitle:f.codeActionTitle,virtual:!!f.virtual}},p);return r?.syntaxIssues.push(m),{raw:f,diagnostic:m}},Gt=(t,e,n,r,{severity:i=zt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,linkedToTemplateStrings:u=[]}={severity:zt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[],linkedToTemplateStrings:[]})=>{let d={issues:Array.isArray(t)?t:[t],range:on(e,n),fsPath:e.fsPath,severity:i,linkedTo:s.map(({range:m,fsPath:h},y)=>{let S=pn(h);return S?{...S,templateStrings:[]}:{range:m,fsPath:h,templateStrings:u.at(y)??[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};_T(d);let f,p=()=>(f??={severity:d.severity,range:d.range,message:uH(d),source:"devicetree",tags:d.tags,relatedInformation:[...d.linkedTo.map(m=>({message:d.issues.map(h=>dH(h,m.templateStrings)).join(" or "),location:{uri:ue(m.fsPath),range:m.range}}))]},f);return r?.resettableIssues.push(p),{raw:d,diagnostic:p}},F=(t,e,n,r,{severity:i=zt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l}={severity:zt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let u={issues:Array.isArray(t)?t:[t],range:on(e,n),severity:i,fsPath:e.fsPath,linkedTo:s.map(({range:p,fsPath:m})=>{let h=pn(m);return h?{...h,templateStrings:[]}:{range:p,fsPath:m,templateStrings:[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};_T(u);let d,f=()=>(d??={severity:u.severity,range:u.range,message:fH(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(pH).join(" or "),location:{uri:ue(p.fsPath),range:p.range}}))],source:"devicetree",tags:u.tags,data:{type:"StandardTypeIssue",firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:n.pos,tokens:n.tokens,value:n.value},edit:u.edit,codeActionTitle:u.codeActionTitle,items:u.issues,virtual:!!u.virtual}},d);return Array.isArray(r)?r.forEach(p=>p.resettableIssues.push(f)):r?.resettableIssues.push(f),{raw:u,diagnostic:f}};function Ve(t,e,n,{severity:r=zt.DiagnosticSeverity.Warning,linkedTo:i=[],tags:s,templateStrings:o=[],edit:a,codeActionTitle:c}={severity:zt.DiagnosticSeverity.Warning,linkedTo:[],templateStrings:[],edit:[],codeActionTitle:void 0},l=n){let u={issues:Array.isArray(t)?t:[t],range:zt.Range.create(n,l),severity:r,fsPath:e,linkedTo:i.map(({range:p,fsPath:m})=>({range:p,fsPath:m,templateStrings:[]})),tags:s,templateStrings:o,edit:a,codeActionTitle:c,virtual:bi(e)},d;return{raw:u,diagnostic:()=>(d??={severity:u.severity,range:u.range,message:hH(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(mH).join(" or "),location:{uri:ue(p.fsPath),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 SE=(t,e)=>[...t].sort((r,i)=>{let s=e.getSortKey(r),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=r.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 Rt(t,e,n){let r=_e(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=>Qt(u,r,t.position));return c&&(o={runtime:s,item:null,ast:Jr(c,r,t.position)},a=Number.MAX_SAFE_INTEGER),o||(o=s.getDeepestAstNode(r,t.position),a=e.getSortKey(o?.ast)??e.getSortKeyFile(t.position,r)),console.log(`search: ${performance.now()-i}ms`),n(o,u=>{let d=t.position;if(fe(u.fsPath,r)){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 he(t,e){return{start:t,end:e??t}}var H=(t,e)=>t?.tokens.some(n=>n===e),st=(t,e)=>n=>n?.value&&(e?.caseInsensitive?t.toLowerCase()===n.value.toLowerCase():t===n.value)?"yes":e?.allowPartial?oH(t)(n):"no",Fe=t=>e=>e?.tokens.some(n=>n===t)?"yes":"no",oH=t=>e=>e?.value&&t.startsWith(e.value)?"partial":"no",mn=(t,e)=>!!t&&!!e&&t.pos.line===e.pos.line&&fe(t.fsPath,e.fsPath),Yt=(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&&mn(t,e),Uf=t=>t.map((e,n)=>({index:n,context:e,files:e.getContextFiles()})),Rn=(t,e,n,r)=>{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 n?.getContextFiles().find(s=>fe(s,e.fsPath))?n:Uf(t).sort(s=>s.context.id===r?-1:0).find(s=>s.files.some(o=>fe(o,e.fsPath)))?.context},PT=(t,e)=>Uf(t).filter(r=>r.files.some(i=>fe(i,e))).map(r=>r.context),_E=t=>{let e=/^(\w+)\s+(.*)$/,n=/^(\w+)\(([^)]*)\)\s+(.*)$/,r=/^(\w+)\(([^)]*),\s*\.\.\.\)\s+(.*)$/,i;if(i=r.exec(t)){let[,,s,o]=i,a=s.split(",").map(c=>c.trim());return(...c)=>{let l=o,u=c.slice(a.length).join(", ");return a.forEach((d,f)=>{l=l.replace(new RegExp(`(?<!#)#\\s*${d}\\b`,"g"),`"${c[f]??""}"`)}),l=l.replace(/(?<!#)#\s*__VA_ARGS__/g,`"${u}"`),a.forEach((d,f)=>{let p=new RegExp(`\\b${d}\\b`,"g");l=l.replace(p,c[f]??"")}),l=l.replace(/__VA_ARGS__/g,u),l}}else 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)=>{l=l.replace(new RegExp(`(?<!#)#\\s*${u}\\b`,"g"),`"${c[d]??""}"`)}),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 aH(t){if(!t.trim())return[];let e=[],n="",r=0;for(let i=0;i<t.length;i++){let s=t[i];s===","&&r===0?(e.push(n.trim()),n=""):(s==="("?r++:s===")"&&r--,n+=s)}return n.trim()&&e.push(n.trim()),e}var cH=0,Hc=(t,e)=>{let n=s=>s.replace(/\s*##\s*/g,""),r=t,i;do i=r,r=n(i),r=r.replace(/\b(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)|\b(\w+)\b/g,(s,o,a,c)=>{if(o==="defined"){let l=a.split(",").map(u=>u.trim());return l[0]?e.get(l[0])?.resolver:l}else if(o&&typeof e.get(o)?.resolver=="function"){let l=aH(a).map(u=>u.trim()).map(u=>u==="__COUNTER__"?(cH++).toString():u).map(u=>Hc(u,e));return(e.get(o)?.resolver)(...l)}else if(c&&typeof e.get(c)?.resolver=="string")return e.get(c)?.resolver;return s});while(r!==i);return r};function kT(t){return t.replace(/'(.)'/g,(e,n)=>n.charCodeAt(0).toString()).replace(/(0x[a-f\d]+|\d+)[ul]*/gi,"$1")}function Me(t){try{return(0,eval)(kT(t))}catch{}return t}var ue=t=>vT.default.pathToFileURL(t).toString(),_e=t=>dt(vT.default.fileURLToPath(t)),PE=(t,e)=>{let n=(0,fa.relative)(t,e);return!!n&&!n.startsWith("..")&&!(0,fa.isAbsolute)(n)},fe=(t,e)=>!t||!e?!1:t===e,dt=t=>(0,fa.normalize)(process.platform==="win32"?t.toLowerCase():t),Wi=t=>(0,TE.createHash)("sha256").update([dt(t.dtsFile),...t.includePaths.map(dt),...t.overlays.map(dt),t.bindingType,...t.zephyrBindings.map(dt),...t.deviceOrgBindingsMetaSchema.map(dt),...t.deviceOrgTreeBindings.map(dt),`showFormattingErrorAsDiagnostics-${t.showFormattingErrorAsDiagnostics}`,`disableFileWatchers-${t.disableFileWatchers}`].join(":")).digest("hex"),lH=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"}},uH=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 "),dH=(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"}},fH=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 ")}`;case 38:return"Empty ranges property should only be used when address size cells is identical to the parent node";case 39:return'The value shall be one of the following: "spin-table" or "[vendor],[method]"';case 40:return'The value shall match "[vendor],[method]"'}}).join(" or ").replace("INTRO",`Property "${t.templateStrings[0]}"`).replaceAll("INTRO ",""),pH=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"}},hH=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}`;case 10:return"Node address is already a hex value. Remove '0x'.";case 11:return"Node address size is determined by '@size-cells', Remove 'ull'.";case 12:return`'\\' is not necessary. ${t.codeActionTitle}`;case 13:return`Node does not contribute anything. ${t.codeActionTitle}`;case 14:return`Property is redefined in same closure. ${t.codeActionTitle}`;case 15:return`${t.codeActionTitle}`}}).join(" or "),mH=t=>"TODO";var Dt=(t,e)=>{let n=Math.max(t.length,e.length);for(let r=0;r<n;r++){let i=t[t.length-n+r]??0,s=e[e.length-n+r]??0;if(i<s)return-1;if(i>s)return 1}return 0},Xr=(t,e)=>{let n=Math.max(t.length,e.length),r=new Array(n).fill(0),i=0;for(let s=0;s<n;s++){let o=t[t.length-1-s]??0,a=e[e.length-1-s]??0,c=o+a+i;r[n-1-s]=c>>>0,i=c>4294967295?1:0}return i&&r.unshift(1),r},gH=(t,e)=>{let n=Math.max(t.length,e.length),r=new Array(n).fill(0),i=0;for(let s=0;s<n;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,r[n-1-s]=o-a>>>0}for(;r.length>1&&r[0]===0;)r.shift();return r},yH=(t,e)=>Xr(t,e),kE=(t,e)=>{let n=[];for(let r of t){let i=r.childAddress,s=r.length,o=Xr(i,s);if(Dt(e,i)>=0&&Dt(e,o)<0){let a=gH(e,i),c=r.parentAddress,l=yH(c,a),u=Xr(c,s);n.push({start:l,end:u,range:on(r.rangeTokens.start,r.rangeTokens.end),fsPath:r.rangeTokens.start.fsPath})}}return n};function NE(t){return Array.isArray(t)&&Array.isArray(t[0])}function Gc(t){return!t||t instanceof Wt?t:Gc(t.parentNode)}function Jn(t,e){let n=e.filter(r=>!r.raw.virtual).flatMap(r=>r.raw.edit).filter(r=>!!r);return NT(t,n)}function NT(t,e){let n=t.getText(),r=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=n;for(let s of r){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 yE(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 RE(t,e){return yE(t.end,e.start)>0&&yE(t.start,e.end)<0}var wE=(t,e)=>{let n=EE(t,e),r=CE(t,e);n&&(t.topComment=n),r&&(t.endComment=r)},EE=(t,e)=>{let n=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(!n||n.astBeforeComment)return;n.astAfterComment=t;let r=EE(n,e);return r&&(r.astAfterComment=t,n.astAfterComment=void 0),r??n},CE=(t,e)=>{let n=e.find(i=>!i.disabled&&i.firstToken.prevToken===t.lastToken&&i.firstToken.pos.line===t.lastToken.pos.line);if(!n)return;n.astBeforeComment=t;let r=CE(n,e);return r&&(r.astBeforeComment=t,n.astBeforeComment=void 0),r??n},co=(t,e,n)=>{let r=[42,44,45,36];return n||r.push(52,32,53,8,49),t.severity===zt.DiagnosticSeverity.Error&&fe(t.fsPath,e)&&!r.some(i=>t.issues.includes(i))};function Hf(t){let e=t?.charAt(0);return!!e&&(e>="A"&&e<="Z"||e>="a"&&e<="z")}var pa=t=>{if(t)return t instanceof we?t:pa(t?.parentNode)},ha=(t,e,n=0)=>{if(!e||!e.parentNode?.fsPath)return n;let r=pa(e.parentNode);return ha(t,r,n+1)};function DE(t,e,n,r){let i=n-e,s=r.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]=r[l];for(let l=n;l<t.length;l++,c++)a[c]=t[l];return a}function ma(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"):""}function Vf(t,e,n,r,i){let s=e.closeScope?.prevToken??e.lastToken.prevToken;if(!s)return;let o="";switch(r.types[0]){case"U32":case"U64":case"PROP_ENCODED_ARRAY":o=` = <${n==="reg"&&t.address?t.address.map(a=>`0x${a.toString(16)}`).join(" "):""}>`;break;case"STRING":case"STRINGLIST":o=' = ""';break;case"BYTESTRING":o=" = []";break}return zt.TextEdit.insert(zt.Position.create(s.pos.line,s.pos.col+1),`
|
|
184
|
-
${"".padEnd(ha(s.fsPath,e),i.context.formattingOptions.insertSpaces?" ".repeat(i.context.formattingOptions.tabSize):" ")}${n}${o};`)}var cl=require("fs"),Pa=require("path"),fo=L(U());var CD=require("path"),wr=L(U());var xn=class extends te{constructor(n,r,i,s){super();this.startLabels=n;this.value=r;this.endLabels=i;this.bits=s;this.startLabels.forEach(o=>{this.addChild(o)}),this.addChild(s),this.addChild(r),this.endLabels.forEach(o=>{this.addChild(o)})}toString(){return`${[this.value?.toString()??"NULL",...this.endLabels.map(n=>n.toString())].join(" ")}`}toPrettyString(n){return`${[this.value?.toPrettyString(n)??"NULL",...this.endLabels.map(r=>r.toString())].join(" ")}`}toJson(){return this.value?.toJson()}};var Zt=t=>t instanceof hn?!0:t instanceof we?!1:t.parentNode?Zt(t.parentNode):!1;var RT=t=>{if(t instanceof Ne)return t;if(!(t instanceof we))return t.parentNode?RT(t.parentNode):void 0},lo=t=>!t||t instanceof Ne?!1:t instanceof xn||lo(t.parentNode),wT=t=>{if(t instanceof Ee||t instanceof nt)return t.name;if(t instanceof ut)return t.reference},Wf=t=>[...t.map(wT)].filter(e=>!!e),ET=(t,e)=>e?e.parentNode===t||ET(t,e.parentNode):!1;var
|
|
182
|
+
deps: ${n}}`};var pJ={keyword:"dependencies",type:"object",schemaType:"object",error:xi.error,code(t){let[e,n]=hJ(t);F$(t,e),B$(t,n)}};function hJ({schema:t}){let e={},n={};for(let r in t){if(r==="__proto__")continue;let i=Array.isArray(t[r])?e:n;i[r]=t[r]}return[e,n]}function F$(t,e=t.schema){let{gen:n,data:r,it:i}=t;if(Object.keys(e).length===0)return;let s=n.let("missing");for(let o in e){let a=e[o];if(a.length===0)continue;let c=(0,Hu.propertyInData)(n,r,o,i.opts.ownProperties);t.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),i.allErrors?n.if(c,()=>{for(let l of a)(0,Hu.checkReportMissingProp)(t,l)}):(n.if((0,I_._)`${c} && (${(0,Hu.checkMissingProp)(t,a,s)})`),(0,Hu.reportMissingProp)(t,s),n.else())}}xi.validatePropertyDeps=F$;function B$(t,e=t.schema){let{gen:n,data:r,keyword:i,it:s}=t,o=n.name("valid");for(let a in e)(0,fJ.alwaysValidSchema)(s,e[a])||(n.if((0,Hu.propertyInData)(n,r,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:a},o);t.mergeValidEvaluated(c,o)},()=>n.var(o,!0)),t.ok(o))}xi.validateSchemaDeps=B$;xi.default=pJ});var U$=N(O_=>{"use strict";Object.defineProperty(O_,"__esModule",{value:!0});var j$=be(),mJ=De(),gJ={message:"property name must be valid",params:({params:t})=>(0,j$._)`{propertyName: ${t.propertyName}}`},yJ={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:gJ,code(t){let{gen:e,schema:n,data:r,it:i}=t;if((0,mJ.alwaysValidSchema)(i,n))return;let s=e.name("valid");e.forIn("key",r,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,j$.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};O_.default=yJ});var x_=N(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});var tg=$r(),pi=be(),TJ=qr(),ng=De(),vJ={message:"must NOT have additional properties",params:({params:t})=>(0,pi._)`{additionalProperty: ${t.additionalProperty}}`},bJ={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:vJ,code(t){let{gen:e,schema:n,parentSchema:r,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,ng.alwaysValidSchema)(o,n))return;let l=(0,tg.allSchemaProperties)(r.properties),u=(0,tg.allSchemaProperties)(r.patternProperties);d(),t.ok((0,pi._)`${s} === ${TJ.default.errors}`);function d(){e.forIn("key",i,y=>{!l.length&&!u.length?m(y):e.if(f(y),()=>m(y))})}function f(y){let S;if(l.length>8){let b=(0,ng.schemaRefOrVal)(o,r.properties,"properties");S=(0,tg.isOwnProperty)(e,b,y)}else l.length?S=(0,pi.or)(...l.map(b=>(0,pi._)`${y} === ${b}`)):S=pi.nil;return u.length&&(S=(0,pi.or)(S,...u.map(b=>(0,pi._)`${(0,tg.usePattern)(t,b)}.test(${y})`))),(0,pi.not)(S)}function p(y){e.code((0,pi._)`delete ${i}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){p(y);return}if(n===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof n=="object"&&!(0,ng.alwaysValidSchema)(o,n)){let S=e.name("valid");c.removeAdditional==="failing"?(h(y,S,!1),e.if((0,pi.not)(S),()=>{t.reset(),p(y)})):(h(y,S),a||e.if((0,pi.not)(S),()=>e.break()))}}function h(y,S,b){let v={keyword:"additionalProperties",dataProp:y,dataPropType:ng.Type.Str};b===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,S)}}};M_.default=bJ});var W$=N(q_=>{"use strict";Object.defineProperty(q_,"__esModule",{value:!0});var SJ=Eu(),H$=$r(),L_=De(),V$=x_(),_J={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:n,parentSchema:r,data:i,it:s}=t;s.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&V$.default.code(new SJ.KeywordCxt(s,V$.default,"additionalProperties"));let o=(0,H$.allSchemaProperties)(n);for(let d of o)s.definedProperties.add(d);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=L_.mergeEvaluated.props(e,(0,L_.toHash)(o),s.props));let a=o.filter(d=>!(0,L_.alwaysValidSchema)(s,n[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,H$.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&&n[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};q_.default=_J});var K$=N($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});var z$=$r(),rg=be(),G$=De(),Y$=De(),PJ={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:n,data:r,parentSchema:i,it:s}=t,{opts:o}=s,a=(0,z$.allSchemaProperties)(n),c=a.filter(h=>(0,G$.alwaysValidSchema)(s,n[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 rg.Name)&&(s.props=(0,Y$.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 y in l)new RegExp(h).test(y)&&(0,G$.checkStrictMode)(s,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",r,y=>{e.if((0,rg._)`${(0,z$.usePattern)(t,h)}.test(${y})`,()=>{let S=c.includes(h);S||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:Y$.Type.Str},u),s.opts.unevaluated&&d!==!0?e.assign((0,rg._)`${d}[${y}]`,!0):!S&&!s.allErrors&&e.if((0,rg.not)(u),()=>e.break())})})}}};$_.default=PJ});var X$=N(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});var kJ=De(),NJ={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:n,it:r}=t;if((0,kJ.alwaysValidSchema)(r,n)){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"}};F_.default=NJ});var J$=N(B_=>{"use strict";Object.defineProperty(B_,"__esModule",{value:!0});var RJ=$r(),wJ={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:RJ.validateUnion,error:{message:"must match a schema in anyOf"}};B_.default=wJ});var Q$=N(j_=>{"use strict";Object.defineProperty(j_,"__esModule",{value:!0});var ig=be(),EJ=De(),CJ={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,ig._)`{passingSchemas: ${t.passing}}`},DJ={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:CJ,code(t){let{gen:e,schema:n,parentSchema:r,it:i}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(i.opts.discriminator&&r.discriminator)return;let s=n,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,EJ.alwaysValidSchema)(i,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,ig._)`${c} && ${o}`).assign(o,!1).assign(a,(0,ig._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,d),f&&t.mergeEvaluated(f,ig.Name)})})}}};j_.default=DJ});var Z$=N(U_=>{"use strict";Object.defineProperty(U_,"__esModule",{value:!0});var AJ=De(),IJ={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:n,it:r}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");let i=e.name("valid");n.forEach((s,o)=>{if((0,AJ.alwaysValidSchema)(r,s))return;let a=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(a)})}};U_.default=IJ});var nF=N(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});var sg=be(),tF=De(),OJ={message:({params:t})=>(0,sg.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,sg._)`{failingKeyword: ${t.ifClause}}`},MJ={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:OJ,code(t){let{gen:e,parentSchema:n,it:r}=t;n.then===void 0&&n.else===void 0&&(0,tF.checkStrictMode)(r,'"if" without "then" and "else" is ignored');let i=eF(r,"then"),s=eF(r,"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,sg.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,sg._)`${u}`):t.setParams({ifClause:u})}}}};function eF(t,e){let n=t.schema[e];return n!==void 0&&!(0,tF.alwaysValidSchema)(t,n)}H_.default=MJ});var rF=N(V_=>{"use strict";Object.defineProperty(V_,"__esModule",{value:!0});var xJ=De(),LJ={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:n}){e.if===void 0&&(0,xJ.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};V_.default=LJ});var iF=N(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});var qJ=w_(),$J=x$(),FJ=E_(),BJ=q$(),jJ=$$(),UJ=eg(),HJ=U$(),VJ=x_(),WJ=W$(),zJ=K$(),GJ=X$(),YJ=J$(),KJ=Q$(),XJ=Z$(),JJ=nF(),QJ=rF();function ZJ(t=!1){let e=[GJ.default,YJ.default,KJ.default,XJ.default,JJ.default,QJ.default,HJ.default,VJ.default,UJ.default,WJ.default,zJ.default];return t?e.push($J.default,BJ.default):e.push(qJ.default,FJ.default),e.push(jJ.default),e}W_.default=ZJ});var sF=N(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});var jt=be(),e6={message:({schemaCode:t})=>(0,jt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,jt._)`{format: ${t}}`},t6={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:e6,code(t,e){let{gen:n,data:r,$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=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=n.const("fDef",(0,jt._)`${m}[${o}]`),y=n.let("fType"),S=n.let("format");n.if((0,jt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>n.assign(y,(0,jt._)`${h}.type || "string"`).assign(S,(0,jt._)`${h}.validate`),()=>n.assign(y,(0,jt._)`"string"`).assign(S,h)),t.fail$data((0,jt.or)(b(),v()));function b(){return c.strictSchema===!1?jt.nil:(0,jt._)`${o} && !${S}`}function v(){let k=u.$async?(0,jt._)`(${h}.async ? await ${S}(${r}) : ${S}(${r}))`:(0,jt._)`${S}(${r})`,R=(0,jt._)`(typeof ${S} == "function" ? ${k} : ${S}.test(${r}))`;return(0,jt._)`${S} && ${S} !== true && ${y} === ${e} && !${R}`}}function p(){let m=d.formats[s];if(!m){b();return}if(m===!0)return;let[h,y,S]=v(m);h===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(R());return}throw new Error(R());function R(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function v(R){let q=R instanceof RegExp?(0,jt.regexpCode)(R):c.code.formats?(0,jt._)`${c.code.formats}${(0,jt.getProperty)(s)}`:void 0,O=n.scopeValue("formats",{key:s,ref:R,code:q});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,(0,jt._)`${O}.validate`]:["string",R,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,jt._)`await ${S}(${r})`}return typeof y=="function"?(0,jt._)`${S}(${r})`:(0,jt._)`${S}.test(${r})`}}}};z_.default=t6});var oF=N(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});var n6=sF(),r6=[n6.default];G_.default=r6});var aF=N(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.contentVocabulary=hc.metadataVocabulary=void 0;hc.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];hc.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var lF=N(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});var i6=y$(),s6=A$(),o6=iF(),a6=oF(),cF=aF(),c6=[i6.default,s6.default,(0,o6.default)(),a6.default,cF.metadataVocabulary,cF.contentVocabulary];Y_.default=c6});var X_=N(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.dynamicAnchor=void 0;var K_=be(),l6=qr(),uF=Du(),u6=Ym(),d6={keyword:"$dynamicAnchor",schemaType:"string",code:t=>dF(t,t.schema)};function dF(t,e){let{gen:n,it:r}=t;r.schemaEnv.root.dynamicAnchors[e]=!0;let i=(0,K_._)`${l6.default.dynamicAnchors}${(0,K_.getProperty)(e)}`,s=r.errSchemaPath==="#"?r.validateName:f6(t);n.if((0,K_._)`!${i}`,()=>n.assign(i,s))}Vu.dynamicAnchor=dF;function f6(t){let{schemaEnv:e,schema:n,self:r}=t.it,{root:i,baseId:s,localRefs:o,meta:a}=e.root,{schemaId:c}=r.opts,l=new uF.SchemaEnv({schema:n,schemaId:c,root:i,baseId:s,localRefs:o,meta:a});return uF.compileSchema.call(r,l),(0,u6.getValidate)(t,l)}Vu.default=d6});var J_=N(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.dynamicRef=void 0;var fF=be(),p6=qr(),pF=Ym(),h6={keyword:"$dynamicRef",schemaType:"string",code:t=>hF(t,t.schema)};function hF(t,e){let{gen:n,keyword:r,it:i}=t;if(e[0]!=="#")throw new Error(`"${r}" only supports hash fragment reference`);let s=e.slice(1);if(i.allErrors)o();else{let c=n.let("valid",!1);o(c),t.ok(c)}function o(c){if(i.schemaEnv.root.dynamicAnchors[s]){let l=n.let("_v",(0,fF._)`${p6.default.dynamicAnchors}${(0,fF.getProperty)(s)}`);n.if(l,a(l,c),a(i.validateName,c))}else a(i.validateName,c)()}function a(c,l){return l?()=>n.block(()=>{(0,pF.callRef)(t,c),n.let(l,!0)}):()=>(0,pF.callRef)(t,c)}}Wu.dynamicRef=hF;Wu.default=h6});var mF=N(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});var m6=X_(),g6=De(),y6={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,m6.dynamicAnchor)(t,""):(0,g6.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};Q_.default=y6});var gF=N(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});var T6=J_(),v6={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,T6.dynamicRef)(t,t.schema)};Z_.default=v6});var yF=N(eP=>{"use strict";Object.defineProperty(eP,"__esModule",{value:!0});var b6=X_(),S6=J_(),_6=mF(),P6=gF(),k6=[b6.default,S6.default,_6.default,P6.default];eP.default=k6});var vF=N(tP=>{"use strict";Object.defineProperty(tP,"__esModule",{value:!0});var TF=eg(),N6={keyword:"dependentRequired",type:"object",schemaType:"object",error:TF.error,code:t=>(0,TF.validatePropertyDeps)(t)};tP.default=N6});var bF=N(nP=>{"use strict";Object.defineProperty(nP,"__esModule",{value:!0});var R6=eg(),w6={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,R6.validateSchemaDeps)(t)};nP.default=w6});var SF=N(rP=>{"use strict";Object.defineProperty(rP,"__esModule",{value:!0});var E6=De(),C6={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:n}){e.contains===void 0&&(0,E6.checkStrictMode)(n,`"${t}" without "contains" is ignored`)}};rP.default=C6});var _F=N(iP=>{"use strict";Object.defineProperty(iP,"__esModule",{value:!0});var D6=vF(),A6=bF(),I6=SF(),O6=[D6.default,A6.default,I6.default];iP.default=O6});var kF=N(sP=>{"use strict";Object.defineProperty(sP,"__esModule",{value:!0});var Vs=be(),PF=De(),M6=qr(),x6={message:"must NOT have unevaluated properties",params:({params:t})=>(0,Vs._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},L6={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:x6,code(t){let{gen:e,schema:n,data:r,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:o,props:a}=s;a instanceof Vs.Name?e.if((0,Vs._)`${a} !== true`,()=>e.forIn("key",r,d=>e.if(l(a,d),()=>c(d)))):a!==!0&&e.forIn("key",r,d=>a===void 0?c(d):e.if(u(a,d),()=>c(d))),s.props=!0,t.ok((0,Vs._)`${i} === ${M6.default.errors}`);function c(d){if(n===!1){t.setParams({unevaluatedProperty:d}),t.error(),o||e.break();return}if(!(0,PF.alwaysValidSchema)(s,n)){let f=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:PF.Type.Str},f),o||e.if((0,Vs.not)(f),()=>e.break())}}function l(d,f){return(0,Vs._)`!${d} || !${d}[${f}]`}function u(d,f){let p=[];for(let m in d)d[m]===!0&&p.push((0,Vs._)`${f} !== ${m}`);return(0,Vs.and)(...p)}}};sP.default=L6});var RF=N(oP=>{"use strict";Object.defineProperty(oP,"__esModule",{value:!0});var xo=be(),NF=De(),q6={message:({params:{len:t}})=>(0,xo.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,xo._)`{limit: ${t}}`},$6={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:q6,code(t){let{gen:e,schema:n,data:r,it:i}=t,s=i.items||0;if(s===!0)return;let o=e.const("len",(0,xo._)`${r}.length`);if(n===!1)t.setParams({len:s}),t.fail((0,xo._)`${o} > ${s}`);else if(typeof n=="object"&&!(0,NF.alwaysValidSchema)(i,n)){let c=e.var("valid",(0,xo._)`${o} <= ${s}`);e.if((0,xo.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:NF.Type.Num},c),i.allErrors||e.if((0,xo.not)(c),()=>e.break())})}}};oP.default=$6});var wF=N(aP=>{"use strict";Object.defineProperty(aP,"__esModule",{value:!0});var F6=kF(),B6=RF(),j6=[F6.default,B6.default];aP.default=j6});var CF=N(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});og.DiscrError=void 0;var EF;(function(t){t.Tag="tag",t.Mapping="mapping"})(EF||(og.DiscrError=EF={}))});var AF=N(lP=>{"use strict";Object.defineProperty(lP,"__esModule",{value:!0});var mc=be(),cP=CF(),DF=Du(),U6=Cu(),H6=De(),V6={message:({params:{discrError:t,tagName:e}})=>t===cP.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:n}})=>(0,mc._)`{error: ${t}, tag: ${n}, tagValue: ${e}}`},W6={keyword:"discriminator",type:"object",schemaType:"object",error:V6,code(t){let{gen:e,data:n,schema:r,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(r.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,mc._)`${n}${(0,mc.getProperty)(a)}`);e.if((0,mc._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:cP.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,mc._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:cP.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,mc.Name),m}function f(){var p;let m={},h=S(i),y=!0;for(let k=0;k<o.length;k++){let R=o[k];if(R?.$ref&&!(0,H6.schemaHasRulesButRef)(R,s.self.RULES)){let O=R.$ref;if(R=DF.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,O),R instanceof DF.SchemaEnv&&(R=R.schema),R===void 0)throw new U6.default(s.opts.uriResolver,s.baseId,O)}let q=(p=R?.properties)===null||p===void 0?void 0:p[a];if(typeof q!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||S(R)),b(q,k)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function S({required:k}){return Array.isArray(k)&&k.includes(a)}function b(k,R){if(k.const)v(k.const,R);else if(k.enum)for(let q of k.enum)v(q,R);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(k,R){if(typeof k!="string"||k in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[k]=R}}}};lP.default=W6});var IF=N((pDe,z6)=>{z6.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 OF=N((hDe,G6)=>{G6.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 MF=N((mDe,Y6)=>{Y6.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 xF=N((gDe,K6)=>{K6.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 LF=N((yDe,X6)=>{X6.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 qF=N((TDe,J6)=>{J6.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 $F=N((vDe,Q6)=>{Q6.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 FF=N(uP=>{"use strict";Object.defineProperty(uP,"__esModule",{value:!0});var Z6=IF(),eQ=OF(),tQ=MF(),nQ=xF(),rQ=LF(),iQ=qF(),sQ=$F(),oQ=["/properties"];function aQ(t){return[Z6,eQ,tQ,nQ,e(this,rQ),iQ,e(this,sQ)].forEach(n=>this.addMetaSchema(n,void 0,!1)),this;function e(n,r){return t?n.$dataMetaSchema(r,oQ):r}}uP.default=aQ});var BF=N((Pt,fP)=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.MissingRefError=Pt.ValidationError=Pt.CodeGen=Pt.Name=Pt.nil=Pt.stringify=Pt.str=Pt._=Pt.KeywordCxt=Pt.Ajv2019=void 0;var cQ=f$(),lQ=lF(),uQ=yF(),dQ=_F(),fQ=wF(),pQ=AF(),hQ=FF(),dP="https://json-schema.org/draft/2019-09/schema",gc=class extends cQ.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(uQ.default),lQ.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(dQ.default),this.addVocabulary(fQ.default),this.opts.discriminator&&this.addKeyword(pQ.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:n}=this.opts;n&&(hQ.default.call(this,e),this.refs["http://json-schema.org/schema"]=dP)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(dP)?dP:void 0)}};Pt.Ajv2019=gc;fP.exports=Pt=gc;fP.exports.Ajv2019=gc;Object.defineProperty(Pt,"__esModule",{value:!0});Pt.default=gc;var mQ=Eu();Object.defineProperty(Pt,"KeywordCxt",{enumerable:!0,get:function(){return mQ.KeywordCxt}});var yc=be();Object.defineProperty(Pt,"_",{enumerable:!0,get:function(){return yc._}});Object.defineProperty(Pt,"str",{enumerable:!0,get:function(){return yc.str}});Object.defineProperty(Pt,"stringify",{enumerable:!0,get:function(){return yc.stringify}});Object.defineProperty(Pt,"nil",{enumerable:!0,get:function(){return yc.nil}});Object.defineProperty(Pt,"Name",{enumerable:!0,get:function(){return yc.Name}});Object.defineProperty(Pt,"CodeGen",{enumerable:!0,get:function(){return yc.CodeGen}});var gQ=Bm();Object.defineProperty(Pt,"ValidationError",{enumerable:!0,get:function(){return gQ.default}});var yQ=Cu();Object.defineProperty(Pt,"MissingRefError",{enumerable:!0,get:function(){return yQ.default}})});var Sc=require("path"),He=L(aE());var Lf=class t{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,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 n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(let r of e)if(t.isIncremental(r)){let i=lE(r.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.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=cE(r.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=r.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(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=cE(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){let o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}let s=r-1;return{line:s,character:e-n[s]}}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}},xt;(function(t){function e(i,s,o,a){return new Lf(i,s,o,a)}t.create=e;function n(i,s,o){if(i instanceof Lf)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){let o=i.getText(),a=yT(s.map(sH),(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=r})(xt||(xt={}));function yT(t,e){if(t.length<=1)return t;let n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);yT(r,e),yT(i,e);let s=0,o=0,a=0;for(;s<r.length&&o<i.length;)e(r[s],i[o])<=0?t[a++]=r[s++]:t[a++]=i[o++];for(;s<r.length;)t[a++]=r[s++];for(;o<i.length;)t[a++]=i[o++];return t}function cE(t,e,n=0){let r=e?[n]:[];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++,r.push(n+i+1))}return r}function lE(t){let e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function sH(t){let e=lE(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var qf=["namespace","class","enum","interface","struct","typeParameter","type","parameter","variable","property","enumMember","decorator","event","function","method","macro","label","comment","string","keyword","number","regexp","operator"],$f=["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"];var vT=L(require("url")),TE=require("crypto"),fa=require("path"),Gt=L(U());var TT=L(U());var Kn=L(U());var te=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 fsPath(){return this.firstToken.fsPath}getTopMostAstNodeForFile(e){return fe(e,this.fsPath)?[this]:this.children.flatMap(n=>n.getTopMostAstNodeForFile(e))}getDocumentSymbols(e){if(!this.docSymbolsMeta)return this.children.flatMap(r=>r.getDocumentSymbols(e)??[]);if(!fe(this.fsPath,e))return[];let n=ce(this);return[{name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind,range:n,selectionRange:n,children:[...this.children.flatMap(r=>r.getDocumentSymbols(e)??[])]}]}getWorkspaceSymbols(){if(!this.docSymbolsMeta)return this.children.flatMap(i=>i.getWorkspaceSymbols()??[]);let e=this.docSymbolsMeta.kind;if(![Kn.SymbolKind.File,Kn.SymbolKind.Class,Kn.SymbolKind.Constant].some(i=>i===e))return[];let n=pn(this.fsPath),r=n?.range??ce(this);return[{location:Kn.Location.create(ue(n?.fsPath??this.fsPath),r),name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind},...this.children.flatMap(i=>i.getWorkspaceSymbols()??[]).filter(i=>i.kind===Kn.SymbolKind.File||i.kind===Kn.SymbolKind.Class||i.kind===Kn.SymbolKind.Constant)]}buildSemanticTokens(e){this._children.forEach(n=>n.buildSemanticTokens(e)),!(!this.semanticTokenType||!this.semanticTokenModifiers)&&e(Hi(this.semanticTokenType),Vi(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(n=>n===e||n.isAncestorOf(e))}toPrettyString(e){return this.toString()}toString(e){return"TODO"}get range(){return Kn.Range.create(Kn.Position.create(this.firstToken.pos.line,this.firstToken.pos.col),Kn.Position.create(this.lastToken.pos.line,this.lastToken.pos.colEnd))}get serializeURL(){return ue(this.fsPath)}serialize(e){return{url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var me=class extends te{get firstToken(){return this.operator?this.operator.firstToken:super.firstToken}toJson(){return-1}#e;resolve(e){return this.#e??=Hc(this.toString(),e),this.#e}#n;evaluate(e){return this.#n??=Me(`${this.operator?this.operator.toString():""}${this.resolve(e)}`),this.#n}#r;isTrue(e){return this.#r??=Me(`!!(${this.operator?this.operator.toString():""}${this.resolve(e)})`),typeof this.#r=="boolean"&&this.#r}toPrettyString(e){let n=this.evaluate(e);return`${n.toString()} /* ${this.toString()}${typeof n=="number"?` = 0x${n.toString(16)}`:""} */`}serialize(e){return{type:"EXPRESSION",value:this.toString(),evaluated:this.evaluate(e),url:this.serializeURL,range:this.range,issues:this.serializeIssues}}},rn=class t extends me{constructor(n,r,i){super();this.expression=n;this.wrapped=r;this.addChild(n),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(n,r){this.addChild(n),this.addChild(r),this.join??=[],this.join?.push({operator:n,expression:r})}toString(){let n=this.children.map(r=>"radix"in r&&r.radix===16?`0x${r.toString()}`:r.toString()).join(" ");return this.wrapped?`(${n})`:`${n}`}isTrue(n){let r=`(${this.children.map(i=>i instanceof me?i.resolve(n):i.toString()).join(" ")})`;return Me(`!!(${this.operator?this.operator.toString():""}${r})`)}get flatJoin(){return this.wrapped?this.join??(this.expression instanceof t?this.expression.flatJoin:[]):[...this.expression instanceof t?this.expression.flatJoin:[],...this.join?.flatMap(n=>[{operator:n.operator,expression:n.expression instanceof t?n.expression.expression:n.expression},...n.expression instanceof t?n.expression.flatJoin:[]])??[]]}};var vi=class extends me{constructor(n,r,i){super(r);this.value=n;this.docSymbolsMeta={name:`param${i+1}`,kind:TT.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.value}},zt=class extends me{constructor(n,r){super();this.functionName=n;this.params=r;this.addChild(n),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(n){return fe(this.fsPath,n)?[{name:this.functionName.name,kind:TT.SymbolKind.Function,range:ce(this),selectionRange:ce(this),children:this.params.flatMap(r=>r?.getDocumentSymbols(n)??[])}]:[]}toString(){return`${this.functionName.toString()}(${this.params.map(n=>n?.toString()??"").join(", ")})`}isTrue(n){if(this.functionName.name==="defined"){let r=!!(this.params.length===1&&this.params[0]&&n.has(this.params[0].value));return this.operator?Me(`!!(${this.operator}${r})`):r}return super.isTrue(n)}};var Kr=L(U());var hE=L(U());var uE=L(U());var re=class extends te{constructor(n,r){super(r);this.value=n;this.semanticTokenType="string",this.semanticTokenModifiers="declaration",this.docSymbolsMeta={name:this.value,kind:uE.SymbolKind.String}}toString(){return`"${this.value.toString()}"`}toJson(){return this.value}serialize(){return{type:"STRING",value:this.value,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var fE=L(U());var dE=L(U());var sn=class extends me{constructor(n,r,i=10){super(r);this.value=n;this.radix=i;this.docSymbolsMeta={name:this.value.toString(),kind:dE.SymbolKind.Number},this.semanticTokenType="number",this.semanticTokenModifiers="declaration"}resolve(n){return this.value.toString()}evaluate(n){return this.value}isTrue(n){return!!this.value}toString(n){return this.value.toString(n??this.radix)}toJson(){return this.value}toPrettyString(n){let r=this.value;return this.radix===16?`0x${r.toString(16)} /* ${typeof r=="number"?`${r.toString(10)}`:""} */`:`${r.toString(10)} /* ${typeof r=="number"?`0x${r.toString(16)}`:""} */`}serialize(){return{type:"NUMBER_VALUE",value:`${this.radix===16?"0x":""}${this.toString()}`,evaluated:this.value,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var ct=class extends te{constructor(n){super();this.values=n;this.docSymbolsMeta={name:"Cell Array",kind:fE.SymbolKind.Array},this.values.forEach(r=>this.addChild(r))}toString(){return`<${this.values.map(n=>n.toString()).join(" ")}>`}toPrettyString(n){return`<${this.values.map(r=>r.toPrettyString(n)).join(" ")}>`}toJson(){if(this.values.length===1)return this.values[0].value?.toJson();if(this.values.length===2&&this.values.every(n=>n.value instanceof sn)){let n=new ArrayBuffer(8),r=new DataView(n);return this.values.map(i=>i.value.value).forEach((i,s)=>{r.setUint32(s*4,i)}),r.getBigUint64(0)}return this.values.map(n=>n.value?.toJson()??NaN)}serialize(n){return{type:"ARRAY_VALUE",value:this.values.map(r=>r.value?.serialize(n)??null),url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var pE=L(U());var Mn=class extends te{constructor(n){super();this.values=n;this.docSymbolsMeta={name:"Byte String Value",kind:pE.SymbolKind.Array},this.values.forEach(r=>this.addChild(r))}toString(){return`[${this.values.map(n=>n.toString(16).padStart(2,"0")).join(" ")}]`}toJson(){return this.values.map(n=>n.value?.toJson()??NaN)}serialize(){return{type:"BYTESTRING",values:this.values.map(n=>n.value?.serialize()??null),url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var Xe=class extends te{constructor(n,r){super(r);this.name=n;this.semanticTokenType="property",this.semanticTokenModifiers="declaration"}toString(){return this.name}serialize(){return{value:this.name,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}},Ne=class extends te{constructor(n,r=[]){super();this.propertyName=n;this.labels=r;this._values=void 0;this.docSymbolsMeta={name:this.propertyName?.name??"Unknown",kind:hE.SymbolKind.Property},this.labels.forEach(i=>this.addChild(i)),this.addChild(n)}set values(n){if(this._values)throw new Error("Only one property name is allowed");this._values=n,this.addChild(n)}get values(){return this._values}get quickValues(){return this.values?.values.map(n=>n?n.value instanceof re?n.value.value:n.value instanceof ct?n.value.values.map(r=>r.value instanceof sn?r.value.value:NaN):n.value instanceof Mn?n.value.values.map(r=>r.value?.value??NaN):NaN:null)}getFlatAstValues(){return this.values?.values.flatMap(n=>n?n.value instanceof re?n.value:n.value instanceof ct?n.value.values.map(r=>r.value):n.value instanceof Mn?n.value.values.map(r=>r.value):n.value:null)}toString(){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(n=>n?.toString()??"NULL").join(", ")??"NULL"}`:""};`}toPrettyString(n,r){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(i=>i?.toPrettyString(n)??"NULL").join(r?`,
|
|
183
|
+
${" ".repeat(r)}`:", ")??"NULL"}`:""};${bi(this.fsPath)?" /* default value from binding */":""}`}serialize(n){return{name:this.propertyName?.serialize()??null,values:this.values===void 0?void 0:this.values?.values.map(r=>r?.value?.serialize(n)??null)??null,url:this.serializeURL,range:this.range,issues:[...this.serializeIssues,...this.values?.issues.map(r=>r())??[]]}}};var mE=L(U());var hn=class extends te{constructor(n,r){super();this.keyword=r;this.addChild(r),this.docSymbolsMeta={name:n,kind:mE.SymbolKind.Function}}};var Xn=class extends hn{constructor(n){super("Delete Node",n);this._nodeNameOrRef=null}set nodeNameOrRef(n){if(this._nodeNameOrRef)throw new Error("Only one property name is allowed");this._nodeNameOrRef=n,this.addChild(n)}get nodeNameOrRef(){return this._nodeNameOrRef}};var lt=class extends hn{constructor(n){super("Delete Property",n);this._propertyName=null}set propertyName(n){if(this._propertyName)throw new Error("Only only property name is allowed");this._propertyName=n,this.addChild(n)}get propertyName(){return this._propertyName}};var gE=L(U());var ie=class extends te{constructor(n){super();this.label=n;this.docSymbolsMeta={name:`&${this.label?.value??"NULL"}`,kind:gE.SymbolKind.Key},this.addChild(n)}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,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var we=class t extends te{constructor(){super()}get path(){if(!this.pathName)return["__UNDEFINED__"];if(!this.parentNode||this instanceof nt)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 Xn)}addNodeChild(e){this.addChild(e)}},nt=class extends we{constructor(){super(),this.docSymbolsMeta={name:"/",kind:Kr.SymbolKind.Class}}get properties(){return this.children.filter(e=>e instanceof Ne)}#e;get name(){return this.#e??=new $e("/",he(this.firstToken)),this.#e}get identifierAst(){return this.name}get deleteProperties(){return this.children.filter(e=>e instanceof lt)}get nodes(){return this.children.filter(e=>e instanceof Ee)}get pathName(){return"/"}serialize(e){return{type:"ROOT",properties:this.properties.map(n=>n.serialize(e)),nodes:this.nodes.map(n=>n.serialize(e)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},ut=class extends we{constructor(n=[]){super();this.labels=n;this._reference=null;this.docSymbolsMeta={name:"DTC Name",kind:Kr.SymbolKind.Class},n.forEach(r=>{super.addChild(r)})}get serializeIssues(){return[...this.issues,...this.reference?.issues??[]].map(n=>n())}get identifierAst(){return this.reference}set reference(n){if(this._reference)throw new Error("Only on label reference is allowed");this._reference=n;let r;n instanceof ie?r=n.value:r=n?.path?.pathParts.at(-1)?.name??"DTC Name",this.docSymbolsMeta={name:r??"DTC Name",kind:Kr.SymbolKind.Class},this.addChild(n)}get path(){return this.resolveNodePath?this.resolveNodePath:super.path}get reference(){return this._reference}get nodes(){return this.children.filter(n=>n instanceof Ee)}get pathName(){if(this.reference instanceof ie&&this.reference.label?.value)return`&${this.reference.label.value}`}get properties(){return this.children.filter(n=>n instanceof Ne)}get deleteProperties(){return this.children.filter(n=>n instanceof lt)}serialize(n){return{type:"REF",labels:this.labels.map(r=>r.serialize(n)),name:this.reference?.serialize()??null,properties:this.properties.map(r=>r.serialize(n)),nodes:this.nodes.map(r=>r.serialize(n)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},Ee=class t extends we{constructor(n=[],r){super();this.labels=n;this.omitIfNoRef=r;this._name=null;this.docSymbolsMeta={name:"DTC Name",kind:Kr.SymbolKind.Class},r&&this.addChild(r),n.forEach(i=>{this.addChild(i)})}get identifierAst(){return this.name}get serializeIssues(){return[...this.issues,...this.name?.issues??[]].map(n=>n())}set name(n){if(this._name)throw new Error("Only on label reference is allowed");this._name=n,this.docSymbolsMeta={name:this._name?.toString()??"DTC Name",kind:Kr.SymbolKind.Class},this.addChild(n)}get name(){return this._name}get nodes(){return this.children.filter(n=>n instanceof t)}get pathName(){return this._name?.toString()}get properties(){return this.children.filter(n=>n instanceof Ne)}get deleteProperties(){return this.children.filter(n=>n instanceof lt)}serialize(n){return{type:"CHILD",labels:this.labels.map(r=>r.serialize(n)),name:this.name?.serialize()??null,properties:this.properties.map(r=>r.serialize(n)),nodes:this.nodes.map(r=>r.serialize(n)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},Vc=class extends te{constructor(n,r){super(r);this.address=n;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.address?.map((n,r)=>n.toString(16).padStart(r?8:0,"0")).join("")??"NaN"}serialize(){return{address:this.address,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}},$e=class extends te{constructor(n,r,i){super(r);this.name=n;this._address=i;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}get value(){return this.name}get address(){return this._address}set address(n){if(this._address)throw new Error("Address can only be set once");n&&(this.lastToken=void 0,this._address=n,n.forEach(r=>this.addChild(r)))}get fullAddress(){return this._address?[...this._address.flatMap(n=>n.address)]:void 0}toString(){return this._address!==void 0?`${this.name}@${this._address.map(n=>n.toString()).join(",")}`:this.name}buildSemanticTokens(n){let r=this.firstToken;if(!r.value)return;let i={...r,pos:{...r.pos,len:this.name.length}};n(Hi("type"),Vi("declaration"),i,i),this.address!==void 0&&this.address.forEach(s=>{n(Hi("decorator"),Vi("declaration"),s.firstToken,s.lastToken),s.buildSemanticTokens(n)})}get serializeIssues(){return[...this.issues,...this._address?.flatMap(n=>n.issues)??[]].map(n=>n())}serialize(){let n=this.firstToken;return{fullName:this.toString(),name:{name:this.name,url:this.serializeURL,range:Kr.Range.create(Kr.Position.create(n.pos.line,n.pos.col),Kr.Position.create(n.pos.line,n.pos.colEnd)),issues:this.serializeIssues},address:this.address?.map(r=>r.serialize())??null,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var on=(t,e,n=!0,r=!0)=>({start:{line:t?.pos.line??0,character:n?t?.pos.col??0:(t?.pos.col??0)+(t?.pos.len??0)},end:{line:e?.pos.line??0,character:r?(e?.pos.col??0)+(e?.pos.len??0):e?.pos.col??0}});var se=(t,e=!0)=>Gt.Position.create(t.pos.line,e?t.pos.colEnd:t.pos.col),ce=t=>on(t.firstToken,t.lastToken),Hi=t=>qf.findIndex(e=>e===t),Vi=t=>$f.findIndex(e=>e===t),gs=(t,e,n)=>!fe(t.fsPath,e)||n.line<t.pos.line?!1:n.line>t.pos.line?!0:n.character>=t.pos.colEnd,bT=(t,e,n)=>fe(t.fsPath,e)?n.line<t.pos.line?!0:n.line>t.pos.line?!1:n.character<t.pos.col:!1,Qt=(t,e,n)=>{let r=t.firstToken,i=t.lastToken;return!!((r.pos.line<n.line||r.pos.line===n.line&&r.pos.col<=n.character)&&(i.pos.line>n.line||i.pos.line===n.line&&i.pos.colEnd>=n.character)&&fe(t.fsPath,e))},ao=(t,e)=>{let n=(i,s)=>i.line<s.line||i.line===s.line&&i.character<=s.character,r=(i,s)=>i.line>s.line||i.line===s.line&&i.character>=s.character;return n(t.start,e.start)&&r(t.end,e.end)},vE=(t,e,n)=>{let r=t.firstToken,i=t.lastToken;return!!(t.lastToken.value!==";"&&(r.pos.line===n.line||i.pos.line===n.line)&&n.character>=i.pos.colEnd&&fe(t.fsPath,e))},bE=(t,e,n)=>{if(!t)return!1;let i=t.filter(s=>s.pos.line===n.line).at(-1);return i&&i.pos.col>=n.character?!1:e.lastToken===i};var Jr=(t,e,n)=>{let r=t,i=t;for(;i;)r=i,i=[...r.children].reverse().find(s=>Qt(s,e,n));return r},Wc=(t,e,n)=>{let r=t,i=t;for(;i;)r=i,i=[...r.children].find(s=>bT(s.lastToken,e,n));return r===t?void 0:r},zc=(t,e,n)=>{let r=t,i=t;for(;i;)r=i,i=[...r.children].reverse().find(s=>gs(s.firstToken,e,n));return r===t?void 0:r},ST="#virtual",bi=t=>t.includes(ST),jf=(t,e)=>`${t}?loc=${e.start.line}:${e.start.character}-${e.end.line}:${e.end.character}${ST}`,pn=t=>{if(!bi(t))return;let[e,n]=t.split("?"),[r,i]=n.replace("loc=","").replace(ST,"").split("-"),[s,o]=r.split(":"),[a,c]=i.split(":");return{fsPath:e,range:Gt.Range.create(Gt.Position.create(Number.parseInt(s),Number.parseInt(o)),Gt.Position.create(Number.parseInt(a),Number.parseInt(c)))}},_T=t=>{let e=pn(t.fsPath);e&&(t.range=e.range,t.fsPath=e?.fsPath,t.virtual=!0,t.linkedTo=t.linkedTo.map(({range:n,fsPath:r})=>{let i=pn(r);return{range:i?.range??n,fsPath:i?.fsPath??r,templateStrings:[]}}))},Y=(t,e,n=e,r,{severity:i=Gt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,inclusiveStart:u,inclusiveEnd:d}={severity:Gt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let f={issues:Array.isArray(t)?t:[t],range:on(e,n,u,d),fsPath:e.fsPath,severity:i,linkedTo:s.map(({range:h,fsPath:y})=>{let S=pn(y);return S?{...S,templateStrings:[]}:{range:h,fsPath:y,templateStrings:[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};_T(f);let p,m=()=>(p??={severity:f.severity,range:f.range,message:f.issues?f.issues.map(lH).join(" or "):"",source:"devicetree",tags:f.tags,data:{firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:n.pos,tokens:n.tokens,value:n.value},type:"SyntaxIssue",items:f.issues,edit:f.edit,codeActionTitle:f.codeActionTitle,virtual:!!f.virtual}},p);return r?.syntaxIssues.push(m),{raw:f,diagnostic:m}},Yt=(t,e,n,r,{severity:i=Gt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,linkedToTemplateStrings:u=[]}={severity:Gt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[],linkedToTemplateStrings:[]})=>{let d={issues:Array.isArray(t)?t:[t],range:on(e,n),fsPath:e.fsPath,severity:i,linkedTo:s.map(({range:m,fsPath:h},y)=>{let S=pn(h);return S?{...S,templateStrings:[]}:{range:m,fsPath:h,templateStrings:u.at(y)??[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};_T(d);let f,p=()=>(f??={severity:d.severity,range:d.range,message:uH(d),source:"devicetree",tags:d.tags,relatedInformation:[...d.linkedTo.map(m=>({message:d.issues.map(h=>dH(h,m.templateStrings)).join(" or "),location:{uri:ue(m.fsPath),range:m.range}}))]},f);return r?.resettableIssues.push(p),{raw:d,diagnostic:p}},F=(t,e,n,r,{severity:i=Gt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l}={severity:Gt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let u={issues:Array.isArray(t)?t:[t],range:on(e,n),severity:i,fsPath:e.fsPath,linkedTo:s.map(({range:p,fsPath:m})=>{let h=pn(m);return h?{...h,templateStrings:[]}:{range:p,fsPath:m,templateStrings:[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};_T(u);let d,f=()=>(d??={severity:u.severity,range:u.range,message:fH(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(pH).join(" or "),location:{uri:ue(p.fsPath),range:p.range}}))],source:"devicetree",tags:u.tags,data:{type:"StandardTypeIssue",firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:n.pos,tokens:n.tokens,value:n.value},edit:u.edit,codeActionTitle:u.codeActionTitle,items:u.issues,virtual:!!u.virtual}},d);return Array.isArray(r)?r.forEach(p=>p.resettableIssues.push(f)):r?.resettableIssues.push(f),{raw:u,diagnostic:f}};function Ve(t,e,n,{severity:r=Gt.DiagnosticSeverity.Warning,linkedTo:i=[],tags:s,templateStrings:o=[],edit:a,codeActionTitle:c}={severity:Gt.DiagnosticSeverity.Warning,linkedTo:[],templateStrings:[],edit:[],codeActionTitle:void 0},l=n){let u={issues:Array.isArray(t)?t:[t],range:Gt.Range.create(n,l),severity:r,fsPath:e,linkedTo:i.map(({range:p,fsPath:m})=>({range:p,fsPath:m,templateStrings:[]})),tags:s,templateStrings:o,edit:a,codeActionTitle:c,virtual:bi(e)},d;return{raw:u,diagnostic:()=>(d??={severity:u.severity,range:u.range,message:hH(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(mH).join(" or "),location:{uri:ue(p.fsPath),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 SE=(t,e)=>[...t].sort((r,i)=>{let s=e.getSortKey(r),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=r.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 Rt(t,e,n){let r=_e(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=>Qt(u,r,t.position));return c&&(o={runtime:s,item:null,ast:Jr(c,r,t.position)},a=Number.MAX_SAFE_INTEGER),o||(o=s.getDeepestAstNode(r,t.position),a=e.getSortKey(o?.ast)??e.getSortKeyFile(t.position,r)),console.log(`search: ${performance.now()-i}ms`),n(o,u=>{let d=t.position;if(fe(u.fsPath,r)){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 he(t,e){return{start:t,end:e??t}}var H=(t,e)=>t?.tokens.some(n=>n===e),st=(t,e)=>n=>n?.value&&(e?.caseInsensitive?t.toLowerCase()===n.value.toLowerCase():t===n.value)?"yes":e?.allowPartial?oH(t)(n):"no",Fe=t=>e=>e?.tokens.some(n=>n===t)?"yes":"no",oH=t=>e=>e?.value&&t.startsWith(e.value)?"partial":"no",mn=(t,e)=>!!t&&!!e&&t.pos.line===e.pos.line&&fe(t.fsPath,e.fsPath),Kt=(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&&mn(t,e),Uf=t=>t.map((e,n)=>({index:n,context:e,files:e.getContextFiles()})),Rn=(t,e,n,r)=>{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 n?.getContextFiles().find(s=>fe(s,e.fsPath))?n:Uf(t).sort(s=>s.context.id===r?-1:0).find(s=>s.files.some(o=>fe(o,e.fsPath)))?.context},PT=(t,e)=>Uf(t).filter(r=>r.files.some(i=>fe(i,e))).map(r=>r.context),_E=t=>{let e=/^(\w+)\s+(.*)$/,n=/^(\w+)\(([^)]*)\)\s+(.*)$/,r=/^(\w+)\(([^)]*),\s*\.\.\.\)\s+(.*)$/,i;if(i=r.exec(t)){let[,,s,o]=i,a=s.split(",").map(c=>c.trim());return(...c)=>{let l=o,u=c.slice(a.length).join(", ");return a.forEach((d,f)=>{l=l.replace(new RegExp(`(?<!#)#\\s*${d}\\b`,"g"),`"${c[f]??""}"`)}),l=l.replace(/(?<!#)#\s*__VA_ARGS__/g,`"${u}"`),a.forEach((d,f)=>{let p=new RegExp(`\\b${d}\\b`,"g");l=l.replace(p,c[f]??"")}),l=l.replace(/__VA_ARGS__/g,u),l}}else 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)=>{l=l.replace(new RegExp(`(?<!#)#\\s*${u}\\b`,"g"),`"${c[d]??""}"`)}),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 aH(t){if(!t.trim())return[];let e=[],n="",r=0;for(let i=0;i<t.length;i++){let s=t[i];s===","&&r===0?(e.push(n.trim()),n=""):(s==="("?r++:s===")"&&r--,n+=s)}return n.trim()&&e.push(n.trim()),e}var cH=0,Hc=(t,e)=>{let n=s=>s.replace(/\s*##\s*/g,""),r=t,i;do i=r,r=n(i),r=r.replace(/\b(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)|\b(\w+)\b/g,(s,o,a,c)=>{if(o==="defined"){let l=a.split(",").map(u=>u.trim());return l[0]?e.get(l[0])?.resolver:l}else if(o&&typeof e.get(o)?.resolver=="function"){let l=aH(a).map(u=>u.trim()).map(u=>u==="__COUNTER__"?(cH++).toString():u).map(u=>Hc(u,e));return(e.get(o)?.resolver)(...l)}else if(c&&typeof e.get(c)?.resolver=="string")return e.get(c)?.resolver;return s});while(r!==i);return r};function kT(t){return t.replace(/'(.)'/g,(e,n)=>n.charCodeAt(0).toString()).replace(/(0x[a-f\d]+|\d+)[ul]*/gi,"$1")}function Me(t){try{return(0,eval)(kT(t))}catch{}return t}var ue=t=>vT.default.pathToFileURL(t).toString(),_e=t=>dt(vT.default.fileURLToPath(t)),PE=(t,e)=>{let n=(0,fa.relative)(t,e);return!!n&&!n.startsWith("..")&&!(0,fa.isAbsolute)(n)},fe=(t,e)=>!t||!e?!1:t===e,dt=t=>(0,fa.normalize)(process.platform==="win32"?t.toLowerCase():t),Wi=t=>(0,TE.createHash)("sha256").update([dt(t.dtsFile),...t.includePaths.map(dt),...t.overlays.map(dt),t.bindingType,...t.zephyrBindings.map(dt),...t.deviceOrgBindingsMetaSchema.map(dt),...t.deviceOrgTreeBindings.map(dt),`showFormattingErrorAsDiagnostics-${t.showFormattingErrorAsDiagnostics}`,`disableFileWatchers-${t.disableFileWatchers}`].join(":")).digest("hex"),lH=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"}},uH=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 "),dH=(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"}},fH=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 ")}`;case 38:return"Empty ranges property should only be used when address size cells is identical to the parent node";case 39:return'The value shall be one of the following: "spin-table" or "[vendor],[method]"';case 40:return'The value shall match "[vendor],[method]"'}}).join(" or ").replace("INTRO",`Property "${t.templateStrings[0]}"`).replaceAll("INTRO ",""),pH=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"}},hH=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}`;case 10:return"Node address is already a hex value. Remove '0x'.";case 11:return"Node address size is determined by '@size-cells', Remove 'ull'.";case 12:return`'\\' is not necessary. ${t.codeActionTitle}`;case 13:return`Node does not contribute anything. ${t.codeActionTitle}`;case 14:return`Property is redefined in same closure. ${t.codeActionTitle}`;case 15:return`${t.codeActionTitle}`}}).join(" or "),mH=t=>"TODO";var Lt=(t,e)=>{let n=Math.max(t.length,e.length);for(let r=0;r<n;r++){let i=t[t.length-n+r]??0,s=e[e.length-n+r]??0;if(i<s)return-1;if(i>s)return 1}return 0},Xr=(t,e)=>{let n=Math.max(t.length,e.length),r=new Array(n).fill(0),i=0;for(let s=0;s<n;s++){let o=t[t.length-1-s]??0,a=e[e.length-1-s]??0,c=o+a+i;r[n-1-s]=c>>>0,i=c>4294967295?1:0}return i&&r.unshift(1),r},gH=(t,e)=>{let n=Math.max(t.length,e.length),r=new Array(n).fill(0),i=0;for(let s=0;s<n;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,r[n-1-s]=o-a>>>0}for(;r.length>1&&r[0]===0;)r.shift();return r},yH=(t,e)=>Xr(t,e),kE=(t,e)=>{let n=[];for(let r of t){let i=r.childAddress,s=r.length,o=Xr(i,s);if(Lt(e,i)>=0&&Lt(e,o)<0){let a=gH(e,i),c=r.parentAddress,l=yH(c,a),u=Xr(c,s);n.push({start:l,end:u,range:on(r.rangeTokens.start,r.rangeTokens.end),fsPath:r.rangeTokens.start.fsPath})}}return n};function NE(t){return Array.isArray(t)&&Array.isArray(t[0])}function Gc(t){return!t||t instanceof zt?t:Gc(t.parentNode)}function Jn(t,e){let n=e.filter(r=>!r.raw.virtual).flatMap(r=>r.raw.edit).filter(r=>!!r);return NT(t,n)}function NT(t,e){let n=t.getText(),r=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=n;for(let s of r){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 yE(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 RE(t,e){return yE(t.end,e.start)>0&&yE(t.start,e.end)<0}var wE=(t,e)=>{let n=EE(t,e),r=CE(t,e);n&&(t.topComment=n),r&&(t.endComment=r)},EE=(t,e)=>{let n=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(!n||n.astBeforeComment)return;n.astAfterComment=t;let r=EE(n,e);return r&&(r.astAfterComment=t,n.astAfterComment=void 0),r??n},CE=(t,e)=>{let n=e.find(i=>!i.disabled&&i.firstToken.prevToken===t.lastToken&&i.firstToken.pos.line===t.lastToken.pos.line);if(!n)return;n.astBeforeComment=t;let r=CE(n,e);return r&&(r.astBeforeComment=t,n.astBeforeComment=void 0),r??n},co=(t,e,n)=>{let r=[42,44,45,36];return n||r.push(52,32,53,8,49),t.severity===Gt.DiagnosticSeverity.Error&&fe(t.fsPath,e)&&!r.some(i=>t.issues.includes(i))};function Hf(t){let e=t?.charAt(0);return!!e&&(e>="A"&&e<="Z"||e>="a"&&e<="z")}var pa=t=>{if(t)return t instanceof we?t:pa(t?.parentNode)},ha=(t,e,n=0)=>{if(!e||!e.parentNode?.fsPath)return n;let r=pa(e.parentNode);return ha(t,r,n+1)};function DE(t,e,n,r){let i=n-e,s=r.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]=r[l];for(let l=n;l<t.length;l++,c++)a[c]=t[l];return a}function ma(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"):""}function Vf(t,e,n,r,i){let s=e.closeScope?.prevToken??e.lastToken.prevToken;if(!s)return;let o="";switch(r.types[0]){case"U32":case"U64":case"PROP_ENCODED_ARRAY":o=` = <${n==="reg"&&t.address?t.address.map(a=>`0x${a.toString(16)}`).join(" "):""}>`;break;case"STRING":case"STRINGLIST":o=' = ""';break;case"BYTESTRING":o=" = []";break}return Gt.TextEdit.insert(Gt.Position.create(s.pos.line,s.pos.col+1),`
|
|
184
|
+
${"".padEnd(ha(s.fsPath,e),i.context.formattingOptions.insertSpaces?" ".repeat(i.context.formattingOptions.tabSize):" ")}${n}${o};`)}var cl=require("fs"),Pa=require("path"),fo=L(U());var CD=require("path"),wr=L(U());var xn=class extends te{constructor(n,r,i,s){super();this.startLabels=n;this.value=r;this.endLabels=i;this.bits=s;this.startLabels.forEach(o=>{this.addChild(o)}),this.addChild(s),this.addChild(r),this.endLabels.forEach(o=>{this.addChild(o)})}toString(){return`${[this.value?.toString()??"NULL",...this.endLabels.map(n=>n.toString())].join(" ")}`}toPrettyString(n){return`${[this.value?.toPrettyString(n)??"NULL",...this.endLabels.map(r=>r.toString())].join(" ")}`}toJson(){return this.value?.toJson()}};var Zt=t=>t instanceof hn?!0:t instanceof we?!1:t.parentNode?Zt(t.parentNode):!1;var RT=t=>{if(t instanceof Ne)return t;if(!(t instanceof we))return t.parentNode?RT(t.parentNode):void 0},lo=t=>!t||t instanceof Ne?!1:t instanceof xn||lo(t.parentNode),wT=t=>{if(t instanceof Ee||t instanceof nt)return t.name;if(t instanceof ut)return t.reference},Wf=t=>[...t.map(wT)].filter(e=>!!e),ET=(t,e)=>e?e.parentNode===t||ET(t,e.parentNode):!1;var Xt=L(U());var AE=L(U());var Qr=class extends te{constructor(){super();this._pathParts=[]}addPath(n,r){this._pathParts.push(n),r&&this.addChild(r),this.addChild(n)}get pathParts(){return[...this._pathParts]}toString(){return this._pathParts.map(n=>n?.toString()??"<NULL>").join("/")}buildSemanticTokens(n){this._children.forEach(r=>{r instanceof $e?r.buildSemanticTokens(n):n(Hi("operator"),Vi("declaration"),r.firstToken,r.lastToken)})}},rt=class extends te{constructor(n){super();this.path=n;this.docSymbolsMeta={name:`/${this.path?.toString()??""}`,kind:AE.SymbolKind.Namespace},this.addChild(n)}toString(){return`&${this.path?.toString()??"NULL"}`}toJson(){return-1}serialize(){let n=this.path?.toString();return{type:"NODE_PATH",nodePath:n==="/"?n:`/${n??""}`,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var W=class{constructor(e,n,r="optional",i=void 0,s,o){this.name=e;this.type=n;this.def=i;this.additionalTypeCheck=o;this.hideAutoComplete=!1;this.list=!1;this.onHover=()=>({kind:Xt.MarkupKind.Markdown,value:["### Type","**DTS native type** ",`${this.type.map(e=>e.types.join(" or ")).join(",")}
|
|
185
185
|
|
|
186
186
|
`,...this.bindingType?["**Binding type** ",`${this.bindingType}
|
|
187
187
|
|
|
@@ -190,8 +190,8 @@ ${"".padEnd(ha(s.fsPath,e),i.context.formattingOptions.insertSpaces?" ".repeat(i
|
|
|
190
190
|
`)]:[],...this.examples?["### Example",this.examples.join(`
|
|
191
191
|
|
|
192
192
|
`)]:[]].join(`
|
|
193
|
-
`)});this.signatureArgsCyclic=!1;typeof r!="function"?this.required=()=>r:this.required=r,typeof s!="function"?(this.allowedValues=s,this.values=()=>s===void 0?i?[i]:[]:i&&s.indexOf(i)===-1?[i,...s]:s):this.values=s}getNameMatch(e){return typeof this.name=="string"?this.name===e:this.name.test(e)}validateProperty(e,n,r,i){let s=this.required(n);if(i){if(s==="omitted")return[F(11,i.ast.firstToken,i.ast.lastToken,i.ast,{templateStrings:[r]})]}else return s==="required"?[...e.getOrderedNodeAst(n).filter(u=>!bi(u.fsPath)).map(u=>{let d=wT(u)??u,f=Vf(n,u,r,this.type[0],e);return F(0,d.firstToken,d.lastToken,u,{templateStrings:[r],edit:f})})]:[];let o=TH(i),a=[],c=(l,u,d)=>{if(d??=i.ast,!(l.some(p=>p==u)||l.some(p=>p=="STRINGLIST")&&(u==="STRING"||u==="STRINGLIST")||l.some(p=>p=="PROP_ENCODED_ARRAY")&&(u==="U32"||u==="U64"))){let p=[];l.forEach(m=>{switch(m){case"EMPTY":p.push(1);break;case"STRING":p.push(2);break;case"STRINGLIST":p.push(3);break;case"U32":p.push(5);break;case"U64":p.push(6);break;case"PROP_ENCODED_ARRAY":p.push(7);break}}),p.length&&a.push(F(p,d.firstToken,d.lastToken,d,{templateStrings:[i.name]}))}};if(this.type[0].types.some(l=>l==="ANY"))return[];if(this.type.length>1){let l=this.type;if(!this.list&&this.type.length!==o.length){let u=i.ast.values??i.ast;a.push(F(4,u.firstToken,u.lastToken,u,{templateStrings:[r,this.type.length.toString()]}))}else o.forEach((u,d)=>{if(l[0].types.every(f=>f!==u)){let f=i.ast.values?.values[d]??i.ast;a.push(F(3,f.firstToken,f.lastToken,f))}})}else{if(this.type[0].types.some(u=>u==="STRINGLIST"))o.some(u=>c(["STRINGLIST"],u,i.ast.values?.values[0]?.value));else if(this.list||this.type.length===1&&this.type[0].types.filter(u=>u!=="EMPTY").every(u=>u==="PROP_ENCODED_ARRAY"))o.some(u=>c(this.type[0].types,u,i.ast.values?.values[0]?.value));else if(o.length>1&&this.type[0].types.some(u=>u!=="EMPTY")){let u=i.ast.propertyName??i.ast;a.push(F(8,u.firstToken,u.lastToken,u,{linkedTo:(i.ast.values?.values.slice(1)??[]).filter(d=>!!d),templateStrings:[i.name]}))}else o.length===1&&c(this.type[0].types,o[0],i.ast.values?.values[0]?.value);let l=this.values(i);if(a.length===0&&(a.push(...this.additionalTypeCheck?.(i,e.context.macros)??[]),l.length&&this.type[0].types.some(u=>u==="STRING"))){let u=i.ast.values?.values[0]?.value;if(!l.some(d=>u.value===d)){let d=i.ast.values?.values[0]?.value??i.ast;a.push(F(9,d.firstToken,d.lastToken,d,{templateStrings:[this.values(i).map(f=>`'${f}'`).join(" or ")]}))}}}return a}getPropertyCompletionItems(e,n,r){let i=this.type.at(n);return i?.types.some(s=>s==="STRING")?e.ast.values?.values&&e.ast.values.values?.length>1?[]:this.values(e).map(s=>({label:`"${s}"`,kind:
|
|
194
|
-
`)};`,this.description,...a.flat())],activeSignature:0,activeParameter:d}}return o.signatureArgsCyclic&&d&&(d=d%a.length),{signatures:[Kt.SignatureInformation.create(`${n.name} = <${a.map(f=>f.label).join(" ")}>;`,this.description,...a)],activeSignature:0,activeParameter:d}}getPropertyListCompletionItems(n){return this.properties.filter(r=>!r.hideAutoComplete&&r.required(n)!=="omitted"&&typeof r.name=="string").map(r=>{let i=n&&r.required(n),s=!!n.properties.some(a=>r.getNameMatch(a.name)),o="a";return i==="required"?o=s?"Y":"!":o=s?"Z":"B",{label:`${r.name}`,kind:Kt.CompletionItemKind.Property,sortText:`${o}${r.name}`}})??[]}};var Be=t=>{if(!t?.values.some(e=>!(e?.value instanceof ct)))return t?.values.flatMap(e=>e.value.values.map(n=>n.value))??[]};var We=(t,e,n,r)=>{let i=t.ast.values?.values.at(e)?.value;if(i instanceof ct){let s=i.values.at(n);if(s?.value instanceof me){let o=s.value.evaluate(r);if(typeof o=="number")return o}}},Rr=(t,e,n=0)=>{if(t instanceof xn){if(t?.value instanceof ct){let r=t.value.values.at(n);if(r?.value instanceof sn)return e.getPhandle(r.value.value);if(r?.value instanceof ie)return r.value.linksTo;if(r?.value instanceof rt)return r.value.path?.pathParts.at(-1)?.linksTo}}else{if(t instanceof sn)return e.getPhandle(t.value);if(t instanceof ie)return t.linksTo;if(t instanceof rt)return t.path?.pathParts.at(-1)?.linksTo}},V=t=>Array.isArray(t)?[{types:t}]:[{types:[t]}],Kc=t=>{switch(t){case"string":return V("STRING");case"int":return V("U32");case"boolean":return V("EMPTY");case"array":return V("PROP_ENCODED_ARRAY");case"uint8-array":return V("BYTESTRING");case"string-array":return V("STRINGLIST");case"phandle":return V("U32");case"phandles":return V("PROP_ENCODED_ARRAY");case"phandle-array":return V("PROP_ENCODED_ARRAY");case"path":return V(["STRING","U32"]);case"compound":return V("ANY");default:return V("ANY")}};var IE=()=>{let t=new W("compatible",V("STRINGLIST"));return t.description=["The compatible property value consists of one or more strings that define the specific programming model for the device. This list of strings should be used by a client program for device driver selection. The property value consists of a concatenated list of null terminated strings, from most specific to most general. They allow a device to express its compatibility with a family of similar devices, potentially allowing a single device driver to match against several devices.",'The recommended format is "manufacturer, model", where manufacturer is a string describing the name of the manufacturer (such as a stock ticker symbol), and model specifies the model number.',"The compatible string should consist only of lowercase letters, digits and dashes, and should start with a letter. A single comma is typically only used following a vendor prefix. Underscores should not be used."],t.examples=['```devicetree\ncompatible = "fsl,mpc8641", "ns16550";\n```',"In this example, an operating system would first try to locate a device driver that supported fsl, mpc8641. If a driver was not found, it would then try to locate a driver that supported the more general ns 16550 device type."],t};var zf=L(U());var OE=()=>{let t=new W("device_type",V("STRING"),"optional",void 0,e=>e.parent.name==="cpu"||e.parent.name==="memory"?[e.parent.name]:[],e=>{if(e.parent.name==="cpu"||e.parent.name==="memory"){let n=e.ast.values?.values.at(0)?.value;if(n instanceof re&&n.value!==e.parent.name)return[F(e.parent.name==="cpu"?12:13,e.ast.firstToken,e.ast.lastToken,e.ast,{templateStrings:[e.name]})]}return t.required(e.parent)!=="required"?[F(14,e.ast.firstToken,e.ast.lastToken,e.ast,{severity:zf.DiagnosticSeverity.Hint,tags:[zf.DiagnosticTag.Deprecated],templateStrings:[e.name]})]:[]});return t.description=["The device_type property was used in IEEE 1275 to describe the device's FCode programming model. Because DTSpec does not have FCode, new use of the property is deprecated, and it should be included only on cpu and memory nodes for compatibility with IEEE 1275-derived devicetrees."],t};var ME=()=>{let t=new W("#interrupt-cells",V("U32"));return t.description=["The #interrupt-cells property defines the number of cells required to encode an interrupt specifier for an interrupt domain."],t};var xE=()=>{let t=new W("interrupt-controller",V("EMPTY"),"optional");return t.description=["The presence of an interrupt-controller property defines a node as an interrupt controller node."],t};var LE=()=>{let t=new W("interrupt-parent",V("U32"));return t.description=["Because the hierarchy of the nodes in the interrupt tree might not match the devicetree, the interrupt-parent property is available to make the definition of an interrupt parent explicit. The value is the phandle to the interrupt parent. If this property is missing from a device, its interrupt parent is assumed to be its devicetree parent."],t};var CT=L(U());var qE=()=>{let t=new W("interrupts",V("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,n)=>{let r=[],i=Be(e.ast.values);if(!i)return r;let s=e.parent;if(s.getProperty("interrupts-extended"))return r;let o=s.interruptsParent;if(!o?.parentInterruptNode){if(!o?.interruptParent)return r.push(F(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...e.parent.nodeNameOrLabelRef],templateStrings:[e.name,"interrupt-parent",e.parent.pathString]})),r;let h=o.interruptParent.ast.values?.values.at(0)?.value??o.interruptParent.ast;return r.push(F(17,h.firstToken,h.lastToken,h)),r}let{parentInterruptNode:a}=o,c=a.getProperty("#interrupt-cells");if(!c)return r.push(F(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...a.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",a.pathString]})),r;let l=We(c,0,0,n);if(!l)return r;let u=[...Array.from({length:l},()=>"Interrupt")],d=a.bindingLoader?.type?a.nodeType?.cellsValues?.find(h=>h.specifier==="interrupt"):void 0;d?(u=d.values,t.signatureArgs=d.values.map(h=>CT.ParameterInformation.create(h))):t.signatureArgs=u.map(h=>CT.ParameterInformation.create(h));let f=a.getProperty("interrupt-map"),p=s.parent?.getProperty("#address-cells");if(f&&!p){let h=e.ast.propertyName??e.ast;r.push(F(16,h.firstToken,h.lastToken,h,{linkedTo:[...e.parent.nodeNameOrLabelRef],templateStrings:[e.name,"#address-cells",s.parent?.pathString??"/"]}))}if(!c)return r.push(F(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...a.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",a.pathString]})),r;let m=0;for(;m<i.length;){let h=i.length-m;if(l>h){let v=i[i.length-1];return r.push(F(19,v.firstToken,v.lastToken,v,{templateStrings:[e.name,`<${u.join(" ")}> `]})),r}let y=i.slice(m,m+l),S=s.mappedReg(n)?.at(0)?.startAddress,b={mappingValuesAst:y,cellCount:l,target:a,specifierSpace:a.bindingLoader?.type==="Zephyr"?"interrupt":void 0};if(e.nexusMapsTo.push(b),f&&S){let v=a.getNexusMapEntryMatch("interrupt",n,y,S);v?.match?b.mapItem=v.match:r.push(F(31,v.entry.firstToken,v.entry.lastToken,v.entry,{linkedTo:[f.ast]}))}y.every(v=>v instanceof me)&&a.interrupControlerMapping.push({expressions:y,node:s,property:e,specifierSpace:a.bindingLoader?.type==="Zephyr"?"interrupt":void 0}),m+=l}return r});return t.description=["The interrupts property of a device node defines the interrupt or interrupts that are generated by the device.The value of the interrupts property consists of an arbitrary number of interrupt specifiers. The format of an interrupt specifier is defined by the binding of the interrupt domain root.","interrupts is overridden by the interrupts-extended property and normally only one or the other should be used."],t.examples=["A common definition of an interrupt specifier in an open PIC-compatible interrupt domain consists of two cells; an interrupt number and level/sense information. See the following example, which defines a single interrupt specifier, with an interrupt number of OxA and level/sense encoding of 8.","```devicetree\ninterrupts = <0xA 8>;\n```"],t};var Xc=L(U());var $E=()=>{let t=new W("interrupts-extended",V("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,n)=>{let r=[],i=e.parent,s=i.getProperty("interrupts");s&&r.push(F(15,s.ast.firstToken,s.ast.lastToken,s.ast,{severity:Xc.DiagnosticSeverity.Warning,linkedTo:[e.ast],templateStrings:[s.name,"is ignored when 'interrupts-extended' is used"]}));let o=i.getProperty("interrupt-parent");o&&r.push(F(15,o.ast.firstToken,o.ast.lastToken,o.ast,{severity:Xc.DiagnosticSeverity.Warning,linkedTo:[e.ast],templateStrings:[o.name,"is ignored when 'interrupts-extended' is used"]}));let a=i.root,c=Be(e.ast.values);if(!c?.length)return[];let l=0,u=0,d=[];for(;l<c.length;){let f=Rr(c[l],a);if(!f){let R=c[l];return r.push(F(17,R.firstToken,R.lastToken,R)),r}let p=f.getProperty("#interrupt-cells");if(!p){r.push(F(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...f.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",f.pathString]}));break}let m=We(p,0,0,n);if(m==null)return r;let h=c.length-l-1,y=f.bindingLoader?.type?f.nodeType?.cellsValues?.find(R=>R.specifier==="interrupt"):void 0;if(y?d.push(["phandle",...y.values]):d.push(["phandle",...Array.from({length:m},()=>"interrupt")]),m>h){let R=c[c.length-1];return r.push(F(19,R.firstToken,R.lastToken,R,{templateStrings:[e.name,`<${d.at(-1).join(" ")}>`]})),r}let S=c.slice(l+1,l+1+m),b=f.getProperty("interrupt-map"),v={mappingValuesAst:S,target:f,cellCount:m,specifierSpace:f.bindingLoader?.type==="Zephyr"?"interrupt":void 0};e.nexusMapsTo.push(v);let k=i.mappedReg(n)?.at(0)?.startAddress;if(b&&k){let R=f.getNexusMapEntryMatch("interrupt",n,S,k);R?.match?v.mapItem=R.match:r.push(F(31,R.entry.firstToken,R.entry.lastToken,R.entry,{linkedTo:[b.ast]}))}S.every(R=>R instanceof me)&&f.interrupControlerMapping.push({expressions:S,node:i,property:e,specifierSpace:f.bindingLoader?.type==="Zephyr"?"interrupt":void 0}),l+=m+1,u++}return d.push([`${u}_phandle`,`${u}_interrupt...`]),t.signatureArgs=d.map(f=>f.map(p=>Xc.ParameterInformation.create(p))),r});return t.description=["The interrupts-extended property lists the interrupts) generated by a device. interrupts-extended should be used instead of interrupts when a device is connected to multiple interrupt controllers as it encodes a parent phandle with each interrupt specifier.","The interrupts and interrupts-extended properties are mutually exclusive. A device node should use one or the other, but not both. Using both is only permissible when required for compatibility with software that does not understand interrupts-extended. If both interrupts-extended and interrupts are present then interrupts-extended takes precedence."],t.examples=["This example shows how a device with two interrupt outputs connected to two separate interrupt controllers would describe the connection using an interrupts-extended property. pic is an interrupt controller with an #interrupt-cells specifier of 2, while gic is an interrupt controller with an #interrupts-cells specifier of 1.","```devicetree\ninterrupts-extended = <&pic OXA 8>, <&gic Oxda>;\n```"],t};var FE=()=>{let t=new W("dma-noncoherent",V("EMPTY"));return t.description=["For architectures which are by default coherent for 1/O, the dma-noncoherent property is used to indicate a device is not capable of coherent DMA operations. Some architectures have non-coherent DMA by default and this property is not applicable."],t};var BE=()=>{let t=new W("dma-coherent",V("EMPTY"));return t.description=["For architectures which are by default non-coherent for I/O, the dma-coherent property is used to indicate a device is capable of coherent DMA operations. Some architectures have coherent DMA by default and this property is not applicable."],t};var jE=L(U());var UE=()=>{let t=new W("dma-ranges",V(["EMPTY","PROP_ENCODED_ARRAY"]),"optional",void 0,void 0,(e,n)=>{let r=[],i=e.parent.sizeCells(n),s=e.parent.addressCells(n),o=e.parent.parentAddressCells(n),a=[...Array.from({length:s},(l,u)=>`child-bus-address${s>1?u:""}`),...Array.from({length:o},(l,u)=>`parent-bus-address${o>1?u:""}`),...Array.from({length:i},(l,u)=>`length${i>1?u:""}`)];t.signatureArgs=a.map(l=>jE.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let c=Be(e.ast.values);if(!c?.length)return[];if(c.length===0||c.length%(s+o+i)!==0){let l=c.at(c.length-c.length%(s+o+i))??e.ast;r.push(F(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"child-bus-address"),...Array.from({length:o},()=>"parent-bus-address"),...Array.from({length:i},()=>"length")].join(" ")}>`]}))}return r});return t.description=["The dma-ranges property is used to describe the direct memory access (DMA) structure of a memory-mapped bus whose devicetree parent can be accessed from DMA operations originating from the bus. It provides a means of defining a mapping or translation between the physical address space of the bus and the physical address space of the parent of the bus.","The format of the value of the dma-ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length). Each triplet specified describes a contiguous DMA address range.","- The child-bus-address is a physical address within the child bus' address space. The number of cells to represent the address depends on the bus and can be determined from the #address-cells of this node (the node in which the dma-ranges property appears).","- The parent-bus-address is a physical address within the parent bus' address space. The number of cells to represent the parent address is bus dependent and can be determined from the #address-cells property of the node that defines the parent's address space.","- The length specifies the size of the range in the child's address space. The number of cells to represent the size can be determined from the #size-cells of this node (the node in which the dma-ranges property appears)."],t};var Jc=L(U());var Gf=()=>{let t=new W("ranges",V(["EMPTY","PROP_ENCODED_ARRAY"]),"optional",void 0,void 0,(e,n)=>{let r=[],i=e.parent.sizeCells(n),s=e.parent.addressCells(n),o=e.parent.parentAddressCells(n),a=[...Array.from({length:s},(l,u)=>`child-bus-address${s>1?u:""}`),...Array.from({length:o},(l,u)=>`parent-bus-address${o>1?u:""}`),...Array.from({length:i},(l,u)=>`length${i>1?u:""}`)];t.signatureArgs=a.map(l=>Jc.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let c=Be(e.ast.values);if(!c?.length){let l=e.parent.addressCells(n),u=e.parent.sizeCells(n),d=e.parent?.parentAddressCells(n),f=e.parent?.parentSizeCells(n);return l!==d||u!==f?[F(38,e.ast.firstToken,e.ast.lastToken,e.ast)]:[]}if(c.length===0||c.length%(s+o+i)!==0){let l=c.at(c.length-c.length%(s+o+i))??e.ast;r.push(F(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"child-bus-address"),...Array.from({length:o},()=>"parent-bus-address"),...Array.from({length:o},()=>"length")].join(" ")}>`]}))}return r.length===0&&e.parent.nodes.forEach(l=>{let u=l.getProperty("reg");u&&l.mappedReg(n)?.forEach(d=>{if(d.missingMapping){let f=l.parent?.getProperty("ranges");r.push(F(35,d.regRangeTokens.start,d.regRangeTokens.end,e.ast,{severity:Jc.DiagnosticSeverity.Warning,linkedTo:f?[f.ast]:[]}));return}!d?.mappingEnd||!d.mappedAst||d.inMappingRange||r.push(F(29,d.regRangeTokens.start,d.regRangeTokens.end,e.ast,{severity:Jc.DiagnosticSeverity.Warning,linkedTo:[d.mappedAst],templateStrings:[u.name,`0x${d.endAddress.map((f,p)=>f.toString(16).padStart(p?8:0,"0")).join("")}`,`0x${d.mappingEnd.map((f,p)=>f.toString(16).padStart(p?8:0,"0")).join("")}`]}))})}),r});return t.description=["The ranges property provides a means of defining a mapping or translation between the address space of the bus (the child address space) and the address space of the bus node's parent (the parent address space).","The format of the value of the ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length)","- The child-bus-address is a physical address within the child bus' address space. The number of cells to represent the address is bus dependent and can be determined from the #address-cells of this node (the node in which the ranges property appears).","- The parent-bus-address is a physical address within the parent bus' address space. The number of cells to represent the parent address is bus dependent and can be determined from the #address-cells property of the node that defines the parent's address space.","- The length specifies the size of the range in the child's address space. The number of cells to represent the size can be determined from the #size-cells of this node (the node in which the ranges property appears).","If the property is defined with an < empty> value, it specifies that the parent and child address space is identical, and no address translation is required.","If the property is not present in a bus node, it is assumed that no mapping exists between children of the node and the parent address space."],t.examples=["Address Translation Example:",["```devicetree",`soc {
|
|
193
|
+
`)});this.signatureArgsCyclic=!1;typeof r!="function"?this.required=()=>r:this.required=r,typeof s!="function"?(this.allowedValues=s,this.values=()=>s===void 0?i?[i]:[]:i&&s.indexOf(i)===-1?[i,...s]:s):this.values=s}getNameMatch(e){return typeof this.name=="string"?this.name===e:this.name.test(e)}validateProperty(e,n,r,i){let s=this.required(n);if(i){if(s==="omitted")return[F(11,i.ast.firstToken,i.ast.lastToken,i.ast,{templateStrings:[r]})]}else return s==="required"?[...e.getOrderedNodeAst(n).filter(u=>!bi(u.fsPath)).map(u=>{let d=wT(u)??u,f=Vf(n,u,r,this.type[0],e);return F(0,d.firstToken,d.lastToken,u,{templateStrings:[r],edit:f})})]:[];let o=TH(i),a=[],c=(l,u,d)=>{if(d??=i.ast,!(l.some(p=>p==u)||l.some(p=>p=="STRINGLIST")&&(u==="STRING"||u==="STRINGLIST")||l.some(p=>p=="PROP_ENCODED_ARRAY")&&(u==="U32"||u==="U64"))){let p=[];l.forEach(m=>{switch(m){case"EMPTY":p.push(1);break;case"STRING":p.push(2);break;case"STRINGLIST":p.push(3);break;case"U32":p.push(5);break;case"U64":p.push(6);break;case"PROP_ENCODED_ARRAY":p.push(7);break}}),p.length&&a.push(F(p,d.firstToken,d.lastToken,d,{templateStrings:[i.name]}))}};if(this.type[0].types.some(l=>l==="ANY"))return[];if(this.type.length>1){let l=this.type;if(!this.list&&this.type.length!==o.length){let u=i.ast.values??i.ast;a.push(F(4,u.firstToken,u.lastToken,u,{templateStrings:[r,this.type.length.toString()]}))}else o.forEach((u,d)=>{if(l[0].types.every(f=>f!==u)){let f=i.ast.values?.values[d]??i.ast;a.push(F(3,f.firstToken,f.lastToken,f))}})}else{if(this.type[0].types.some(u=>u==="STRINGLIST"))o.some(u=>c(["STRINGLIST"],u,i.ast.values?.values[0]?.value));else if(this.list||this.type.length===1&&this.type[0].types.filter(u=>u!=="EMPTY").every(u=>u==="PROP_ENCODED_ARRAY"))o.some(u=>c(this.type[0].types,u,i.ast.values?.values[0]?.value));else if(o.length>1&&this.type[0].types.some(u=>u!=="EMPTY")){let u=i.ast.propertyName??i.ast;a.push(F(8,u.firstToken,u.lastToken,u,{linkedTo:(i.ast.values?.values.slice(1)??[]).filter(d=>!!d),templateStrings:[i.name]}))}else o.length===1&&c(this.type[0].types,o[0],i.ast.values?.values[0]?.value);let l=this.values(i);if(a.length===0&&(a.push(...this.additionalTypeCheck?.(i,e.context.macros)??[]),l.length&&this.type[0].types.some(u=>u==="STRING"))){let u=i.ast.values?.values[0]?.value;if(!l.some(d=>u.value===d)){let d=i.ast.values?.values[0]?.value??i.ast;a.push(F(9,d.firstToken,d.lastToken,d,{templateStrings:[this.values(i).map(f=>`'${f}'`).join(" or ")]}))}}}return a}getPropertyCompletionItems(e,n,r){let i=this.type.at(n);return i?.types.some(s=>s==="STRING")?e.ast.values?.values&&e.ast.values.values?.length>1?[]:this.values(e).map(s=>({label:`"${s}"`,kind:Xt.CompletionItemKind.Variable,sortText:s===this.def?`A${s}`:`Z${s}`,insertText:r?`${s}`:`"${s}"`})):i?.types.some(s=>s==="U32"||s==="U64")?this.values(e).map(s=>({label:`<${s}>`,kind:Xt.CompletionItemKind.Variable,sortText:s===this.def?`A${s}`:`Z${s}`,insertText:r?`${s}`:`<${s}>`})):[]}},TH=t=>t.ast.values?t.ast.values.values.map(e=>vH(e)):["EMPTY"],vH=t=>t?t.value instanceof re?"STRING":t.value instanceof ct?t.value.values.length===1?"U32":t.value.values.length===2?"U64":"PROP_ENCODED_ARRAY":t.value instanceof ie||t.value instanceof rt?"U32":"BYTESTRING":"UNKNOWN",Yc=class{constructor(){this.extends=new Set;this.hasParentBinding=!1}get defaultProperties(){return Object.values(this.zephyrBinding?.properties??{}).filter(e=>e.default!==void 0)}},St=class extends Yc{constructor(n=()=>[]){super();this.additionalValidations=n;this.#e=[];this.noMismatchPropertiesAllowed=!1;this.warnMismatchProperties=!1}#e;#n;getIssue(n,r){let i=[];if(r.disabled){let a=r.getProperty("status");return r.implementations.forEach(c=>i.push(F(21,c.firstToken,c.lastToken,c,{severity:Xt.DiagnosticSeverity.Hint,linkedTo:[...a?.ast?[a?.ast]:[]],tags:[Xt.DiagnosticTag.Unnecessary]}))),i}let s=new Set,o=this.properties.flatMap(a=>{if(a.name==="reg"&&a.required(r)==="required"&&!r.address&&r.properties.find(u=>u.name==="reg")){let u=r.regArray(n.context.macros)?.at(0)?.startAddress.map(m=>m.toString(16)).join(","),d=r.definitions,f=d[d.length-1],p=f.name??f;i.push(F(36,p.firstToken,p.lastToken,p,{linkedTo:d.slice(0,-1).map(m=>m.name??m),edit:u?d.filter(m=>!!m.name).map(m=>Xt.TextEdit.insert(Xt.Position.create(m.name.lastToken.pos.line,m.name.lastToken.pos.colEnd),`@${u}`)):void 0,codeActionTitle:"Add Node Address"}))}if(typeof a.name=="string"){let u=r.getProperty(a.name);return u&&s.add(u),a.validateProperty(n,r,a.name,u)}let c=r.properties.filter(u=>a.getNameMatch(u.name));c.forEach(u=>s.add(u));let l=this.properties.filter(u=>u!==a)??[];return l.length&&c.some(u=>l.some(d=>d.getNameMatch(u.name)))?[]:c.flatMap(u=>a.validateProperty(n,r,u.name,u))});return s.size!==r.properties.length&&(this.noMismatchPropertiesAllowed||this.warnMismatchProperties)&&r.properties.filter(c=>!s.has(c)).forEach(c=>{n.context.bindingLoader?.type==="Zephyr"&&c.name.endsWith("-controller")||i.push(F(this.warnMismatchProperties?34:27,c.ast.firstToken,c.ast.lastToken,c.ast,{severity:this.warnMismatchProperties?Xt.DiagnosticSeverity.Warning:Xt.DiagnosticSeverity.Error,templateStrings:[c.name],edit:Xt.TextEdit.del(on(c.ast.firstToken.prevToken,c.ast.lastToken,!1))}))}),[...i,...o,...this.additionalValidations(n,r)]}get properties(){return this.#e}addProperty(n){Array.isArray(n)?n.forEach(r=>this.#e.push(r)):this.#e.push(n),this.#e.sort((r,i)=>typeof r.name=="string"&&typeof i.name=="string"||typeof r.name!="string"&&typeof i.name!="string"?0:typeof r.name=="string"?-1:1)}get childNodeType(){return this.#n}set childNodeType(n){n&&(this.#n=r=>{let i=n(r);return i.bindingsPath=this.bindingsPath,i})}getOnPropertyHover(n){let r=this.properties.find(i=>i.getNameMatch(n));return r?.onHover.bind(r)()}getSignatureHelp(n,r,i,s){let o=this.properties.find(f=>f.getNameMatch(n.name)),a=o?.signatureArgs;if(!o||!a)return;let c=n.getArgumentIndex(i),l=n.getArgumentIndex(s),d=n.getArgumentIndex(r)??l??(c!==void 0?c+1:void 0);if(NE(a)){let f=0;if(d!==void 0){let p=d,m=d?a.findIndex(h=>f<=p&&h.length+f>p?!0:(f+=h.length,!1)):void 0;m!==void 0&&(m>1&&(d=d-a.slice(0,m-1).reduce((h,y)=>h+y.length,0)),a=a.slice(m?m-1:0,m+2))}return{signatures:[Xt.SignatureInformation.create(`${n.name} = ${a.map(p=>`<${p.map(m=>m.label).join(" ")}>`).join(`,
|
|
194
|
+
`)};`,this.description,...a.flat())],activeSignature:0,activeParameter:d}}return o.signatureArgsCyclic&&d&&(d=d%a.length),{signatures:[Xt.SignatureInformation.create(`${n.name} = <${a.map(f=>f.label).join(" ")}>;`,this.description,...a)],activeSignature:0,activeParameter:d}}getPropertyListCompletionItems(n){return this.properties.filter(r=>!r.hideAutoComplete&&r.required(n)!=="omitted"&&typeof r.name=="string").map(r=>{let i=n&&r.required(n),s=!!n.properties.some(a=>r.getNameMatch(a.name)),o="a";return i==="required"?o=s?"Y":"!":o=s?"Z":"B",{label:`${r.name}`,kind:Xt.CompletionItemKind.Property,sortText:`${o}${r.name}`}})??[]}};var Be=t=>{if(!t?.values.some(e=>!(e?.value instanceof ct)))return t?.values.flatMap(e=>e.value.values.map(n=>n.value))??[]};var We=(t,e,n,r)=>{let i=t.ast.values?.values.at(e)?.value;if(i instanceof ct){let s=i.values.at(n);if(s?.value instanceof me){let o=s.value.evaluate(r);if(typeof o=="number")return o}}},Rr=(t,e,n=0)=>{if(t instanceof xn){if(t?.value instanceof ct){let r=t.value.values.at(n);if(r?.value instanceof sn)return e.getPhandle(r.value.value);if(r?.value instanceof ie)return r.value.linksTo;if(r?.value instanceof rt)return r.value.path?.pathParts.at(-1)?.linksTo}}else{if(t instanceof sn)return e.getPhandle(t.value);if(t instanceof ie)return t.linksTo;if(t instanceof rt)return t.path?.pathParts.at(-1)?.linksTo}},V=t=>Array.isArray(t)?[{types:t}]:[{types:[t]}],Kc=t=>{switch(t){case"string":return V("STRING");case"int":return V("U32");case"boolean":return V("EMPTY");case"array":return V("PROP_ENCODED_ARRAY");case"uint8-array":return V("BYTESTRING");case"string-array":return V("STRINGLIST");case"phandle":return V("U32");case"phandles":return V("PROP_ENCODED_ARRAY");case"phandle-array":return V("PROP_ENCODED_ARRAY");case"path":return V(["STRING","U32"]);case"compound":return V("ANY");default:return V("ANY")}};var IE=()=>{let t=new W("compatible",V("STRINGLIST"));return t.description=["The compatible property value consists of one or more strings that define the specific programming model for the device. This list of strings should be used by a client program for device driver selection. The property value consists of a concatenated list of null terminated strings, from most specific to most general. They allow a device to express its compatibility with a family of similar devices, potentially allowing a single device driver to match against several devices.",'The recommended format is "manufacturer, model", where manufacturer is a string describing the name of the manufacturer (such as a stock ticker symbol), and model specifies the model number.',"The compatible string should consist only of lowercase letters, digits and dashes, and should start with a letter. A single comma is typically only used following a vendor prefix. Underscores should not be used."],t.examples=['```devicetree\ncompatible = "fsl,mpc8641", "ns16550";\n```',"In this example, an operating system would first try to locate a device driver that supported fsl, mpc8641. If a driver was not found, it would then try to locate a driver that supported the more general ns 16550 device type."],t};var zf=L(U());var OE=()=>{let t=new W("device_type",V("STRING"),"optional",void 0,e=>e.parent.name==="cpu"||e.parent.name==="memory"?[e.parent.name]:[],e=>{if(e.parent.name==="cpu"||e.parent.name==="memory"){let n=e.ast.values?.values.at(0)?.value;if(n instanceof re&&n.value!==e.parent.name)return[F(e.parent.name==="cpu"?12:13,e.ast.firstToken,e.ast.lastToken,e.ast,{templateStrings:[e.name]})]}return t.required(e.parent)!=="required"?[F(14,e.ast.firstToken,e.ast.lastToken,e.ast,{severity:zf.DiagnosticSeverity.Hint,tags:[zf.DiagnosticTag.Deprecated],templateStrings:[e.name]})]:[]});return t.description=["The device_type property was used in IEEE 1275 to describe the device's FCode programming model. Because DTSpec does not have FCode, new use of the property is deprecated, and it should be included only on cpu and memory nodes for compatibility with IEEE 1275-derived devicetrees."],t};var ME=()=>{let t=new W("#interrupt-cells",V("U32"));return t.description=["The #interrupt-cells property defines the number of cells required to encode an interrupt specifier for an interrupt domain."],t};var xE=()=>{let t=new W("interrupt-controller",V("EMPTY"),"optional");return t.description=["The presence of an interrupt-controller property defines a node as an interrupt controller node."],t};var LE=()=>{let t=new W("interrupt-parent",V("U32"));return t.description=["Because the hierarchy of the nodes in the interrupt tree might not match the devicetree, the interrupt-parent property is available to make the definition of an interrupt parent explicit. The value is the phandle to the interrupt parent. If this property is missing from a device, its interrupt parent is assumed to be its devicetree parent."],t};var CT=L(U());var qE=()=>{let t=new W("interrupts",V("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,n)=>{let r=[],i=Be(e.ast.values);if(!i)return r;let s=e.parent;if(s.getProperty("interrupts-extended"))return r;let o=s.interruptsParent;if(!o?.parentInterruptNode){if(!o?.interruptParent)return r.push(F(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...e.parent.nodeNameOrLabelRef],templateStrings:[e.name,"interrupt-parent",e.parent.pathString]})),r;let h=o.interruptParent.ast.values?.values.at(0)?.value??o.interruptParent.ast;return r.push(F(17,h.firstToken,h.lastToken,h)),r}let{parentInterruptNode:a}=o,c=a.getProperty("#interrupt-cells");if(!c)return r.push(F(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...a.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",a.pathString]})),r;let l=We(c,0,0,n);if(!l)return r;let u=[...Array.from({length:l},()=>"Interrupt")],d=a.bindingLoader?.type?a.nodeType?.cellsValues?.find(h=>h.specifier==="interrupt"):void 0;d?(u=d.values,t.signatureArgs=d.values.map(h=>CT.ParameterInformation.create(h))):t.signatureArgs=u.map(h=>CT.ParameterInformation.create(h));let f=a.getProperty("interrupt-map"),p=s.parent?.getProperty("#address-cells");if(f&&!p){let h=e.ast.propertyName??e.ast;r.push(F(16,h.firstToken,h.lastToken,h,{linkedTo:[...e.parent.nodeNameOrLabelRef],templateStrings:[e.name,"#address-cells",s.parent?.pathString??"/"]}))}if(!c)return r.push(F(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...a.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",a.pathString]})),r;let m=0;for(;m<i.length;){let h=i.length-m;if(l>h){let v=i[i.length-1];return r.push(F(19,v.firstToken,v.lastToken,v,{templateStrings:[e.name,`<${u.join(" ")}> `]})),r}let y=i.slice(m,m+l),S=s.mappedReg(n)?.at(0)?.startAddress,b={mappingValuesAst:y,cellCount:l,target:a,specifierSpace:a.bindingLoader?.type==="Zephyr"?"interrupt":void 0};if(e.nexusMapsTo.push(b),f&&S){let v=a.getNexusMapEntryMatch("interrupt",n,y,S);v?.match?b.mapItem=v.match:r.push(F(31,v.entry.firstToken,v.entry.lastToken,v.entry,{linkedTo:[f.ast]}))}y.every(v=>v instanceof me)&&a.interrupControlerMapping.push({expressions:y,node:s,property:e,specifierSpace:a.bindingLoader?.type==="Zephyr"?"interrupt":void 0}),m+=l}return r});return t.description=["The interrupts property of a device node defines the interrupt or interrupts that are generated by the device.The value of the interrupts property consists of an arbitrary number of interrupt specifiers. The format of an interrupt specifier is defined by the binding of the interrupt domain root.","interrupts is overridden by the interrupts-extended property and normally only one or the other should be used."],t.examples=["A common definition of an interrupt specifier in an open PIC-compatible interrupt domain consists of two cells; an interrupt number and level/sense information. See the following example, which defines a single interrupt specifier, with an interrupt number of OxA and level/sense encoding of 8.","```devicetree\ninterrupts = <0xA 8>;\n```"],t};var Xc=L(U());var $E=()=>{let t=new W("interrupts-extended",V("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,n)=>{let r=[],i=e.parent,s=i.getProperty("interrupts");s&&r.push(F(15,s.ast.firstToken,s.ast.lastToken,s.ast,{severity:Xc.DiagnosticSeverity.Warning,linkedTo:[e.ast],templateStrings:[s.name,"is ignored when 'interrupts-extended' is used"]}));let o=i.getProperty("interrupt-parent");o&&r.push(F(15,o.ast.firstToken,o.ast.lastToken,o.ast,{severity:Xc.DiagnosticSeverity.Warning,linkedTo:[e.ast],templateStrings:[o.name,"is ignored when 'interrupts-extended' is used"]}));let a=i.root,c=Be(e.ast.values);if(!c?.length)return[];let l=0,u=0,d=[];for(;l<c.length;){let f=Rr(c[l],a);if(!f){let R=c[l];return r.push(F(17,R.firstToken,R.lastToken,R)),r}let p=f.getProperty("#interrupt-cells");if(!p){r.push(F(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...f.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",f.pathString]}));break}let m=We(p,0,0,n);if(m==null)return r;let h=c.length-l-1,y=f.bindingLoader?.type?f.nodeType?.cellsValues?.find(R=>R.specifier==="interrupt"):void 0;if(y?d.push(["phandle",...y.values]):d.push(["phandle",...Array.from({length:m},()=>"interrupt")]),m>h){let R=c[c.length-1];return r.push(F(19,R.firstToken,R.lastToken,R,{templateStrings:[e.name,`<${d.at(-1).join(" ")}>`]})),r}let S=c.slice(l+1,l+1+m),b=f.getProperty("interrupt-map"),v={mappingValuesAst:S,target:f,cellCount:m,specifierSpace:f.bindingLoader?.type==="Zephyr"?"interrupt":void 0};e.nexusMapsTo.push(v);let k=i.mappedReg(n)?.at(0)?.startAddress;if(b&&k){let R=f.getNexusMapEntryMatch("interrupt",n,S,k);R?.match?v.mapItem=R.match:r.push(F(31,R.entry.firstToken,R.entry.lastToken,R.entry,{linkedTo:[b.ast]}))}S.every(R=>R instanceof me)&&f.interrupControlerMapping.push({expressions:S,node:i,property:e,specifierSpace:f.bindingLoader?.type==="Zephyr"?"interrupt":void 0}),l+=m+1,u++}return d.push([`${u}_phandle`,`${u}_interrupt...`]),t.signatureArgs=d.map(f=>f.map(p=>Xc.ParameterInformation.create(p))),r});return t.description=["The interrupts-extended property lists the interrupts) generated by a device. interrupts-extended should be used instead of interrupts when a device is connected to multiple interrupt controllers as it encodes a parent phandle with each interrupt specifier.","The interrupts and interrupts-extended properties are mutually exclusive. A device node should use one or the other, but not both. Using both is only permissible when required for compatibility with software that does not understand interrupts-extended. If both interrupts-extended and interrupts are present then interrupts-extended takes precedence."],t.examples=["This example shows how a device with two interrupt outputs connected to two separate interrupt controllers would describe the connection using an interrupts-extended property. pic is an interrupt controller with an #interrupt-cells specifier of 2, while gic is an interrupt controller with an #interrupts-cells specifier of 1.","```devicetree\ninterrupts-extended = <&pic OXA 8>, <&gic Oxda>;\n```"],t};var FE=()=>{let t=new W("dma-noncoherent",V("EMPTY"));return t.description=["For architectures which are by default coherent for 1/O, the dma-noncoherent property is used to indicate a device is not capable of coherent DMA operations. Some architectures have non-coherent DMA by default and this property is not applicable."],t};var BE=()=>{let t=new W("dma-coherent",V("EMPTY"));return t.description=["For architectures which are by default non-coherent for I/O, the dma-coherent property is used to indicate a device is capable of coherent DMA operations. Some architectures have coherent DMA by default and this property is not applicable."],t};var jE=L(U());var UE=()=>{let t=new W("dma-ranges",V(["EMPTY","PROP_ENCODED_ARRAY"]),"optional",void 0,void 0,(e,n)=>{let r=[],i=e.parent.sizeCells(n),s=e.parent.addressCells(n),o=e.parent.parentAddressCells(n),a=[...Array.from({length:s},(l,u)=>`child-bus-address${s>1?u:""}`),...Array.from({length:o},(l,u)=>`parent-bus-address${o>1?u:""}`),...Array.from({length:i},(l,u)=>`length${i>1?u:""}`)];t.signatureArgs=a.map(l=>jE.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let c=Be(e.ast.values);if(!c?.length)return[];if(c.length===0||c.length%(s+o+i)!==0){let l=c.at(c.length-c.length%(s+o+i))??e.ast;r.push(F(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"child-bus-address"),...Array.from({length:o},()=>"parent-bus-address"),...Array.from({length:i},()=>"length")].join(" ")}>`]}))}return r});return t.description=["The dma-ranges property is used to describe the direct memory access (DMA) structure of a memory-mapped bus whose devicetree parent can be accessed from DMA operations originating from the bus. It provides a means of defining a mapping or translation between the physical address space of the bus and the physical address space of the parent of the bus.","The format of the value of the dma-ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length). Each triplet specified describes a contiguous DMA address range.","- The child-bus-address is a physical address within the child bus' address space. The number of cells to represent the address depends on the bus and can be determined from the #address-cells of this node (the node in which the dma-ranges property appears).","- The parent-bus-address is a physical address within the parent bus' address space. The number of cells to represent the parent address is bus dependent and can be determined from the #address-cells property of the node that defines the parent's address space.","- The length specifies the size of the range in the child's address space. The number of cells to represent the size can be determined from the #size-cells of this node (the node in which the dma-ranges property appears)."],t};var Jc=L(U());var Gf=()=>{let t=new W("ranges",V(["EMPTY","PROP_ENCODED_ARRAY"]),"optional",void 0,void 0,(e,n)=>{let r=[],i=e.parent.sizeCells(n),s=e.parent.addressCells(n),o=e.parent.parentAddressCells(n),a=[...Array.from({length:s},(l,u)=>`child-bus-address${s>1?u:""}`),...Array.from({length:o},(l,u)=>`parent-bus-address${o>1?u:""}`),...Array.from({length:i},(l,u)=>`length${i>1?u:""}`)];t.signatureArgs=a.map(l=>Jc.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let c=Be(e.ast.values);if(!c?.length){let l=e.parent.addressCells(n),u=e.parent.sizeCells(n),d=e.parent?.parentAddressCells(n),f=e.parent?.parentSizeCells(n);return l!==d||u!==f?[F(38,e.ast.firstToken,e.ast.lastToken,e.ast)]:[]}if(c.length===0||c.length%(s+o+i)!==0){let l=c.at(c.length-c.length%(s+o+i))??e.ast;r.push(F(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"child-bus-address"),...Array.from({length:o},()=>"parent-bus-address"),...Array.from({length:o},()=>"length")].join(" ")}>`]}))}return r.length===0&&e.parent.nodes.forEach(l=>{let u=l.getProperty("reg");u&&l.mappedReg(n)?.forEach(d=>{if(d.missingMapping){let f=l.parent?.getProperty("ranges");r.push(F(35,d.regRangeTokens.start,d.regRangeTokens.end,e.ast,{severity:Jc.DiagnosticSeverity.Warning,linkedTo:f?[f.ast]:[]}));return}!d?.mappingEnd||!d.mappedAst||d.inMappingRange||r.push(F(29,d.regRangeTokens.start,d.regRangeTokens.end,e.ast,{severity:Jc.DiagnosticSeverity.Warning,linkedTo:[d.mappedAst],templateStrings:[u.name,`0x${d.endAddress.map((f,p)=>f.toString(16).padStart(p?8:0,"0")).join("")}`,`0x${d.mappingEnd.map((f,p)=>f.toString(16).padStart(p?8:0,"0")).join("")}`]}))})}),r});return t.description=["The ranges property provides a means of defining a mapping or translation between the address space of the bus (the child address space) and the address space of the bus node's parent (the parent address space).","The format of the value of the ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length)","- The child-bus-address is a physical address within the child bus' address space. The number of cells to represent the address is bus dependent and can be determined from the #address-cells of this node (the node in which the ranges property appears).","- The parent-bus-address is a physical address within the parent bus' address space. The number of cells to represent the parent address is bus dependent and can be determined from the #address-cells property of the node that defines the parent's address space.","- The length specifies the size of the range in the child's address space. The number of cells to represent the size can be determined from the #size-cells of this node (the node in which the ranges property appears).","If the property is defined with an < empty> value, it specifies that the parent and child address space is identical, and no address translation is required.","If the property is not present in a bus node, it is assumed that no mapping exists between children of the node and the parent address space."],t.examples=["Address Translation Example:",["```devicetree",`soc {
|
|
195
195
|
compatible = "simple-bus";
|
|
196
196
|
#address-cells = <1>;
|
|
197
197
|
#size-cells = <1>;
|
|
@@ -206,7 +206,7 @@ ${"".padEnd(ha(s.fsPath,e),i.context.formattingOptions.insertSpaces?" ".repeat(i
|
|
|
206
206
|
};
|
|
207
207
|
};`,"```"].join(`
|
|
208
208
|
`),"The soc node specifies a ranges property of",["```devicetree","<Ox0 Oxe0000000 0x00100000>;","```"].join(`
|
|
209
|
-
`),"This property value specifies that for a 1024 KB range of address space, a child node addressed at physical OxO maps to a parent address of physical 0xe0000000. With this mapping, the serial device node can be addressed by a load or store at address 0xe0004600, an offset of 0x4600 (specified in reg) plus the 0xe0000000 mapping specified in ranges."],t};var HE=()=>{let t=new W("virtual-reg",V("U32"));return t.description=["The virtual-res property specifies an effective address that maps to the first physical address specified in the reg property of the device node. This property enables boot programs to provide client programs with virtual-to-physical mappings that have been set up."],t};var VE=L(U());var WE=()=>{let t=new W("reg",V("PROP_ENCODED_ARRAY"),e=>e.address!==void 0?"required":"omitted",void 0,void 0,(e,n)=>{let r=[],i=e.parent.parentSizeCells(n),s=e.parent.parentAddressCells(n),o=[...Array.from({length:s},(l,u)=>`address${s>1?u:""}`),...Array.from({length:i},(l,u)=>`size${i>1?u:""}`)];t.signatureArgs=o.map(l=>VE.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let a=Be(e.ast.values);if(!a)return[];if(a.length===0||a.length%(i+s)!==0){let l=a.at(a.length-a.length%(i+s))??e.ast;return r.push(F(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"address"),...Array.from({length:i},()=>"size")].join(" ")}>`]})),r}let c=a.slice(0,s).map((l,u)=>We(e,0,u,n)??0);if(e.parent.address&&
|
|
209
|
+
`),"This property value specifies that for a 1024 KB range of address space, a child node addressed at physical OxO maps to a parent address of physical 0xe0000000. With this mapping, the serial device node can be addressed by a load or store at address 0xe0004600, an offset of 0x4600 (specified in reg) plus the 0xe0000000 mapping specified in ranges."],t};var HE=()=>{let t=new W("virtual-reg",V("U32"));return t.description=["The virtual-res property specifies an effective address that maps to the first physical address specified in the reg property of the device node. This property enables boot programs to provide client programs with virtual-to-physical mappings that have been set up."],t};var VE=L(U());var WE=()=>{let t=new W("reg",V("PROP_ENCODED_ARRAY"),e=>e.address!==void 0?"required":"omitted",void 0,void 0,(e,n)=>{let r=[],i=e.parent.parentSizeCells(n),s=e.parent.parentAddressCells(n),o=[...Array.from({length:s},(l,u)=>`address${s>1?u:""}`),...Array.from({length:i},(l,u)=>`size${i>1?u:""}`)];t.signatureArgs=o.map(l=>VE.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let a=Be(e.ast.values);if(!a)return[];if(a.length===0||a.length%(i+s)!==0){let l=a.at(a.length-a.length%(i+s))??e.ast;return r.push(F(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"address"),...Array.from({length:i},()=>"size")].join(" ")}>`]})),r}let c=a.slice(0,s).map((l,u)=>We(e,0,u,n)??0);if(e.parent.address&&Lt(e.parent.address,c)!==0){let l=e.ast.values?.values.at(0)?.value?.values?.at(0),u=e.ast.values?.values.at(0)?.value?.values?.at(s-1),f=(l&&u?new te(he(l.firstToken,u.lastToken)):void 0)??e.ast.values??e.ast;r.push(F(10,f.firstToken,f.lastToken,f,{templateStrings:[e.name]}))}return r});return t.examples=["Suppose a device within a system-on-a-chip had two blocks of registers, a 32-byte block at offset 0x3000 in the SOC and a 256-byte block at offset OxFE00. The reg property would be encoded as follows (assuming #address-cells and #size-cells values of 1):","```devicetree\nreg = <0x3000 0x20 0xFE00 0x100>;\n```"],t};var Yf=()=>new W("#size-cells",V("U32"),"optional",1);var Kf=()=>{let t=new W("#address-cells",V("U32"),"optional",2);return t.description=["The #address-cells and #size-cells properties may be used in any device node that has children in the devicetree hierarchy and describes how child device nodes should be addressed. The #address-cells property defines the number of <u32> cells used to encode the address field in a child node's reg property. The #size-cells property defines the number of <u32 > cells used to encode the size field in a child node's reg property.","The #address-cells and #size-cells properties are not inherited from ancestors in the devicetree. They shall be explicitly defined.","A DTSpec-compliant boot program shall supply #address-cells and #size-cells on all nodes that have children.","If missing, a client program should assume a default value of 2 for #address-cells, and a value of 1 for #size-cells."],t.examples=["See the following devicetree excerpt:",["```devicetree",`SOC {
|
|
210
210
|
#address-cells = <1>;
|
|
211
211
|
#size-cells = <1>;
|
|
212
212
|
serial@4600 {
|
|
@@ -261,10 +261,10 @@ If PIR cannot be modified and the PIR value is distinct from the interrupt contr
|
|
|
261
261
|
The CPU is in a quiescent state.
|
|
262
262
|
"fail" :
|
|
263
263
|
The CPU is not operational or does not exist.`,"A quiescent CPU is in a state where it cannot interfere with the normal operation of other CPUs, nor can its state be affected by the normal operation of other running CPUs, except by an explicit method for enabling or re-enabling the quiescent CPU (see the enable-method property).","In particular, a running CPU shall be able to issue broadcast TLB invalidates without affecting a quiescent CPU.","Examples: A quiescent CPU could be in a spin loop, held in reset, and electrically isolated from the system bus or in another implementation dependent state.",'A CPU with "fail" status does not affect the system in any way. The status is assigned to nodes for which no corresponding CPU exists.'],t.addProperty(mD()),t.addProperty(gD()),t.addProperty(yD()),t.addProperty(TD()),t.addProperty(vD()),t.addProperty(bD()),t}function SD(){let t=HT();return t.additionalValidations=(e,n)=>{if(n.parent?.name!=="cpus"){let r=n.implementations[0];return[F(26,r.firstToken,r.lastToken,r,{linkedTo:n.implementations.slice(1),templateStrings:["`cpu` node can only be a child of `cpus` node"]})]}return[]},t}function _D(){let t=HT();t.additionalValidations=(a,c)=>{if(c.parent?.name!=="/"){let l=c.implementations[0];return[F(26,l.firstToken,l.lastToken,l,{linkedTo:c.implementations.slice(1),templateStrings:["Cpus node can only be added to a root node"]})]}return[]};let e=t.properties.find(a=>a.name==="reg");e.required=()=>"optional";let n=t.properties.find(a=>a.name==="clock-frequency");n.required=()=>"optional";let r=t.properties.find(a=>a.name==="timebase-frequency");r.required=()=>"optional";let i=t.properties.find(a=>a.name==="#address-cells");i.required=()=>"required";let s=t.properties.find(a=>a.name==="#size-cells");s.required=()=>"required";let o=s?.additionalTypeCheck;return s.additionalTypeCheck=(a,c)=>{let l=o?.(a,c)??[],u=a.parent.getProperty(a.name);return(u?We(u,0,0,c):void 0)!==0&&l.push(F(28,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:[`${a.name} value in cpus node must be '0'`]})),l},t}var PD=()=>{let t=new W("alignment",V("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,n)=>{let r=[],i=Be(e.ast.values),s=e.parent.sizeCells(n),o=[...Array.from({length:s},(a,c)=>`size${s>1?c:""}`)];if(t.signatureArgs=o.map(a=>Qn.create(a)),i?.length!==s){let a=e.ast.values??e.ast;r.push(F(19,a.firstToken,a.lastToken,a,{templateStrings:[e.name,`<${Array.from({length:e.parent.sizeCells(n)},()=>"size")}>`]}))}return r});return t.description=["Address boundary for alignment of allocation."],t};var kD=()=>{let t=new W("alloc-ranges",V("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,n)=>{let r=[],i=e.parent.addressCells(n),s=e.parent.sizeCells(n),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=>Qn.create(c)),t.signatureArgsCyclic=!0;let a=Be(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 r.push(F(19,c.firstToken,c.lastToken,c,{templateStrings:[e.name,`<${[...Array.from({length:i},()=>"address"),...Array.from({length:s},()=>"size")].join(" ")}>`]})),r}return r});return t.description=["Specifies regions of memory that are acceptable to allocate from"],t};var ND=()=>{let t=new W("no-map",V("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
|
|
264
|
-
any circumstances other than under the control of the device driver using the region.`],t};var RD=()=>{let t=new W("reusable",V("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 wD=()=>{let t=new W("size",V("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,n)=>{let r=[],i=Be(e.ast.values),s=e.parent.sizeCells(n),o=[...Array.from({length:s},(a,c)=>`size${s>1?c:""}`)];if(t.signatureArgs=o.map(a=>Qn.create(a)),i?.length!==e.parent.sizeCells(n)){let a=e.ast.values??e.ast;r.push(F(19,a.firstToken,a.lastToken,a,{templateStrings:[e.name,`<${Array.from({length:s},()=>"size")}>`]}))}return r});return t.description=["Size in bytes of memory to reserve for dynamically allocated regions."],t};function ED(){let t=Zn(),e=t.properties.find(n=>n.name==="reg");return e.required=()=>"optional",t.addProperty([wD(),PD(),kD(),ND(),RD()]),t}function uo(t){switch(t?.name){case"/":return oD();case"aliases":return cD();case"memory":return lD();case"reserved-memory":return dD();case"chosen":return fD();case"cpus":return _D();case"cpu":return SD()}return t?.parent?.name==="reserved-memory"?ED():Zn()}var X=class t{constructor(e,n,r,i=null){this.bindingLoader=e;this.name=n;this.address=r;this.parent=i;this.implementations=[];this._properties=[];this._deletedProperties=[];this._deletedNodes=[];this.deletes=[];this._nodes=[];this.linkedNodeNamePaths=[];this.linkedRefLabels=[];this.interrupControlerMapping=[];this.spesifierNexusMapping=[];this.missingBinding=[];i?.addNode(this)}get definitions(){return this.implementations.filter(e=>e instanceof Ee||e instanceof nt)}static toJson(e){let n={};return e.properties.forEach(r=>n[r.name]=r.ast.values?.toJson()??!0),e.nodes.forEach(r=>n[r.fullName]=t.toJson(r)),n}get disabled(){return this.getProperty("status")?.ast.quickValues?.at(0)==="disabled"}get nodeTypes(){if(this._nodeTypes)return this._nodeTypes;if(!this.bindingLoader)return this._nodeTypes=[uo(this)],this._nodeTypes;if(!this.getProperty("compatible")){let e=this.parent?.nodeType?.childNodeType?.(this);if(e)return this._nodeTypes=[e],this._nodeTypes}return this._nodeTypes=this.bindingLoader.getNodeTypes(this).type,this._nodeTypes}get nodeType(){return this.nodeTypes.find(e=>!e.onBus||this.parent?.nodeType?.bus?.some(n=>n===e.onBus))}isChildOf(e){return this.parent?this.parent===e?!0:this.parent.isChildOf(e):!1}getReferenceBy(e){return this.implementations.filter(r=>r instanceof ut).some(r=>r===e)?this:[...this._nodes,...this._deletedNodes.map(r=>r.node)].map(r=>r.getReferenceBy(e)).find(r=>r)}get nodeNameOrLabelRef(){return Wf(this.implementations)}getDeepestAstNode(e,n){let r=this.implementations.find(i=>Qt(i,e,n));if(r){let i=this.deletes.map(c=>({item:this,ast:Jr(c,e,n),beforeAst:zc(c,e,n),afterAst:Wc(c,e,n)})).find(c=>Qt(c.ast,e,n));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=>Qt(c.ast,e,n)||c.ast.lastToken.value!==";"&&vE(c.ast,e,n));if(s)return s.item.getDeepestAstNode(e,n);let o=[...this._nodes,...this._deletedNodes.map(c=>c.node)].map(c=>c.getDeepestAstNode(e,n)).find(c=>c);if(o)return o;let a=Jr(r,e,n);return{item:this,ast:a,beforeAst:zc(a,e,n),afterAst:Wc(a,e,n)}}}get labels(){return this.implementations.flatMap(e=>e instanceof nt?[]: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(n=>!n.disabled).flatMap(n=>{let r=n.regArray(e),i=this._nodes.filter(s=>s!==n&&!s.disabled);return r?.flatMap(s=>{let o=i.flatMap(a=>a.regArray(e)?.filter(c=>
|
|
264
|
+
any circumstances other than under the control of the device driver using the region.`],t};var RD=()=>{let t=new W("reusable",V("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 wD=()=>{let t=new W("size",V("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,n)=>{let r=[],i=Be(e.ast.values),s=e.parent.sizeCells(n),o=[...Array.from({length:s},(a,c)=>`size${s>1?c:""}`)];if(t.signatureArgs=o.map(a=>Qn.create(a)),i?.length!==e.parent.sizeCells(n)){let a=e.ast.values??e.ast;r.push(F(19,a.firstToken,a.lastToken,a,{templateStrings:[e.name,`<${Array.from({length:s},()=>"size")}>`]}))}return r});return t.description=["Size in bytes of memory to reserve for dynamically allocated regions."],t};function ED(){let t=Zn(),e=t.properties.find(n=>n.name==="reg");return e.required=()=>"optional",t.addProperty([wD(),PD(),kD(),ND(),RD()]),t}function uo(t){switch(t?.name){case"/":return oD();case"aliases":return cD();case"memory":return lD();case"reserved-memory":return dD();case"chosen":return fD();case"cpus":return _D();case"cpu":return SD()}return t?.parent?.name==="reserved-memory"?ED():Zn()}var X=class t{constructor(e,n,r,i=null){this.bindingLoader=e;this.name=n;this.address=r;this.parent=i;this.implementations=[];this._properties=[];this._deletedProperties=[];this._deletedNodes=[];this.deletes=[];this._nodes=[];this.linkedNodeNamePaths=[];this.linkedRefLabels=[];this.interrupControlerMapping=[];this.spesifierNexusMapping=[];this.missingBinding=[];i?.addNode(this)}get definitions(){return this.implementations.filter(e=>e instanceof Ee||e instanceof nt)}static toJson(e){let n={};return e.properties.forEach(r=>n[r.name]=r.ast.values?.toJson()??!0),e.nodes.forEach(r=>n[r.fullName]=t.toJson(r)),n}get disabled(){return this.getProperty("status")?.ast.quickValues?.at(0)==="disabled"}get nodeTypes(){if(this._nodeTypes)return this._nodeTypes;if(!this.bindingLoader)return this._nodeTypes=[uo(this)],this._nodeTypes;if(!this.getProperty("compatible")){let e=this.parent?.nodeType?.childNodeType?.(this);if(e)return this._nodeTypes=[e],this._nodeTypes}return this._nodeTypes=this.bindingLoader.getNodeTypes(this).type,this._nodeTypes}get nodeType(){return this.nodeTypes.find(e=>!e.onBus||this.parent?.nodeType?.bus?.some(n=>n===e.onBus))}isChildOf(e){return this.parent?this.parent===e?!0:this.parent.isChildOf(e):!1}getReferenceBy(e){return this.implementations.filter(r=>r instanceof ut).some(r=>r===e)?this:[...this._nodes,...this._deletedNodes.map(r=>r.node)].map(r=>r.getReferenceBy(e)).find(r=>r)}get nodeNameOrLabelRef(){return Wf(this.implementations)}getDeepestAstNode(e,n){let r=this.implementations.find(i=>Qt(i,e,n));if(r){let i=this.deletes.map(c=>({item:this,ast:Jr(c,e,n),beforeAst:zc(c,e,n),afterAst:Wc(c,e,n)})).find(c=>Qt(c.ast,e,n));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=>Qt(c.ast,e,n)||c.ast.lastToken.value!==";"&&vE(c.ast,e,n));if(s)return s.item.getDeepestAstNode(e,n);let o=[...this._nodes,...this._deletedNodes.map(c=>c.node)].map(c=>c.getDeepestAstNode(e,n)).find(c=>c);if(o)return o;let a=Jr(r,e,n);return{item:this,ast:a,beforeAst:zc(a,e,n),afterAst:Wc(a,e,n)}}}get labels(){return this.implementations.flatMap(e=>e instanceof nt?[]: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(n=>!n.disabled).flatMap(n=>{let r=n.regArray(e),i=this._nodes.filter(s=>s!==n&&!s.disabled);return r?.flatMap(s=>{let o=i.flatMap(a=>a.regArray(e)?.filter(c=>Lt(c.startAddress,s.endAddress)<0&&Lt(s.startAddress,c.endAddress)<0).flatMap(c=>({reg:c,node:a}))).filter(a=>!!a);return o.length?Yt(10,s.rangeTokens.start,s.rangeTokens.end,n.properties.find(a=>a.name==="reg")?.ast??n.implementations[0],{severity:wr.DiagnosticSeverity.Information,linkedTo:o.map(a=>({range:on(a.reg.rangeTokens.start,a.reg.rangeTokens.end),fsPath:a.reg.rangeTokens.start.fsPath})),templateStrings:[n.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 n=[...this.properties.flatMap(r=>r.issues),...this._nodes.flatMap(r=>r.getIssues(e)),...this._deletedNodes.flatMap(r=>r.node.getIssues(e)),...this.deletedPropertiesIssues,...this.deletedNodesIssues,...this.missingBinding,...this.getOverlappingNodeAddressesIssues(e)];if(this.name==="/"&&this.implementations.length&&!this._nodes.some(r=>r.name==="cpus")){let r=this.implementations[this.implementations.length-1],i=r.identifierAst??r;n.push(Yt(9,i.firstToken,i.lastToken,i,{severity:wr.DiagnosticSeverity.Error,linkedTo:this.implementations.slice(0,-1),templateStrings:["/","cpus"]}))}return n}get deletedPropertiesIssues(){return[...this._deletedProperties.flatMap(e=>[Yt(6,e.property.ast.firstToken,e.property.ast.lastToken,e.property.ast,{severity:wr.DiagnosticSeverity.Hint,tags:[wr.DiagnosticTag.Deprecated],linkedTo:[e.by],templateStrings:[e.property.name]}),...e.property.allReplaced.map(n=>Yt(6,n.ast.firstToken,n.ast.lastToken,n.ast,{severity:wr.DiagnosticSeverity.Hint,linkedTo:[e.by],tags:[wr.DiagnosticTag.Deprecated],templateStrings:[e.property.name]})),...e.property.issues])]}get deletedNodesIssues(){return this._deletedNodes.flatMap(e=>[...e.node.implementations.filter(n=>n instanceof Ee||n instanceof ut).flatMap(n=>{let r;return n instanceof Ee?r=n.name.toString():n.reference instanceof ie?r=n.reference.label.value:r=n.reference.path.pathParts.at(-1).name,Yt(7,n.firstToken,n.lastToken,n,{severity:wr.DiagnosticSeverity.Hint,linkedTo:[e.by],tags:[wr.DiagnosticTag.Deprecated],templateStrings:[r]})})])}get path(){return this.parent?[...this.parent.path,this.fullName]:[this.fullName]}get pathString(){return`/${this.path.slice(1).join("/")}`}get defaultProperties(){let e=(this.nodeType?.defaultProperties??[]).filter(s=>!this.getProperty(s.name)&&s.name!=="#address-cells"&&s.name!=="#size-cells"&&s.name!=="status"),n=this.nodes.flatMap(s=>s.defaultProperties);if(!e.length&&!n.length)return[];if(!e.length)return n;let r=this.definitions.at(-1);return[{fsPath:jf(r.firstToken.fsPath,ce(r)),text:`&{${this.pathString}} {
|
|
265
265
|
${e.map(s=>{if(s.default===void 0)return;let o=Array.isArray(s.default)?s.default:[s.default];switch(s.type){case"array":case"uint8-array":case"int":return`${s.name} = <${o.map(a=>a.toString()).join(" ")}>;`;case"string":case"string-array":return`${s.name} = ${o.map(a=>`"${a.toString()}"`).join(", ")};`}}).join(`;
|
|
266
266
|
`)}
|
|
267
|
-
};`},...n]}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,n){return this._nodes.some(r=>r.name===e&&(r.address===n||r.address?.every((i,s)=>n?.at(s)===i)))}hasProperty(e){return this._properties.some(n=>n.name===e)}getProperty(e){return this._properties.find(n=>n.name===e)}deleteNode(e,n,r){let i=this._nodes.findIndex(s=>s.name===e&&(s.address===r||r?.every((o,a)=>s.address?.at(a)===o)));i!==-1&&(this._deletedNodes.push({node:this._nodes[i],by:n}),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 ct){let n=e.values.at(0)?.value;if(n instanceof sn)return this.#e=n.value,this.#e}}getAllPhandle(e){return e===this.phandle?[this,...this._nodes.flatMap(n=>n.getAllPhandle(e))]:this._nodes.flatMap(n=>n.getAllPhandle(e))}getPhandle(e){if(this.phandle===e)return this;for(let n of this._nodes){let r=n.getPhandle(e);if(r)return r}}getNode(e,n,r=!0){let i=r||!!n||this._nodes.filter(o=>o.name===e).length>1,s=this._nodes.findIndex(o=>o.name===e&&(!i||o.address===n||o.address?.every((a,c)=>n?.at(c)===a)));if(s!==-1)return this._nodes[s]}deleteProperty(e,n){let r=this._properties.findIndex(i=>i.name===e);r!==-1&&(this._deletedProperties.push({property:this._properties[r],by:n}),this._properties.splice(r,1))}addNode(e){this._nodes.push(e)}addProperty(e){let n=this._properties.findIndex(r=>r.name===e.name);if(n===-1)this._properties.push(e);else{let r=this._properties.splice(n,1)[0];this._properties.push(e),e.replaces=r,r.replacedBy=e}if(e.name==="compatible")if(this.bindingLoader){let r=this.bindingLoader.getNodeTypes(this);this._nodeTypes=r.type,this.missingBinding.push(...r.issues)}else this._nodeTypes=[uo(this)]}getChild(e,n=!0){if(e.length===1&&e[0]==="/"&&this.name==="/")return this;let r=[...e];r.splice(0,1);let i=r[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,n);return r.length===1||!a?a:a.getChild(r)}getChildFromScope(e,n){if(e.length===1&&e[0]===this.fullName)return this;if(e[0]!==this.fullName)return;let r=[...e];return r.splice(0,1),[...this._nodes,...this._deletedNodes.filter(s=>!n(s.by)).map(s=>s.node)].find(s=>s.fullName===r[0])?.getChildFromScope(r,n)}get fullName(){return this.address!==void 0?`${this.name}@${this.address.map(e=>e.toString(16)).join(",")}`:this.name}#n;regArray(e){if(this.#n!==void 0)return this.#n;let n=this.getProperty("reg");if(!n){this.#n=null;return}let r=this.parentAddressCells(e),i=this.parentSizeCells(e),s=[],o=Be(n.ast.values)?.reverse();for(;o?.length;){let a=Array.from({length:r}).map(()=>o.pop()),c=Array.from({length:i}).map(()=>o.pop());if(![...a,...c].every(f=>f instanceof me))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:Xr(l,u),size:u,rangeTokens:he(d,c.at(-1)?.lastToken??a.at(-1)?.lastToken)})}return this.#n=s,this.#n}#r;rangeMap(e){if(this.#r!==void 0)return this.#r;let n=this.getProperty("ranges");if(!n)
|
|
267
|
+
};`},...n]}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,n){return this._nodes.some(r=>r.name===e&&(r.address===n||r.address?.every((i,s)=>n?.at(s)===i)))}hasProperty(e){return this._properties.some(n=>n.name===e)}getProperty(e){return this._properties.find(n=>n.name===e)}deleteNode(e,n,r){let i=this._nodes.findIndex(s=>s.name===e&&(s.address===r||r?.every((o,a)=>s.address?.at(a)===o)));i!==-1&&(this._deletedNodes.push({node:this._nodes[i],by:n}),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 ct){let n=e.values.at(0)?.value;if(n instanceof sn)return this.#e=n.value,this.#e}}getAllPhandle(e){return e===this.phandle?[this,...this._nodes.flatMap(n=>n.getAllPhandle(e))]:this._nodes.flatMap(n=>n.getAllPhandle(e))}getPhandle(e){if(this.phandle===e)return this;for(let n of this._nodes){let r=n.getPhandle(e);if(r)return r}}getNode(e,n,r=!0){let i=r||!!n||this._nodes.filter(o=>o.name===e).length>1,s=this._nodes.findIndex(o=>o.name===e&&(!i||o.address===n||o.address?.every((a,c)=>n?.at(c)===a)));if(s!==-1)return this._nodes[s]}deleteProperty(e,n){let r=this._properties.findIndex(i=>i.name===e);r!==-1&&(this._deletedProperties.push({property:this._properties[r],by:n}),this._properties.splice(r,1))}addNode(e){this._nodes.push(e)}addProperty(e){let n=this._properties.findIndex(r=>r.name===e.name);if(n===-1)this._properties.push(e);else{let r=this._properties.splice(n,1)[0];this._properties.push(e),e.replaces=r,r.replacedBy=e}if(e.name==="compatible")if(this.bindingLoader){let r=this.bindingLoader.getNodeTypes(this);this._nodeTypes=r.type,this.missingBinding.push(...r.issues)}else this._nodeTypes=[uo(this)]}getChild(e,n=!0){if(e.length===1&&e[0]==="/"&&this.name==="/")return this;let r=[...e];r.splice(0,1);let i=r[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,n);return r.length===1||!a?a:a.getChild(r)}getChildFromScope(e,n){if(e.length===1&&e[0]===this.fullName)return this;if(e[0]!==this.fullName)return;let r=[...e];return r.splice(0,1),[...this._nodes,...this._deletedNodes.filter(s=>!n(s.by)).map(s=>s.node)].find(s=>s.fullName===r[0])?.getChildFromScope(r,n)}get fullName(){return this.address!==void 0?`${this.name}@${this.address.map(e=>e.toString(16)).join(",")}`:this.name}#n;regArray(e){if(this.#n!==void 0)return this.#n;let n=this.getProperty("reg");if(!n){this.#n=null;return}let r=this.parentAddressCells(e),i=this.parentSizeCells(e),s=[],o=Be(n.ast.values)?.reverse();for(;o?.length;){let a=Array.from({length:r}).map(()=>o.pop()),c=Array.from({length:i}).map(()=>o.pop());if(![...a,...c].every(f=>f instanceof me))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:Xr(l,u),size:u,rangeTokens:he(d,c.at(-1)?.lastToken??a.at(-1)?.lastToken)})}return this.#n=s,this.#n}#r;rangeMap(e){if(this.#r!==void 0)return this.#r;let n=this.getProperty("ranges");if(!n)return this.#r=null,null;let r=this.sizeCells(e),i=this.addressCells(e),s=this.parentAddressCells(e),o=[],a=Be(n.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:r}).map(()=>a.pop());if(![...c,...l,...u].every(h=>h instanceof me))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:he(m,u.at(-1).lastToken)})}return this.#r=o.length?o:this.parent?.rangeMap(e)??[],this.#r}#t;dmaRangeMap(e){if(this.#t!==void 0)return this.#t;let n=this.getProperty("dma-ranges");if(!n)return this.#t=null,null;let r=this.sizeCells(e),i=this.addressCells(e),s=this.parentAddressCells(e),o=[],a=Be(n.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:r}).map(()=>a.pop());if(![...c,...l,...u].every(h=>h instanceof me))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:he(m,u.at(-1).lastToken)})}return this.#t=o.length?o:this.parent?.dmaRangeMap(e)??[],this.#t}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 n=this?.getProperty("#address-cells");return this.#o=n?We(n,0,0,e)??2:2,this.#o}#h;sizeCells(e){if(this.#h!==void 0)return this.#h;let n=this.getProperty("#size-cells");return this.#h=n?We(n,0,0,e)??1:1,this.#h}#a;mappedReg(e){if(this.#a!==void 0)return this.#a;let n=this.parent,r=this.regArray(e);do{let i=n?.rangeMap(e);this.#a=r?.flatMap(s=>{let o=s.startAddress,a=s.size,c=Xr(o,a),l={startAddress:o,startAddressRaw:o,size:a,endAddress:c,endAddressRaw:c,inMappingRange:!1,regRangeTokens:{start:s.rangeTokens.start,end:s.rangeTokens.end},missingMapping:!1};if(!i?.length)return[l];let u=kE(i,o);return u.length?u.map(d=>(l.mappedAst={range:d.range,fsPath:d.fsPath},l.startAddress=d.start,l.endAddress=Xr(l.startAddress,a),l.inMappingRange=Lt(l.endAddress,d.end)<=0,l.mappingEnd=d.end,{...l,mappedAst:{range:d.range,fsPath:d.fsPath},startAddress:d.start,endAddress:Xr(d.start,a),inMappingRange:Lt(l.endAddress,d.end)<=0,mappingEnd:d.end})):(l.missingMapping=!0,[l])}).sort((s,o)=>Lt(s.endAddress,o.endAddress))??[],r=this.#a.map(s=>({startAddress:s.startAddress,size:s.size,endAddress:s.endAddress,rangeTokens:s.regRangeTokens})),n=n?.parent}while(n&&this.#a.every(i=>!i.missingMapping&&i.inMappingRange));return this.#a}get interruptsParent(){if(this.getProperty("interrupts-extended"))return null;let e=this.bindingLoader?.type==="Zephyr",n=this.getProperty("interrupt-parent"),r=n?Rr(n?.ast.values?.values.at(0),this.root):e?void 0:this.parent;return!e||n?{interruptParent:n,parentInterruptNode:r??null}:r?{interruptParent:n,parentInterruptNode:r??null}:this.parent?this.parent.interruptsParent:{parentInterruptNode:this}}getNexusMapEntryMatch(e,n,r,i=[]){let s=new te(he(r[0].firstToken,r.at(-1).lastToken)),o=this.getNexusMap(e,n);if(o){let a=[...i.map((l,u)=>l&(o.mapMask.at(u)??4294967295)),...r.map((l,u)=>{let d=l instanceof me?l.evaluate(n):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 me?u.evaluate(n):u).toString()).join(":")===a);return{entry:s,match:c}}return{entry:s}}getNexusMap(e,n){let r=this.getProperty(`${e}-map`),i=Be(r?.ast.values);if(!i?.length)return;let s=this.root,o=this.getProperty(`#${e}-cells`);if(!o)return;let a=We(o,0,0,n);if(a==null)return;e==="interrupt"&&(a+=this.addressCells(n));let c=[],l=0;for(;l<i.length;){let f=i.slice(l,a+l),p={childCellCount:a,mappingValues:f};if(c.push(p),l+=a,i.length<l+1)break;p.nodeAst=i[l];let m=Rr(p.nodeAst,s);if(!m)break;p.node=m;let h=m.getProperty(`#${e}-cells`);if(!h)return;l++;let y=We(h,0,0,n);if(y==null||(e==="interrupt"&&(y+=m.addressCells(n)),p.parentCellCount=y,l+=y,i.length<l))break;p.parentValues=i.slice(l-y,l)}let u=this.getProperty(`${e}-map-mask`);return{mapMask:Array.from({length:a}).map((f,p)=>(u?We(u,0,p,n):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?`
|
|
268
268
|
`:""}${this.properties.map(n=>n.toPrettyString(e)).join(`
|
|
269
269
|
`)}${this.nodes.length?`
|
|
270
270
|
${this.nodes.map(n=>`${n.fullName} { /* ... */ };`).join(`
|
|
@@ -285,39 +285,39 @@ ${" ".repeat(r)}`)}${this.nodes.length?`${this.properties.length?`
|
|
|
285
285
|
|
|
286
286
|
${" ".repeat(r)}`)}`:""}
|
|
287
287
|
${" ".repeat(r-1)}};`}serialize(e,n,r=()=>!0){let i=this.mappedReg(n),s=this.implementations.filter(r),o=this.nodeType;e[this.pathString]={nodeType:o instanceof St?{...o,extends:Array.from(this.nodeType?.extends??[]),properties:o.properties.map(a=>({name:typeof a.name=="string"?a.name:a.name.toString(),nameIsRegex:typeof a.name!="string",allowedValues:a.allowedValues,type:a.type,description:a.description?.join(`
|
|
288
|
-
`),required:a.required(this)==="required"})),zephyrBinding:o.zephyrBinding,vendor:o.vendor}:void 0,issues:s.flatMap(a=>a.serializeIssues),path:this.pathString,disabled:this.disabled,name:this.name,fullName:this.fullName,labels:Array.from(new Set(this.labels.filter(r).map(a=>a.label.value))),nodes:s.filter(r).map(a=>a.serialize(n)),properties:this.properties.map(a=>a.serialize(n,r)).filter(a=>!!a),childNodes:this.nodes.filter(a=>a.implementations.some(r)).map(a=>a.pathString),reg:i?.map(a=>({mappedStartAddress:a?.startAddress,mappedEndAddress:a?.endAddress,startAddress:a?.startAddressRaw,endAddress:a?.endAddressRaw,size:a?.size,inMappingRange:a?.inMappingRange})),interruptControllerMappings:this.interrupControlerMapping.map(a=>({cells:a.expressions.map(c=>c.serialize(n)),path:a.node.pathString,property:a.property.ast.serialize(n),specifierSpace:a.specifierSpace})),specifierNexusMappings:this.spesifierNexusMapping.map(a=>({cells:a.expressions.map(c=>c.serialize(n)),path:a.node.pathString,propertyNodePath:a.property.parent.pathString,property:a.property.ast.serialize(n),specifierSpace:a.specifierSpace})),nexusMaps:this.properties.filter(a=>!!a.name.match(/^(?!no-).*?-map$/)).flatMap(a=>{let c=a.name.split("-map",1)[0];return(this.getNexusMap(c,n)?.map??[]).map(u=>({childCellCount:u.childCellCount,mappingValues:u.mappingValues.map(d=>d.serialize(n)),target:u.node?.pathString,targetAst:u.nodeAst?.serialize(n),parentCellCount:u.parentCellCount,parentValues:u.parentValues?.map(d=>d.serialize(n)),specifierSpace:c}))})??[],deletedProperties:this.deletedProperties.filter(a=>r(a.by)).map(a=>({deleteAst:a.by.serialize(n),deletedAst:a.property.serialize(n,r)})).filter(a=>!!a.deletedAst)},this.nodes.filter(a=>a.implementations.some(r)).forEach(a=>a.serialize(e,n,r))}get memoryRegionName(){return this.parent?.name==="/"||this.parent?.properties.some(e=>e.name==="ranges")?this.parent.memoryRegionName:this.pathString}getMemoryViews(e){let n=[],r=this.memoryRegionName;return this.properties.some(i=>i.name==="reg")&&this.mappedReg(e)?.forEach(i=>{let s=i.startAddress,o=i.size;n.push({name:r,labels:Array.from(new Set(this.labels.map(a=>a.label.toString()))),nodePath:this.pathString,start:s,size:o,disabled:this.disabled})}),n.push(...this.nodes.flatMap(i=>i.getMemoryViews(e))),n}};var Ta=L(U());var VT=L(U());var ys=class extends te{constructor(n,r){super(r);this.label=n;this.docSymbolsMeta={name:this.label.value,kind:VT.SymbolKind.Constant},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration",this.addChild(n)}toString(){return`${this.label.toString()}:`}serialize(n){return{value:this.label.value,...super.serialize(n)}}},gn=class extends te{constructor(n,r){super(r);this.value=n;this.docSymbolsMeta={name:this.value,kind:VT.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}buildSemanticTokens(n){let r=this.parentNode;if(!(r instanceof ie&&r.linksTo)){super.buildSemanticTokens(n);return}n(Hi("type"),Vi("declaration"),this.firstToken,this.lastToken)}toString(){return`${this.value}`}};var Je=class{constructor(e,n){this.ast=e;this.parent=n;this.nexusMapsTo=[]}getDeepestAstNode(e,n){let r=Jr(this.ast,e,n);return this.ast.assignOperatorToken&&gs(this.ast.assignOperatorToken,e,n)?{item:this,ast:r,beforeAst:zc(this.ast,e,n),afterAst:Wc(this.ast,e,n)}:{item:this,ast:r}}get name(){return this.ast.propertyName?.name??"[UNSET]"}get labels(){return this.ast.allDescendants.filter(e=>e instanceof ys)}get labelsMapped(){return this.labels.map(e=>({label:e,owner:this.ast.labels.some(n=>n===e)?this:null}))}getArgumentIndex(e){if(!e)return;let n=this.ast.getFlatAstValues()?.findIndex(r=>r===e||r?.isAncestorOf(e));return n===-1?void 0:n}get issues(){return this.replacedIssues}get replacedIssues(){return[...this.replaces?.replacedIssues??[],...this.replaces?[
|
|
288
|
+
`),required:a.required(this)==="required"})),zephyrBinding:o.zephyrBinding,vendor:o.vendor}:void 0,issues:s.flatMap(a=>a.serializeIssues),path:this.pathString,disabled:this.disabled,name:this.name,fullName:this.fullName,labels:Array.from(new Set(this.labels.filter(r).map(a=>a.label.value))),nodes:s.filter(r).map(a=>a.serialize(n)),properties:this.properties.map(a=>a.serialize(n,r)).filter(a=>!!a),childNodes:this.nodes.filter(a=>a.implementations.some(r)).map(a=>a.pathString),reg:i?.map(a=>({mappedStartAddress:a?.startAddress,mappedEndAddress:a?.endAddress,startAddress:a?.startAddressRaw,endAddress:a?.endAddressRaw,size:a?.size,inMappingRange:a?.inMappingRange})),interruptControllerMappings:this.interrupControlerMapping.map(a=>({cells:a.expressions.map(c=>c.serialize(n)),path:a.node.pathString,property:a.property.ast.serialize(n),specifierSpace:a.specifierSpace})),specifierNexusMappings:this.spesifierNexusMapping.map(a=>({cells:a.expressions.map(c=>c.serialize(n)),path:a.node.pathString,propertyNodePath:a.property.parent.pathString,property:a.property.ast.serialize(n),specifierSpace:a.specifierSpace})),nexusMaps:this.properties.filter(a=>!!a.name.match(/^(?!no-).*?-map$/)).flatMap(a=>{let c=a.name.split("-map",1)[0];return(this.getNexusMap(c,n)?.map??[]).map(u=>({childCellCount:u.childCellCount,mappingValues:u.mappingValues.map(d=>d.serialize(n)),target:u.node?.pathString,targetAst:u.nodeAst?.serialize(n),parentCellCount:u.parentCellCount,parentValues:u.parentValues?.map(d=>d.serialize(n)),specifierSpace:c}))})??[],deletedProperties:this.deletedProperties.filter(a=>r(a.by)).map(a=>({deleteAst:a.by.serialize(n),deletedAst:a.property.serialize(n,r)})).filter(a=>!!a.deletedAst)},this.nodes.filter(a=>a.implementations.some(r)).forEach(a=>a.serialize(e,n,r))}get memoryRegionName(){return this.parent?.name==="/"||this.parent?.properties.some(e=>e.name==="ranges")?this.parent.memoryRegionName:this.pathString}getMemoryViews(e){let n=[],r=this.memoryRegionName;return this.properties.some(i=>i.name==="reg")&&this.mappedReg(e)?.forEach(i=>{let s=i.startAddress,o=i.size;n.push({name:r,labels:Array.from(new Set(this.labels.map(a=>a.label.toString()))),nodePath:this.pathString,start:s,size:o,disabled:this.disabled})}),n.push(...this.nodes.flatMap(i=>i.getMemoryViews(e))),n}};var Ta=L(U());var VT=L(U());var ys=class extends te{constructor(n,r){super(r);this.label=n;this.docSymbolsMeta={name:this.label.value,kind:VT.SymbolKind.Constant},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration",this.addChild(n)}toString(){return`${this.label.toString()}:`}serialize(n){return{value:this.label.value,...super.serialize(n)}}},gn=class extends te{constructor(n,r){super(r);this.value=n;this.docSymbolsMeta={name:this.value,kind:VT.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}buildSemanticTokens(n){let r=this.parentNode;if(!(r instanceof ie&&r.linksTo)){super.buildSemanticTokens(n);return}n(Hi("type"),Vi("declaration"),this.firstToken,this.lastToken)}toString(){return`${this.value}`}};var Je=class{constructor(e,n){this.ast=e;this.parent=n;this.nexusMapsTo=[]}getDeepestAstNode(e,n){let r=Jr(this.ast,e,n);return this.ast.assignOperatorToken&&gs(this.ast.assignOperatorToken,e,n)?{item:this,ast:r,beforeAst:zc(this.ast,e,n),afterAst:Wc(this.ast,e,n)}:{item:this,ast:r}}get name(){return this.ast.propertyName?.name??"[UNSET]"}get labels(){return this.ast.allDescendants.filter(e=>e instanceof ys)}get labelsMapped(){return this.labels.map(e=>({label:e,owner:this.ast.labels.some(n=>n===e)?this:null}))}getArgumentIndex(e){if(!e)return;let n=this.ast.getFlatAstValues()?.findIndex(r=>r===e||r?.isAncestorOf(e));return n===-1?void 0:n}get issues(){return this.replacedIssues}get replacedIssues(){return[...this.replaces?.replacedIssues??[],...this.replaces?[Yt(0,this.replaces.ast.firstToken,this.replaces.ast.lastToken,this.replaces.ast,{severity:Ta.DiagnosticSeverity.Hint,linkedTo:[this.ast],tags:[Ta.DiagnosticTag.Unnecessary],templateStrings:[this.name]})]:[]]}onHover(){if(this.nexusMapsTo.length)return{kind:Ta.MarkupKind.Markdown,value:["### Nexus mappings",...this.nexusMapsTo.filter(e=>!!e.mapItem).flatMap(e=>["```",`${this.name} = <... ${e.mappingValuesAst.map(n=>n.toString()).join(" ")} ...> maps to <... ${e.mapItem.mappingValues.map(n=>n.toString()).join(" ")} ...>;`,"```",`[Mapping (${e.mappingValuesAst.map(n=>n.toString()).join(" ")})](${`${e.mapItem.mappingValues[0].fsPath}#L${e.mapItem.mappingValues[0].firstToken.pos.line+1}`})`])].join(`
|
|
289
289
|
`)}}get allReplaced(){return this.replaces?[this.replaces,...this.replaces.allReplaced]:[]}toString(){return this.ast.toString()}toPrettyString(e,n){return this.ast.toPrettyString(e,n)}serialize(e,n=()=>!0){let r=[this,...this.allReplaced].find(i=>n(i.ast));if(r)return{...r.ast.serialize(e),nodePath:this.parent.pathString,replaces:r.allReplaced.map(i=>({range:ce(i.ast),url:i.ast.serializeURL,values:i.ast.values===void 0?void 0:i.ast.values?.values.map(s=>s?.value?.serialize(e)??null)??null})),nexusMapEntry:r.nexusMapsTo.map(i=>({mappingValuesAst:i.mappingValuesAst.map(s=>s.serialize(e)),cellCount:i.cellCount,specifierSpace:i.specifierSpace,target:i.target.pathString,mapItem:i.mapItem?{childCellCount:i.mapItem.childCellCount,mappingValues:i.mapItem.mappingValues.map(s=>s.serialize(e)),target:i.mapItem.node?.pathString,targetAst:i.mapItem.nodeAst?.serialize(e),parentCellCount:i.mapItem.parentCellCount,parentValues:i.mapItem.parentValues?.map(s=>s.serialize(e)),specifierSpace:i.specifierSpace??"interrupt"}:void 0}))}}};var LD=L(U());var ol=require("fs");var er=class t{constructor(e,n){this.text=e;this.fsPath=n;this.inComment=!1;this.lineNumber=0;this.columnNumber=0;this._tokens=[];let r=this.text.replace(/\r\n/g,`
|
|
290
290
|
`).trimEnd();this.lines=r.split(`
|
|
291
291
|
`);for(let i=0;i<this.lines.length;i++)this.lines[i]+=`
|
|
292
292
|
`;this.lexIt()}get tokens(){return this._tokens}isWhiteSpace(){let e=this.currentChar;if(!e)return!1;let n=e.charCodeAt(0);return n===32||n===9||n===10||n===13||n===12||n===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 n=this.lines[this.lineNumber].length;return this.columnNumber>=n?this.moveToNextLine():(this.columnNumber++,this.columnNumber>=n&&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 n=this.lineNumber;if(!this.move()||this.lineNumber!==n)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 n=e;for(;this.currentChar!==e;){if(this.currentChar===`
|
|
293
|
-
`){let o=this.lineNumber,a=this.columnNumber,c=n.length;this.pushToken({tokens:[21],value:n,pos:{col:a-c,line:o,len:c,colEnd:a}}),n=""}else if(this.currentChar==="\\"){let o=this.lineNumber;if(n+=this.currentChar??"",this.move())o===this.lineNumber&&(n+=this.currentChar??"");else break}else n+=this.currentChar??"";if(!this.move())break}n+=e;let r=this.lineNumber,i=this.columnNumber+1,s=n.length;this.pushToken({tokens:[21],value:n,pos:{col:i-s,line:r,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 n=this.isString(e);if(!n){let i=t.KEYWORD_TOKENS.get(e.toLowerCase());if(i&&(n=!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(Yt(this.tokens[s-1],this.tokens[s]))n=!1,this.tokens.pop();else return!0}}if(n||(n=this.isDigit(e)||this.isHexDigit(e)||this.isLetters(e)),!n&&e.length===1){let i=t.SINGLE_CHAR_TOKENS.get(e);if(i)return n=!0,this.pushToken({tokens:i,value:e,pos:this.generatePos(e,e)}),!0}if(n||(n=this.isHash(e)||this.unknownToken(e)),!n)throw new Error(`Lexer is not complete!!! Could not find token for "${e}"`);let r=this._tokens[this._tokens.length-1];return n&&!r?.tokens.some(i=>i===21)&&r&&r.pos.len<e.length?this.process(e.slice(r.pos.len)):!0}pushToken(e){let n={tokens:e.tokens,pos:e.pos,value:e.value,fsPath:this.fsPath},r=this._tokens[this._tokens.length-1];n.prevToken=r,r&&(r.nextToken=n),this._tokens.push(n)}isLetters(e){let n=e[0]?.charCodeAt(0);if(t.isLetterCode(n)){let r="";for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(t.isLetterCode(s))r+=e[i];else break}return this.pushToken({tokens:[47],value:r,pos:this.generatePos(e,r)}),!0}return!1}isDigit(e){let n=e[0],r=n?.charCodeAt(0);return r>=48&&r<=57?(this.pushToken({tokens:[20,19],value:n,pos:this.generatePos(e,n)}),!0):!1}isHexDigit(e){let n=e[0],r=n?.charCodeAt(0);return r>=65&&r<=70||r>=97&&r<=102?(this.pushToken({tokens:[20,47],value:n,pos:this.generatePos(e,n)}),!0):!1}isHash(e){let n="#";return e.startsWith(n)?(this.pushToken({tokens:[46],pos:this.generatePos(e,n),value:n}),!0):!1}unknownToken(e){return this.pushToken({tokens:[41],pos:this.generatePos(e," "),value:e}),!0}isString(e){if(this.inComment)return!1;let n=e[0];if(n==='"'||n==="'"){let r=e.length-1;if(this.columnNumber+1<r)throw new Error("Error while rewinding");return this.columnNumber-=r,this.getString(n),!0}return!1}generatePos(e,n){let r=this.columnNumber-e.length,i=n.length;return{line:this.lineNumber,col:r,len:i,colEnd:r+i}}};var WT=require("fs"),Sa=require("path"),il=L(U());var At=class extends te{constructor(e){super(e),this.semanticTokenType="keyword",this.semanticTokenModifiers="declaration"}};var DD=require("path"),np=L(U());var Zr=class extends te{constructor(n,r){super();this.keyword=n;this.path=r;this.docSymbolsMeta={name:`Include ${r}`,kind:np.SymbolKind.File},this.addChild(n),this.addChild(r)}get resolvedPath(){return this._resolvedPath}set resolvedPath(n){this.docSymbolsMeta={name:`Include ${n}`,kind:np.SymbolKind.File},this._resolvedPath=n}},va=class extends te{constructor(n,r,i){super(i);this._path=n;this.relative=r;this.docSymbolsMeta={name:(0,DD.basename)(this.path),kind:np.SymbolKind.File},this.semanticTokenType="string",this.semanticTokenModifiers="declaration"}get path(){return this.relative?this._path.slice(1,-1):this._path}};var AD=L(U());var Tt=class extends me{constructor(n,r){super(r);this.name=n;this.docSymbolsMeta={name:this.name.toString(),kind:AD.SymbolKind.Variable},this.semanticTokenType="macro",this.semanticTokenModifiers="declaration"}toString(){return this.name}};var rp=class extends te{constructor(n,r){super(r);this.operator=n;this.semanticTokenType="operator",this.semanticTokenModifiers="declaration"}toString(){return this.operator}};var ID=L(U());var ba=class extends At{toString(){return"..."}},ei=class extends te{constructor(n,r){super();this.functionName=n;this.params=r;this.addChild(n),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(n){return fe(this.fsPath,n)?[{name:this.functionName.name,kind:ID.SymbolKind.Function,range:ce(this),selectionRange:ce(this),children:this.params.flatMap(r=>r.getDocumentSymbols(n))}]:[]}toString(){return`${this.functionName}(${this.params.map(n=>n.toString()).join(",")})`}};var zi=class t{constructor(){this.positionStack=[];this._issues=[];this.issueLengthPositionStack=[];this.moveEndOfLine=(e,n=!0,r=!1)=>{let i=e.pos.line;if(this.currentToken?.pos.line!==i||!fe(this.currentToken?.fsPath,e.fsPath))return;let s=this.currentToken,o=s;for(;this.currentToken?.pos.line===i&&fe(this.currentToken?.fsPath,e.fsPath);)o=this.moveToNextToken;return n&&this._issues.push(Y(22,s,o,null)),r&&o?.value==="\\"&&o.nextToken?this.moveEndOfLine(o.nextToken,n):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(),n=this.positionStack.pop();if(n===void 0||e===void 0)throw new Error("Index out of bounds");this.positionStack[this.positionStack.length-1]=n}peekIndex(e=1){let n=this.positionStack.at(-1*e);if(n===void 0)throw new Error("Index out of bounds");return n}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 n=[];return e.every(r=>{let i=this.currentToken,s=r(i),o=!1;return s!=="no"&&i&&(n.push(i),this.moveToNextToken,o=Yt(i,this.currentToken)),s==="yes"&&o}),this.mergeStack(),n}consumeAnyConcurrentTokens(e){this.enqueueToStack();let n=[],r,i=!0;for(;e.some(s=>s(this.currentToken)==="yes"&&i);)n.push(this.currentToken),r=this.moveToNextToken,i=Yt(r,this.currentToken);return this.mergeStack(),n}getDocumentSymbols(e){return this.allAstItems.flatMap(n=>n.getDocumentSymbols(e))}getWorkspaceSymbols(){return this.allAstItems.flatMap(e=>e.getWorkspaceSymbols())}static push(e,n,r,i,s,o){if(!r||!i||!fe(r.fsPath,s)||!fe(i.fsPath,s))return;let a=i.pos.colEnd-r.pos.col;o.push({line:r.pos.line,char:r.pos.col,length:i===r?i.pos.len:a,tokenType:e,tokenModifiers:n})}buildSemanticTokens(e,n,r=[]){this.allAstItems.forEach(i=>{i.buildSemanticTokens((...s)=>t.push(...s,n,r))}),r.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,n,r=!1){this.enqueueToStack();let i=this.consumeAnyConcurrentTokens([19,47,48].map(Fe));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 Tt(s,he(i[0],i.at(-1)));if(r&&!e.has(o.name)){this.popStack();return}return!n&&o.firstToken!==o.lastToken&&o.name!=="defined"&&(e.get(o.name)||this._issues.push(Y(42,o.firstToken,o.lastToken,o))),this.mergeStack(),o}isOperator(){this.enqueueToStack();let e=this.moveToNextToken;if(!e){this.popStack();return}let n=e,r;if(H(e,40)?(r="&",H(this.currentToken,40)&&(r="&&",n=this.moveToNextToken)):H(e,6)?(r="!",H(this.currentToken,0)&&(r="!=",n=this.moveToNextToken)):H(e,10)?r="~":H(e,8)?(r="|",H(this.currentToken,8)&&(r="||",n=this.moveToNextToken)):H(e,9)?r="^":H(e,4)?(r=">",H(this.currentToken,4)?(r=">>",n=this.moveToNextToken):H(this.currentToken,0)&&(r=">=",n=this.moveToNextToken)):H(e,5)?(r="<",H(this.currentToken,5)?(r="<<",n=this.moveToNextToken):H(this.currentToken,0)&&(r="<=",n=this.moveToNextToken)):H(e,15)?r="+":H(e,16)?r="-":H(e,17)?r="*":H(e,13)?r="/":H(e,18)?r="%":H(e,46)?H(this.currentToken,46)&&(r="##",n=this.moveToNextToken):H(e,0)&&H(this.currentToken,0)&&(r="==",n=this.moveToNextToken),r){let i=new rp(r,he(e,n));return this.mergeStack(),i}this.popStack()}parseScopedBlock(e,n,r){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&&!n(d);){if(r?.(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,n,r);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&&n(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 n=this.processCIdentifier(e,!1);if(!n){this.popStack();return}if(!(e.get(n.name)?.macro.identifier instanceof ei)&&!Yt(n.lastToken,this.currentToken)){this.popStack();return}let i=this.processMacroCallParams();if(!i){this.popStack();return}if(n.name==="defined")i.length>1?this._issues.push(Y(44,n.firstToken,n.lastToken,n)):i.length<1&&this._issues.push(Y(45,n.firstToken,n.lastToken,n));else{let o=e.get(n.name)?.macro;o&&(o?.identifier instanceof ei?o.identifier.params.at(-1)instanceof ba||(i.length>o.identifier.params.length?this._issues.push(Y(44,n.firstToken,n.lastToken,n,{linkedTo:[o]})):i.length<o.identifier.params.length&&this._issues.push(Y(45,n.firstToken,n.lastToken,n,{linkedTo:[o]}))):this._issues.push(Y(43,n.firstToken,n.lastToken,n)))}let s=new Wt(n,i);return s.lastToken=this.prevToken,this.mergeStack(),s}processHex(){this.enqueueToStack();let e=this.checkConcurrentTokens([st("0"),st("x",{caseInsensitive:!0})]);if(e.length!==2){this.popStack();return}let n=this.consumeAnyConcurrentTokens([19,20].map(Fe));if(!n.length){this.popStack();return}let r=Number.parseInt(n.map(s=>s.value).join(""),16),i=new sn(r,he(e[0],n.at(-1)),16);return this.mergeStack(),i}processDec(e=!1){this.enqueueToStack();let n;e&&(H(this.currentToken,16)||H(this.currentToken,15))&&Yt(this.currentToken,this.currentToken?.nextToken)&&(n=this.moveToNextToken);let r=this.consumeAnyConcurrentTokens([19].map(Fe));if(!r.length){this.popStack();return}let i=Number.parseInt(r.map(o=>o.value).join(""),10);n&&H(n,16)&&(i=4294967295-i);let s=new sn(i,he(n??r[0],r.at(-1)),10);return this.mergeStack(),s}processEnclosedExpression(e,n){this.enqueueToStack();let r,i;if(H(this.currentToken,42)){let s;r=this.moveToNextToken,i=r;let o=this.processExpression(e,n,!0);return o&&(s=new rn(o,!0),o=new rn(s,!1),s.openBracket=r),H(this.currentToken,43)?(i=this.moveToNextToken,s&&(s.closeBracket=i)):r&&this._issues.push(Y(26,r,r,n)),this.mergeStack(),o}this.popStack()}processExpression(e,n,r=!1){this.enqueueToStack();let i,s;if(r&&(s=this.isOperator()),i=this.processEnclosedExpression(e,n)||this.isFunctionCall(e)||this.processCIdentifier(e,!1)||this.processHex()||this.processDec(!0),!i){this.popStack();return}if(s&&(i.operator=s),r){let o=this.isOperator();for(;o;){let a=this.processExpression(e,n,!0);a?i instanceof rn?i.addExpression(o,a):i=new rn(i,!1,{operator:o,expression:a}):this._issues.push(Y(27,o.firstToken,o.lastToken,n)),o=this.isOperator()}}return this.mergeStack(),i}processMacroCallParams(){if(!H(this.currentToken,42))return;let e=this.parseScopedBlock(r=>!!H(r,42),r=>!!H(r,43),r=>!!H(r,24));return e?.items.length===2&&H(e.endToken,43)?[]:e?.splitTokens.map((r,i)=>{if(r.tokens.length===0)return null;let s=new vi(r.tokens.map((o,a)=>{let c=o.value;return o.pos.line===r.tokens.at(a+1)?.pos.line?c=c.padEnd(r.tokens[a+1].pos.col-o.pos.col," "):o.value==="\\"&&(c=c.slice(0,-1)),c}).join(""),he(r.tokens[0],r.tokens.at(-1)),i);return s.splitToken=e.separatorTokens.at(i),s})}};var pr=class extends te{constructor(n){super();this.comments=n;this.disabled=!1;n.forEach(this.addChild.bind(this))}toString(){return this.comments.map(n=>n.toString()).join(`
|
|
294
|
-
`)}},hr=class extends te{constructor(n){super(n);this.disabled=!1;this.semanticTokenType="comment",this.semanticTokenModifiers="documentation"}toString(){let n,r=this.firstToken,i="";for(;r!==this.lastToken;)i+=r?.value.padStart(r.value.length+(n?r.pos.col-n.pos.colEnd:0)," "),n=r,r=r?.nextToken;r&&(i+=r?.value.padStart(r.value.length+(n?r.pos.col-n.pos.colEnd:0)," "));let s=i.match(/^\s*(?:(?:\/\/|\/\*+)\s*)?(.*?)\s*(?:\*\/)?\s*$/s);return s?s[1]:""}};var ip=class t extends zi{constructor(n,r=()=>Ln().requestTokens(this.fsPath,!0)){super();this.fsPath=n;this.getTokens=r;this.comments=[];this.tokens=[]}cleanUpComments(){let n=[];for(let r=0;r<this.tokens.length;r++){let i=t.processBlockComment(this.tokens,r)||t.processLineComment(this.tokens,r);i&&(r=i.index,n.push(...i.tokenUsed),this.comments.push(i.comment))}if(n.length>0){let r=new Set(n),i=[];for(let s=0;s<this.tokens.length;s++)r.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(n,r){let i=[],s=()=>(i.push(r++),n[r]),o=()=>n[r],a=()=>n[r-1],c=o(),l=c;if(!c||!H(c,13)||(l=s(),!H(l,17)||c.pos.line!==l.pos.line||c.pos.col+1!==l.pos.col))return;let u=()=>!(!H(a(),17)||!H(o(),13)||!
|
|
295
|
-
`)}}};var tl=class extends te{constructor(e){super(e)}},nl=class extends te{constructor(n,r){super();this.keyword=n;this.content=r;this.active=!1;this.addChild(n)}},rl=class extends nl{constructor(n,r,i){super(n,i);this.expression=r;this.addChild(r),this.addChild(i)}useBlock(n){return this.expression&&n.has(this.expression.name)}},op=class extends nl{constructor(n,r,i){super(n,i);this.expression=r;this.addChild(r),this.addChild(i)}useBlock(n){return this.expression?.isTrue(n)}},ap=class extends rl{useBlock(e){return this.expression&&!e.has(this.expression.name)}},cp=class extends nl{};var el=(t,e)=>{let n=t,r=[];for(;n&&(r.push(n),n!==e);)n=n.nextToken;return r},Er=class extends te{constructor(n,r,i){super();this.ifBlocks=n;this.endIf=r;this.elseOption=i;n.forEach(s=>this.addChild(s)),i&&this.addChild(i),this.addChild(r)}getInValidTokenRange(n){let r=this.ifBlocks.find(i=>i.useBlock(n));return r?r.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(r||this.elseOption)}get inactiveRanges(){let n=[],r=!!this.elseOption;this.ifBlocks.forEach((s,o)=>{if(s.active)return;let a=o===this.ifBlocks.length-1,c=s.firstToken,l=a?r?this.elseOption.firstToken:this.lastToken:s.content?.lastToken??this.ifBlocks[o+1].firstToken??s.lastToken;n.push(et.create(se(c),se(l)))});let i=n.length!==this.ifBlocks.length;if(this.elseOption&&i){let s=this.elseOption.firstToken,o=this.elseOption.content?.lastToken??this.endIf?.lastToken??this.lastToken;return n.push(et.create(se(s),se(o))),n}if(!i){let s=this.firstToken,o=this.lastToken;return[et.create(se(s),se(o))]}return n}getInValidTokenRangeWhenActiveBlock(n){let r=new WeakSet,i=!1;return this.ifBlocks.forEach(s=>{let o=s.expression?.lastToken??s.keyword.lastToken;el(s.firstToken,o).forEach(a=>r.add(a)),!i&&s===n?i=!0:s.content&&el(s.content.firstToken,s.content.lastToken).forEach(a=>r.add(a))}),this.elseOption&&(el(this.elseOption.keyword.firstToken,this.elseOption.keyword.lastToken).forEach(s=>r.add(s)),i&&this.elseOption.content&&el(this.elseOption.content.firstToken,this.elseOption.content.lastToken).forEach(s=>r.add(s))),this.endIf&&el(this.endIf.firstToken,this.endIf.lastToken).forEach(s=>r.add(s)),r}};var _a=class extends zi{constructor(n,r,i,s,o){super();this.fsPath=n;this.incudes=r;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(n){this._comments=this._comments.filter(r=>!n.has(r))}get currentToken(){let n=this.prevToken,r=this.peekIndex(),i=this.tokens.at(r),s=mn(n,i)||!n||H(n,14)&&n.pos.line+1===i?.pos.line;if(!(this.macroStart&&!s))return this.macroStart&&H(i,14)?(this.moveStackIndex(),this.currentToken):i}reset(n){super.reset(),this.macros.clear(),n?(this.macroSnapShot.clear(),Array.from(n).forEach(([r,i])=>this.macroSnapShot.set(r,i)),Array.from(n).forEach(([r,i])=>this.macros.set(r,i))):Array.from(this.macroSnapShot).forEach(([r,i])=>this.macros.set(r,i)),this.nodes=[],this.dtsIncludes=[],this.rangesToClean=new Set}async reparse(n){let r=this.stable;return this.parsing=new Promise(i=>{r.then(()=>{if(n&&n.size===this.macroSnapShot.size){let s=Array.from(n);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.fsPath),i();return}}this.reset(n),this.parse().then(i)})}),this.parsing}async parse(){let n=new ip(this.fsPath,this.getTokens);if(await n.stable,this.tokens=n.tokens,this._comments=n.allAstItems,this.positionStack.push(0),this.tokens.length!==0){for(;!this.done;)await this.lineProcessor();if(this.rangesToClean.size&&!this.fsPath.endsWith(".h")&&(this.tokens=this.tokens.filter(r=>!this.rangesToClean.has(r))),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||!fe(this.prevToken.fsPath,this.currentToken.fsPath))){this.moveEndOfLine(this.prevToken,!1),this.mergeStack();return}let r=this.currentToken,i=await this.processInclude()||this.processDefinitions()||this.processUndef()||this.processError();this.processIfDefBlocks(),r&&this.moveEndOfLine(r,!!i),this.mergeStack()}addTokensToClean(n){for(let r=n.start;r<n.start+n.count;r++){let i=this.tokens[r];i&&this.rangesToClean.add(i)}}processDefinitions(){this.enqueueToStack();let n=this.peekIndex(),r=this.moveToNextToken;if(!r||!H(r,25))return this.popStack(),!1;this.macroStart=!0;let i=new At(he(r)),s=this.isFunctionDefinition()||this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(Y(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=this.consumeDefinitionContent(),a;o.length&&(a=new sp(he(o[0],o.at(-1)),o));let c=new Zc(i,s,a);this.macros.set(c.name,{macro:c,resolver:_E(c.toString())}),this.nodes.push(c);let l=this.peekIndex();return this.addTokensToClean({start:n,count:l-n}),this.mergeStack(),this.macroStart=!1,!0}processUndef(){this.enqueueToStack();let n=this.peekIndex(),r=this.moveToNextToken;if(!r||!H(r,28))return this.popStack(),!1;this.macroStart=!0;let i=new At(he(r)),s=this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(Y(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:n,count:a-n}),this.mergeStack(),this.macroStart=!1,!0}processError(){this.enqueueToStack();let n=this.peekIndex(),r=this.moveToNextToken;if(!r||!H(r,29))return this.popStack(),!1;this.moveEndOfLine(r,!1,!0);let i=this.peekIndex();return this.addTokensToClean({start:n,count:i-n}),this.mergeStack(),!0}consumeDefinitionContent(){let n=[];for(;this.currentToken;){let r=this.moveToNextToken;r&&n.push(r)}return n}isFunctionDefinition(){this.enqueueToStack();let n=this.processCIdentifier(this.macros,!0);if(!n){this.popStack();return}let r=this.moveToNextToken;if(!H(r,42)||!Yt(n.lastToken,r)){this.popStack();return}let i=[],s=this.processCIdentifier(this.macros,!0)||this.processVariadic();for(;s;)i.push(s),!H(this.currentToken,24)&&!H(this.currentToken,43)?this._issues.push(Y(28,s.firstToken,s.lastToken,s)):H(this.currentToken,43)||(r=this.moveToNextToken),s=this.processCIdentifier(this.macros,!0)||this.processVariadic();let o=new ei(n,i);if(H(this.currentToken,43))r=this.moveToNextToken,o.lastToken=r;else{o.lastToken=this.prevToken;let a=i.at(-1)??o;this._issues.push(Y(26,a.firstToken,a.lastToken,a))}return this.mergeStack(),o}processVariadic(){this.enqueueToStack();let n=this.checkConcurrentTokens([Fe(45),Fe(45),Fe(45)]);if(n.length!==3){this.popStack();return}let r=new ba(he(n[0],n.at(-1)));return this.mergeStack(),r}processIfDefBlocks(){let n=this.peekIndex(),r=this.parseScopedBlock(a=>!!a&&[33,34,32].some(c=>H(a,c))&&!mn(a.prevToken,a),a=>!!a&&[37].some(c=>H(a,c))&&!mn(a.prevToken,a),a=>!!a&&[36,35].some(c=>H(a,c))&&!mn(a.prevToken,a));if(!r)return;let i=this.processIfBlock(r);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=>ao(c,a.range))&&(a.disabled=!0)}),[...i.ifBlocks,...i.elseOption?[i.elseOption]:[]].forEach(a=>{!a.active&&a.content&&this._issues.push(Y(47,a.content.firstToken,a.content.lastToken,a.content,{severity:il.DiagnosticSeverity.Hint,tags:[il.DiagnosticTag.Unnecessary]}))}),this.positionStack[this.positionStack.length-1]=n}processIfBlock(n){this.enqueueToStack();let r=new At(he(n.startToken)),i=[],s;n.splitTokens.forEach((c,l)=>{c.rewind();let u=this.prevToken,d=l===n.splitTokens.length-1&&H(u,36),f=new At(he(u));this.macroStart=!0;let p,m;if(H(f.firstToken,33)||H(f.firstToken,34)?(m=this.processCIdentifier(this.macros,!0),p=m):(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0),p instanceof Tt&&p.name.toLowerCase()==="defined"&&(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0))),this.macroStart=!1,d){let h=u,y=new At(he(h)),S;c.tokens.length&&(S=new tl(he(c.tokens[0],c.tokens.at(-1)))),s=new cp(y,S??null)}else{p||this._issues.push(Y(31,f.firstToken,f.lastToken,f));let h,y=c.tokens.indexOf(p?.lastToken??r.lastToken)+1,S=c.tokens[y];y!==-1&&S&&(h=new tl(he(S,c.tokens.at(-1)))),H(f.firstToken,33)?i.push(new rl(f,m??null,h??null)):H(f.firstToken,34)?i.push(new ap(f,m??null,h??null)):i.push(new op(f,p??null,h??null))}});let o;n.endToken?o=new At(he(n.endToken)):this._issues.push(Y(46,r.firstToken,r.lastToken,r));let a=new Er(i,o??null,s);return this.mergeStack(),a}get allAstItems(){return[...this.dtsIncludes,...this.nodes,...this.comments]}resolveInclude(n){if(n.path.path)return n.path.relative?[(0,Sa.resolve)((0,Sa.dirname)(n.fsPath),n.path.path),...this.incudes.map(r=>(0,Sa.resolve)(r,n.path.path))].find(r=>(0,WT.existsSync)(r)):this.incudes.map(r=>(0,Sa.resolve)(r,n.path.path)).find(r=>(0,WT.existsSync)(r))}async processInclude(){this.enqueueToStack();let n=this.peekIndex(),r=this.currentToken;if(!r)return this.popStack(),!1;let i=r,s=r;if(H(r,26))this.moveToNextToken;else{let h=this.checkConcurrentTokens([Fe(13),st("include"),Fe(13)]);if(h.length!==3)return this.popStack(),!1;i=h[0],s=h.at(-1)}let o=i,a=new At(he(i,s));r=this.moveToNextToken;let c=r,l=!!H(r,21);if(!c||!l&&!H(r,5))return o&&this.moveEndOfLine(o),this.mergeStack(),!0;let u="";if(l)u=r?.value??"";else for(;this.currentToken?.pos.line===o.pos.line&&!H(this.currentToken,4);)u+=this.currentToken?.value??"",r=this.moveToNextToken;let d=new va(u,l,he(c,r)),f=new Zr(a,d);this.dtsIncludes.push(f),l||(this.currentToken?.pos.line!==o.pos.line||!H(this.currentToken,4)?this._issues.push(Y(12,f.firstToken,f.lastToken,f)):(r=this.moveToNextToken,d.lastToken=r)),this.mergeStack();let p=this.peekIndex(),m=this.resolveInclude(f);if(f.resolvedPath=m,m||this._issues.push(Y(36,f.path.firstToken,f.path.lastToken,f.path,{severity:il.DiagnosticSeverity.Warning})),m&&!this.optimizeForFormatting){Ln().requestTokens(m,!0);let h=sl().getCPreprocessorParser(m,this.incudes,this.macros,this.fsPath);await h.stable,this._issues.push(...h.issues),this.macros.clear(),Array.from(h.macros).forEach(([y,S])=>this.macros.set(y,S)),m.endsWith(".h")?this.addTokensToClean({start:n,count:p-n}):(this.tokens=DE(this.tokens,n,p,h.tokens),this.positionStack[this.positionStack.length-1]=n),this.nodes.push(...h.nodes),this.dtsIncludes.push(...h.dtsIncludes)}else this.addTokensToClean({start:n,count:p-n});return!0}};var zT,lp=class{constructor(){this.headerFiles=new Map;this.includeOwners=new WeakMap}getCPreprocessorParser(e,n,r,i){e=dt(e);let s=`${Array.from(r).map(l=>l[1].macro.toString()).join("::")}`,o=this.headerFiles.get(e)?.get(s);if(o)return o.reparse(r),o;console.log("No c-preprocessor cache",e);let a=new _a(e,n,r),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=dt(e);let n=this.headerFiles.get(e);n&&Array.from(n).forEach(([r,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 sl(){return zT??=new lp,zT}function MD(){zT=new lp}var GT,up=class t{constructor(){this.fileMap=new Map}static clone(e){let n=e.length;if(n===0)return[];let r=new Array(n),i;for(let s=0;s<n;s++){let o=e[s],a={tokens:o.tokens,pos:o.pos,value:o.value,fsPath:o.fsPath,prevToken:i,nextToken:void 0};i&&(i.nextToken=a),r[s]=a,i=a}return r}needsRenew(e,n){return e=dt(e),this.fileMap.get(e)?.text!==n}getDocument(e,n){return Lt.create(e,"devicetree",0,n??this.fileMap.get(e)?.text??(0,ol.readFileSync)(e).toString())}renewLexer(e,n){if(e=dt(e),sl().reset(e),!n&&!(0,ol.existsSync)(e))return[];try{n??=(0,ol.readFileSync)(e).toString();let r=new er(n,e);return this.fileMap.set(e,r),t.clone(r.tokens)}catch{}return[]}requestTokens(e,n){e=dt(e);let r=this.fileMap.get(e)?.tokens;return!r&&n?[...this.renewLexer(e)]:t.clone(r??[])}reset(e){e=dt(e),sl().reset(e),this.fileMap.delete(e)}};function Ln(){return GT??=new up,GT}function xD(){GT=new up}var Pi=class t{constructor(e){this.context=e;this.comments=[];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 n=this.fileTopMostAstCache.get(e);if(n)return n;let r=[...this.rootNode.implementations,...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,r),r}getDeepestAstNode(e,n){let r=this.fileTopMostAsts(e),i=Ln().requestTokens(e,!1),s=r.find(o=>Qt(o,e,n)||bE(i,o,n));if(!s){let o=this.context.allParsers.flatMap(l=>l.includes),a=(l,u)=>{let d=o.find(f=>fe(f.resolvedPath,l));return d&&this.context.getSortKeyFile(u,l)===void 0?a(d.lastToken.fsPath,se(d.lastToken)):d},c=a(e,n);c&&(s=r.at(-1)?.parentNode,e=c.fsPath,n=LD.Position.create(c.lastToken.pos.line,c.lastToken.pos.colEnd))}if(s instanceof ut){let a=this.rootNode.getReferenceBy(s)?.getDeepestAstNode(e,n);return a?{...a,runtime:this}:{item:null,runtime:this,ast:Jr(s,e,n)}}else if(s instanceof nt&&s.path){let o=this.rootNode.getDeepestAstNode(e,n);return o?{...o,runtime:this}:void 0}else if(s instanceof Ee&&s.path){let o=t.getNodeFromPath(s.path.slice(1),this.rootNode)?.getDeepestAstNode(e,n);return o?{...o,runtime:this}:void 0}else if(s)return{runtime:this,item:null,ast:Jr(s,e,n)}}static getNodeFromPath(e,n,r=!0){if(e.length===0)return n;let i=e[0].split("@"),s=i[0],a=i.at(1)?.split(",").map(u=>Number.parseInt(u,16)),c=e.slice(1),l=n.getNode(s,a,r);return l?t.getNodeFromPath(c,l,r):void 0}resolvePath(e,n){if(!e.at(0)?.startsWith("&"))return e;let r=this.labelsUsedCache.get(e[0].slice(1));return r||(n??=this.rootNode.allDescendantsLabels,n.find(s=>s.label.value===e.at(0)?.slice(1)&&s.parentNode instanceof we)?.lastLinkedTo?.path)}get issues(){return this.issuesCache??=[...this.labelIssues(),...this.rootNode.getIssues(this.context.macros)],this.issuesCache}labelIssues(){let e=[],n=new Map;return this.rootNode.allDescendantsLabelsMapped.forEach(r=>{n.has(r.label.label.value)?n.get(r.label.label.value)?.push(r):n.set(r.label.label.value,[r])}),Array.from(n).forEach(r=>{let i=r[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(Gt(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=n=>[...n.nodeType?.getIssue(this,n)??[],...n.nodes.flatMap(r=>e(r))];return this.typesIssuesCache??=e(this.rootNode),this.typesIssuesCache}getOrderedNodeAst(e){return SE(e.implementations,this.context)}};var al=L(U());var qD=L(U());var dp=class extends te{constructor(n){super();this.values=n;this.docSymbolsMeta={name:"Values",kind:qD.SymbolKind.String},this.values.forEach(r=>this.addChild(r))}toString(){return this.values.map(n=>n?.toString()).join(",")}toJson(){return this.values.length===1?this.values[0]?.toJson():this.values.map(n=>n?.toJson())}};var $D=L(U());var fp=class extends te{constructor(n){super();this.keyword=n;this.addChild(n),this.docSymbolsMeta={name:"DTS Document version",kind:$D.SymbolKind.Function}}};var ki=class extends te{constructor(n,r){super();this.value=n;this.labels=r;this.labels.forEach(i=>{this.addChild(i)}),this.addChild(this.value)}toString(n){return`${this.labels.map(r=>r.toString()).join(" ")}${this.value?.toString(n)??"NULL"}`}toPrettyString(n){return`${this.labels.map(r=>r.toString()).join(" ")}${this.value?.toPrettyString(n)??"NULL"}`}};var FD=L(U());var pp=class extends te{constructor(n,r,i){super();this.keyword=n;this.startAddress=r;this.endAddress=i;this.addChild(n),this.docSymbolsMeta={name:"Memreserve",kind:FD.SymbolKind.Function},this.addChild(r),this.addChild(i)}toString(){return`/memreserve/ 0x${this.startAddress?.value?.toString(16)} 0x${this.endAddress?.value?.toString(16)}`}};var BD=L(U());var hp=class extends te{constructor(n,r){super();this.keyword=n;this.bitsSize=r;this.addChild(n),this.docSymbolsMeta={name:"bits",kind:BD.SymbolKind.Function},this.addChild(r)}toString(){return`/bits/ ${this.bitsSize?.value?.toString()}`}};var Cr=class extends zi{constructor(n,r,i,s,o){super();this.fsPath=n;this.incudes=r;this.tokens=[];this.others=[];this.rootDocument=new we;this.unhandledStatements=new nt;this.injectedMacros=[];this.#e=!1;this.cPreprocessorParser=new _a(this.fsPath,this.incudes,i,s,o)}get issues(){return[...this._issues,...this.cPreprocessorParser.issues]}getFiles(){return[this.fsPath,...this.cPreprocessorParser.dtsIncludes.flatMap(n=>n.resolvedPath).filter(n=>!!n)]}reset(){super.reset(),this.others=[],this.rootDocument=new we,this._issues=[],this.unhandledStatements=new nt,this.#e=!1}async reparse(){let n=performance.now(),r=this.stable;return this.parsing=new Promise(i=>{r.then(async()=>{this.reset(),await this.cPreprocessorParser.reparse(),await this.parse(),console.log("parsing",performance.now()-n),i()})}),this.parsing}async parse(){if(await this.cPreprocessorParser.stable,this.tokens=this.cPreprocessorParser.tokens,dt(this.fsPath).endsWith(".h")||(this.positionStack.push(0),this.tokens.length===0))return;let n=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(Y(22,s,s,null)),this.reportExtraEndStatements())}};for(;!this.done;)await n();this.fsPath.endsWith(".dtsi")||(this.unhandledStatements.nodes.forEach(s=>{this._issues.push(Y(53,s.firstToken,s.lastToken,s))}),this.unhandledStatements.properties.forEach(s=>{this._issues.push(Y(32,s.firstToken,s.lastToken,s))}),this.unhandledStatements.deleteProperties.forEach(s=>{this._issues.push(Y(33,s.firstToken,s.lastToken,s))}));let r=this.allAstItems.flatMap(s=>[s,...s.allDescendants]),i=this.cPreprocessorParser.comments;if(i.length&&r.forEach(s=>{(s instanceof we||s instanceof Ne||s instanceof Zr)&&wE(s,i)}),this.positionStack.length!==1)throw new Error("Incorrect final stack size")}processInjectPreProcessorMacros(n){let r=this.peekIndex(),i=this.isFunctionCall(n)||this.processCIdentifier(n,!0,!0);return this.injectPreProcessorResults(n,i,r)}injectPreProcessorResults(n,r,i){let s=r?.resolve(n);if(r&&typeof s=="string"){s=kT(s);let o=jf(r.fsPath,ce(r)),a=new Set;if(this.cPreprocessorParser.comments.forEach(l=>{Qt(r,r.fsPath,l.range.start)&&a.add(l)}),this.cPreprocessorParser.removeComments(a),this.injectedMacros.push(r),r instanceof Tt&&s.includes(r.name)||r instanceof Wt&&s.includes(r.functionName.name))return!0;let c=new er(s,o);return this.tokens.splice(i,this.peekIndex()-i,...c.tokens),this.positionStack[this.positionStack.length-1]=i,!0}}isRootNodeDefinition(n){this.enqueueToStack();let r=this.moveToNextToken,i=r;if(!r||!H(r,13))return this.popStack(),!1;if(i=this.moveToNextToken,!i||!H(i,2))return this.popStack(),!1;let s=new nt;s.openScope=i,n.addNodeChild(s),this.processNode(s,"Name");let o=this.nodeEnd(s)??i;return s.firstToken=r,s.lastToken=o,this.mergeStack(),!0}nodeEnd(n){let r=this.currentToken;if(H(r,3))this.moveToNextToken;else{let i=this.prevToken;return i&&this._issues.push(Y(3,i,i,n)),this.endStatement(n,!1)}return this.prevToken?.value==="}"&&(n.closeScope=this.prevToken),this.endStatement(n)}isNodeEnd(){return H(this.currentToken,3)||H(this.currentToken,1)}endStatement(n,r=!0){let i=this.currentToken;if(!H(i,1)){let s=this.prevToken;if(s&&r)return this._issues.push(Y(1,s,s,n)),s}return this.moveToNextToken,this.reportExtraEndStatements(),i}reportExtraEndStatements(){for(;H(this.currentToken,1);){let n=this.moveToNextToken;n&&this._issues.push(Y(23,n,n,null))}}processNode(n,r){if(this.done)return!1;let i=!1,s=!1;do{for(;this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros););if(s=this.isChildNode(n,r)||this.isProperty(n)||this.isDeleteNode(n,r)||this.isDeleteProperty(n),!s&&!this.isNodeEnd()&&!this.done){let o=this.moveToNextToken;o&&(this._issues.push(Y(22,o,o,null)),this.reportExtraEndStatements())}else if(this.done)break;i=i||s}while(!this.isNodeEnd());return i}processOptionalLabelAssign(n=!1){let r=[],i=this.isLabelAssign(n);for(;i;)r.push(i),i=this.isLabelAssign(n);return r}isChildNode(n,r){this.enqueueToStack();let i;r==="Name"&&(i=this.isOmitIfNoRefNode());let s=this.processOptionalLabelAssign(),o,a,c=r==="Ref"?new ut(s):new Ee(s,i);if(r==="Ref"?(this.enqueueToStack(),a=this.processNodePathRef(c),!a||!H(this.currentToken,2)?(this.popStack(),a=void 0):this.mergeStack(),a??=this.isLabelRef(c)):r==="Name"&&(o=this.isNodeName()),!a&&!o){if(!H(this.currentToken,2))return this.popStack(),!1;c.firstToken=this.currentToken,this._issues.push(Y(r==="Name"?[7]:[10,48,11],c.firstToken,this.currentToken?.nextToken,c))}let l=!1;if(a&&c instanceof ut?(c.reference=a,l=!0):o&&c instanceof Ee&&(l=o.address!==void 0,c.name=o),H(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(Y(2,u.firstToken,u.lastToken,u))}else return this.popStack(),!1;return n.addNodeChild(c),this.mergeStack(),!0}processNodeAddress(n){let r=this.prevToken;this.enqueueToStack();let i=this.checkConcurrentTokens([st("0"),st("x",{caseInsensitive:!0})]);i.length!==2?(i=[],this.popStack()):(this._issues.push(Y(50,i[0],i[1],n,{severity:al.DiagnosticSeverity.Warning})),r=i.at(-1),this.mergeStack());let s=this.consumeAnyConcurrentTokens([19,20,48].map(Fe)),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 r&&(a.some(l=>Number.isNaN(l))?this._issues.push(Y(8,r,r,n)):!Number.isNaN(a)&&!Yt(r,s[0])&&!bi(s[0].fsPath)&&this._issues.push(Y(29,r,s[0],n,{inclusiveStart:!1,inclusiveEnd:!1}))),this.currentToken?.value.toUpperCase()==="ULL"&&(this._issues.push(Y(51,this.currentToken,this.currentToken,n,{severity:al.DiagnosticSeverity.Warning})),this.moveToNextToken),new Vc(a,he(i.at(0)??s[0]??this.prevToken,this.prevToken))}processNodeAddresses(n){this.enqueueToStack();let r=this.checkConcurrentTokens([Fe(49)]);if(r.length){Yt(n.lastToken,r[0])||this._issues.push(Y(29,n.lastToken,r[0],n,{inclusiveStart:!1,inclusiveEnd:!1}));let i=[],s=()=>{this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros),i.push(this.processNodeAddress(n)),H(this.currentToken,24)&&(this.prevToken&&!Yt(this.prevToken,this.currentToken)&&this._issues.push(Y(29,this.prevToken,this.currentToken,n,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken,s())};s();let o=this.currentToken;for(;!H(this.currentToken,2)&&!H(this.currentToken,1)&&!H(this.currentToken,3)&&!H(this.currentToken,13)&&mn(this.currentToken,i.at(-1)?.lastToken);)this.moveToNextToken;if(o&&o!==this.currentToken){this._issues.push(Y(52,o,this.currentToken,n));let a=new Vc([],he(o,this.prevToken));i.push(a)}return this.mergeStack(),i}this.popStack()}isNodeName(){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16].map(Fe));if(!n.length){this.popStack();return}let r=n.map(o=>o.value).join(""),i=new $e(r,he(n[0],n.at(-1))),s=this.processNodeAddresses(i);return i.address=s,Hf(r)||this._issues.push(Y(49,i.firstToken,i.lastToken,i)),this.mergeStack(),i}isPropertyName(){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16,44,46].map(Fe));if(!n.length){this.popStack();return}let r=new Xe(n.map(i=>i.value).join(""),he(n[0],n.at(-1)));return this.mergeStack(),r}isLabelName(){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,48].map(Fe));if(!n.length){this.popStack();return}if(!Hf(n?.[0].value)){this.popStack();return}let r=n.map(s=>s.value).join(""),i=new gn(r,he(n[0],n[n.length-1]));return this.mergeStack(),i}isLabelAssign(n){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,48].map(Fe));if(!r.length){this.popStack();return}if(!Hf(r?.[0].value)){this.popStack();return}let i=r.map(c=>c.value).join(""),s=this.currentToken,o=s&&H(s,50),a=new ys(new gn(i,he(r[0],r.at(-1))),he(r[0],o?s:r.at(-1)));if(o){let c=r.at(-1);c&&(s.pos.line!==a.firstToken.pos.line||s.pos.col!==c.pos.colEnd)&&this._issues.push(Y(29,c,s,a,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken}else if(n)this._issues.push(Y(24,a.firstToken,a.lastToken,a));else{this.popStack();return}return this.mergeStack(),a}isProperty(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(),i=this.isPropertyName();if(!i)return this.popStack(),!1;if(H(this.currentToken,2)||H(this.currentToken,49))return this.popStack(),!1;let s=new Ne(i,r),o;H(this.currentToken,0)?(s.assignOperatorToken=this.moveToNextToken,o=this.processValue(n),o?.values.filter(c=>!!c).length||this._issues.push(Y(0,s.firstToken,s.lastToken,s)),s.values=o??null):s.values=void 0;let a=this.endStatement(s);return s.lastToken=a,n.addNodeChild(s),this.mergeStack(),!0}isDtsDocumentVersion(){this.enqueueToStack();let n=this.checkConcurrentTokens([Fe(13),st("d"),st("ts"),Fe(16),st("v"),st("1")]);if(n.length!==6)return this.popStack(),!1;let r=n[0],i=r,s=new At;s.firstToken=r;let o=new fp(s);if(this.others.push(o),H(this.currentToken,13))i=this.moveToNextToken;else return s.lastToken=n.at(-1),this._issues.push(Y(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 n=this.checkConcurrentTokens([Fe(13),st("memreserve")]);if(n.length!==2)return this.popStack(),!1;let r=new At;r.firstToken=n[0];let s=n[0];H(this.currentToken,13)?(s=this.moveToNextToken,r.lastToken=s):(r.lastToken=n.at(-1),this._issues.push(Y(21,r.firstToken,r.lastToken,r)));let o=this.processHex()||this.processDec(),a=o&&(this.processHex()||this.processDec()),c=new pp(r,o,a);if(this.others.push(c),o||this._issues.push(Y(37,r.firstToken,r.lastToken,r)),!a){let l=o??r;this._issues.push(Y(38,l.firstToken,l.lastToken,c))}return c.lastToken=this.endStatement(c),this.mergeStack(),!0}isPlugin(){this.enqueueToStack();let n=this.checkConcurrentTokens([Fe(13),st("plugin"),Fe(13)]);if(n.length!==3)return this.popStack(),!1;let r=new At(he(n[0],n.at(-1)));return r.lastToken=this.endStatement(r),this.mergeStack(),this.others.push(r),!0}processBits(){this.enqueueToStack();let n=this.checkConcurrentTokens([Fe(13),st("b"),st("its")]);if(n.length!==3){this.popStack();return}let r=new At;r.firstToken=n[0];let s=n[0];H(this.currentToken,13)?(s=this.moveToNextToken,r.lastToken=s):(r.lastToken=n.at(-1),this._issues.push(Y(21,r.firstToken,r.lastToken,r)));let o=this.processDec(),a=new hp(r,o);return this.others.push(a),o?o.value!==8&&o.value!==16&&o.value!==32&&o.value!==64&&this._issues.push(Y(40,o.firstToken,o.lastToken,o)):this._issues.push(Y(39,r.firstToken,r.lastToken,r)),this._issues.push(Y(41,a.firstToken,a.lastToken,a,{severity:al.DiagnosticSeverity.Warning})),this.mergeStack(),a}isOmitIfNoRefNode(){this.enqueueToStack();let n=this.checkConcurrentTokens([Fe(13),st("omit"),Fe(16),st("if"),Fe(16),st("no"),Fe(16),st("ref"),Fe(13)]);if(n.length!==9){this.popStack();return}let r=new At(he(n[0],n.at(-1)));return this.mergeStack(),r}isDeleteNode(n,r){this.enqueueToStack();let i=this.checkConcurrentTokens([Fe(13),st("d"),st("e"),st("lete",{allowPartial:!0}),Fe(16),st("node",{allowPartial:!0})]);if(!i.length)return this.popStack(),!1;let s=i[0],o=s,a=new At;if(a.firstToken=s,i.length===1&&!H(this.currentToken,2)){this._issues.push(Y(25,a.firstToken,a.lastToken,a)),a.lastToken=i.at(-1);let d=new Xn(a);return n.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(Y(c.startsWith("/delete-n")?34:25,a.firstToken,a.lastToken,a)):H(this.currentToken,13)?(o=this.moveToNextToken,a.lastToken=o):this._issues.push(Y(21,a.firstToken,a.lastToken,a));let l=new Xn(a);if(mn(a.lastToken,s)){let d=this.processNodePathRef(n);d&&r==="Name"&&this._issues.push(Y(7,d.firstToken,d.lastToken,d));let f=d?void 0:this.isLabelRef(n);f&&r==="Name"&&this._issues.push(Y(7,f.firstToken,f.lastToken,f));let p=d||f?void 0:this.isNodeName();p&&r==="Ref"&&this._issues.push(Y(10,p.firstToken,p.lastToken,p)),!d&&!p&&!f&&this._issues.push(Y([7,10],l.firstToken,l.lastToken,l)),l.nodeNameOrRef=d??f??p??null}else r==="Name"?this._issues.push(Y(7,a.firstToken,a.lastToken,a)):r==="Ref"&&this._issues.push(Y(10,a.firstToken,a.lastToken,a));let u=this.endStatement(l);return l.lastToken=u,n.addNodeChild(l),this.mergeStack(),!0}isDeleteProperty(n){this.enqueueToStack();let r=this.checkConcurrentTokens([Fe(13),st("d"),st("e"),st("lete",{allowPartial:!0}),Fe(16),st("property",{allowPartial:!0})]);if(!r.length)return this.popStack(),!1;let i=r[0],s=i,o=new At;if(o.firstToken=i,r.length===1&&!H(this.currentToken,2)){this._issues.push(Y(25,o.firstToken,o.lastToken,o)),o.lastToken=r.at(-1);let u=new lt(o);return n.addNodeChild(u),this.mergeStack(),!0}let a=r.map(u=>u.value??"").join("");if(!"/delete-property/".startsWith(a)||a.endsWith("-"))return this.popStack(),!1;o.lastToken=r.at(-1),a!=="/delete-property"?this._issues.push(Y(a.startsWith("/delete-p")?35:25,o.firstToken,o.lastToken,o)):H(this.currentToken,13)?(s=this.moveToNextToken,o.lastToken=s):this._issues.push(Y(21,o.firstToken,o.lastToken,o));let c=new lt(o);if(mn(o.lastToken,i)){let u=this.isPropertyName();u||this._issues.push(Y(6,c.firstToken,c.lastToken,c)),c.propertyName=u??null}else this._issues.push(Y(6,o.firstToken,o.lastToken,o));let l=this.endStatement(c);return c.lastToken=l,n.addNodeChild(c),this.mergeStack(),!0}isNodePathRef(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),i=this.processNodePathRef(n);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 xn(r,i,s);return this.mergeStack(),o}processValue(n){this.enqueueToStack();let i=(()=>{let o=()=>(this.processStringValue()||this.isNodePathRef(n)||this.isLabelRefValue(n)||this.arrayValues(n)||this.processByteStringValue()||this.isExpressionValue(n))??null,a=o();if(!a)return[];let c=[a];for(;!H(this.currentToken,1);){let l=this.prevToken,u=this.currentToken,d,f=H(this.currentToken,24);if(f)d=this.currentToken,this.moveToNextToken;else if(!mn(this.prevToken,this.currentToken))break;let p=o();if(u&&p===null&&f){let h=new te(he(u,this.currentToken));this._issues.push(Y(0,h.firstToken,h.lastToken,h))}if(!f&&p===null)break;if(l&&!f&&p){let h=new te(he(l));this._issues.push(Y(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 dp(i)}processStringValue(){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),r=this.consumeAnyConcurrentTokens([Fe(21)]);if(!r.length){this.popStack();return}if(r.some(u=>u.value===void 0))throw new Error("Token must have value");let i=r.map(u=>u.value).join(`
|
|
296
|
-
`),s=i,o=['"',"'"].some(u=>s.endsWith(u));o&&(s=s.slice(1,-1));let a=new re(s,he(r[0],r.at(-1)));o||this._issues.push(Y(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 xn(n,a,c);return this.mergeStack(),l}arrayValues(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),i=this.processBits(),s=this.currentToken;if(H(s,5))this.moveToNextToken;else{this.popStack();return}let o=this.processArrayValues(n)??null;o.openBracket=s;let a=this.processOptionalLabelAssign(!0)??[],c=new xn(r,o,a,i);if(!H(this.currentToken,4))this._issues.push(Y(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 n=this.processOptionalLabelAssign(!0),r=this.moveToNextToken,i=r;if(!H(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(Y(15,u.firstToken,u.lastToken,u))});let a=new Mn(s??[]);a.openBracket=i,a.values.length===0&&(a.firstToken=r,this._issues.push(Y(14,a.firstToken,a.lastToken,a,{severity:al.DiagnosticSeverity.Information})));let c=new xn(n,a,o);H(this.currentToken,12)?a.closeBracket=this.moveToNextToken:this._issues.push(Y(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=r,a.lastToken=this.prevToken,c}processLabeledValue(n){this.enqueueToStack();let r=n(),i=[];if(!r)return this.popStack(),[];for(;r;)i.push(r),r=n();if(i.length){let s=n();s&&i.push(s)}return this.mergeStack(),i}processArrayValues(n){this.enqueueToStack();let r=this.processLabeledValue(()=>{let s=()=>this.processRefValue(n,!1)||this.processLabeledHex(!1)||this.processLabeledDec(!1)||this.processLabeledExpression(!0,!1,n),o=this.peekIndex(),a=s();return a&&!this.cPreprocessorParser.optimizeForFormatting&&(a.value instanceof Wt&&a.value.params.every(c=>!!c)&&this.cPreprocessorParser.macros.has(a.value.functionName.name)||a.value instanceof Tt&&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 ct(r);return r.length===0&&(i.firstToken=this.currentToken),this.mergeStack(),i}processLabeledHex(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(n),i=this.processHex();if(!i){this.popStack();return}let s=new ki(i,r);return this.mergeStack(),s}processHexString(){this.enqueueToStack();let n=this.processOptionalLabelAssign(!1),r=this.checkConcurrentTokens([20,20].map(Fe));if(!r.length){this.popStack();return}let i=Number.parseInt(r.map(a=>a.value).join(""),16),s=new sn(i,he(r[0],r.at(-1)),16),o=new ki(s,n);return this.mergeStack(),o}processLabeledDec(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(n),i=this.processDec();if(!i){this.popStack();return}let s=new ki(i,r);return this.mergeStack(),s}processLabeledExpression(n=!0,r=n,i){this.enqueueToStack();let s=[];n&&(s=this.processOptionalLabelAssign(r));let o=this.processExpression(this.cPreprocessorParser.macros,i);if(!o){this.popStack();return}let a=new ki(o,s);return this.mergeStack(),a}isExpressionValue(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(!1),i=this.processExpression(this.cPreprocessorParser.macros,n);if(!i){this.popStack();return}let s=this.processOptionalLabelAssign(!0),o=new xn(r,i,s);return this.mergeStack(),o}isLabelRef(n){this.enqueueToStack();let r=this.currentToken;if(!r||!H(r,40)){this.popStack();return}else this.moveToNextToken;let i=this.isLabelName();if(!i){let o=new ie(null);return this._issues.push(Y(18,r,r,n)),o.firstToken=r,this.mergeStack(),o}r&&(i.firstToken.pos.line!==r.pos.line||i.firstToken.pos.col!==r.pos.colEnd)&&this._issues.push(Y(29,r,i.firstToken,n,{inclusiveStart:!1,inclusiveEnd:!1}));let s=new ie(i);return s.firstToken=r,this.mergeStack(),s}isLabelRefValue(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),i=this.isLabelRef(n);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 xn(r,i,s);return this.mergeStack(),o}processRefValue(n,r){this.enqueueToStack();let i=this.processOptionalLabelAssign(r),s=this.currentToken;if(!s||!H(s,40)){this.popStack();return}let o=this.processNodePathRef(n);if(o!==void 0){let l=new ki(o,i);return this.mergeStack(),l}let a=this.isLabelRef(n);if(a===void 0){this._issues.push(Y([18,9],s,s,n));let l=new ki(null,i);return l.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),l}let c=new ki(a,i);return c.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),c}processNodePath(n=!0,r=new Qr){this.enqueueToStack();let i;if(H(this.currentToken,13))i=this.moveToNextToken;else{if(!n){this.popStack();return}this.prevToken&&this._issues.push(Y(19,this.prevToken,this.prevToken,r))}let s=this.isNodeName(),o=i??this.prevToken;if(!s&&o&&!n&&this._issues.push(Y(7,o,o,r)),!n||s?r.addPath(s??null,i?new te(he(i)):void 0):n&&!s&&i&&(r.addPath(new $e("/",he(i))),r.firstToken=i),n&&!i&&r.children.length===0){this.mergeStack();return}return this.processNodePath(!1,r),this.mergeStack(),r}processNodePathRef(n){this.enqueueToStack();let r=this.moveToNextToken,i=r;if(!H(i,40)){this.popStack();return}let s=this.moveToNextToken;if(i=s,!H(i,2)){this.popStack();return}r&&!Yt(r,s)&&this._issues.push(Y(29,r,s,n,{inclusiveStart:!1,inclusiveEnd:!1}));let o=this.processNodePath(),a=new rt(o??null),c=this.currentToken??this.prevToken,l=c;return o?.children.forEach((u,d)=>{if(d===o?.children.length-1&&u&&l&&!Yt(u.lastToken,l)){this._issues.push(Y(29,u.lastToken,l,n,{inclusiveStart:!1,inclusiveEnd:!1}));return}if(d===0&&s&&!Yt(s,u?.firstToken)){this._issues.push(Y(29,s,u?.firstToken,n,{inclusiveStart:!1,inclusiveEnd:!1}));return}let f=o?.children[d+1];u&&f&&!Yt(u.lastToken,f.firstToken)&&this._issues.push(Y(29,u.lastToken,f?.firstToken,n,{inclusiveStart:!1,inclusiveEnd:!1}))}),H(c,3)?this.moveToNextToken:this.prevToken&&this._issues.push(Y(3,this.prevToken,this.prevToken,n)),a.firstToken=r,a.lastToken=c??this.prevToken,this.mergeStack(),a}get includes(){return this.cPreprocessorParser.dtsIncludes}get allAstItems(){return[...this.cPreprocessorParser.allAstItems,...this.rootDocument.children,...this.others,...this.unhandledStatements.properties,...this.unhandledStatements.deleteProperties,...this.unhandledStatements.nodes]}#e;get latestSemanticTokensBuilt(){return this.#e}buildSemanticTokens(n,r){let i=[];this.injectedMacros.forEach(s=>{s.buildSemanticTokens((...o)=>zi.push(...o,r,i))}),super.buildSemanticTokens(n,r,i),this.#e=!0}};var mp=class t{constructor(e,n,r){this.settings=e;this.formattingOptions=n;this.bindingLoader=r;this._issues=[];this.overlayParsers=[];this.overlays=[];this.ctxNames_=new Set;this.sortKeys=new WeakMap;this.staleFsPaths=new Set;let i={...e,ctxName:e.ctxName??(0,Pa.basename)(e.dtsFile)};this.isFullContext=this.settings.dtsFile.toLowerCase().endsWith(".dts"),this.overlays=i.overlays,this.overlays.filter(cl.existsSync);let s=this.isFullContext&&r?.type==="Zephyr"?[(0,Pa.join)((0,Pa.dirname)(this.settings.dtsFile),"dts"),...i.includePaths]:i.includePaths;this.parser=new Cr(i.dtsFile,s),this.ctxNames_.add(i.ctxName),this.id=Wi(i),this.parser.stable.then(()=>{this.overlayParsers=this.overlays?.map(o=>new Cr(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,n=r=>({fsPath:r,includes:(e.get(r)??[]).map(i=>n(i.resolvedPath??i.path))});return[...this.parser.includes,...this.overlayParsers.flatMap(r=>r.includes)].forEach(r=>{let i=e.get(r.fsPath);i||(i=[],e.set(r.fsPath,i)),i.push({path:r.path.path,resolvedPath:r.resolvedPath})}),{mainDtsPath:n(this.parser.fsPath),overlays:this.overlays.map(n)}}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(n=>fe(n,e))}getFsPathParser(e){return this.allParsers.find(r=>r.getFiles().some(i=>fe(i,e)))}async getAllStableParsers(){return await this.stable(),this.allParsers}get allParsers(){return[this.parser,...this.overlayParsers]}async getDocumentLinks(e,n){if(!this.isInContext(e))return[];let i=(await this.getRuntime()).rootNode.allBindingsProperties.filter(s=>fe(s.ast.fsPath,e)&&s.ast.values&&(!n||Qt(s.ast.values,e,n))).flatMap(s=>s.ast.values?.values.flatMap(o=>{let c=s.parent?.nodeTypes.find(l=>o?.value instanceof re&&l.compatible===o.value.value);return c?{range:ce(o.value),target:ue(c.bindingsPath)}:void 0})).filter(s=>!!s)??[];return[...[...this.parser.cPreprocessorParser.dtsIncludes,...this.overlayParsers.flatMap(s=>s.cPreprocessorParser.dtsIncludes)].filter(s=>fe(s.fsPath,e)&&(!n||Qt(s,e,n))).map(s=>{let o=this.parser.cPreprocessorParser.resolveInclude(s);if(o)return{range:ce(s.path),target:ue(o)}}).filter(s=>!!s)??[],...i]}linkPropertiesLabelsAndNodePaths(e){let n=s=>[...s.properties,...s.nodes.flatMap(n)],r=n(e.rootNode),i=e.rootNode.allDescendantsLabels;r.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(Gt(3,o.firstToken,o.lastToken,o,{templateStrings:[o.value]}))}else o instanceof Qr&&this.linkNodePath(o,e.rootNode)}))}linkNodePath(e,n){let r=n,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==="/"?n:r?.getNode(a.name,a.fullAddress,!1);a.linksTo=c,!o&&!c&&(o=!0,this._issues.push(Gt(8,a.firstToken,a.lastToken,a,{templateStrings:[a.toString(),`${e.pathParts.filter(l=>l?.linksTo).map(l=>l?.toString()).join("/")}`]}))),c?.linkedNodeNamePaths.push(a),r=c}else break}}setStaleFsPath(e){this.staleFsPaths.add(e)}async reevaluate(e){this.setStaleFsPath(e);let n=new Set;return this.staleFsPaths.forEach(r=>{let i=this.getFsPathParser(r);i&&n.add(i)}),n.size?(this.sortKeys=new WeakMap,await Promise.all(Array.from(n).map(r=>r.reparse())),this._runtime=this.evaluate(),this._runtime):this._runtime}getSortKey(e,n=!1){if(e)return this.sortKeys.get(n?e.lastToken:e.firstToken)}async evaluate(){let e=performance.now();await this.stable();let n=new Pi(this);this.staleFsPaths.clear(),this._issues=[],this.parser.rootDocument.resetIssues(),this.processRoot(this.parser.rootDocument,n);for(let i=0;i<this.overlayParsers.length;i++)this.overlayParsers[i].rootDocument.resetIssues(),this.processRoot(this.overlayParsers[i].rootDocument,n);let r=await Promise.all(n.rootNode.defaultProperties.map(async i=>{let s=new er(i.text,i.fsPath),o=new Cr(i.fsPath,[],void 0,()=>s.tokens);return await o.stable,this.processRoot(o.rootDocument,n),o}));return n.comments=this.parser.cPreprocessorParser.allAstItems.filter(i=>i instanceof hr),[...this.allParsers,...r].flatMap(i=>i.tokens).forEach((i,s)=>this.sortKeys.set(i,s)),this.linkPropertiesLabelsAndNodePaths(n),this.reportNodeNameAndPropertyClashes(n),console.log(`(ID: ${this.id}) evaluate`,performance.now()-e),n}getSortKeyFile(e,n){let r=this.findTokenBeforePosition(e,n),i=r,s=i?this.sortKeys.get(i):void 0;for(;i&&!s;)i=i.nextToken,s=i?this.sortKeys.get(i):void 0;if(s!==void 0)return s;for(i=r,s=i?this.sortKeys.get(i):void 0;i&&!s;)i=i.prevToken,s=i?this.sortKeys.get(i):void 0;return s}findTokenBeforePosition(e,n){let r=this.allParsers.flatMap(i=>({parser:i,tokens:i.tokens}));for(let[i,s]of r.entries()){if(s.tokens.length===0&&fe(s.parser.fsPath,n)){let c=r[i-1];return i?c.tokens[c.tokens.length-1]:void 0}let o=s.tokens.find((c,l)=>gs(c,n,e)&&(l===s.tokens.length-1||!c.nextToken||bT(c.nextToken,n,e)));if(o)return o;let a=s.parser.includes.find(c=>c.resolvedPath===n);if(a)return a.lastToken;if(s.parser.getFiles().some(c=>fe(c,n)))return s.tokens[s.tokens.length-1]}}reportNodeNameAndPropertyClashes(e){let n=r=>{r.properties.forEach(i=>{r.nodes.filter(o=>o.address===void 0&&o.name===i.ast.propertyName?.name&&o.definitions.at(-1)?.name).forEach(o=>{let a=o.definitions,c=a[a.length-1].name;this._issues.push(Gt(2,c.firstToken,c.lastToken,c,{linkedTo:[i.ast,...i.allReplaced.map(l=>l.ast)]}))})}),r.nodes.forEach(n)};n(e.rootNode)}processRoot(e,n){for(let r=0;r<e.children.length;r++){let i=e.children[r];this.processChild(i,n.rootNode,n)}}processChild(e,n,r){e instanceof we?this.processDtcBaseNode(e,n,r):e instanceof Ne?this.processDtcProperty(e,n,r):e instanceof Xn?this.processDeleteNode(e,n,r):e instanceof lt&&this.processDeleteProperty(e,n,r)}checkNodeUniqueNames(e,n){let r=(o,a)=>o.filter(c=>c.name===a.name&&(c.address===a.fullAddress&&c.address===void 0||Dt(c.address??[],a.fullAddress??[])===0)).map(c=>c.issueAst),i=n.nodes.map(o=>{let a=o.definitions[0];return{name:o.name,address:o.address,issueAst:a.name??a}}),s=[];e.children.forEach(o=>{if(o instanceof Ee&&o.name){let a=r(s.map(c=>({name:c.name,address:c.fullAddress,issueAst:c})),o.name);a.length&&this._issues.push(Gt(2,o.name.firstToken,o.name.lastToken,o.name,{linkedTo:a})),s.push(o.name)}else if(o instanceof Xn&&o.nodeNameOrRef instanceof $e){let a=o.nodeNameOrRef;r(i,a)&&(s=s.filter(c=>r(s.map(l=>({name:l.name,address:l.fullAddress,issueAst:l})),c).length))}})}getCompileCommands(){if(!(!this.settings.compileCommands||!(0,cl.existsSync)(this.settings.compileCommands)))return JSON.parse((0,cl.readFileSync)(this.settings.compileCommands).toString())}processDtcBaseNode(e,n,r){e instanceof nt?this.processDtcRootNode(e,r):e instanceof Ee?this.processDtcChildNode(e,n,r):e instanceof ut&&this.processDtcRefNode(e,r)}processDtcRootNode(e,n){n.rootNode.implementations.push(e),this.checkNodeUniqueNames(e,n.rootNode),e.children.forEach(r=>this.processChild(r,n.rootNode,n))}processDtcChildNode(e,n,r){if(e.name?.name){let i=e.path?r.resolvePath(e.path):void 0,o=(i?r.rootNode.getChild(i):void 0)??new X(this.bindingLoader,e.name.name,e.name.fullAddress,n);o.implementations.push(e),e.labels.forEach(a=>a.lastLinkedTo=o),n=o,this.checkNodeUniqueNames(e,o)}e.children.forEach(i=>this.processChild(i,n,r))}processDtcRefNodeLabelRef(e,n,r){let i,s=e.resolveNodePath??(e.pathName?r.resolvePath([e.pathName]):void 0);return s?(e.resolveNodePath??=[...s],i=r.rootNode.getChild(s),n.linksTo=i,e.labels.forEach(o=>o.lastLinkedTo=i),i?.linkedRefLabels.push(n),i?.implementations.push(e),e.labels.forEach(o=>{r.labelsUsedCache.set(o.label.value,s)}),i?(r.references.push(e),this.checkNodeUniqueNames(e,i)):r.unlinkedRefNodes.push(e)):(this._issues.push(Gt(3,n.firstToken,n.lastToken,n,{templateStrings:[n.label?.value??""]})),r.unlinkedRefNodes.push(e)),i}processDtcRefNodeNodePathRef(e,n,r){let i;n.path&&this.linkNodePath(n.path,r.rootNode);let o=n.path?.pathParts.at(-1)?.linksTo?.path;return o?(e.resolveNodePath??=o,i=r.rootNode.getChild(o),e.labels.forEach(a=>a.lastLinkedTo=i),i?.implementations.push(e),e.labels.forEach(a=>{r.labelsUsedCache.set(a.label.value,o)}),i?(r.references.push(e),this.checkNodeUniqueNames(e,i)):r.unlinkedRefNodes.push(e)):r.unlinkedRefNodes.push(e),i}processDtcRefNode(e,n){let r;e.reference?e.reference instanceof ie?r=this.processDtcRefNodeLabelRef(e,e.reference,n):r=this.processDtcRefNodeNodePathRef(e,e.reference,n):n.unlinkedRefNodes.push(e),e.children.forEach(i=>this.processChild(i,r??new X(this.bindingLoader,""),n))}processDtcProperty(e,n,r){e.propertyName?.name&&n.addProperty(new Je(e,n)),e.children.forEach(i=>this.processChild(i,n,r))}processDeleteNode(e,n,r){if(e.nodeNameOrRef instanceof $e&&e.nodeNameOrRef.value){if(e.parentNode?.parentNode)if(!n.hasNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress))this._issues.push(Gt(5,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef));else{n.deletes.push(e);let i=n.getNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress);e.nodeNameOrRef.linksTo=i,n.deleteNode(e.nodeNameOrRef.name,e,e.nodeNameOrRef.fullAddress),i?.labels.forEach(s=>{r.labelsUsedCache.delete(s.label.value)})}}else if(e.nodeNameOrRef instanceof ie&&e.nodeNameOrRef.value){let i=r.resolvePath([`&${e.nodeNameOrRef.value}`]),s;i?(s=r.rootNode.getChild(i),n.deletes.push(e),e.nodeNameOrRef.linksTo=s,s?.labels.forEach(o=>{r.labelsUsedCache.delete(o.label.value)}),s?.linkedRefLabels.push(e.nodeNameOrRef),s?.parent?.deleteNode(s.name,e,s.address),e.parentNode instanceof we&&!e.parentNode.pathName&&r.globalDeletes.push(e)):(r.unlinkedDeletes.push(e),this._issues.push(Gt(3,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef,{templateStrings:[e.nodeNameOrRef.value]})))}else if(e.nodeNameOrRef instanceof rt&&e.nodeNameOrRef.path&&!e.nodeNameOrRef.path.pathParts.some(i=>!i)){let i=r.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||(r.unlinkedDeletes.push(e),o&&this._issues.push(Gt(8,o.firstToken,o.lastToken,o,{templateStrings:[o.toString(),`${e.nodeNameOrRef.path.pathParts.filter(c=>c?.linksTo).map(c=>c?.toString()).join("/")}`]}))),n.deletes.push(e),a?.labels.forEach(c=>{r.labelsUsedCache.delete(c.label.value)}),a?.parent?.deleteNode(a.name,e,a.address),e.parentNode instanceof we&&!e.parentNode.pathName&&r.globalDeletes.push(e)}else r.unlinkedDeletes.push(e);e.children.forEach(i=>this.processChild(i,n,r))}processDeleteProperty(e,n,r){e.propertyName?.name&&!n.hasProperty(e.propertyName.name)?this._issues.push(Gt(1,e.propertyName.firstToken,e.propertyName.lastToken,e.propertyName)):e.propertyName?.name&&(n.deletes.push(e),n.deleteProperty(e.propertyName.name,e)),e.children.forEach(i=>this.processChild(i,n,r))}static#e(e,n,r){let i=r.get(n);i||(i=[],r.set(n,i)),i.push(e)}getIssues(e,n=new Map,r=i=>{if(!(i.raw.severity===fo.DiagnosticSeverity.Hint&&i.raw.virtual))return i.raw.severity===fo.DiagnosticSeverity.Error&&!this.isFullContext&&(i.raw.severity=fo.DiagnosticSeverity.Warning),i}){return e.forEach(i=>{let s=r(i);s&&t.#e(s.diagnostic(),s.raw.fsPath,n)}),n}async getSyntaxIssues(e=new Map,n=r=>{if(r.raw.severity===fo.DiagnosticSeverity.Error&&!this.isFullContext&&!co(r.raw,r.raw.fsPath,!1)&&(r.raw.severity=fo.DiagnosticSeverity.Warning),!(r.raw.severity===fo.DiagnosticSeverity.Hint&&r.raw.virtual))return r}){return(await this.getAllStableParsers()).forEach(r=>this.getIssues(r.issues,e,n)),e}async getDiagnostics(){let e=new Map;try{await this.getSyntaxIssues(e);let n=await this.getContextIssues()??[];this.getIssues(n,e);let r=await this.getRuntime();return this.getIssues(r.typesIssues,e),e}catch(n){throw console.error(n),n}}async toFullString(){return`/dts-v1/;
|
|
293
|
+
`){let o=this.lineNumber,a=this.columnNumber,c=n.length;this.pushToken({tokens:[21],value:n,pos:{col:a-c,line:o,len:c,colEnd:a}}),n=""}else if(this.currentChar==="\\"){let o=this.lineNumber;if(n+=this.currentChar??"",this.move())o===this.lineNumber&&(n+=this.currentChar??"");else break}else n+=this.currentChar??"";if(!this.move())break}n+=e;let r=this.lineNumber,i=this.columnNumber+1,s=n.length;this.pushToken({tokens:[21],value:n,pos:{col:i-s,line:r,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 n=this.isString(e);if(!n){let i=t.KEYWORD_TOKENS.get(e.toLowerCase());if(i&&(n=!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(Kt(this.tokens[s-1],this.tokens[s]))n=!1,this.tokens.pop();else return!0}}if(n||(n=this.isDigit(e)||this.isHexDigit(e)||this.isLetters(e)),!n&&e.length===1){let i=t.SINGLE_CHAR_TOKENS.get(e);if(i)return n=!0,this.pushToken({tokens:i,value:e,pos:this.generatePos(e,e)}),!0}if(n||(n=this.isHash(e)||this.unknownToken(e)),!n)throw new Error(`Lexer is not complete!!! Could not find token for "${e}"`);let r=this._tokens[this._tokens.length-1];return n&&!r?.tokens.some(i=>i===21)&&r&&r.pos.len<e.length?this.process(e.slice(r.pos.len)):!0}pushToken(e){let n={tokens:e.tokens,pos:e.pos,value:e.value,fsPath:this.fsPath},r=this._tokens[this._tokens.length-1];n.prevToken=r,r&&(r.nextToken=n),this._tokens.push(n)}isLetters(e){let n=e[0]?.charCodeAt(0);if(t.isLetterCode(n)){let r="";for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(t.isLetterCode(s))r+=e[i];else break}return this.pushToken({tokens:[47],value:r,pos:this.generatePos(e,r)}),!0}return!1}isDigit(e){let n=e[0],r=n?.charCodeAt(0);return r>=48&&r<=57?(this.pushToken({tokens:[20,19],value:n,pos:this.generatePos(e,n)}),!0):!1}isHexDigit(e){let n=e[0],r=n?.charCodeAt(0);return r>=65&&r<=70||r>=97&&r<=102?(this.pushToken({tokens:[20,47],value:n,pos:this.generatePos(e,n)}),!0):!1}isHash(e){return e.startsWith("#")?(this.pushToken({tokens:[46],pos:this.generatePos(e,"#"),value:"#"}),!0):!1}unknownToken(e){return this.pushToken({tokens:[41],pos:this.generatePos(e," "),value:e}),!0}isString(e){if(this.inComment)return!1;let n=e[0];if(n==='"'||n==="'"){let r=e.length-1;if(this.columnNumber+1<r)throw new Error("Error while rewinding");return this.columnNumber-=r,this.getString(n),!0}return!1}generatePos(e,n){let r=this.columnNumber-e.length,i=n.length;return{line:this.lineNumber,col:r,len:i,colEnd:r+i}}};var WT=require("fs"),Sa=require("path"),il=L(U());var Dt=class extends te{constructor(e){super(e),this.semanticTokenType="keyword",this.semanticTokenModifiers="declaration"}};var DD=require("path"),np=L(U());var Zr=class extends te{constructor(n,r){super();this.keyword=n;this.path=r;this.docSymbolsMeta={name:`Include ${r}`,kind:np.SymbolKind.File},this.addChild(n),this.addChild(r)}get resolvedPath(){return this._resolvedPath}set resolvedPath(n){this.docSymbolsMeta={name:`Include ${n}`,kind:np.SymbolKind.File},this._resolvedPath=n}},va=class extends te{constructor(n,r,i){super(i);this._path=n;this.relative=r;this.docSymbolsMeta={name:(0,DD.basename)(this.path),kind:np.SymbolKind.File},this.semanticTokenType="string",this.semanticTokenModifiers="declaration"}get path(){return this.relative?this._path.slice(1,-1):this._path}};var AD=L(U());var Tt=class extends me{constructor(n,r){super(r);this.name=n;this.docSymbolsMeta={name:this.name.toString(),kind:AD.SymbolKind.Variable},this.semanticTokenType="macro",this.semanticTokenModifiers="declaration"}toString(){return this.name}};var rp=class extends te{constructor(n,r){super(r);this.operator=n;this.semanticTokenType="operator",this.semanticTokenModifiers="declaration"}toString(){return this.operator}};var ID=L(U());var ba=class extends Dt{toString(){return"..."}},ei=class extends te{constructor(n,r){super();this.functionName=n;this.params=r;this.addChild(n),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(n){return fe(this.fsPath,n)?[{name:this.functionName.name,kind:ID.SymbolKind.Function,range:ce(this),selectionRange:ce(this),children:this.params.flatMap(r=>r.getDocumentSymbols(n))}]:[]}toString(){return`${this.functionName}(${this.params.map(n=>n.toString()).join(",")})`}};var zi=class t{constructor(){this.positionStack=[];this._issues=[];this.issueLengthPositionStack=[];this.moveEndOfLine=(e,n=!0,r=!1)=>{let i=e.pos.line;if(this.currentToken?.pos.line!==i||!fe(this.currentToken?.fsPath,e.fsPath))return;let s=this.currentToken,o=s;for(;this.currentToken?.pos.line===i&&fe(this.currentToken?.fsPath,e.fsPath);)o=this.moveToNextToken;return n&&this._issues.push(Y(22,s,o,null)),r&&o?.value==="\\"&&o.nextToken?this.moveEndOfLine(o.nextToken,n):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(),n=this.positionStack.pop();if(n===void 0||e===void 0)throw new Error("Index out of bounds");this.positionStack[this.positionStack.length-1]=n}peekIndex(e=1){let n=this.positionStack.at(-1*e);if(n===void 0)throw new Error("Index out of bounds");return n}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 n=[];return e.every(r=>{let i=this.currentToken,s=r(i),o=!1;return s!=="no"&&i&&(n.push(i),this.moveToNextToken,o=Kt(i,this.currentToken)),s==="yes"&&o}),this.mergeStack(),n}consumeAnyConcurrentTokens(e){this.enqueueToStack();let n=[],r,i=!0;for(;e.some(s=>s(this.currentToken)==="yes"&&i);)n.push(this.currentToken),r=this.moveToNextToken,i=Kt(r,this.currentToken);return this.mergeStack(),n}getDocumentSymbols(e){return this.allAstItems.flatMap(n=>n.getDocumentSymbols(e))}getWorkspaceSymbols(){return this.allAstItems.flatMap(e=>e.getWorkspaceSymbols())}static push(e,n,r,i,s,o){if(!r||!i||!fe(r.fsPath,s)||!fe(i.fsPath,s))return;let a=i.pos.colEnd-r.pos.col;o.push({line:r.pos.line,char:r.pos.col,length:i===r?i.pos.len:a,tokenType:e,tokenModifiers:n})}buildSemanticTokens(e,n,r=[]){this.allAstItems.forEach(i=>{i.buildSemanticTokens((...s)=>t.push(...s,n,r))}),r.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,n,r=!1){this.enqueueToStack();let i=this.consumeAnyConcurrentTokens([19,47,48].map(Fe));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 Tt(s,he(i[0],i.at(-1)));if(r&&!e.has(o.name)){this.popStack();return}return!n&&o.firstToken!==o.lastToken&&o.name!=="defined"&&(e.get(o.name)||this._issues.push(Y(42,o.firstToken,o.lastToken,o))),this.mergeStack(),o}isOperator(){this.enqueueToStack();let e=this.moveToNextToken;if(!e){this.popStack();return}let n=e,r;if(H(e,40)?(r="&",H(this.currentToken,40)&&(r="&&",n=this.moveToNextToken)):H(e,6)?(r="!",H(this.currentToken,0)&&(r="!=",n=this.moveToNextToken)):H(e,10)?r="~":H(e,8)?(r="|",H(this.currentToken,8)&&(r="||",n=this.moveToNextToken)):H(e,9)?r="^":H(e,4)?(r=">",H(this.currentToken,4)?(r=">>",n=this.moveToNextToken):H(this.currentToken,0)&&(r=">=",n=this.moveToNextToken)):H(e,5)?(r="<",H(this.currentToken,5)?(r="<<",n=this.moveToNextToken):H(this.currentToken,0)&&(r="<=",n=this.moveToNextToken)):H(e,15)?r="+":H(e,16)?r="-":H(e,17)?r="*":H(e,13)?r="/":H(e,18)?r="%":H(e,46)?H(this.currentToken,46)&&(r="##",n=this.moveToNextToken):H(e,0)&&H(this.currentToken,0)&&(r="==",n=this.moveToNextToken),r){let i=new rp(r,he(e,n));return this.mergeStack(),i}this.popStack()}parseScopedBlock(e,n,r){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&&!n(d);){if(r?.(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,n,r);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&&n(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 n=this.processCIdentifier(e,!1);if(!n){this.popStack();return}if(!(e.get(n.name)?.macro.identifier instanceof ei)&&!Kt(n.lastToken,this.currentToken)){this.popStack();return}let i=this.processMacroCallParams();if(!i){this.popStack();return}if(n.name==="defined")i.length>1?this._issues.push(Y(44,n.firstToken,n.lastToken,n)):i.length<1&&this._issues.push(Y(45,n.firstToken,n.lastToken,n));else{let o=e.get(n.name)?.macro;o&&(o?.identifier instanceof ei?o.identifier.params.at(-1)instanceof ba||(i.length>o.identifier.params.length?this._issues.push(Y(44,n.firstToken,n.lastToken,n,{linkedTo:[o]})):i.length<o.identifier.params.length&&this._issues.push(Y(45,n.firstToken,n.lastToken,n,{linkedTo:[o]}))):this._issues.push(Y(43,n.firstToken,n.lastToken,n)))}let s=new zt(n,i);return s.lastToken=this.prevToken,this.mergeStack(),s}processHex(){this.enqueueToStack();let e=this.checkConcurrentTokens([st("0"),st("x",{caseInsensitive:!0})]);if(e.length!==2){this.popStack();return}let n=this.consumeAnyConcurrentTokens([19,20].map(Fe));if(!n.length){this.popStack();return}let r=Number.parseInt(n.map(s=>s.value).join(""),16),i=new sn(r,he(e[0],n.at(-1)),16);return this.mergeStack(),i}processDec(e=!1){this.enqueueToStack();let n;e&&(H(this.currentToken,16)||H(this.currentToken,15))&&Kt(this.currentToken,this.currentToken?.nextToken)&&(n=this.moveToNextToken);let r=this.consumeAnyConcurrentTokens([19].map(Fe));if(!r.length){this.popStack();return}let i=Number.parseInt(r.map(o=>o.value).join(""),10);n&&H(n,16)&&(i=4294967295-i);let s=new sn(i,he(n??r[0],r.at(-1)),10);return this.mergeStack(),s}processEnclosedExpression(e,n){this.enqueueToStack();let r,i;if(H(this.currentToken,42)){let s;r=this.moveToNextToken,i=r;let o=this.processExpression(e,n,!0);return o&&(s=new rn(o,!0),o=new rn(s,!1),s.openBracket=r),H(this.currentToken,43)?(i=this.moveToNextToken,s&&(s.closeBracket=i)):r&&this._issues.push(Y(26,r,r,n)),this.mergeStack(),o}this.popStack()}processExpression(e,n,r=!1){this.enqueueToStack();let i,s;if(r&&(s=this.isOperator()),i=this.processEnclosedExpression(e,n)||this.isFunctionCall(e)||this.processCIdentifier(e,!1)||this.processHex()||this.processDec(!0),!i){this.popStack();return}if(s&&(i.operator=s),r){let o=this.isOperator();for(;o;){let a=this.processExpression(e,n,!0);a?i instanceof rn?i.addExpression(o,a):i=new rn(i,!1,{operator:o,expression:a}):this._issues.push(Y(27,o.firstToken,o.lastToken,n)),o=this.isOperator()}}return this.mergeStack(),i}processMacroCallParams(){if(!H(this.currentToken,42))return;let e=this.parseScopedBlock(r=>!!H(r,42),r=>!!H(r,43),r=>!!H(r,24));return e?.items.length===2&&H(e.endToken,43)?[]:e?.splitTokens.map((r,i)=>{if(r.tokens.length===0)return null;let s=new vi(r.tokens.map((o,a)=>{let c=o.value;return o.pos.line===r.tokens.at(a+1)?.pos.line?c=c.padEnd(r.tokens[a+1].pos.col-o.pos.col," "):o.value==="\\"&&(c=c.slice(0,-1)),c}).join(""),he(r.tokens[0],r.tokens.at(-1)),i);return s.splitToken=e.separatorTokens.at(i),s})}};var pr=class extends te{constructor(n){super();this.comments=n;this.disabled=!1;n.forEach(this.addChild.bind(this))}toString(){return this.comments.map(n=>n.toString()).join(`
|
|
294
|
+
`)}},hr=class extends te{constructor(n){super(n);this.disabled=!1;this.semanticTokenType="comment",this.semanticTokenModifiers="documentation"}toString(){let n,r=this.firstToken,i="";for(;r!==this.lastToken;)i+=r?.value.padStart(r.value.length+(n?r.pos.col-n.pos.colEnd:0)," "),n=r,r=r?.nextToken;r&&(i+=r?.value.padStart(r.value.length+(n?r.pos.col-n.pos.colEnd:0)," "));let s=i.match(/^\s*(?:(?:\/\/|\/\*+)\s*)?(.*?)\s*(?:\*\/)?\s*$/s);return s?s[1]:""}};var ip=class t extends zi{constructor(n,r=()=>Ln().requestTokens(this.fsPath,!0)){super();this.fsPath=n;this.getTokens=r;this.comments=[];this.tokens=[]}cleanUpComments(){let n=[];for(let r=0;r<this.tokens.length;r++){let i=t.processBlockComment(this.tokens,r)||t.processLineComment(this.tokens,r);i&&(r=i.index,n.push(...i.tokenUsed),this.comments.push(i.comment))}if(n.length>0){let r=new Set(n),i=[];for(let s=0;s<this.tokens.length;s++)r.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(n,r){let i=[],s=()=>(i.push(r++),n[r]),o=()=>n[r],a=()=>n[r-1],c=o(),l=c;if(!c||!H(c,13)||(l=s(),!H(l,17)||c.pos.line!==l.pos.line||c.pos.col+1!==l.pos.col))return;let u=()=>!(!H(a(),17)||!H(o(),13)||!Kt(a(),o())),d=l.pos.line,f=c,p=[];l=s();do{if(o()?.pos.line!==d){let y=new hr(he(f,a()));p.push(y),d=o().pos.line??0,f=o()}l=s()}while(r<n.length&&!u());let m=new hr(he(f,o()));p.push(m);let h=new pr(p);return s(),{comment:h,tokenUsed:i,index:r-1}}static processLineComment(n,r){let i=[];if(!H(n[r],13)||n.length===r+1||!H(n[r+1],13)||!Kt(n[r],n[r+1]))return;for(;n[r].pos.line===n.at(r+1)?.pos.line;)i.push(r++);return i.push(r++),{comment:new hr(he(n[i[0]],n[i.at(-1)])),tokenUsed:i,index:r-1}}};var OD=L(U());var sp=class extends te{constructor(n,r){super(n);this.content=r}toString(){let n=this.content.filter(r=>!H(r,14));return n.map((r,i)=>{let s=r.value;return r.pos.line===n.at(i+1)?.pos.line?s=s.padEnd(n[i+1].pos.col-r.pos.col," "):n.at(i+1)&&(s=s.padEnd(s.length+1," ")),s}).join("")}},Zc=class extends te{constructor(n,r,i){super();this.keyword=n;this.identifier=r;this.content=i;this.addChild(n),this.addChild(this.identifier),this.content&&this.addChild(this.content)}get name(){return this.identifier instanceof Tt?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:OD.MarkupKind.Markdown,value:["```cpp",`#define ${this.toString()}`,"```"].join(`
|
|
295
|
+
`)}}};var tl=class extends te{constructor(e){super(e)}},nl=class extends te{constructor(n,r){super();this.keyword=n;this.content=r;this.active=!1;this.addChild(n)}},rl=class extends nl{constructor(n,r,i){super(n,i);this.expression=r;this.addChild(r),this.addChild(i)}useBlock(n){return this.expression&&n.has(this.expression.name)}},op=class extends nl{constructor(n,r,i){super(n,i);this.expression=r;this.addChild(r),this.addChild(i)}useBlock(n){return this.expression?.isTrue(n)}},ap=class extends rl{useBlock(e){return this.expression&&!e.has(this.expression.name)}},cp=class extends nl{};var el=(t,e)=>{let n=t,r=[];for(;n&&(r.push(n),n!==e);)n=n.nextToken;return r},Er=class extends te{constructor(n,r,i){super();this.ifBlocks=n;this.endIf=r;this.elseOption=i;n.forEach(s=>this.addChild(s)),i&&this.addChild(i),this.addChild(r)}getInValidTokenRange(n){let r=this.ifBlocks.find(i=>i.useBlock(n));return r?r.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(r||this.elseOption)}get inactiveRanges(){let n=[],r=!!this.elseOption;this.ifBlocks.forEach((s,o)=>{if(s.active)return;let a=o===this.ifBlocks.length-1,c=s.firstToken,l=a?r?this.elseOption.firstToken:this.lastToken:s.content?.lastToken??this.ifBlocks[o+1].firstToken??s.lastToken;n.push(et.create(se(c),se(l)))});let i=n.length!==this.ifBlocks.length;if(this.elseOption&&i){let s=this.elseOption.firstToken,o=this.elseOption.content?.lastToken??this.endIf?.lastToken??this.lastToken;return n.push(et.create(se(s),se(o))),n}if(!i){let s=this.firstToken,o=this.lastToken;return[et.create(se(s),se(o))]}return n}getInValidTokenRangeWhenActiveBlock(n){let r=new WeakSet,i=!1;return this.ifBlocks.forEach(s=>{let o=s.expression?.lastToken??s.keyword.lastToken;el(s.firstToken,o).forEach(a=>r.add(a)),!i&&s===n?i=!0:s.content&&el(s.content.firstToken,s.content.lastToken).forEach(a=>r.add(a))}),this.elseOption&&(el(this.elseOption.keyword.firstToken,this.elseOption.keyword.lastToken).forEach(s=>r.add(s)),i&&this.elseOption.content&&el(this.elseOption.content.firstToken,this.elseOption.content.lastToken).forEach(s=>r.add(s))),this.endIf&&el(this.endIf.firstToken,this.endIf.lastToken).forEach(s=>r.add(s)),r}};var _a=class extends zi{constructor(n,r,i,s,o){super();this.fsPath=n;this.incudes=r;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(n){this._comments=this._comments.filter(r=>!n.has(r))}get currentToken(){let n=this.prevToken,r=this.peekIndex(),i=this.tokens.at(r),s=mn(n,i)||!n||H(n,14)&&n.pos.line+1===i?.pos.line;if(!(this.macroStart&&!s))return this.macroStart&&H(i,14)?(this.moveStackIndex(),this.currentToken):i}reset(n){super.reset(),this.macros.clear(),n?(this.macroSnapShot.clear(),Array.from(n).forEach(([r,i])=>this.macroSnapShot.set(r,i)),Array.from(n).forEach(([r,i])=>this.macros.set(r,i))):Array.from(this.macroSnapShot).forEach(([r,i])=>this.macros.set(r,i)),this.nodes=[],this.dtsIncludes=[],this.rangesToClean=new Set}async reparse(n){let r=this.stable;return this.parsing=new Promise(i=>{r.then(()=>{if(n&&n.size===this.macroSnapShot.size){let s=Array.from(n);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.fsPath),i();return}}this.reset(n),this.parse().then(i)})}),this.parsing}async parse(){let n=new ip(this.fsPath,this.getTokens);if(await n.stable,this.tokens=n.tokens,this._comments=n.allAstItems,this.positionStack.push(0),this.tokens.length!==0){for(;!this.done;)await this.lineProcessor();if(this.rangesToClean.size&&!this.fsPath.endsWith(".h")&&(this.tokens=this.tokens.filter(r=>!this.rangesToClean.has(r))),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||!fe(this.prevToken.fsPath,this.currentToken.fsPath))){this.moveEndOfLine(this.prevToken,!1),this.mergeStack();return}let r=this.currentToken,i=await this.processInclude()||this.processDefinitions()||this.processUndef()||this.processError();this.processIfDefBlocks(),r&&this.moveEndOfLine(r,!!i),this.mergeStack()}addTokensToClean(n){for(let r=n.start;r<n.start+n.count;r++){let i=this.tokens[r];i&&this.rangesToClean.add(i)}}processDefinitions(){this.enqueueToStack();let n=this.peekIndex(),r=this.moveToNextToken;if(!r||!H(r,25))return this.popStack(),!1;this.macroStart=!0;let i=new Dt(he(r)),s=this.isFunctionDefinition()||this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(Y(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=this.consumeDefinitionContent(),a;o.length&&(a=new sp(he(o[0],o.at(-1)),o));let c=new Zc(i,s,a);this.macros.set(c.name,{macro:c,resolver:_E(c.toString())}),this.nodes.push(c);let l=this.peekIndex();return this.addTokensToClean({start:n,count:l-n}),this.mergeStack(),this.macroStart=!1,!0}processUndef(){this.enqueueToStack();let n=this.peekIndex(),r=this.moveToNextToken;if(!r||!H(r,28))return this.popStack(),!1;this.macroStart=!0;let i=new Dt(he(r)),s=this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(Y(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:n,count:a-n}),this.mergeStack(),this.macroStart=!1,!0}processError(){this.enqueueToStack();let n=this.peekIndex(),r=this.moveToNextToken;if(!r||!H(r,29))return this.popStack(),!1;this.moveEndOfLine(r,!1,!0);let i=this.peekIndex();return this.addTokensToClean({start:n,count:i-n}),this.mergeStack(),!0}consumeDefinitionContent(){let n=[];for(;this.currentToken;){let r=this.moveToNextToken;r&&n.push(r)}return n}isFunctionDefinition(){this.enqueueToStack();let n=this.processCIdentifier(this.macros,!0);if(!n){this.popStack();return}let r=this.moveToNextToken;if(!H(r,42)||!Kt(n.lastToken,r)){this.popStack();return}let i=[],s=this.processCIdentifier(this.macros,!0)||this.processVariadic();for(;s;)i.push(s),!H(this.currentToken,24)&&!H(this.currentToken,43)?this._issues.push(Y(28,s.firstToken,s.lastToken,s)):H(this.currentToken,43)||(r=this.moveToNextToken),s=this.processCIdentifier(this.macros,!0)||this.processVariadic();let o=new ei(n,i);if(H(this.currentToken,43))r=this.moveToNextToken,o.lastToken=r;else{o.lastToken=this.prevToken;let a=i.at(-1)??o;this._issues.push(Y(26,a.firstToken,a.lastToken,a))}return this.mergeStack(),o}processVariadic(){this.enqueueToStack();let n=this.checkConcurrentTokens([Fe(45),Fe(45),Fe(45)]);if(n.length!==3){this.popStack();return}let r=new ba(he(n[0],n.at(-1)));return this.mergeStack(),r}processIfDefBlocks(){let n=this.peekIndex(),r=this.parseScopedBlock(a=>!!a&&[33,34,32].some(c=>H(a,c))&&!mn(a.prevToken,a),a=>!!a&&[37].some(c=>H(a,c))&&!mn(a.prevToken,a),a=>!!a&&[36,35].some(c=>H(a,c))&&!mn(a.prevToken,a));if(!r)return;let i=this.processIfBlock(r);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=>ao(c,a.range))&&(a.disabled=!0)}),[...i.ifBlocks,...i.elseOption?[i.elseOption]:[]].forEach(a=>{!a.active&&a.content&&this._issues.push(Y(47,a.content.firstToken,a.content.lastToken,a.content,{severity:il.DiagnosticSeverity.Hint,tags:[il.DiagnosticTag.Unnecessary]}))}),this.positionStack[this.positionStack.length-1]=n}processIfBlock(n){this.enqueueToStack();let r=new Dt(he(n.startToken)),i=[],s;n.splitTokens.forEach((c,l)=>{c.rewind();let u=this.prevToken,d=l===n.splitTokens.length-1&&H(u,36),f=new Dt(he(u));this.macroStart=!0;let p,m;if(H(f.firstToken,33)||H(f.firstToken,34)?(m=this.processCIdentifier(this.macros,!0),p=m):(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0),p instanceof Tt&&p.name.toLowerCase()==="defined"&&(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0))),this.macroStart=!1,d){let h=u,y=new Dt(he(h)),S;c.tokens.length&&(S=new tl(he(c.tokens[0],c.tokens.at(-1)))),s=new cp(y,S??null)}else{p||this._issues.push(Y(31,f.firstToken,f.lastToken,f));let h,y=c.tokens.indexOf(p?.lastToken??r.lastToken)+1,S=c.tokens[y];y!==-1&&S&&(h=new tl(he(S,c.tokens.at(-1)))),H(f.firstToken,33)?i.push(new rl(f,m??null,h??null)):H(f.firstToken,34)?i.push(new ap(f,m??null,h??null)):i.push(new op(f,p??null,h??null))}});let o;n.endToken?o=new Dt(he(n.endToken)):this._issues.push(Y(46,r.firstToken,r.lastToken,r));let a=new Er(i,o??null,s);return this.mergeStack(),a}get allAstItems(){return[...this.dtsIncludes,...this.nodes,...this.comments]}resolveInclude(n){if(n.path.path)return n.path.relative?[(0,Sa.resolve)((0,Sa.dirname)(n.fsPath),n.path.path),...this.incudes.map(r=>(0,Sa.resolve)(r,n.path.path))].find(r=>(0,WT.existsSync)(r)):this.incudes.map(r=>(0,Sa.resolve)(r,n.path.path)).find(r=>(0,WT.existsSync)(r))}async processInclude(){this.enqueueToStack();let n=this.peekIndex(),r=this.currentToken;if(!r)return this.popStack(),!1;let i=r,s=r;if(H(r,26))this.moveToNextToken;else{let h=this.checkConcurrentTokens([Fe(13),st("include"),Fe(13)]);if(h.length!==3)return this.popStack(),!1;i=h[0],s=h.at(-1)}let o=i,a=new Dt(he(i,s));r=this.moveToNextToken;let c=r,l=!!H(r,21);if(!c||!l&&!H(r,5))return o&&this.moveEndOfLine(o),this.mergeStack(),!0;let u="";if(l)u=r?.value??"";else for(;this.currentToken?.pos.line===o.pos.line&&!H(this.currentToken,4);)u+=this.currentToken?.value??"",r=this.moveToNextToken;let d=new va(u,l,he(c,r)),f=new Zr(a,d);this.dtsIncludes.push(f),l||(this.currentToken?.pos.line!==o.pos.line||!H(this.currentToken,4)?this._issues.push(Y(12,f.firstToken,f.lastToken,f)):(r=this.moveToNextToken,d.lastToken=r)),this.mergeStack();let p=this.peekIndex(),m=this.resolveInclude(f);if(f.resolvedPath=m,m||this._issues.push(Y(36,f.path.firstToken,f.path.lastToken,f.path,{severity:il.DiagnosticSeverity.Warning})),m&&!this.optimizeForFormatting){Ln().requestTokens(m,!0);let h=sl().getCPreprocessorParser(m,this.incudes,this.macros,this.fsPath);await h.stable,this._issues.push(...h.issues),this.macros.clear(),Array.from(h.macros).forEach(([y,S])=>this.macros.set(y,S)),m.endsWith(".h")?this.addTokensToClean({start:n,count:p-n}):(this.tokens=DE(this.tokens,n,p,h.tokens),this.positionStack[this.positionStack.length-1]=n),this.nodes.push(...h.nodes),this.dtsIncludes.push(...h.dtsIncludes)}else this.addTokensToClean({start:n,count:p-n});return!0}};var zT,lp=class{constructor(){this.headerFiles=new Map;this.includeOwners=new WeakMap}getCPreprocessorParser(e,n,r,i){e=dt(e);let s=`${Array.from(r).map(l=>l[1].macro.toString()).join("::")}`,o=this.headerFiles.get(e)?.get(s);if(o)return o.reparse(r),o;console.log("No c-preprocessor cache",e);let a=new _a(e,n,r),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=dt(e);let n=this.headerFiles.get(e);n&&Array.from(n).forEach(([r,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 sl(){return zT??=new lp,zT}function MD(){zT=new lp}var GT,up=class t{constructor(){this.fileMap=new Map}static clone(e){let n=e.length;if(n===0)return[];let r=new Array(n),i;for(let s=0;s<n;s++){let o=e[s],a={tokens:o.tokens,pos:o.pos,value:o.value,fsPath:o.fsPath,prevToken:i,nextToken:void 0};i&&(i.nextToken=a),r[s]=a,i=a}return r}needsRenew(e,n){return e=dt(e),this.fileMap.get(e)?.text!==n}getDocument(e,n){return xt.create(e,"devicetree",0,n??this.fileMap.get(e)?.text??(0,ol.readFileSync)(e).toString())}renewLexer(e,n){if(e=dt(e),sl().reset(e),!n&&!(0,ol.existsSync)(e))return[];try{n??=(0,ol.readFileSync)(e).toString();let r=new er(n,e);return this.fileMap.set(e,r),t.clone(r.tokens)}catch{}return[]}requestTokens(e,n){e=dt(e);let r=this.fileMap.get(e)?.tokens;return!r&&n?[...this.renewLexer(e)]:t.clone(r??[])}reset(e){e=dt(e),sl().reset(e),this.fileMap.delete(e)}};function Ln(){return GT??=new up,GT}function xD(){GT=new up}var Pi=class t{constructor(e){this.context=e;this.comments=[];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 n=this.fileTopMostAstCache.get(e);if(n)return n;let r=[...this.rootNode.implementations,...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,r),r}getDeepestAstNode(e,n){let r=this.fileTopMostAsts(e),i=Ln().requestTokens(e,!1),s=r.find(o=>Qt(o,e,n)||bE(i,o,n));if(!s){let o=this.context.allParsers.flatMap(l=>l.includes),a=(l,u)=>{let d=o.find(f=>fe(f.resolvedPath,l));return d&&this.context.getSortKeyFile(u,l)===void 0?a(d.lastToken.fsPath,se(d.lastToken)):d},c=a(e,n);c&&(s=r.at(-1)?.parentNode,e=c.fsPath,n=LD.Position.create(c.lastToken.pos.line,c.lastToken.pos.colEnd))}if(s instanceof ut){let a=this.rootNode.getReferenceBy(s)?.getDeepestAstNode(e,n);return a?{...a,runtime:this}:{item:null,runtime:this,ast:Jr(s,e,n)}}else if(s instanceof nt&&s.path){let o=this.rootNode.getDeepestAstNode(e,n);return o?{...o,runtime:this}:void 0}else if(s instanceof Ee&&s.path){let o=t.getNodeFromPath(s.path.slice(1),this.rootNode)?.getDeepestAstNode(e,n);return o?{...o,runtime:this}:void 0}else if(s)return{runtime:this,item:null,ast:Jr(s,e,n)}}static getNodeFromPath(e,n,r=!0){if(e.length===0)return n;let i=e[0].split("@"),s=i[0],a=i.at(1)?.split(",").map(u=>Number.parseInt(u,16)),c=e.slice(1),l=n.getNode(s,a,r);return l?t.getNodeFromPath(c,l,r):void 0}resolvePath(e,n){if(!e.at(0)?.startsWith("&"))return e;let r=this.labelsUsedCache.get(e[0].slice(1));return r||(n??=this.rootNode.allDescendantsLabels,n.find(s=>s.label.value===e.at(0)?.slice(1)&&s.parentNode instanceof we)?.lastLinkedTo?.path)}get issues(){return this.issuesCache??=[...this.labelIssues(),...this.rootNode.getIssues(this.context.macros)],this.issuesCache}labelIssues(){let e=[],n=new Map;return this.rootNode.allDescendantsLabelsMapped.forEach(r=>{n.has(r.label.label.value)?n.get(r.label.label.value)?.push(r):n.set(r.label.label.value,[r])}),Array.from(n).forEach(r=>{let i=r[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(Yt(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=n=>[...n.nodeType?.getIssue(this,n)??[],...n.nodes.flatMap(r=>e(r))];return this.typesIssuesCache??=e(this.rootNode),this.typesIssuesCache}getOrderedNodeAst(e){return SE(e.implementations,this.context)}};var al=L(U());var qD=L(U());var dp=class extends te{constructor(n){super();this.values=n;this.docSymbolsMeta={name:"Values",kind:qD.SymbolKind.String},this.values.forEach(r=>this.addChild(r))}toString(){return this.values.map(n=>n?.toString()).join(",")}toJson(){return this.values.length===1?this.values[0]?.toJson():this.values.map(n=>n?.toJson())}};var $D=L(U());var fp=class extends te{constructor(n){super();this.keyword=n;this.addChild(n),this.docSymbolsMeta={name:"DTS Document version",kind:$D.SymbolKind.Function}}};var ki=class extends te{constructor(n,r){super();this.value=n;this.labels=r;this.labels.forEach(i=>{this.addChild(i)}),this.addChild(this.value)}toString(n){return`${this.labels.map(r=>r.toString()).join(" ")}${this.value?.toString(n)??"NULL"}`}toPrettyString(n){return`${this.labels.map(r=>r.toString()).join(" ")}${this.value?.toPrettyString(n)??"NULL"}`}};var FD=L(U());var pp=class extends te{constructor(n,r,i){super();this.keyword=n;this.startAddress=r;this.endAddress=i;this.addChild(n),this.docSymbolsMeta={name:"Memreserve",kind:FD.SymbolKind.Function},this.addChild(r),this.addChild(i)}toString(){return`/memreserve/ 0x${this.startAddress?.value?.toString(16)} 0x${this.endAddress?.value?.toString(16)}`}};var BD=L(U());var hp=class extends te{constructor(n,r){super();this.keyword=n;this.bitsSize=r;this.addChild(n),this.docSymbolsMeta={name:"bits",kind:BD.SymbolKind.Function},this.addChild(r)}toString(){return`/bits/ ${this.bitsSize?.value?.toString()}`}};var Cr=class extends zi{constructor(n,r,i,s,o){super();this.fsPath=n;this.incudes=r;this.tokens=[];this.others=[];this.rootDocument=new we;this.unhandledStatements=new nt;this.injectedMacros=[];this.#e=!1;this.cPreprocessorParser=new _a(this.fsPath,this.incudes,i,s,o)}get issues(){return[...this._issues,...this.cPreprocessorParser.issues]}getFiles(){return[this.fsPath,...this.cPreprocessorParser.dtsIncludes.flatMap(n=>n.resolvedPath).filter(n=>!!n)]}reset(){super.reset(),this.others=[],this.rootDocument=new we,this._issues=[],this.unhandledStatements=new nt,this.#e=!1}async reparse(){let n=performance.now(),r=this.stable;return this.parsing=new Promise(i=>{r.then(async()=>{this.reset(),await this.cPreprocessorParser.reparse(),await this.parse(),console.log("parsing",performance.now()-n),i()})}),this.parsing}async parse(){if(await this.cPreprocessorParser.stable,this.tokens=this.cPreprocessorParser.tokens,dt(this.fsPath).endsWith(".h")||(this.positionStack.push(0),this.tokens.length===0))return;let n=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(Y(22,s,s,null)),this.reportExtraEndStatements())}};for(;!this.done;)await n();this.fsPath.endsWith(".dtsi")||(this.unhandledStatements.nodes.forEach(s=>{this._issues.push(Y(53,s.firstToken,s.lastToken,s))}),this.unhandledStatements.properties.forEach(s=>{this._issues.push(Y(32,s.firstToken,s.lastToken,s))}),this.unhandledStatements.deleteProperties.forEach(s=>{this._issues.push(Y(33,s.firstToken,s.lastToken,s))}));let r=this.allAstItems.flatMap(s=>[s,...s.allDescendants]),i=this.cPreprocessorParser.comments;if(i.length&&r.forEach(s=>{(s instanceof we||s instanceof Ne||s instanceof Zr)&&wE(s,i)}),this.positionStack.length!==1)throw new Error("Incorrect final stack size")}processInjectPreProcessorMacros(n){let r=this.peekIndex(),i=this.isFunctionCall(n)||this.processCIdentifier(n,!0,!0);return this.injectPreProcessorResults(n,i,r)}injectPreProcessorResults(n,r,i){let s=r?.resolve(n);if(r&&typeof s=="string"){s=kT(s);let o=jf(r.fsPath,ce(r)),a=new Set;if(this.cPreprocessorParser.comments.forEach(l=>{Qt(r,r.fsPath,l.range.start)&&a.add(l)}),this.cPreprocessorParser.removeComments(a),this.injectedMacros.push(r),r instanceof Tt&&s.includes(r.name)||r instanceof zt&&s.includes(r.functionName.name))return!0;let c=new er(s,o);return this.tokens.splice(i,this.peekIndex()-i,...c.tokens),this.positionStack[this.positionStack.length-1]=i,!0}}isRootNodeDefinition(n){this.enqueueToStack();let r=this.moveToNextToken,i=r;if(!r||!H(r,13))return this.popStack(),!1;if(i=this.moveToNextToken,!i||!H(i,2))return this.popStack(),!1;let s=new nt;s.openScope=i,n.addNodeChild(s),this.processNode(s,"Name");let o=this.nodeEnd(s)??i;return s.firstToken=r,s.lastToken=o,this.mergeStack(),!0}nodeEnd(n){let r=this.currentToken;if(H(r,3))this.moveToNextToken;else{let i=this.prevToken;return i&&this._issues.push(Y(3,i,i,n)),this.endStatement(n,!1)}return this.prevToken?.value==="}"&&(n.closeScope=this.prevToken),this.endStatement(n)}isNodeEnd(){return H(this.currentToken,3)||H(this.currentToken,1)}endStatement(n,r=!0){let i=this.currentToken;if(!H(i,1)){let s=this.prevToken;if(s&&r)return this._issues.push(Y(1,s,s,n)),s}return this.moveToNextToken,this.reportExtraEndStatements(),i}reportExtraEndStatements(){for(;H(this.currentToken,1);){let n=this.moveToNextToken;n&&this._issues.push(Y(23,n,n,null))}}processNode(n,r){if(this.done)return!1;let i=!1,s=!1;do{for(;this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros););if(s=this.isChildNode(n,r)||this.isProperty(n)||this.isDeleteNode(n,r)||this.isDeleteProperty(n),!s&&!this.isNodeEnd()&&!this.done){let o=this.moveToNextToken;o&&(this._issues.push(Y(22,o,o,null)),this.reportExtraEndStatements())}else if(this.done)break;i=i||s}while(!this.isNodeEnd());return i}processOptionalLabelAssign(n=!1){let r=[],i=this.isLabelAssign(n);for(;i;)r.push(i),i=this.isLabelAssign(n);return r}isChildNode(n,r){this.enqueueToStack();let i;r==="Name"&&(i=this.isOmitIfNoRefNode());let s=this.processOptionalLabelAssign(),o,a,c=r==="Ref"?new ut(s):new Ee(s,i);if(r==="Ref"?(this.enqueueToStack(),a=this.processNodePathRef(c),!a||!H(this.currentToken,2)?(this.popStack(),a=void 0):this.mergeStack(),a??=this.isLabelRef(c)):r==="Name"&&(o=this.isNodeName()),!a&&!o){if(!H(this.currentToken,2))return this.popStack(),!1;c.firstToken=this.currentToken,this._issues.push(Y(r==="Name"?[7]:[10,48,11],c.firstToken,this.currentToken?.nextToken,c))}let l=!1;if(a&&c instanceof ut?(c.reference=a,l=!0):o&&c instanceof Ee&&(l=o.address!==void 0,c.name=o),H(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(Y(2,u.firstToken,u.lastToken,u))}else return this.popStack(),!1;return n.addNodeChild(c),this.mergeStack(),!0}processNodeAddress(n){let r=this.prevToken;this.enqueueToStack();let i=this.checkConcurrentTokens([st("0"),st("x",{caseInsensitive:!0})]);i.length!==2?(i=[],this.popStack()):(this._issues.push(Y(50,i[0],i[1],n,{severity:al.DiagnosticSeverity.Warning})),r=i.at(-1),this.mergeStack());let s=this.consumeAnyConcurrentTokens([19,20,48].map(Fe)),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 r&&(a.some(l=>Number.isNaN(l))?this._issues.push(Y(8,r,r,n)):!Number.isNaN(a)&&!Kt(r,s[0])&&!bi(s[0].fsPath)&&this._issues.push(Y(29,r,s[0],n,{inclusiveStart:!1,inclusiveEnd:!1}))),this.currentToken?.value.toUpperCase()==="ULL"&&(this._issues.push(Y(51,this.currentToken,this.currentToken,n,{severity:al.DiagnosticSeverity.Warning})),this.moveToNextToken),new Vc(a,he(i.at(0)??s[0]??this.prevToken,this.prevToken))}processNodeAddresses(n){this.enqueueToStack();let r=this.checkConcurrentTokens([Fe(49)]);if(r.length){Kt(n.lastToken,r[0])||this._issues.push(Y(29,n.lastToken,r[0],n,{inclusiveStart:!1,inclusiveEnd:!1}));let i=[],s=()=>{this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros),i.push(this.processNodeAddress(n)),H(this.currentToken,24)&&(this.prevToken&&!Kt(this.prevToken,this.currentToken)&&this._issues.push(Y(29,this.prevToken,this.currentToken,n,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken,s())};s();let o=this.currentToken;for(;!H(this.currentToken,2)&&!H(this.currentToken,1)&&!H(this.currentToken,3)&&!H(this.currentToken,13)&&mn(this.currentToken,i.at(-1)?.lastToken);)this.moveToNextToken;if(o&&o!==this.currentToken){this._issues.push(Y(52,o,this.currentToken,n));let a=new Vc([],he(o,this.prevToken));i.push(a)}return this.mergeStack(),i}this.popStack()}isNodeName(){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16].map(Fe));if(!n.length){this.popStack();return}let r=n.map(o=>o.value).join(""),i=new $e(r,he(n[0],n.at(-1))),s=this.processNodeAddresses(i);return i.address=s,Hf(r)||this._issues.push(Y(49,i.firstToken,i.lastToken,i)),this.mergeStack(),i}isPropertyName(){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16,44,46].map(Fe));if(!n.length){this.popStack();return}let r=new Xe(n.map(i=>i.value).join(""),he(n[0],n.at(-1)));return this.mergeStack(),r}isLabelName(){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,48].map(Fe));if(!n.length){this.popStack();return}if(!Hf(n?.[0].value)){this.popStack();return}let r=n.map(s=>s.value).join(""),i=new gn(r,he(n[0],n[n.length-1]));return this.mergeStack(),i}isLabelAssign(n){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,48].map(Fe));if(!r.length){this.popStack();return}if(!Hf(r?.[0].value)){this.popStack();return}let i=r.map(c=>c.value).join(""),s=this.currentToken,o=s&&H(s,50),a=new ys(new gn(i,he(r[0],r.at(-1))),he(r[0],o?s:r.at(-1)));if(o){let c=r.at(-1);c&&(s.pos.line!==a.firstToken.pos.line||s.pos.col!==c.pos.colEnd)&&this._issues.push(Y(29,c,s,a,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken}else if(n)this._issues.push(Y(24,a.firstToken,a.lastToken,a));else{this.popStack();return}return this.mergeStack(),a}isProperty(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(),i=this.isPropertyName();if(!i)return this.popStack(),!1;if(H(this.currentToken,2)||H(this.currentToken,49))return this.popStack(),!1;let s=new Ne(i,r),o;H(this.currentToken,0)?(s.assignOperatorToken=this.moveToNextToken,o=this.processValue(n),o?.values.filter(c=>!!c).length||this._issues.push(Y(0,s.firstToken,s.lastToken,s)),s.values=o??null):s.values=void 0;let a=this.endStatement(s);return s.lastToken=a,n.addNodeChild(s),this.mergeStack(),!0}isDtsDocumentVersion(){this.enqueueToStack();let n=this.checkConcurrentTokens([Fe(13),st("d"),st("ts"),Fe(16),st("v"),st("1")]);if(n.length!==6)return this.popStack(),!1;let r=n[0],i=r,s=new Dt;s.firstToken=r;let o=new fp(s);if(this.others.push(o),H(this.currentToken,13))i=this.moveToNextToken;else return s.lastToken=n.at(-1),this._issues.push(Y(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 n=this.checkConcurrentTokens([Fe(13),st("memreserve")]);if(n.length!==2)return this.popStack(),!1;let r=new Dt;r.firstToken=n[0];let s=n[0];H(this.currentToken,13)?(s=this.moveToNextToken,r.lastToken=s):(r.lastToken=n.at(-1),this._issues.push(Y(21,r.firstToken,r.lastToken,r)));let o=this.processHex()||this.processDec(),a=o&&(this.processHex()||this.processDec()),c=new pp(r,o,a);if(this.others.push(c),o||this._issues.push(Y(37,r.firstToken,r.lastToken,r)),!a){let l=o??r;this._issues.push(Y(38,l.firstToken,l.lastToken,c))}return c.lastToken=this.endStatement(c),this.mergeStack(),!0}isPlugin(){this.enqueueToStack();let n=this.checkConcurrentTokens([Fe(13),st("plugin"),Fe(13)]);if(n.length!==3)return this.popStack(),!1;let r=new Dt(he(n[0],n.at(-1)));return r.lastToken=this.endStatement(r),this.mergeStack(),this.others.push(r),!0}processBits(){this.enqueueToStack();let n=this.checkConcurrentTokens([Fe(13),st("b"),st("its")]);if(n.length!==3){this.popStack();return}let r=new Dt;r.firstToken=n[0];let s=n[0];H(this.currentToken,13)?(s=this.moveToNextToken,r.lastToken=s):(r.lastToken=n.at(-1),this._issues.push(Y(21,r.firstToken,r.lastToken,r)));let o=this.processDec(),a=new hp(r,o);return this.others.push(a),o?o.value!==8&&o.value!==16&&o.value!==32&&o.value!==64&&this._issues.push(Y(40,o.firstToken,o.lastToken,o)):this._issues.push(Y(39,r.firstToken,r.lastToken,r)),this._issues.push(Y(41,a.firstToken,a.lastToken,a,{severity:al.DiagnosticSeverity.Warning})),this.mergeStack(),a}isOmitIfNoRefNode(){this.enqueueToStack();let n=this.checkConcurrentTokens([Fe(13),st("omit"),Fe(16),st("if"),Fe(16),st("no"),Fe(16),st("ref"),Fe(13)]);if(n.length!==9){this.popStack();return}let r=new Dt(he(n[0],n.at(-1)));return this.mergeStack(),r}isDeleteNode(n,r){this.enqueueToStack();let i=this.checkConcurrentTokens([Fe(13),st("d"),st("e"),st("lete",{allowPartial:!0}),Fe(16),st("node",{allowPartial:!0})]);if(!i.length)return this.popStack(),!1;let s=i[0],o=s,a=new Dt;if(a.firstToken=s,i.length===1&&!H(this.currentToken,2)){this._issues.push(Y(25,a.firstToken,a.lastToken,a)),a.lastToken=i.at(-1);let d=new Xn(a);return n.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(Y(c.startsWith("/delete-n")?34:25,a.firstToken,a.lastToken,a)):H(this.currentToken,13)?(o=this.moveToNextToken,a.lastToken=o):this._issues.push(Y(21,a.firstToken,a.lastToken,a));let l=new Xn(a);if(mn(a.lastToken,s)){let d=this.processNodePathRef(n);d&&r==="Name"&&this._issues.push(Y(7,d.firstToken,d.lastToken,d));let f=d?void 0:this.isLabelRef(n);f&&r==="Name"&&this._issues.push(Y(7,f.firstToken,f.lastToken,f));let p=d||f?void 0:this.isNodeName();p&&r==="Ref"&&this._issues.push(Y(10,p.firstToken,p.lastToken,p)),!d&&!p&&!f&&this._issues.push(Y([7,10],l.firstToken,l.lastToken,l)),l.nodeNameOrRef=d??f??p??null}else r==="Name"?this._issues.push(Y(7,a.firstToken,a.lastToken,a)):r==="Ref"&&this._issues.push(Y(10,a.firstToken,a.lastToken,a));let u=this.endStatement(l);return l.lastToken=u,n.addNodeChild(l),this.mergeStack(),!0}isDeleteProperty(n){this.enqueueToStack();let r=this.checkConcurrentTokens([Fe(13),st("d"),st("e"),st("lete",{allowPartial:!0}),Fe(16),st("property",{allowPartial:!0})]);if(!r.length)return this.popStack(),!1;let i=r[0],s=i,o=new Dt;if(o.firstToken=i,r.length===1&&!H(this.currentToken,2)){this._issues.push(Y(25,o.firstToken,o.lastToken,o)),o.lastToken=r.at(-1);let u=new lt(o);return n.addNodeChild(u),this.mergeStack(),!0}let a=r.map(u=>u.value??"").join("");if(!"/delete-property/".startsWith(a)||a.endsWith("-"))return this.popStack(),!1;o.lastToken=r.at(-1),a!=="/delete-property"?this._issues.push(Y(a.startsWith("/delete-p")?35:25,o.firstToken,o.lastToken,o)):H(this.currentToken,13)?(s=this.moveToNextToken,o.lastToken=s):this._issues.push(Y(21,o.firstToken,o.lastToken,o));let c=new lt(o);if(mn(o.lastToken,i)){let u=this.isPropertyName();u||this._issues.push(Y(6,c.firstToken,c.lastToken,c)),c.propertyName=u??null}else this._issues.push(Y(6,o.firstToken,o.lastToken,o));let l=this.endStatement(c);return c.lastToken=l,n.addNodeChild(c),this.mergeStack(),!0}isNodePathRef(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),i=this.processNodePathRef(n);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 xn(r,i,s);return this.mergeStack(),o}processValue(n){this.enqueueToStack();let i=(()=>{let o=()=>(this.processStringValue()||this.isNodePathRef(n)||this.isLabelRefValue(n)||this.arrayValues(n)||this.processByteStringValue()||this.isExpressionValue(n))??null,a=o();if(!a)return[];let c=[a];for(;!H(this.currentToken,1);){let l=this.prevToken,u=this.currentToken,d,f=H(this.currentToken,24);if(f)d=this.currentToken,this.moveToNextToken;else if(!mn(this.prevToken,this.currentToken))break;let p=o();if(u&&p===null&&f){let h=new te(he(u,this.currentToken));this._issues.push(Y(0,h.firstToken,h.lastToken,h))}if(!f&&p===null)break;if(l&&!f&&p){let h=new te(he(l));this._issues.push(Y(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 dp(i)}processStringValue(){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),r=this.consumeAnyConcurrentTokens([Fe(21)]);if(!r.length){this.popStack();return}if(r.some(u=>u.value===void 0))throw new Error("Token must have value");let i=r.map(u=>u.value).join(`
|
|
296
|
+
`),s=i,o=['"',"'"].some(u=>s.endsWith(u));o&&(s=s.slice(1,-1));let a=new re(s,he(r[0],r.at(-1)));o||this._issues.push(Y(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 xn(n,a,c);return this.mergeStack(),l}arrayValues(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),i=this.processBits(),s=this.currentToken;if(H(s,5))this.moveToNextToken;else{this.popStack();return}let o=this.processArrayValues(n)??null;o.openBracket=s;let a=this.processOptionalLabelAssign(!0)??[],c=new xn(r,o,a,i);if(!H(this.currentToken,4))this._issues.push(Y(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 n=this.processOptionalLabelAssign(!0),r=this.moveToNextToken,i=r;if(!H(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(Y(15,u.firstToken,u.lastToken,u))});let a=new Mn(s??[]);a.openBracket=i,a.values.length===0&&(a.firstToken=r,this._issues.push(Y(14,a.firstToken,a.lastToken,a,{severity:al.DiagnosticSeverity.Information})));let c=new xn(n,a,o);H(this.currentToken,12)?a.closeBracket=this.moveToNextToken:this._issues.push(Y(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=r,a.lastToken=this.prevToken,c}processLabeledValue(n){this.enqueueToStack();let r=n(),i=[];if(!r)return this.popStack(),[];for(;r;)i.push(r),r=n();if(i.length){let s=n();s&&i.push(s)}return this.mergeStack(),i}processArrayValues(n){this.enqueueToStack();let r=this.processLabeledValue(()=>{let s=()=>this.processRefValue(n,!1)||this.processLabeledHex(!1)||this.processLabeledDec(!1)||this.processLabeledExpression(!0,!1,n),o=this.peekIndex(),a=s();return a&&!this.cPreprocessorParser.optimizeForFormatting&&(a.value instanceof zt&&a.value.params.every(c=>!!c)&&this.cPreprocessorParser.macros.has(a.value.functionName.name)||a.value instanceof Tt&&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 ct(r);return r.length===0&&(i.firstToken=this.currentToken),this.mergeStack(),i}processLabeledHex(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(n),i=this.processHex();if(!i){this.popStack();return}let s=new ki(i,r);return this.mergeStack(),s}processHexString(){this.enqueueToStack();let n=this.processOptionalLabelAssign(!1),r=this.checkConcurrentTokens([20,20].map(Fe));if(!r.length){this.popStack();return}let i=Number.parseInt(r.map(a=>a.value).join(""),16),s=new sn(i,he(r[0],r.at(-1)),16),o=new ki(s,n);return this.mergeStack(),o}processLabeledDec(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(n),i=this.processDec();if(!i){this.popStack();return}let s=new ki(i,r);return this.mergeStack(),s}processLabeledExpression(n=!0,r=n,i){this.enqueueToStack();let s=[];n&&(s=this.processOptionalLabelAssign(r));let o=this.processExpression(this.cPreprocessorParser.macros,i);if(!o){this.popStack();return}let a=new ki(o,s);return this.mergeStack(),a}isExpressionValue(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(!1),i=this.processExpression(this.cPreprocessorParser.macros,n);if(!i){this.popStack();return}let s=this.processOptionalLabelAssign(!0),o=new xn(r,i,s);return this.mergeStack(),o}isLabelRef(n){this.enqueueToStack();let r=this.currentToken;if(!r||!H(r,40)){this.popStack();return}else this.moveToNextToken;let i=this.isLabelName();if(!i){let o=new ie(null);return this._issues.push(Y(18,r,r,n)),o.firstToken=r,this.mergeStack(),o}r&&(i.firstToken.pos.line!==r.pos.line||i.firstToken.pos.col!==r.pos.colEnd)&&this._issues.push(Y(29,r,i.firstToken,n,{inclusiveStart:!1,inclusiveEnd:!1}));let s=new ie(i);return s.firstToken=r,this.mergeStack(),s}isLabelRefValue(n){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),i=this.isLabelRef(n);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 xn(r,i,s);return this.mergeStack(),o}processRefValue(n,r){this.enqueueToStack();let i=this.processOptionalLabelAssign(r),s=this.currentToken;if(!s||!H(s,40)){this.popStack();return}let o=this.processNodePathRef(n);if(o!==void 0){let l=new ki(o,i);return this.mergeStack(),l}let a=this.isLabelRef(n);if(a===void 0){this._issues.push(Y([18,9],s,s,n));let l=new ki(null,i);return l.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),l}let c=new ki(a,i);return c.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),c}processNodePath(n=!0,r=new Qr){this.enqueueToStack();let i;if(H(this.currentToken,13))i=this.moveToNextToken;else{if(!n){this.popStack();return}this.prevToken&&this._issues.push(Y(19,this.prevToken,this.prevToken,r))}let s=this.isNodeName(),o=i??this.prevToken;if(!s&&o&&!n&&this._issues.push(Y(7,o,o,r)),!n||s?r.addPath(s??null,i?new te(he(i)):void 0):n&&!s&&i&&(r.addPath(new $e("/",he(i))),r.firstToken=i),n&&!i&&r.children.length===0){this.mergeStack();return}return this.processNodePath(!1,r),this.mergeStack(),r}processNodePathRef(n){this.enqueueToStack();let r=this.moveToNextToken,i=r;if(!H(i,40)){this.popStack();return}let s=this.moveToNextToken;if(i=s,!H(i,2)){this.popStack();return}r&&!Kt(r,s)&&this._issues.push(Y(29,r,s,n,{inclusiveStart:!1,inclusiveEnd:!1}));let o=this.processNodePath(),a=new rt(o??null),c=this.currentToken??this.prevToken,l=c;return o?.children.forEach((u,d)=>{if(d===o?.children.length-1&&u&&l&&!Kt(u.lastToken,l)){this._issues.push(Y(29,u.lastToken,l,n,{inclusiveStart:!1,inclusiveEnd:!1}));return}if(d===0&&s&&!Kt(s,u?.firstToken)){this._issues.push(Y(29,s,u?.firstToken,n,{inclusiveStart:!1,inclusiveEnd:!1}));return}let f=o?.children[d+1];u&&f&&!Kt(u.lastToken,f.firstToken)&&this._issues.push(Y(29,u.lastToken,f?.firstToken,n,{inclusiveStart:!1,inclusiveEnd:!1}))}),H(c,3)?this.moveToNextToken:this.prevToken&&this._issues.push(Y(3,this.prevToken,this.prevToken,n)),a.firstToken=r,a.lastToken=c??this.prevToken,this.mergeStack(),a}get includes(){return this.cPreprocessorParser.dtsIncludes}get allAstItems(){return[...this.cPreprocessorParser.allAstItems,...this.rootDocument.children,...this.others,...this.unhandledStatements.properties,...this.unhandledStatements.deleteProperties,...this.unhandledStatements.nodes]}#e;get latestSemanticTokensBuilt(){return this.#e}buildSemanticTokens(n,r){let i=[];this.injectedMacros.forEach(s=>{s.buildSemanticTokens((...o)=>zi.push(...o,r,i))}),super.buildSemanticTokens(n,r,i),this.#e=!0}};var mp=class t{constructor(e,n,r){this.settings=e;this.formattingOptions=n;this.bindingLoader=r;this._issues=[];this.overlayParsers=[];this.overlays=[];this.ctxNames_=new Set;this.sortKeys=new WeakMap;this.staleFsPaths=new Set;let i={...e,ctxName:e.ctxName??(0,Pa.basename)(e.dtsFile)};this.isFullContext=this.settings.dtsFile.toLowerCase().endsWith(".dts"),this.overlays=i.overlays,this.overlays.filter(cl.existsSync);let s=this.isFullContext&&r?.type==="Zephyr"?[(0,Pa.join)((0,Pa.dirname)(this.settings.dtsFile),"dts"),...i.includePaths]:i.includePaths;this.parser=new Cr(i.dtsFile,s),this.ctxNames_.add(i.ctxName),this.id=Wi(i),this.parser.stable.then(()=>{this.overlayParsers=this.overlays?.map(o=>new Cr(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,n=r=>({fsPath:r,includes:(e.get(r)??[]).map(i=>n(i.resolvedPath??i.path))});return[...this.parser.includes,...this.overlayParsers.flatMap(r=>r.includes)].forEach(r=>{let i=e.get(r.fsPath);i||(i=[],e.set(r.fsPath,i)),i.push({path:r.path.path,resolvedPath:r.resolvedPath})}),{mainDtsPath:n(this.parser.fsPath),overlays:this.overlays.map(n)}}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(n=>fe(n,e))}getFsPathParser(e){return this.allParsers.find(r=>r.getFiles().some(i=>fe(i,e)))}async getAllStableParsers(){return await this.stable(),this.allParsers}get allParsers(){return[this.parser,...this.overlayParsers]}async getDocumentLinks(e,n){if(!this.isInContext(e))return[];let i=(await this.getRuntime()).rootNode.allBindingsProperties.filter(s=>fe(s.ast.fsPath,e)&&s.ast.values&&(!n||Qt(s.ast.values,e,n))).flatMap(s=>s.ast.values?.values.flatMap(o=>{let c=s.parent?.nodeTypes.find(l=>o?.value instanceof re&&l.compatible===o.value.value);return c&&c.bindingsPath?{range:ce(o.value),target:ue(c.bindingsPath)}:void 0})).filter(s=>!!s)??[];return[...[...this.parser.cPreprocessorParser.dtsIncludes,...this.overlayParsers.flatMap(s=>s.cPreprocessorParser.dtsIncludes)].filter(s=>fe(s.fsPath,e)&&(!n||Qt(s,e,n))).map(s=>{let o=this.parser.cPreprocessorParser.resolveInclude(s);if(o)return{range:ce(s.path),target:ue(o)}}).filter(s=>!!s)??[],...i]}linkPropertiesLabelsAndNodePaths(e){let n=s=>[...s.properties,...s.nodes.flatMap(n)],r=n(e.rootNode),i=e.rootNode.allDescendantsLabels;r.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(Yt(3,o.firstToken,o.lastToken,o,{templateStrings:[o.value]}))}else o instanceof Qr&&this.linkNodePath(o,e.rootNode)}))}linkNodePath(e,n){let r=n,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==="/"?n:r?.getNode(a.name,a.fullAddress,!1);a.linksTo=c,!o&&!c&&(o=!0,this._issues.push(Yt(8,a.firstToken,a.lastToken,a,{templateStrings:[a.toString(),`${e.pathParts.filter(l=>l?.linksTo).map(l=>l?.toString()).join("/")}`]}))),c?.linkedNodeNamePaths.push(a),r=c}else break}}setStaleFsPath(e){this.staleFsPaths.add(e)}async reevaluate(e){this.setStaleFsPath(e);let n=new Set;return this.staleFsPaths.forEach(r=>{let i=this.getFsPathParser(r);i&&n.add(i)}),n.size?(this.sortKeys=new WeakMap,await Promise.all(Array.from(n).map(r=>r.reparse())),this._runtime=this.evaluate(),this._runtime):this._runtime}getSortKey(e,n=!1){if(e)return this.sortKeys.get(n?e.lastToken:e.firstToken)}async evaluate(){let e=performance.now();await this.stable();let n=new Pi(this);this.staleFsPaths.clear(),this._issues=[],this.parser.rootDocument.resetIssues(),this.processRoot(this.parser.rootDocument,n);for(let i=0;i<this.overlayParsers.length;i++)this.overlayParsers[i].rootDocument.resetIssues(),this.processRoot(this.overlayParsers[i].rootDocument,n);let r=await Promise.all(n.rootNode.defaultProperties.map(async i=>{let s=new er(i.text,i.fsPath),o=new Cr(i.fsPath,[],void 0,()=>s.tokens);return await o.stable,this.processRoot(o.rootDocument,n),o}));return n.comments=this.parser.cPreprocessorParser.allAstItems.filter(i=>i instanceof hr),[...this.allParsers,...r].flatMap(i=>i.tokens).forEach((i,s)=>this.sortKeys.set(i,s)),this.linkPropertiesLabelsAndNodePaths(n),this.reportNodeNameAndPropertyClashes(n),console.log(`(ID: ${this.id}) evaluate`,performance.now()-e),n}getSortKeyFile(e,n){let r=this.findTokenBeforePosition(e,n),i=r,s=i?this.sortKeys.get(i):void 0;for(;i&&!s;)i=i.nextToken,s=i?this.sortKeys.get(i):void 0;if(s!==void 0)return s;for(i=r,s=i?this.sortKeys.get(i):void 0;i&&!s;)i=i.prevToken,s=i?this.sortKeys.get(i):void 0;return s}findTokenBeforePosition(e,n){let r=this.allParsers.flatMap(i=>({parser:i,tokens:i.tokens}));for(let[i,s]of r.entries()){if(s.tokens.length===0&&fe(s.parser.fsPath,n)){let c=r[i-1];return i?c.tokens[c.tokens.length-1]:void 0}let o=s.tokens.find((c,l)=>gs(c,n,e)&&(l===s.tokens.length-1||!c.nextToken||bT(c.nextToken,n,e)));if(o)return o;let a=s.parser.includes.find(c=>c.resolvedPath===n);if(a)return a.lastToken;if(s.parser.getFiles().some(c=>fe(c,n)))return s.tokens[s.tokens.length-1]}}reportNodeNameAndPropertyClashes(e){let n=r=>{r.properties.forEach(i=>{r.nodes.filter(o=>o.address===void 0&&o.name===i.ast.propertyName?.name&&o.definitions.at(-1)?.name).forEach(o=>{let a=o.definitions,c=a[a.length-1].name;this._issues.push(Yt(2,c.firstToken,c.lastToken,c,{linkedTo:[i.ast,...i.allReplaced.map(l=>l.ast)]}))})}),r.nodes.forEach(n)};n(e.rootNode)}processRoot(e,n){for(let r=0;r<e.children.length;r++){let i=e.children[r];this.processChild(i,n.rootNode,n)}}processChild(e,n,r){e instanceof we?this.processDtcBaseNode(e,n,r):e instanceof Ne?this.processDtcProperty(e,n,r):e instanceof Xn?this.processDeleteNode(e,n,r):e instanceof lt&&this.processDeleteProperty(e,n,r)}checkNodeUniqueNames(e,n){let r=(o,a)=>o.filter(c=>c.name===a.name&&(c.address===a.fullAddress&&c.address===void 0||Lt(c.address??[],a.fullAddress??[])===0)).map(c=>c.issueAst),i=n.nodes.map(o=>{let a=o.definitions[0];return{name:o.name,address:o.address,issueAst:a.name??a}}),s=[];e.children.forEach(o=>{if(o instanceof Ee&&o.name){let a=r(s.map(c=>({name:c.name,address:c.fullAddress,issueAst:c})),o.name);a.length&&this._issues.push(Yt(2,o.name.firstToken,o.name.lastToken,o.name,{linkedTo:a})),s.push(o.name)}else if(o instanceof Xn&&o.nodeNameOrRef instanceof $e){let a=o.nodeNameOrRef;r(i,a)&&(s=s.filter(c=>r(s.map(l=>({name:l.name,address:l.fullAddress,issueAst:l})),c).length))}})}getCompileCommands(){if(!(!this.settings.compileCommands||!(0,cl.existsSync)(this.settings.compileCommands)))return JSON.parse((0,cl.readFileSync)(this.settings.compileCommands).toString())}processDtcBaseNode(e,n,r){e instanceof nt?this.processDtcRootNode(e,r):e instanceof Ee?this.processDtcChildNode(e,n,r):e instanceof ut&&this.processDtcRefNode(e,r)}processDtcRootNode(e,n){n.rootNode.implementations.push(e),this.checkNodeUniqueNames(e,n.rootNode),e.children.forEach(r=>this.processChild(r,n.rootNode,n))}processDtcChildNode(e,n,r){if(e.name?.name){let i=e.path?r.resolvePath(e.path):void 0,o=(i?r.rootNode.getChild(i):void 0)??new X(this.bindingLoader,e.name.name,e.name.fullAddress,n);o.implementations.push(e),e.labels.forEach(a=>a.lastLinkedTo=o),n=o,this.checkNodeUniqueNames(e,o)}e.children.forEach(i=>this.processChild(i,n,r))}processDtcRefNodeLabelRef(e,n,r){let i,s=e.resolveNodePath??(e.pathName?r.resolvePath([e.pathName]):void 0);return s?(e.resolveNodePath??=[...s],i=r.rootNode.getChild(s),n.linksTo=i,e.labels.forEach(o=>o.lastLinkedTo=i),i?.linkedRefLabels.push(n),i?.implementations.push(e),e.labels.forEach(o=>{r.labelsUsedCache.set(o.label.value,s)}),i?(r.references.push(e),this.checkNodeUniqueNames(e,i)):r.unlinkedRefNodes.push(e)):(this._issues.push(Yt(3,n.firstToken,n.lastToken,n,{templateStrings:[n.label?.value??""]})),r.unlinkedRefNodes.push(e)),i}processDtcRefNodeNodePathRef(e,n,r){let i;n.path&&this.linkNodePath(n.path,r.rootNode);let o=n.path?.pathParts.at(-1)?.linksTo?.path;return o?(e.resolveNodePath??=o,i=r.rootNode.getChild(o),e.labels.forEach(a=>a.lastLinkedTo=i),i?.implementations.push(e),e.labels.forEach(a=>{r.labelsUsedCache.set(a.label.value,o)}),i?(r.references.push(e),this.checkNodeUniqueNames(e,i)):r.unlinkedRefNodes.push(e)):r.unlinkedRefNodes.push(e),i}processDtcRefNode(e,n){let r;e.reference?e.reference instanceof ie?r=this.processDtcRefNodeLabelRef(e,e.reference,n):r=this.processDtcRefNodeNodePathRef(e,e.reference,n):n.unlinkedRefNodes.push(e),e.children.forEach(i=>this.processChild(i,r??new X(this.bindingLoader,""),n))}processDtcProperty(e,n,r){e.propertyName?.name&&n.addProperty(new Je(e,n)),e.children.forEach(i=>this.processChild(i,n,r))}processDeleteNode(e,n,r){if(e.nodeNameOrRef instanceof $e&&e.nodeNameOrRef.value){if(e.parentNode?.parentNode)if(!n.hasNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress))this._issues.push(Yt(5,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef));else{n.deletes.push(e);let i=n.getNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress);e.nodeNameOrRef.linksTo=i,n.deleteNode(e.nodeNameOrRef.name,e,e.nodeNameOrRef.fullAddress),i?.labels.forEach(s=>{r.labelsUsedCache.delete(s.label.value)})}}else if(e.nodeNameOrRef instanceof ie&&e.nodeNameOrRef.value){let i=r.resolvePath([`&${e.nodeNameOrRef.value}`]),s;i?(s=r.rootNode.getChild(i),n.deletes.push(e),e.nodeNameOrRef.linksTo=s,s?.labels.forEach(o=>{r.labelsUsedCache.delete(o.label.value)}),s?.linkedRefLabels.push(e.nodeNameOrRef),s?.parent?.deleteNode(s.name,e,s.address),e.parentNode instanceof we&&!e.parentNode.pathName&&r.globalDeletes.push(e)):(r.unlinkedDeletes.push(e),this._issues.push(Yt(3,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef,{templateStrings:[e.nodeNameOrRef.value]})))}else if(e.nodeNameOrRef instanceof rt&&e.nodeNameOrRef.path&&!e.nodeNameOrRef.path.pathParts.some(i=>!i)){let i=r.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||(r.unlinkedDeletes.push(e),o&&this._issues.push(Yt(8,o.firstToken,o.lastToken,o,{templateStrings:[o.toString(),`${e.nodeNameOrRef.path.pathParts.filter(c=>c?.linksTo).map(c=>c?.toString()).join("/")}`]}))),n.deletes.push(e),a?.labels.forEach(c=>{r.labelsUsedCache.delete(c.label.value)}),a?.parent?.deleteNode(a.name,e,a.address),e.parentNode instanceof we&&!e.parentNode.pathName&&r.globalDeletes.push(e)}else r.unlinkedDeletes.push(e);e.children.forEach(i=>this.processChild(i,n,r))}processDeleteProperty(e,n,r){e.propertyName?.name&&!n.hasProperty(e.propertyName.name)?this._issues.push(Yt(1,e.propertyName.firstToken,e.propertyName.lastToken,e.propertyName)):e.propertyName?.name&&(n.deletes.push(e),n.deleteProperty(e.propertyName.name,e)),e.children.forEach(i=>this.processChild(i,n,r))}static#e(e,n,r){let i=r.get(n);i||(i=[],r.set(n,i)),i.push(e)}getIssues(e,n=new Map,r=i=>{if(!(i.raw.severity===fo.DiagnosticSeverity.Hint&&i.raw.virtual))return i.raw.severity===fo.DiagnosticSeverity.Error&&!this.isFullContext&&(i.raw.severity=fo.DiagnosticSeverity.Warning),i}){return e.forEach(i=>{let s=r(i);s&&t.#e(s.diagnostic(),s.raw.fsPath,n)}),n}async getSyntaxIssues(e=new Map,n=r=>{if(r.raw.severity===fo.DiagnosticSeverity.Error&&!this.isFullContext&&!co(r.raw,r.raw.fsPath,!1)&&(r.raw.severity=fo.DiagnosticSeverity.Warning),!(r.raw.severity===fo.DiagnosticSeverity.Hint&&r.raw.virtual))return r}){return(await this.getAllStableParsers()).forEach(r=>this.getIssues(r.issues,e,n)),e}async getDiagnostics(){let e=new Map;try{await this.getSyntaxIssues(e);let n=await this.getContextIssues()??[];this.getIssues(n,e);let r=await this.getRuntime();return this.getIssues(r.typesIssues,e),e}catch(n){throw console.error(n),n}}async toFullString(){return`/dts-v1/;
|
|
297
297
|
|
|
298
|
-
${(await this.getRuntime()).rootNode.toFullString((await this.getAllStableParsers()).at(-1).cPreprocessorParser.macros,this.settings.cwd)}`}async serialize(){let e={};return await this.stable,await this.getDiagnostics(),(await this?.getRuntime())?.rootNode.serialize(e,(await this.getAllStableParsers()).at(-1).cPreprocessorParser.macros),e}};var jD=require("fs"),ka=require("path"),
|
|
298
|
+
${(await this.getRuntime()).rootNode.toFullString((await this.getAllStableParsers()).at(-1).cPreprocessorParser.macros,this.settings.cwd)}`}async serialize(){let e={};return await this.stable,await this.getDiagnostics(),(await this?.getRuntime())?.rootNode.serialize(e,(await this.getAllStableParsers()).at(-1).cPreprocessorParser.macros),e}};var jD=require("fs"),ka=require("path"),At=L(U());function bH(t){if(!t||!(t.ast instanceof va))return[];let e=r=>r.flatMap(i=>{try{return(0,jD.readdirSync)(i,{withFileTypes:!0,recursive:!0}).filter(s=>s.name.toLowerCase().endsWith(".dtsi")||s.name.toLowerCase().endsWith(".h")).map(s=>({label:`${(0,ka.join)((0,ka.relative)(i,s.parentPath),s.name)}`,kind:At.CompletionItemKind.File}))}catch{return[]}});if(t.ast.relative)return e([(0,ka.dirname)(t.ast.fsPath)]);let n=t.runtime.context.settings.includePaths??[];return e(n)}var gp=(t,e)=>[...t.labels.filter(e),...t.deletedNodes.filter(n=>!e(n.by)).flatMap(n=>gp(n.node,e)),...t.nodes.flatMap(n=>gp(n,e))],YT=(t,e)=>[...t.labels,...t.deletedNodes.filter(n=>!e(n.by)).flatMap(n=>YT(n.node,e)),...t.nodes.flatMap(n=>YT(n,e))];function SH(t,e){if(!t||!(t.item instanceof Je)||!(t.ast instanceof ie))return[];let n=i=>YT(i,e),r=new Map;return n(t.runtime.rootNode).forEach(i=>r.set(i.label.value,i)),Array.from(r).map(([,i])=>({label:`${i.label.value}`,kind:At.CompletionItemKind.Method,documentation:i.lastLinkedTo?.toMarkupContent(t.runtime.context.macros)}))}function _H(t,e){if(!t||t.item!==null||!(t.ast instanceof ie)||!(t.ast.parentNode instanceof ut))return[];let n=r=>gp(r,e).filter(i=>e(i));return[...Array.from(new Set(n(t.runtime.rootNode).map(r=>r.label.value))).map(r=>({label:r,insertText:t.ast.lastToken.nextToken?.value==="{"?r:`${r} {
|
|
299
299
|
$1
|
|
300
|
-
};`,kind:
|
|
300
|
+
};`,kind:At.CompletionItemKind.Value,insertTextFormat:At.InsertTextFormat.Snippet}))]}function PH(t,e){let n=s=>s?s.parentNode instanceof ut||s.parentNode instanceof nt||s.parentNode instanceof Ee?!1:n(s.parentNode):!0;if(!t||t.item!==null||!Zt(t.ast)||!n(t.ast))return[];let r=s=>gp(s,e).filter(o=>e(o));if(t.ast instanceof Dt)return r(t.runtime.rootNode).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:At.CompletionItemKind.Keyword,insertTextFormat:At.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:At.CompletionItemKind.Keyword,insertTextFormat:At.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[];let i=new Map;return r(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:At.CompletionItemKind.Variable,documentation:s.lastLinkedTo?.toMarkupContent(t.runtime.context.macros)}))}function kH(t,e){if(!t||!(t.item instanceof X)||t.item===null||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof hn)||t.beforeAst?.parentNode instanceof lt))return[];let n=r=>[...r.nodes,...r.deletedNodes.filter(i=>!e(i.by)).map(i=>i.node)].flatMap(i=>({node:i,astNodes:i.implementations.filter(s=>s instanceof Ee)})).filter(i=>i.astNodes.some(e));return t.ast instanceof $e||t.ast instanceof Xn||t.beforeAst?.parentNode instanceof Xn?n(t.item).map(r=>({label:`${r.astNodes.at(0)?.name?.toString()}`,kind:At.CompletionItemKind.Variable,documentation:r.node.toMarkupContent(t.runtime.context.macros)})):n(t.item).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:At.CompletionItemKind.Keyword,insertTextFormat:At.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function NH(t,e){if(!t||!(t.item instanceof X)||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof hn)||t.beforeAst?.parentNode instanceof Xn))return[];let n=r=>[...r.properties,...r.deletedProperties.filter(i=>!e(i.by)).map(i=>i.property)].flatMap(i=>[i,...i.allReplaced]).filter(i=>e(i.ast));if(t.ast instanceof Xe||t.ast instanceof lt||t.beforeAst?.parentNode instanceof lt){let r=new Map;return n(t.item).forEach(i=>r.set(i.name,i)),Array.from(r).map(([,i])=>({label:`${i.name}`,kind:At.CompletionItemKind.Variable,documentation:i.ast.toPrettyString(t.runtime.context.macros)}))}return n(t.item).length?[{label:"/delete-property/",insertText:"/delete-property/ $1;",kind:At.CompletionItemKind.Keyword,sortText:"~",insertTextFormat:At.InsertTextFormat.Snippet,command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function RH(t,e){let n=t?.ast instanceof Qr?t.ast:t?.ast.parentNode;if(!t||!n||!(n instanceof Qr))return[];let r=n.pathParts.slice(0,-1);if(r.some(o=>!o))return[];let i=r.map(o=>o.toString());return(()=>{let o=t.runtime.rootNode.getChildFromScope(["/",...i],e);return[...o?.nodes.filter(a=>!Zt(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:At.CompletionItemKind.Variable,documentation:o.toMarkupContent(t.runtime.context.macros)}))}function wH(t){return!t||!(t.item instanceof Je&&t.item.ast.assignOperatorToken)||t.ast instanceof re?[]:!lo(t?.ast)&&!(t.ast instanceof Ne&&t.item.ast.values===null)&&!lo(t.beforeAst)&&!lo(t.afterAst)?[]:t.item.parent.nodeType instanceof St?Array.from([t.runtime.context.parser,...t.runtime.context.overlayParsers].at(-1)?.cPreprocessorParser.macros??[]).map(([,r])=>r.macro.identifier instanceof ei?{label:`${r.macro.identifier.toString()}`,insertText:`${r.macro.name}(${r.macro.identifier.params.map((i,s)=>i instanceof Tt?`$${s+1}`:"").join(", ")})`,kind:At.CompletionItemKind.Function,sortText:`~${r.macro.name}`,insertTextFormat:At.InsertTextFormat.Snippet}:{label:r.macro.identifier.name,kind:At.CompletionItemKind.Variable,sortText:`~${r.macro.name}`}):[]}function EH(t,e){return!t?.item||!(t.ast instanceof Xe&&t.ast.parentNode instanceof Ne||t.ast instanceof nt)?[]:(t.item instanceof X?t.item:t.item.parent).nodes.filter(r=>{let i=r.definitions.at(-1);return i&&e(i)}).map(r=>r.name?.toString()).filter(r=>r).map(r=>({label:`${r}`,insertText:`${r} {
|
|
301
301
|
$1
|
|
302
|
-
};`,kind:It.CompletionItemKind.Class,sortText:`!${r}`,insertTextFormat:It.InsertTextFormat.Snippet}))}async function UD(t,e){return Rt(t,e,(n,r)=>[...NH(n,r),...kH(n,r),...PH(n,r),...RH(n,r),..._H(n,r),...SH(n,r),...bH(n),...wH(n),...EH(n,r)])}var Xp=L(U());var VD=require("child_process");var KT=t=>/[A-Za-z0-9_]/.test(t);function CH(t,e){let n=[];for(let r=0;r<e;r++){let i=t[r];i==="("?n.push(r):i===")"&&n.pop()}return n.length?n[n.length-1]:void 0}function HD(t,e){let n=1;for(let r=e+1;r<t.length;r++){let i=t[r];if(i==="(")n++;else if(i===")"&&(n--,n===0))return r}}function WD(t,e,n){let r=[],i=0,s=!1,o=!1,a=e;for(let f=e;f<n;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,y=m,S=h;for(;y<S&&/\s/.test(t[y]);)y++;for(;S>y&&/\s/.test(t[S-1]);)S--;r.push({start:m,end:h,text:t.slice(y,S)}),a=f+1}}}let c=a,l=n,u=c,d=l;for(;u<d&&/\s/.test(t[u]);)u++;for(;d>u&&/\s/.test(t[d-1]);)d--;return r.push({start:c,end:l,text:t.slice(u,d)}),r}function XT(t){let e=t.trim(),n=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(e);if(!n)return{macro:e};let r=n[1],i=n[2],s=WD(i,0,i.length),o={macro:r,args:[]};return o.args=s.map(a=>{let c=XT(a.text);return c.parent=o,c}),o}function Gi(t,e){let n=t.getText(),r=t.offsetAt(e),i=r,s=r;for(;i>0&&KT(n[i-1]);)i--;for(;s<n.length&&KT(n[s]);)s++;if(n[s]==="("){let y=HD(n,s);y!==void 0&&(s=y+1)}let o=n.slice(i,s),a=o.trim().length?XT(o):void 0,c=CH(n,r);if(c===void 0)return a;let l=HD(n,c);if(l===void 0||!(c<r&&r<=l))return a;let u=c,d=u;for(;d>0&&KT(n[d-1]);)d--;let f=n.slice(d,u);if(!f)return a;let p=WD(n,c+1,l),m={macro:f,args:[]};m.args=p.map(y=>{let S=XT(y.text);return S.parent=m,S});let h=-1;for(let y=0;y<p.length;y++){let S=p[y];if(r>=S.start&&r<=S.end){h=y;break}}if(h>=0){let y=m.args[h];return y.argIndexInParent=h,y}return m}function DH(t,e,n){let i=t.getText().split(/\r?\n/),s=new RegExp(`^\\s*#\\s*define\\s+(${e})\\b(\\s*\\([^)]*\\))?\\s*(.*)$`);for(let o=Math.min(n.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 pt.create(o,u>=0?u:a.length)}}}async function Ts(t,e,n,r){let i=zD(t,e,n);if(i)return i;let s=await IH(e,r,_e(t.uri));if(s)return[s,n]}function zD(t,e,n){if(e.startsWith("DT_"))return;let r=DH(t,e,n);if(!r)return;let i=Gi(t,r);if(i)return[i,r]}var AH=(t,e)=>new Promise(n=>{let r=(0,VD.spawn)(t,e,{stdio:["ignore","pipe","pipe"]}),i="";r.stdout.on("data",s=>{i+=s.toString()}),r.on("close",s=>{n(s?"":i)})});async function IH(t,e,n){let r=e.getCompileCommands()?.find(s=>fe(s.file,n));if(!r)return;let i=`${r.command.replace(/-(o|c)\s+\S+/g,"")} -E -dM ${r.file}`;try{let[s,...o]=i.split(" "),a=await AH(s,o.filter(u=>!!u)),c=Lt.create(`macros://${r.file}`,"devicetree",0,a),l=zD(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 ll=L(U());async function GD({macro:t,context:e}){if(t.macro&&"DT_ALIAS".startsWith(t.macro))return[{label:"DT_ALIAS(...)",insertText:"DT_ALIAS($1)",kind:ll.CompletionItemKind.Function,insertTextFormat:ll.InsertTextFormat.Snippet}];if(t.parent?.macro!=="DT_ALIAS"||t.argIndexInParent!==0)return[];let n=await e.getRuntime();return n.rootNode.getNode("aliases")?.properties.map(r=>{let i=r.ast.getFlatAstValues()?.at(0),s;return i instanceof ie?s=i.linksTo:i instanceof Qr&&(s=i.pathParts.at(-1)?.linksTo),{label:Z(r.name),kind:ll.CompletionItemKind.Property,documentation:s?.toMarkupContent(n.context.macros)}})??[]}var ul=L(U());async function wn(t,e,n){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 rt)return s.path?.pathParts.at(-1)?.linksTo;if(s instanceof ie)return s.linksTo;if(s instanceof re)return s.value;if(s instanceof me){let o=s.evaluate(n.macros);return typeof o=="number"?o:s.toString()}})}async function yp({document:t,macro:e,context:n,position:r},i){let s=e.args;if(e.macro!=="DT_PROP"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:n,position:r});return o?wn(o,s[1].macro,n):void 0}async function YD(t,e){let n=await yp(t,e);if(typeof n=="boolean")return;let r=n?.at(0);if(n?.length===1&&r instanceof X)return r}async function KD(t,e,n,r){if(n=typeof n=="number"?n:Me(n),typeof n!="number")return;let i=await wn(t,e,r);if(i===!0)return!0;if(!i)return;let s=i.at(n);if(s)return i.length===1&&i[0]instanceof X?i[0]:s}async function Tp({document:t,macro:e,context:n,position:r},i){if(!(e.macro!=="DT_PROP_BY_IDX"||e.args?.length!==3))return KD(await i({document:t,macro:e.args[0],context:n,position:r}),e.args[1].macro,e.args[2].macro,n)}async function XD(t,e){let n=await Tp(t,e);if(typeof n!="boolean"&&n instanceof X)return n}async function tr(t,{document:e,context:n,macro:r,position:i},s){return t||(await s({document:e,macro:r,context:n,position:i})??r.macro)}async function vp(t,e,n,r){return tr(await wn(t,e,n.context),n,r)}async function Na({document:t,macro:e,context:n,position:r},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:n,position:r});return await vp(c,o.macro,{macro:a,document:t,context:n,position:r},i)}async function JD(t,e){let n=await Na(t,e);if(n instanceof X)return n;if(typeof n=="boolean")return;let r=n?.at(0);if(n?.length===1&&r instanceof X)return r}async function QD(t){let e=t?.nodeType?.onBus,n=t?.parent?.nodeType?.bus;return t&&n?.length&&n?.some(r=>r===e)?t.parent??void 0:void 0}async function bp(t,e){let n=t.macro.args;if(t.macro.macro!=="DT_BUS"||n?.length!==1)return;let r=await e({...t,macro:n[0]});return await QD(r)}async function Sp(t,e){let n=(await t.getRuntime()).rootNode.getChild(["/","chosen"]);if(!n)return;let s=n?.properties.find(o=>Z(o.name)===e)?.ast.getFlatAstValues()?.at(0);if(s instanceof ie)return s.linksTo;if(s instanceof rt)return s.path?.pathParts.at(-1)?.linksTo}async function _p(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_CHOSEN"||e?.length!==1))return await Sp(t.context,e[0].macro)}async function Pp(t,e){let n=await e?.getRuntime();if(n){let r=Pi.getNodeFromPath(["aliases"],n.rootNode,!0),i=r?.properties.find(o=>Z(o.name)===t);if(!i)return;let s=i.ast.getFlatAstValues();return s?.[0]instanceof re?r=n.rootNode.getChild(s[0].value.split("/")):s?.[0]instanceof ie?r=s[0].linksTo:s?.[0]instanceof rt&&(r=s[0].path?.pathParts.at(-1)?.linksTo),r}}async function kp({macro:t,context:e}){if(!(t.macro!=="DT_ALIAS"||t.args?.length!==1))return Pp(t.args[0].macro,e)}async function ZD(t,e){return t?.nodes.find(n=>Z(n.name)===e)}async function Np({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_CHILD"||e.args?.length!==2)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});return ZD(s,e.args[1].macro)}var JT=(t,e)=>t.nodes.filter(n=>!n.disabled&&n.nodeType).flatMap(n=>[n.nodeType.compatible,...Array.from(n.nodeType.extends)].filter(r=>!!r).map(r=>Z(r)).includes(e)?[n,...JT(n,e)]:JT(n,e));async function eA(t,e){let n=await e?.getRuntime();if(n)return JT(n.rootNode,t)}async function QT({macro:t,context:e}){if(!(t.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.args?.length!==1))return eA(t.args[0].macro,e)}async function tA(t){return(await QT(t))?.at(0)}async function nA(t){return t?.parent?.parent??void 0}async function Rp({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_GPARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});return nA(s)}var ZT=(t,e)=>t.nodes.filter(n=>n.nodeType).sort((n,r)=>n.disabled===r.disabled?0:n.disabled?1:-1).flatMap(n=>[n.nodeType.compatible,...Array.from(n.nodeType.extends)].filter(r=>!!r).map(r=>Z(r)).includes(e)?[n,...ZT(n,e)]:ZT(n,e));async function rA(t,e,n){let r=await n?.getRuntime();if(r)return ZT(r.rootNode,e).at(t)}async function wp({macro:t,context:e}){if(t.macro!=="DT_INST"||t.args?.length!==2)return;let n=Me(t.args[0].macro);if(typeof n=="number")return rA(n,t.args[1].macro,e)}async function iA(t,e){let n=await e?.getRuntime(),r=n?.resolvePath([`&${t.trim()}`]);if(n&&r)return Pi.getNodeFromPath(r.slice(1),n.rootNode,!0)}async function Ep({macro:t,context:e}){if(!(t.macro!=="DT_NODELABEL"||t.args?.length!==1))return iA(t.args[0].macro,e)}async function sA(t){return t?.parent??void 0}async function Cp({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_PARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});return sA(s)}var oA=(t,e)=>{if(!e.length)return t;let n=e.splice(0,1)[0],r=t.nodes.find(i=>Z(i.fullName)===n);return r?oA(r,e):void 0};async function Dp(t,e){let n=await e?.getRuntime();if(n)return oA(n.rootNode,t)}async function Ap({macro:t,context:e}){let n=t.args;if(!(t.macro!=="DT_PATH"||!n?.length))return Dp(n.map(r=>r.macro),e)}async function Ip({macro:t,context:e}){let n=t.args;if(!(t.macro!=="DT_ROOT"||n?.length))return(await e.getRuntime()).rootNode}async function Ra(t,e,n){let r=t?.properties.find(c=>Z(c.name)===e);if(!r)return;let i=r?.ast.quickValues?.at(n),s=r.parent.nodeType;if(Array.isArray(i)||!s||!(s instanceof St))return;let a=s.properties.find(c=>c.getNameMatch(r.name))?.values(r).findIndex(c=>c===i)??-1;return a===-1?void 0:a}async function Op(t,e,n,r,i){return tr(await Ra(t,e,n),r,i)}async function Mp({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return await Op(o,s[1].macro,a,{macro:s[3],document:t,context:n,position:r},i)}async function xp({document:t,macro:e,context:n,position:r},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:n,position:r});return await Op(o,s[1].macro,0,{macro:s[2],document:t,context:n,position:r},i)}async function vs(t,e,n,r,i){let s=t?.properties.find(d=>Z(d.name)===e),o=s?.parent.nodeType;if(!o||!(o instanceof St))return;if(typeof n=="string"){let d=s.nexusMapsTo.at(0)?.specifierSpace;if(n=(d?s.parent.getProperty(`${d}-names`)?.ast.quickValues:void 0)?.findIndex(p=>typeof p=="string"&&p.toLowerCase()===n)??-1,n===-1)return}let a=s.nexusMapsTo.at(n),l=a?.target.nodeType?.cellsValues?.find(d=>a.specifierSpace&&d.specifier===a.specifierSpace)?.values?.indexOf(r);if(l===void 0||l===-1)return;let u=a?.mappingValuesAst.at(l);if(u instanceof me){let d=u.evaluate(i.macros);return typeof d!="number"?u.toString():d}}async function wa(t,e,n,r,i,s){return tr(await vs(t,e,n,r,i.context),i,s)}async function Lp({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return wa(o,s[1].macro,a,s[3].macro,{macro:s[4],document:t,context:n,position:r},i)}async function qp({document:t,macro:e,context:n,position:r},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:n,position:r});return wa(o,s[1].macro,s[2].macro,s[3].macro,{macro:s[4],document:t,context:n,position:r},i)}async function Ni(t,e,n=0){let r=t?.properties.find(s=>Z(s.name)===e);if(n=typeof n=="number"?n:Me(n??"0"),typeof n!="number")return;let i=r?.ast.getFlatAstValues()?.at(n);if(i instanceof ie)return i.linksTo;if(i instanceof rt)return i.path?.pathParts.at(-1)?.linksTo}async function bs({document:t,macro:e,context:n,position:r},i){let s=e.args;if(e.macro!=="DT_PHANDLE"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:n,position:r});return Ni(o,s[1].macro,0)}async function Ri({document:t,macro:e,context:n,position:r},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:n,position:r});return Ni(o,s[1].macro,s.at(2)?.macro)}async function aA(t,e,n){let r=t?.properties.find(l=>Z(l.name)===e);if(!r)return;let i=r.parent.nodeType;if(!i||!(i instanceof St))return;let s=r.nexusMapsTo.at(0)?.specifierSpace,a=(s?r.parent.getProperty(`${s}-names`)?.ast.quickValues:void 0)?.findIndex(l=>typeof l=="string"&&l.toLowerCase()===n)??-1;return a===-1?void 0:r.nexusMapsTo.at(a)?.target}async function $p({document:t,macro:e,context:n,position:r},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:n,position:r});return await aA(o,s[1].macro,s[2].macro)}async function Fp({document:t,macro:e,context:n,position:r},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:n,position:r});return wa(o,s[1].macro,0,s[2].macro,{macro:s[3],document:t,context:n,position:r},i)}async function Bp({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX_OR"||e.args?.length!==5)return;let s=await Ni(await i({document:t,macro:e.args[0],context:n,position:r}),e.args[1].macro,e.args[2].macro);return vp(s,e.args[3].macro,{macro:e.args[4],document:t,context:n,position:r},i)}async function jp(t,e){if(!t)return;let n=t?.properties.find(r=>Z(r.name)===e);return n?.nexusMapsTo.length?n.nexusMapsTo.length:n?.ast.getFlatAstValues()?.length}async function cA(t,e,n,r){if(t)return tr(await jp(t,e),n,r)}async function Up({document:t,macro:e,context:n,position:r},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:n,position:r});return o?cA(o,s[1].macro,{macro:s[2],document:t,context:n,position:r},i):void 0}async function Ea(t,e){if(!t)return;let r=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(r?.length===1&&r[0]instanceof re)return Z(r[0].value)}async function lA(t,e,n,r){if(t)return tr(await Ea(t,e),n,r)}async function Hp({document:t,macro:e,context:n,position:r},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:n,position:r});return lA(o,s[1].macro,{document:t,macro:s[2],context:n,position:r},i)}async function Vp(t,e){if(!t)return;let r=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(r?.length===1&&r[0]instanceof re)return r[0].value}async function uA(t,e,n,r){if(t)return tr(await Vp(t,e),n,r)}async function Wp({document:t,macro:e,context:n,position:r},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:n,position:r});return uA(o,s[1].macro,{document:t,macro:s[2],context:n,position:r},i)}async function zp(t,e){return(await Ea(t,e))?.toUpperCase()}async function dA(t,e,n,r){if(t)return tr(await zp(t,e),n,r)}async function Gp({document:t,macro:e,context:n,position:r},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:n,position:r});return dA(o,s[1].macro,{document:t,macro:s[2],context:n,position:r},i)}function ti(t){return async(e,n)=>{let r=await t(e,n);if(r instanceof X)return r}}async function x({macro:t,document:e,context:n,position:r}){["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[bp,_p,kp,Np,tA,Rp,wp,Ep,Cp,Ap,bs,Ri,$p,XD,YD,JD,Ip,ti(Mp),ti(xp),ti(Lp),ti(qp),ti(Fp),ti(Bp),ti(Up),ti(Na),ti(Hp),ti(Wp),ti(Gp)].reduce((a,c)=>a.then(l=>l||c({macro:t,document:e,context:n,position:r},x)),Promise.resolve(void 0));if(s)return Array.isArray(s)?s.at(0):s;let o=await Ts(e,t.macro,r,n);if(o)return x({document:e,macro:o[0],context:n,position:r})}async function fA({macro:t,document:e,context:n,position:r}){return t.macro&&t.macro&&"DT_CHILD".startsWith(t.macro)?[{label:"DT_CHILD(...)",insertText:"DT_CHILD($1, $2)",kind:ul.CompletionItemKind.Function,insertTextFormat:ul.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_CHILD"||t.argIndexInParent!==1||!t.parent.args?.length?[]:(await x({document:e,macro:t.parent.args[0],context:n,position:r}))?.nodes.map(s=>({label:Z(s.fullName),kind:ul.CompletionItemKind.Class,documentation:s.toMarkupContent(n.macros)}))??[]}var dl=L(U());function pA({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:dl.CompletionItemKind.Function,insertTextFormat:dl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.argIndexInParent!==0?[]:e.bindingLoader?.getBindings().map(n=>({label:Z(n),kind:dl.CompletionItemKind.Property}))??[]}var fl=L(U());function hA({macro:t,context:e}){return t.macro&&"DT_INST".startsWith(t.macro)?[{label:"DT_INST(...)",insertText:"DT_INST($1, $2)",kind:fl.CompletionItemKind.Function,insertTextFormat:fl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_INST"||t.argIndexInParent!==1?[]:e.bindingLoader?.getBindings().map(n=>({label:Z(n),kind:fl.CompletionItemKind.Property}))??[]}var pl=L(U());async function mA({macro:t,context:e}){if(t.macro&&"DT_NODELABEL".startsWith(t.macro))return[{label:"DT_NODELABEL(...)",insertText:"DT_NODELABEL($1)",kind:pl.CompletionItemKind.Function,insertTextFormat:pl.InsertTextFormat.Snippet}];let n=await e.getRuntime();return t.parent?.macro!=="DT_NODELABEL"||t.argIndexInParent!==0?[]:await Promise.all(n.rootNode.allDescendantsLabels.map(async r=>({label:r.label.value,kind:pl.CompletionItemKind.Property,documentation:r.lastLinkedTo?.toMarkupContent(n.context.macros)}))??[])}var hl=L(U());async function gA({macro:t,context:e}){return t.macro&&t.macro&&"DT_PATH".startsWith(t.macro)?[{label:"DT_PATH(...)",insertText:"DT_PATH($1)",kind:hl.CompletionItemKind.Function,insertTextFormat:hl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_PATH"||!t.parent.args?.length?[]:(await Dp(t.parent.args.slice(0,-1).map(r=>r.macro),e))?.nodes.map(r=>({label:Z(r.fullName),kind:hl.CompletionItemKind.Class,documentation:r.toMarkupContent(e.macros)}))??[]}var yA=L(U());async function TA({macro:t,context:e}){if(t.macro&&t.macro&&"DT_ROOT".startsWith(t.macro)){let n=await e.getRuntime();return[{label:"DT_ROOT",kind:yA.CompletionItemKind.Class,documentation:n.rootNode.toMarkupContent(n.context.macros)}]}return[]}var Yp=L(U());function vA({macro:t}){return t.macro&&t.macro&&"DT_SAME_NODE".startsWith(t.macro)?[{label:"DT_SAME_NODE(...)",insertText:"DT_SAME_NODE($1, $2)",kind:Yp.CompletionItemKind.Snippet,insertTextFormat:Yp.InsertTextFormat.Snippet}]:[]}var ml=L(U());async function Q({macro:t,document:e,position:n,context:r},i,s,o,a,c=l=>x({document:e,macro:l,context:r,position:n})){if(t.macro&&t.macro&&i.startsWith(t.macro))return[{label:`${i}(...)`,insertText:`${i}(${Array(o).map((d,f)=>`${f+1}`).join(", ")})`,kind:ml.CompletionItemKind.Function,insertTextFormat:ml.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:ml.CompletionItemKind.Property,documentation:d.toPrettyString(r.macros)}))??[]}async function bA(t){return Q(t,"DT_ENUM_HAS_VALUE",1,3)}async function SA(t){return Q(t,"DT_ENUM_HAS_VALUE_BY_IDX",1,4)}async function _A(t){return Q(t,"DT_ENUM_IDX",1,2)}async function PA(t){return Q(t,"DT_ENUM_IDX_BY_IDX",1,3)}async function kA(t){return Q(t,"DT_ENUM_IDX_BY_IDX_OR",1,4)}async function NA(t){return Q(t,"DT_ENUM_IDX_OR",1,3)}var RA=L(U());async function Yi({macro:t,document:e,context:n,position:r},i,s,o){if(t.parent?.macro!==i||t.argIndexInParent!==s||!t.parent.args?.length)return[];let c=(await x({document:e,macro:t.parent.args[0],context:n,position:r}))?.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:RA.CompletionItemKind.Property}))??[]}async function wA(t){return t.macro.argIndexInParent===2?Yi(t,"DT_PHA",2,0):Q(t,"DT_PHA",1,3,e=>!!e.nexusMapsTo.length)}var EA=L(U());async function OH({document:t,macro:e,position:n,context:r},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await x({document:t,macro:e.parent.args[0],context:r,position:n}))?.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:EA.CompletionItemKind.Property}))??[]}async function CA(t){if(t.macro.argIndexInParent===2)return OH(t,"DT_PHA_BY_IDX");if(t.macro.argIndexInParent===3){let e=t.macro.parent?.args?Me(t.macro.parent.args[2].macro):void 0;return typeof e!="number"?[]:Yi(t,"DT_PHA_BY_IDX",3,e)}return Q(t,"DT_PHA_BY_IDX",1,3,e=>!!e.nexusMapsTo.length)}var DA=L(U());async function gl({document:t,macro:e,context:n,position:r},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await x({document:t,macro:e.parent.args[0],context:n,position:r}))?.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:DA.CompletionItemKind.Property}))??[]}async function AA(t){let{macro:e}=t;return e.argIndexInParent===2?gl(t,"DT_PHA_BY_NAME"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Yi(t,"DT_PHA_BY_NAME",3,e.parent.args[2].macro):[]:Q(t,"DT_PHA_BY_NAME",1,3,n=>!!n.nexusMapsTo.length)}async function IA(t){let{macro:e}=t;return e.argIndexInParent===2?gl(t,"DT_PHA_BY_NAME_OR"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Yi(t,"DT_PHA_BY_NAME_OR",3,e.parent.args[2].macro):[]:Q(t,"DT_PHA_BY_NAME_OR",1,3,n=>!!n.nexusMapsTo.length)}async function OA(t){let{macro:e}=t;return e.argIndexInParent===2?Yi(t,"DT_PHA_OR",2,0):Q(t,"DT_PHA_OR",1,3,n=>!!n.nexusMapsTo.length)}async function Kp(t){return Q(t,"DT_PHANDLE",1,2,e=>!!e.ast.getFlatAstValues()?.some(n=>n instanceof ie||n instanceof rt))}async function Ca(t){return Q(t,"DT_PHANDLE_BY_IDX",1,3,e=>!!e.ast.getFlatAstValues()?.some(n=>n instanceof ie||n instanceof rt))}async function MA(t){let{macro:e}=t;return e.argIndexInParent===2?gl(t,"DT_PHANDLE_BY_NAME"):Q(t,"DT_PHANDLE_BY_NAME",1,3,n=>!!n.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof rt))}async function xA(t){return Q(t,"DT_PROP",1,2,e=>!e.nexusMapsTo.length)}async function LA(t){return Q(t,"DT_PROP_BY_IDX",1,3,e=>!e.nexusMapsTo.length)}async function qA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX"?Ca({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE_IDX",3,4,n=>!n.nexusMapsTo.length,()=>Ri({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},x))}async function $A(t){let{macro:e}=t;return e.argIndexInParent===1&&e.parent?.macro==="DT_PROP_BY_PHANDLE"?Kp({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE",2,3,n=>!n.nexusMapsTo.length,()=>bs({...t,macro:{macro:"DT_PHANDLE",args:e.parent?.args?.slice(0,2)}},x))}async function FA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX_OR"?Ca({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE_IDX_OR",3,5,n=>!n.nexusMapsTo.length,()=>Ri({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},x))}async function BA(t){return Q(t,"DT_PROP_HAS_IDX",1,3,e=>!e.nexusMapsTo.length)}async function jA(t){return Q(t,"DT_PROP_HAS_NAME",1,3,e=>!e.nexusMapsTo.length)}async function UA(t){return Q(t,"DT_PROP_LAST",1,2,e=>!e.nexusMapsTo.length)}async function HA(t){return Q(t,"DT_PROP_LEN",1,2,e=>!e.nexusMapsTo.length)}async function VA(t){return Q(t,"DT_PROP_LEN_OR",1,2,e=>!e.nexusMapsTo.length)}async function WA(t){return Q(t,"DT_PROP_OR",1,2,e=>!e.nexusMapsTo.length)}async function zA(t){return Q(t,"DT_STRING_TOKEN",1,2,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}async function GA(t){return Q(t,"DT_STRING_TOKEN_BY_IDX",1,3,e=>{let n=e.ast.getFlatAstValues();return!!n?.length&&n.every(r=>r instanceof re)})}async function YA(t){return Q(t,"DT_STRING_TOKEN_OR",1,3,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}async function KA(t){return Q(t,"DT_STRING_UNQUOTED",1,2,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}async function XA(t){return Q(t,"DT_STRING_UNQUOTED_BY_IDX",1,3,e=>{let n=e.ast.getFlatAstValues();return!!n?.length&&n.every(r=>r instanceof re)})}async function JA(t){return Q(t,"DT_STRING_UNQUOTED_OR",1,3,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}async function QA(t){return Q(t,"DT_STRING_UPPER_TOKEN",1,2,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}async function ZA(t){return Q(t,"DT_STRING_UPPER_TOKEN_BY_IDX",1,3,e=>{let n=e.ast.getFlatAstValues();return!!n?.length&&n.every(r=>r instanceof re)})}async function e0(t){return Q(t,"DT_STRING_UPPER_TOKEN_OR",1,3,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}var yl=L(U());async function t0({macro:t,context:e}){return t.parent?.macro==="DT_ON_BUS"&&t.argIndexInParent===1?e.bindingLoader?.getBusTypes().map(n=>({label:Z(n),kind:yl.CompletionItemKind.Enum}))??[]:t.macro&&"DT_ON_BUS".startsWith(t.macro)?[{label:"DT_ON_BUS(...)",insertText:"DT_ON_BUS($1, $2)",kind:yl.CompletionItemKind.Function,insertTextFormat:yl.InsertTextFormat.Snippet}]:[]}async function n0(t){return Q(t,"DT_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}async function r0(t){return Q(t,"DT_HAS_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}var MH=["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 i0(t,e,n){if(!n)return[];let r=Gi(n,t.position);return r?(await Promise.all([t0,n0,r0,GD,fA,pA,hA,xH,mA,gA,TA,vA,SA,bA,PA,kA,_A,NA,CA,AA,IA,wA,Ca,MA,Kp,OA,LA,$A,qA,FA,xA,BA,jA,UA,HA,VA,WA,zA,GA,YA,KA,XA,JA,QA,ZA,e0].flatMap(async i=>await i({document:n,context:e,macro:r,position:t.position})))).flat():[]}function xH({macro:t}){return t.macro?MH.filter(e=>e.startsWith(t.macro)).map(e=>({label:`${e}(...)`,insertText:`${e}($1)`,kind:Xp.CompletionItemKind.Function,insertTextFormat:Xp.InsertTextFormat.Snippet})):[]}var Dr=L(U());function LH(t){if(!t||t.item===null||!(t.ast instanceof Xe))return[];let e=r=>r.replacedBy?e(r.replacedBy):r,n=r=>{let i=r.parent.deletedProperties.find(s=>s.property===r)?.by;return[r.ast,...r.allReplaced.map(s=>s.ast),...i?[i]:[]].map(s=>{let o=pn(s.fsPath);if(o)return Dr.Location.create(ue(o.fsPath),o.range);if(s instanceof Ne)return Dr.Location.create(ue(s.fsPath),ce(s.propertyName??s));if(s instanceof lt)return Dr.Location.create(ue(s.fsPath),ce(s.propertyName??s))}).filter(s=>s)};if(t.item instanceof Je&&t.ast instanceof Xe)return n(e(t.item));if(t.item instanceof X&&t.ast instanceof Xe&&t.ast.parentNode instanceof lt){let r=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(r)return n(r)}return[]}function qH(t){if(!t)return[];let e=n=>{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("/"))===n)return!0}).map(o=>o.ast)??[],s=n.parent?.deletedNodes.filter(o=>o.node===n&&(o.by.nodeNameOrRef instanceof $e?o.by.nodeNameOrRef!==t.ast:!n.linkedRefLabels.some(a=>a!==t.ast))).map(o=>o.by.nodeNameOrRef)??[];return[...i,...n.linkedRefLabels,...n.linkedNodeNamePaths,...n.definitions,...s].map(o=>{let a=o&&pn(o?.fsPath);if(a)return Dr.Location.create(ue(a.fsPath),a.range);if(o instanceof nt)return Dr.Location.create(ue(o.fsPath),ce(o.name??o));if(o instanceof Ee)return Dr.Location.create(ue(o.fsPath),ce(o.name??o));if(o instanceof $e)return Dr.Location.create(ue(o.fsPath),ce(o));if(o instanceof $e)return Dr.Location.create(ue(o.fsPath),ce(o));if(o instanceof ie)return Dr.Location.create(ue(o.fsPath),ce(o.label??o));if(o instanceof Ne)return Dr.Location.create(ue((o.values??o)?.fsPath),ce(o.values??o))}).filter(o=>o)};if(t.item instanceof X&&!Zt(t.ast))return e(t.item);if(t.ast instanceof gn&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return e(t.ast.parentNode.linksTo);if(t.ast instanceof $e&&t.ast.linksTo)return Zt(t.ast)?[...e(t.ast.linksTo),Dr.Location.create(ue(t.ast.fsPath),ce(t.ast))]:e(t.ast.linksTo);if(t?.ast instanceof re&&t.item instanceof Je&&t.item.parent.name==="aliases"){let n=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(n)return e(n)}return[]}async function s0(t,e){return Rt(t,e,n=>[...qH(n),...LH(n)])}var Ki=L(U());function o0(t){if(!t||t.item===null||!(t.ast instanceof Xe))return[];let e=r=>r.replacedBy?e(r.replacedBy):r,n=r=>[r.ast,...r.allReplaced.map(i=>i.ast),r.parent.deletedProperties.find(i=>i.property===r)?.by??[]].map(i=>{if((i instanceof Ne||i instanceof lt)&&i.propertyName)return Ki.Location.create(ue(i.fsPath),ce(i.propertyName))}).filter(i=>i);if(t.item instanceof Je&&t.ast instanceof Xe)return n(e(t.item));if(t.item instanceof X&&t.ast instanceof Xe&&t.ast.parentNode instanceof lt){let r=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(r)return n(r)}return[]}function a0(t,e){if(!e||!(e.ast instanceof gn))return[];"newName"in t&&(e.ast.parentNode instanceof ie&&t.newName.startsWith("&")?t.newName=t.newName.slice(1):e.ast.parentNode instanceof ys&&t.newName.endsWith(":")&&(t.newName=t.newName.slice(0,-1)));let n=e.ast.value,r=i=>[...i.implementations.filter(s=>s instanceof Ee||s instanceof ut).flatMap(s=>s.labels.map(o=>o.label)),...i.linkedRefLabels.map(s=>s.label)].filter(s=>s?.value===n).map(s=>{if(s)return Ki.Location.create(ue(s.fsPath),ce(s))}).filter(s=>s);return e.item instanceof X&&!Zt(e.ast)?r(e.item):e.ast instanceof gn&&e.ast.parentNode instanceof ie&&e.ast.parentNode.linksTo?r(e.ast.parentNode.linksTo):[]}function c0(t){if(!t||!(t.ast instanceof $e)||t.ast instanceof $e&&t.ast.linksTo===t.runtime.rootNode)return[];let e=n=>{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(n)||c===n)return!0}}).map(o=>o.ast)??[],s=n.parent?.deletedNodes.filter(o=>o.node===n&&o.by.nodeNameOrRef!==t.ast).map(o=>o.by.nodeNameOrRef)??[];return[...i,...n.linkedNodeNamePaths,...n.definitions,...s].map(o=>{if(o instanceof Ee&&o.name)return Ki.Location.create(ue(o.fsPath),ce(o.name));if(o instanceof $e)return Ki.Location.create(ue(o.fsPath),ce(o));if(o instanceof Ne&&o.values?.values[0]?.value&&o.values?.values[0]?.value instanceof re){let a=o.values.values[0].value,c=ce(a),l=a.value.split("/"),u=n.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,Ki.Location.create(ue(o.values.values[0].fsPath),c)}}).filter(o=>o)};return t.item instanceof X&&!Zt(t.ast)?e(t.item):t.ast instanceof $e&&t.ast.linksTo?Zt(t.ast)?[...e(t.ast.linksTo),Ki.Location.create(ue(t.ast.fsPath),ce(t.ast))]:e(t.ast.linksTo):[]}async function l0(t,e){let n={};return(await Rt(t,e,i=>[...c0(i),...a0(t,i),...o0(i)])).forEach(i=>{n[i.uri]??=[],n[i.uri].push(Ki.TextEdit.replace(i.range,t.newName))}),{changes:n}}async function u0(t,e){let n=await Rt(t,e,r=>[...c0(r),...a0(t,r),...o0(r)]);if(n.some(r=>e?.settings.lockRenameEdits?.some(i=>_e(r.uri).startsWith(i))))throw new Error('Path is locked by user setting "lockRenameEdits"');if(n.some(r=>bi(r.uri)))throw new Error("Item was generated using a MACRO.");return{defaultBehavior:!!n.length}}var Aa=L(U());var Da=t=>t.implementations.map(e=>{let n=pn(e.fsPath);return n?Aa.Location.create(ue(n.fsPath),n.range):Aa.Location.create(ue(e.fsPath),ce(e))}).filter(e=>e),d0=t=>t.replacedBy?d0(t.replacedBy):t,Jp=t=>[t.ast,...t.allReplaced.map(e=>e.ast)].map(e=>{let n=pn(e.fsPath);return n?Aa.Location.create(ue(n.fsPath),n.range):Aa.Location.create(ue(e.fsPath),ce(e.propertyName??e))}).filter(e=>e);function $H(t){if(!t||t.item===null||!(t.ast instanceof Xe))return[];if(t.item instanceof Je&&t.ast instanceof Xe)return Jp(d0(t.item));if(t.item instanceof X&&t.ast instanceof Xe&&t.ast.parentNode instanceof lt){let e=t.item.deletedProperties.find(n=>n.by===t.ast.parentNode)?.property;if(e)return Jp(e)}return[]}function FH(t){if(!t)return[];if(t.item instanceof X&&!Zt(t.ast))return Da(t.item);if(t.ast instanceof gn&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return Da(t.ast.parentNode.linksTo);if(t.ast instanceof $e&&t.ast.linksTo)return Da(t.ast.linksTo);if(t?.ast instanceof re&&t.item instanceof Je&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return Da(e)}return[]}function BH(t){if(t?.ast instanceof Tt||t?.ast instanceof vi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof Tt?t.ast.name:t.ast.value);if(e)return[Aa.Location.create(ue(e.macro.fsPath),ce(e.macro.identifier))]}return[]}async function f0(t,e){return Rt(t,e,n=>[...FH(n),...$H(n),...BH(n)])}var jH=["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 Qp({macro:t,document:e,context:n,position:r}){if(jH.some(i=>i===t.parent?.macro)&&t.argIndexInParent===1&&t.parent?.args?.[0])return(await x({document:e,context:n,position:r,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 bs({document:e,context:n,position:r,macro:{macro:"DT_PHANDLE",args:t.parent.args.slice(0,2)}},x))?.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 Ri({document:e,context:n,position:r,macro:{macro:"DT_PHANDLE_BY_IDX",args:t.parent.args.slice(0,3)}},x))?.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 n.getRuntime()).rootNode.getChild(["/","chosen"])?.properties.find(i=>Z(i.name)===t.macro)}async function p0(t,e,n){if(!n)return;let r=Gi(n,t.position);return h0(r,t.position,e,n)}async function h0(t,e,n,r){if(!t?.macro)return;let i=await x({document:r,macro:t,context:n,position:e});if(i)return Da(i);let s=await Qp({document:r,macro:t,context:n,position:e});if(s)return Jp(s);let o=await Ts(r,t.macro,e,n);if(o)return h0(o[0],o[1],n,r)}var Ss=L(U());var Ia=t=>{let e=t.definitions.at(0),n=e&&pn(e.fsPath);return n?Ss.Location.create(ue(n.fsPath),n.range):e?Ss.Location.create(ue(e.fsPath),ce(e)):void 0},Zp=t=>t.replaces?Zp(t.replaces):t,m0=t=>{let e=Zp(t),n=pn(e.ast.fsPath);return n?Ss.Location.create(ue(n.fsPath),n.range):e?Ss.Location.create(ue(e.ast.fsPath),ce(e.ast)):void 0};function UH(t){if(!t||t.item===null||!(t.ast instanceof Xe))return;let e=n=>{let r=pn(n.ast.fsPath);return r?Ss.Location.create(ue(r.fsPath),r.range):Ss.Location.create(ue(n.ast.fsPath),ce(n.ast.propertyName??n.ast))};if(t.item instanceof Je&&t.ast instanceof Xe)return e(Zp(t.item));if(t.item instanceof X&&t.ast instanceof Xe&&t.ast.parentNode instanceof lt){let n=t.item.deletedProperties.find(r=>r.by===t.ast.parentNode)?.property;if(n)return e(Zp(n))}}function HH(t){if(t){if(t.item instanceof X&&!Zt(t.ast))return Ia(t.item);if(t.ast instanceof gn&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return Ia(t.ast.parentNode.linksTo);if(t.ast instanceof $e&&t.ast.linksTo)return Ia(t.ast.linksTo);if(t?.ast instanceof re&&t.item instanceof Je&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return Ia(e)}}}function VH(t){if(t?.ast instanceof Tt||t?.ast instanceof vi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof Tt?t.ast.name:t.ast.value);if(e)return Ss.Location.create(ue(e.macro.fsPath),ce(e.macro.identifier))}}async function g0(t,e){return(await Rt(t,e,n=>[HH(n)||UH(n)||VH(n)])).at(0)}async function y0(t,e,n){if(!n)return;let r=Gi(n,t.position);return T0(r,t.position,e,n)}async function T0(t,e,n,r){if(!t?.macro)return;let i=await x({document:r,macro:t,context:n,position:e});if(i)return Ia(i);let s=await Qp({document:r,macro:t,context:n,position:e});if(s)return m0(s);let o=await Ts(r,t.macro,e,n);if(o)return T0(o[0],o[1],n,r)}var de=L(U());var WH=(t,e,n,r,i)=>{switch(n){case 1:return[{title:"Add semicolon",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),";")]}}}];case 2:return[{title:"Add open curly",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character)," {")]}}}];case 29:return[{title:"Remove white space",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(de.Range.create(de.Position.create(r.range.start.line,t.pos.colEnd),de.Position.create(r.range.end.line,e.pos.col)),"")]}}}];case 3:return[{title:"Add close curly",diagnostics:[r],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),"}")]}}}];case 19:return[{title:"Add '/'",diagnostics:[r],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),"/")]}}}];case 28:return[{title:"Add comma",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),",")]}}}];case 21:return[{title:"Add '/'",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),"/")]}}}];case 23:return[{title:"Remove ';'",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.del(r.range)]}}}];case 34:return[{title:"Complete Keyword '/delete-node/",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(r.range,"/delete-node/")]}}}];case 35:return[{title:"Complete Keyword '/delete-property/",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(r.range,"/delete-property/")]}}}];case 25:return[{title:"Complete Keyword '/delete-property/",diagnostics:[r],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(r.range,"/delete-property/")]}}},{title:"Complete Keyword '/delete-node/",diagnostics:[r],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(r.range,"/delete-node/")]}}}];case 12:return[{title:"Add '>'",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),">")]}}}];default:return}},zH=(t,e,n,r,i)=>{if(!r?.length)return[];switch(t){case 0:return[{title:i??`Add Property "${r[0].newText.split("=",1)[0].replace(";","").trim()}"`,diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[n]:r}}}];case 27:return[{title:i??"Remove Property",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[n]:r}}}];case 26:return[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[n]:r}}}];case 36:return[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[n]:r}}}];case 25:return r?[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[n]:r}}}]:[];default:return}},GH=(t,e,n,r)=>n?.length?[{title:r??"TODO",diagnostics:[t],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[e]:n}}}]:[];function v0(t){let e=t.context.diagnostics.flatMap(a=>{let c=a.data;if(c?.virtual)return[];switch(c?.type){case"FormattingIssues":return GH(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=>WH(c.firstToken,c.lastToken,l,a,t.textDocument.uri));case"StandardTypeIssue":return c?.items.flatMap(l=>zH(l,a,t.textDocument.uri,c.edit?Array.isArray(c.edit)?c.edit:[c.edit]:void 0,c.codeActionTitle))}}).filter(a=>!!a),n=e.filter(a=>a.kind===de.CodeActionKind.SourceFixAll),r=e.filter(a=>a.title.startsWith("Add Property")),i=e.filter(a=>a.kind!==de.CodeActionKind.SourceFixAll),s=n.flatMap(a=>a.edit?.changes?.[t.textDocument.uri]??[]),o=new Map;return r.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,...n.map(a=>({...a,kind:de.CodeActionKind.QuickFix})),...s.length?[{title:"Fix All",kind:de.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:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:a}}}:[])]}var ee=L(U());function b0(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 Tl=(t,e)=>e.some(n=>b0(t,n.start)>=0&&b0(t,n.end)<=0),YH=async(t,e,n)=>{let r=pt.create(t.pos.line,t.pos.col),i=n.find(s=>Qt(s,e,r));if(i)return Jr(i,e,r)},mr=(t,e)=>{let n=pt.create(e.length-1,e.at(-1)?.length??0),r=[],i;return t.filter(o=>(o instanceof pr||o instanceof hr)&&/^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:pt.create(o.firstToken.pos.line,o instanceof pr?o.firstToken.pos.colEnd:0)};else if(a==="dts-format on"&&i){let c=pt.create(o.lastToken.pos.line,o instanceof pr?o.lastToken.pos.colEnd-1:e[o.lastToken.pos.line-1].length);r.push(et.create(i.start,c)),i=void 0}}),i&&r.push(et.create(i.start,n)),r},Oa=async(t,e,n)=>(await ev(t,e,n))?.allAstItems,ev=async(t,e,n)=>{if(e!==n){let r=new Cr(t,[],void 0,()=>new er(n,t).tokens,!0);return await r.stable,r}},gr=(t,e,n)=>{let r=t.length?n.filter(i=>(Array.isArray(i.raw.edit)?i.raw.edit:i.raw.edit?[i.raw.edit]:void 0)?.every(o=>!Tl(o.range.start,t)&&!Tl(o.range.end,t))):n;return"range"in e&&(r=r.filter(i=>ao(e.range,i.raw.range))),r},Ma=(t,e)=>async n=>{let r=t.filter(a=>!(a instanceof Zr)&&!(a instanceof hr)&&!(a instanceof pr)&&!(a instanceof Er)),i=await YH(n.firstToken,e,r);if(!i||i===n||n.allDescendants.some(a=>a===i))return{level:0};let s=pa(i);return{level:ha(e,s),inAst:i}},qn=(t,e)=>{if(t.insertSpaces)return"".padStart(e," ");let n=Math.floor(e/t.tabSize),r=e%t.tabSize;return`${"".padStart(n," ")}${"".padStart(r," ")}`},Ar=(t,e,n="")=>`${"".padStart(t*e.length,e)}${n}`,S0=t=>{let e=t.parentNode;if(!(!e||!(e instanceof me)))return!(e instanceof rn)||!e.openBracket?S0(e):e};function po(t,e,n,r,i,s,o=!1){if(!o&&mn(e.firstToken,t.firstToken))return r[e.firstToken.pos.line].slice(0,e.firstToken.pos.col).replace(/^\s+/,f=>f.replace(/\t/g," ".repeat(n.tabSize))).length-n.tabSize*i;let a=S0(e);if(!a)return s;let l=po(t,a,n,r,i,s);return!o&&mn(e.firstToken,a.firstToken)?l+=e.firstToken.pos.col-a.firstToken.pos.col:a instanceof rn&&a.openBracket&&++l,l}var ni=(t,e,n)=>t[e]??n,eh=t=>({baseFormattingRules:ni(t,"baseFormattingRules",!0),removeMacroMultiline:ni(t,"removeMacroMultiline",!0),wrapLongLines:ni(t,"wrapLongLines",!0),indentExpressions:ni(t,"indentExpressions",!0),removeEmptyReferences:ni(t,"removeEmptyReferences",!0),removeEmptyRoots:ni(t,"removeEmptyRoots",!1),removeEmptyNodes:ni(t,"removeEmptyNodes",!1),removeDuplicateProperties:ni(t,"removeDuplicateProperties",!0),sortNodesAndProperties:ni(t,"sortNodesAndProperties",!1),sortNodesNodesBy:ni(t,"sortNodesNodesBy","none"),sortPropertiesAlphabetically:ni(t,"sortPropertiesAlphabetically",!1)});var qt=L(U());function _s(t,e,n,r){if(!mn(t,e)){let o=e.prevToken;for(;t!==o;){if(o&&mn(t,o)&&_s(t,o,n,r))return!0;o=o?.prevToken}return null}return r[t.pos.line].slice(0,e.pos.colEnd).replace(/^\s+/,o=>o.replace(/\t/g," ".repeat(n.tabSize))).length>n.wordWrapColumn}async function tv(t,e,n,r,i,s,o=[]){let a=r.split(`
|
|
303
|
-
`),c=mr(e,a),l=r;o.push(...await KH(t,e,n,a,s));let u=gr(c,t,o);switch(l=Jn(
|
|
302
|
+
};`,kind:At.CompletionItemKind.Class,sortText:`!${r}`,insertTextFormat:At.InsertTextFormat.Snippet}))}async function UD(t,e){return Rt(t,e,(n,r)=>[...NH(n,r),...kH(n,r),...PH(n,r),...RH(n,r),..._H(n,r),...SH(n,r),...bH(n),...wH(n),...EH(n,r)])}var Xp=L(U());var VD=require("child_process");var KT=t=>/[A-Za-z0-9_]/.test(t);function CH(t,e){let n=[];for(let r=0;r<e;r++){let i=t[r];i==="("?n.push(r):i===")"&&n.pop()}return n.length?n[n.length-1]:void 0}function HD(t,e){let n=1;for(let r=e+1;r<t.length;r++){let i=t[r];if(i==="(")n++;else if(i===")"&&(n--,n===0))return r}}function WD(t,e,n){let r=[],i=0,s=!1,o=!1,a=e;for(let f=e;f<n;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,y=m,S=h;for(;y<S&&/\s/.test(t[y]);)y++;for(;S>y&&/\s/.test(t[S-1]);)S--;r.push({start:m,end:h,text:t.slice(y,S)}),a=f+1}}}let c=a,l=n,u=c,d=l;for(;u<d&&/\s/.test(t[u]);)u++;for(;d>u&&/\s/.test(t[d-1]);)d--;return r.push({start:c,end:l,text:t.slice(u,d)}),r}function XT(t){let e=t.trim(),n=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(e);if(!n)return{macro:e};let r=n[1],i=n[2],s=WD(i,0,i.length),o={macro:r,args:[]};return o.args=s.map(a=>{let c=XT(a.text);return c.parent=o,c}),o}function Gi(t,e){let n=t.getText(),r=t.offsetAt(e),i=r,s=r;for(;i>0&&KT(n[i-1]);)i--;for(;s<n.length&&KT(n[s]);)s++;if(n[s]==="("){let y=HD(n,s);y!==void 0&&(s=y+1)}let o=n.slice(i,s),a=o.trim().length?XT(o):void 0,c=CH(n,r);if(c===void 0)return a;let l=HD(n,c);if(l===void 0||!(c<r&&r<=l))return a;let u=c,d=u;for(;d>0&&KT(n[d-1]);)d--;let f=n.slice(d,u);if(!f)return a;let p=WD(n,c+1,l),m={macro:f,args:[]};m.args=p.map(y=>{let S=XT(y.text);return S.parent=m,S});let h=-1;for(let y=0;y<p.length;y++){let S=p[y];if(r>=S.start&&r<=S.end){h=y;break}}if(h>=0){let y=m.args[h];return y.argIndexInParent=h,y}return m}function DH(t,e,n){let i=t.getText().split(/\r?\n/),s=new RegExp(`^\\s*#\\s*define\\s+(${e})\\b(\\s*\\([^)]*\\))?\\s*(.*)$`);for(let o=Math.min(n.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 pt.create(o,u>=0?u:a.length)}}}async function Ts(t,e,n,r){let i=zD(t,e,n);if(i)return i;let s=await IH(e,r,_e(t.uri));if(s)return[s,n]}function zD(t,e,n){if(e.startsWith("DT_"))return;let r=DH(t,e,n);if(!r)return;let i=Gi(t,r);if(i)return[i,r]}var AH=(t,e)=>new Promise(n=>{let r=(0,VD.spawn)(t,e,{stdio:["ignore","pipe","pipe"]}),i="";r.stdout.on("data",s=>{i+=s.toString()}),r.on("close",s=>{n(s?"":i)})});async function IH(t,e,n){let r=e.getCompileCommands()?.find(s=>fe(s.file,n));if(!r)return;let i=`${r.command.replace(/-(o|c)\s+\S+/g,"")} -E -dM ${r.file}`;try{let[s,...o]=i.split(" "),a=await AH(s,o.filter(u=>!!u)),c=xt.create(`macros://${r.file}`,"devicetree",0,a),l=zD(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 ll=L(U());async function GD({macro:t,context:e}){if(t.macro&&"DT_ALIAS".startsWith(t.macro))return[{label:"DT_ALIAS(...)",insertText:"DT_ALIAS($1)",kind:ll.CompletionItemKind.Function,insertTextFormat:ll.InsertTextFormat.Snippet}];if(t.parent?.macro!=="DT_ALIAS"||t.argIndexInParent!==0)return[];let n=await e.getRuntime();return n.rootNode.getNode("aliases")?.properties.map(r=>{let i=r.ast.getFlatAstValues()?.at(0),s;return i instanceof ie?s=i.linksTo:i instanceof Qr&&(s=i.pathParts.at(-1)?.linksTo),{label:Z(r.name),kind:ll.CompletionItemKind.Property,documentation:s?.toMarkupContent(n.context.macros)}})??[]}var ul=L(U());async function wn(t,e,n){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 rt)return s.path?.pathParts.at(-1)?.linksTo;if(s instanceof ie)return s.linksTo;if(s instanceof re)return s.value;if(s instanceof me){let o=s.evaluate(n.macros);return typeof o=="number"?o:s.toString()}})}async function yp({document:t,macro:e,context:n,position:r},i){let s=e.args;if(e.macro!=="DT_PROP"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:n,position:r});return o?wn(o,s[1].macro,n):void 0}async function YD(t,e){let n=await yp(t,e);if(typeof n=="boolean")return;let r=n?.at(0);if(n?.length===1&&r instanceof X)return r}async function KD(t,e,n,r){if(n=typeof n=="number"?n:Me(n),typeof n!="number")return;let i=await wn(t,e,r);if(i===!0)return!0;if(!i)return;let s=i.at(n);if(s)return i.length===1&&i[0]instanceof X?i[0]:s}async function Tp({document:t,macro:e,context:n,position:r},i){if(!(e.macro!=="DT_PROP_BY_IDX"||e.args?.length!==3))return KD(await i({document:t,macro:e.args[0],context:n,position:r}),e.args[1].macro,e.args[2].macro,n)}async function XD(t,e){let n=await Tp(t,e);if(typeof n!="boolean"&&n instanceof X)return n}async function tr(t,{document:e,context:n,macro:r,position:i},s){return t||(await s({document:e,macro:r,context:n,position:i})??r.macro)}async function vp(t,e,n,r){return tr(await wn(t,e,n.context),n,r)}async function Na({document:t,macro:e,context:n,position:r},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:n,position:r});return await vp(c,o.macro,{macro:a,document:t,context:n,position:r},i)}async function JD(t,e){let n=await Na(t,e);if(n instanceof X)return n;if(typeof n=="boolean")return;let r=n?.at(0);if(n?.length===1&&r instanceof X)return r}async function QD(t){let e=t?.nodeType?.onBus,n=t?.parent?.nodeType?.bus;return t&&n?.length&&n?.some(r=>r===e)?t.parent??void 0:void 0}async function bp(t,e){let n=t.macro.args;if(t.macro.macro!=="DT_BUS"||n?.length!==1)return;let r=await e({...t,macro:n[0]});return await QD(r)}async function Sp(t,e){let n=(await t.getRuntime()).rootNode.getChild(["/","chosen"]);if(!n)return;let s=n?.properties.find(o=>Z(o.name)===e)?.ast.getFlatAstValues()?.at(0);if(s instanceof ie)return s.linksTo;if(s instanceof rt)return s.path?.pathParts.at(-1)?.linksTo}async function _p(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_CHOSEN"||e?.length!==1))return await Sp(t.context,e[0].macro)}async function Pp(t,e){let n=await e?.getRuntime();if(n){let r=Pi.getNodeFromPath(["aliases"],n.rootNode,!0),i=r?.properties.find(o=>Z(o.name)===t);if(!i)return;let s=i.ast.getFlatAstValues();return s?.[0]instanceof re?r=n.rootNode.getChild(s[0].value.split("/")):s?.[0]instanceof ie?r=s[0].linksTo:s?.[0]instanceof rt&&(r=s[0].path?.pathParts.at(-1)?.linksTo),r}}async function kp({macro:t,context:e}){if(!(t.macro!=="DT_ALIAS"||t.args?.length!==1))return Pp(t.args[0].macro,e)}async function ZD(t,e){return t?.nodes.find(n=>Z(n.name)===e)}async function Np({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_CHILD"||e.args?.length!==2)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});return ZD(s,e.args[1].macro)}var JT=(t,e)=>t.nodes.filter(n=>!n.disabled&&n.nodeType).flatMap(n=>[n.nodeType.compatible,...Array.from(n.nodeType.extends)].filter(r=>!!r).map(r=>Z(r)).includes(e)?[n,...JT(n,e)]:JT(n,e));async function eA(t,e){let n=await e?.getRuntime();if(n)return JT(n.rootNode,t)}async function QT({macro:t,context:e}){if(!(t.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.args?.length!==1))return eA(t.args[0].macro,e)}async function tA(t){return(await QT(t))?.at(0)}async function nA(t){return t?.parent?.parent??void 0}async function Rp({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_GPARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});return nA(s)}var ZT=(t,e)=>t.nodes.filter(n=>n.nodeType).sort((n,r)=>n.disabled===r.disabled?0:n.disabled?1:-1).flatMap(n=>[n.nodeType.compatible,...Array.from(n.nodeType.extends)].filter(r=>!!r).map(r=>Z(r)).includes(e)?[n,...ZT(n,e)]:ZT(n,e));async function rA(t,e,n){let r=await n?.getRuntime();if(r)return ZT(r.rootNode,e).at(t)}async function wp({macro:t,context:e}){if(t.macro!=="DT_INST"||t.args?.length!==2)return;let n=Me(t.args[0].macro);if(typeof n=="number")return rA(n,t.args[1].macro,e)}async function iA(t,e){let n=await e?.getRuntime(),r=n?.resolvePath([`&${t.trim()}`]);if(n&&r)return Pi.getNodeFromPath(r.slice(1),n.rootNode,!0)}async function Ep({macro:t,context:e}){if(!(t.macro!=="DT_NODELABEL"||t.args?.length!==1))return iA(t.args[0].macro,e)}async function sA(t){return t?.parent??void 0}async function Cp({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_PARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});return sA(s)}var oA=(t,e)=>{if(!e.length)return t;let n=e.splice(0,1)[0],r=t.nodes.find(i=>Z(i.fullName)===n);return r?oA(r,e):void 0};async function Dp(t,e){let n=await e?.getRuntime();if(n)return oA(n.rootNode,t)}async function Ap({macro:t,context:e}){let n=t.args;if(!(t.macro!=="DT_PATH"||!n?.length))return Dp(n.map(r=>r.macro),e)}async function Ip({macro:t,context:e}){let n=t.args;if(!(t.macro!=="DT_ROOT"||n?.length))return(await e.getRuntime()).rootNode}async function Ra(t,e,n){let r=t?.properties.find(c=>Z(c.name)===e);if(!r)return;let i=r?.ast.quickValues?.at(n),s=r.parent.nodeType;if(Array.isArray(i)||!s||!(s instanceof St))return;let a=s.properties.find(c=>c.getNameMatch(r.name))?.values(r).findIndex(c=>c===i)??-1;return a===-1?void 0:a}async function Op(t,e,n,r,i){return tr(await Ra(t,e,n),r,i)}async function Mp({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return await Op(o,s[1].macro,a,{macro:s[3],document:t,context:n,position:r},i)}async function xp({document:t,macro:e,context:n,position:r},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:n,position:r});return await Op(o,s[1].macro,0,{macro:s[2],document:t,context:n,position:r},i)}async function vs(t,e,n,r,i){let s=t?.properties.find(d=>Z(d.name)===e),o=s?.parent.nodeType;if(!o||!(o instanceof St))return;if(typeof n=="string"){let d=s.nexusMapsTo.at(0)?.specifierSpace;if(n=(d?s.parent.getProperty(`${d}-names`)?.ast.quickValues:void 0)?.findIndex(p=>typeof p=="string"&&p.toLowerCase()===n)??-1,n===-1)return}let a=s.nexusMapsTo.at(n),l=a?.target.nodeType?.cellsValues?.find(d=>a.specifierSpace&&d.specifier===a.specifierSpace)?.values?.indexOf(r);if(l===void 0||l===-1)return;let u=a?.mappingValuesAst.at(l);if(u instanceof me){let d=u.evaluate(i.macros);return typeof d!="number"?u.toString():d}}async function wa(t,e,n,r,i,s){return tr(await vs(t,e,n,r,i.context),i,s)}async function Lp({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return wa(o,s[1].macro,a,s[3].macro,{macro:s[4],document:t,context:n,position:r},i)}async function qp({document:t,macro:e,context:n,position:r},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:n,position:r});return wa(o,s[1].macro,s[2].macro,s[3].macro,{macro:s[4],document:t,context:n,position:r},i)}async function Ni(t,e,n=0){let r=t?.properties.find(s=>Z(s.name)===e);if(n=typeof n=="number"?n:Me(n??"0"),typeof n!="number")return;let i=r?.ast.getFlatAstValues()?.at(n);if(i instanceof ie)return i.linksTo;if(i instanceof rt)return i.path?.pathParts.at(-1)?.linksTo}async function bs({document:t,macro:e,context:n,position:r},i){let s=e.args;if(e.macro!=="DT_PHANDLE"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:n,position:r});return Ni(o,s[1].macro,0)}async function Ri({document:t,macro:e,context:n,position:r},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:n,position:r});return Ni(o,s[1].macro,s.at(2)?.macro)}async function aA(t,e,n){let r=t?.properties.find(l=>Z(l.name)===e);if(!r)return;let i=r.parent.nodeType;if(!i||!(i instanceof St))return;let s=r.nexusMapsTo.at(0)?.specifierSpace,a=(s?r.parent.getProperty(`${s}-names`)?.ast.quickValues:void 0)?.findIndex(l=>typeof l=="string"&&l.toLowerCase()===n)??-1;return a===-1?void 0:r.nexusMapsTo.at(a)?.target}async function $p({document:t,macro:e,context:n,position:r},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:n,position:r});return await aA(o,s[1].macro,s[2].macro)}async function Fp({document:t,macro:e,context:n,position:r},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:n,position:r});return wa(o,s[1].macro,0,s[2].macro,{macro:s[3],document:t,context:n,position:r},i)}async function Bp({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX_OR"||e.args?.length!==5)return;let s=await Ni(await i({document:t,macro:e.args[0],context:n,position:r}),e.args[1].macro,e.args[2].macro);return vp(s,e.args[3].macro,{macro:e.args[4],document:t,context:n,position:r},i)}async function jp(t,e){if(!t)return;let n=t?.properties.find(r=>Z(r.name)===e);return n?.nexusMapsTo.length?n.nexusMapsTo.length:n?.ast.getFlatAstValues()?.length}async function cA(t,e,n,r){if(t)return tr(await jp(t,e),n,r)}async function Up({document:t,macro:e,context:n,position:r},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:n,position:r});return o?cA(o,s[1].macro,{macro:s[2],document:t,context:n,position:r},i):void 0}async function Ea(t,e){if(!t)return;let r=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(r?.length===1&&r[0]instanceof re)return Z(r[0].value)}async function lA(t,e,n,r){if(t)return tr(await Ea(t,e),n,r)}async function Hp({document:t,macro:e,context:n,position:r},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:n,position:r});return lA(o,s[1].macro,{document:t,macro:s[2],context:n,position:r},i)}async function Vp(t,e){if(!t)return;let r=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(r?.length===1&&r[0]instanceof re)return r[0].value}async function uA(t,e,n,r){if(t)return tr(await Vp(t,e),n,r)}async function Wp({document:t,macro:e,context:n,position:r},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:n,position:r});return uA(o,s[1].macro,{document:t,macro:s[2],context:n,position:r},i)}async function zp(t,e){return(await Ea(t,e))?.toUpperCase()}async function dA(t,e,n,r){if(t)return tr(await zp(t,e),n,r)}async function Gp({document:t,macro:e,context:n,position:r},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:n,position:r});return dA(o,s[1].macro,{document:t,macro:s[2],context:n,position:r},i)}function ti(t){return async(e,n)=>{let r=await t(e,n);if(r instanceof X)return r}}async function x({macro:t,document:e,context:n,position:r}){["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[bp,_p,kp,Np,tA,Rp,wp,Ep,Cp,Ap,bs,Ri,$p,XD,YD,JD,Ip,ti(Mp),ti(xp),ti(Lp),ti(qp),ti(Fp),ti(Bp),ti(Up),ti(Na),ti(Hp),ti(Wp),ti(Gp)].reduce((a,c)=>a.then(l=>l||c({macro:t,document:e,context:n,position:r},x)),Promise.resolve(void 0));if(s)return Array.isArray(s)?s.at(0):s;let o=await Ts(e,t.macro,r,n);if(o)return x({document:e,macro:o[0],context:n,position:r})}async function fA({macro:t,document:e,context:n,position:r}){return t.macro&&t.macro&&"DT_CHILD".startsWith(t.macro)?[{label:"DT_CHILD(...)",insertText:"DT_CHILD($1, $2)",kind:ul.CompletionItemKind.Function,insertTextFormat:ul.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_CHILD"||t.argIndexInParent!==1||!t.parent.args?.length?[]:(await x({document:e,macro:t.parent.args[0],context:n,position:r}))?.nodes.map(s=>({label:Z(s.fullName),kind:ul.CompletionItemKind.Class,documentation:s.toMarkupContent(n.macros)}))??[]}var dl=L(U());function pA({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:dl.CompletionItemKind.Function,insertTextFormat:dl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.argIndexInParent!==0?[]:e.bindingLoader?.getBindings().map(n=>({label:Z(n),kind:dl.CompletionItemKind.Property}))??[]}var fl=L(U());function hA({macro:t,context:e}){return t.macro&&"DT_INST".startsWith(t.macro)?[{label:"DT_INST(...)",insertText:"DT_INST($1, $2)",kind:fl.CompletionItemKind.Function,insertTextFormat:fl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_INST"||t.argIndexInParent!==1?[]:e.bindingLoader?.getBindings().map(n=>({label:Z(n),kind:fl.CompletionItemKind.Property}))??[]}var pl=L(U());async function mA({macro:t,context:e}){if(t.macro&&"DT_NODELABEL".startsWith(t.macro))return[{label:"DT_NODELABEL(...)",insertText:"DT_NODELABEL($1)",kind:pl.CompletionItemKind.Function,insertTextFormat:pl.InsertTextFormat.Snippet}];let n=await e.getRuntime();return t.parent?.macro!=="DT_NODELABEL"||t.argIndexInParent!==0?[]:await Promise.all(n.rootNode.allDescendantsLabels.map(async r=>({label:r.label.value,kind:pl.CompletionItemKind.Property,documentation:r.lastLinkedTo?.toMarkupContent(n.context.macros)}))??[])}var hl=L(U());async function gA({macro:t,context:e}){return t.macro&&t.macro&&"DT_PATH".startsWith(t.macro)?[{label:"DT_PATH(...)",insertText:"DT_PATH($1)",kind:hl.CompletionItemKind.Function,insertTextFormat:hl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_PATH"||!t.parent.args?.length?[]:(await Dp(t.parent.args.slice(0,-1).map(r=>r.macro),e))?.nodes.map(r=>({label:Z(r.fullName),kind:hl.CompletionItemKind.Class,documentation:r.toMarkupContent(e.macros)}))??[]}var yA=L(U());async function TA({macro:t,context:e}){if(t.macro&&t.macro&&"DT_ROOT".startsWith(t.macro)){let n=await e.getRuntime();return[{label:"DT_ROOT",kind:yA.CompletionItemKind.Class,documentation:n.rootNode.toMarkupContent(n.context.macros)}]}return[]}var Yp=L(U());function vA({macro:t}){return t.macro&&t.macro&&"DT_SAME_NODE".startsWith(t.macro)?[{label:"DT_SAME_NODE(...)",insertText:"DT_SAME_NODE($1, $2)",kind:Yp.CompletionItemKind.Snippet,insertTextFormat:Yp.InsertTextFormat.Snippet}]:[]}var ml=L(U());async function Q({macro:t,document:e,position:n,context:r},i,s,o,a,c=l=>x({document:e,macro:l,context:r,position:n})){if(t.macro&&t.macro&&i.startsWith(t.macro))return[{label:`${i}(...)`,insertText:`${i}(${Array(o).map((d,f)=>`${f+1}`).join(", ")})`,kind:ml.CompletionItemKind.Function,insertTextFormat:ml.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:ml.CompletionItemKind.Property,documentation:d.toPrettyString(r.macros)}))??[]}async function bA(t){return Q(t,"DT_ENUM_HAS_VALUE",1,3)}async function SA(t){return Q(t,"DT_ENUM_HAS_VALUE_BY_IDX",1,4)}async function _A(t){return Q(t,"DT_ENUM_IDX",1,2)}async function PA(t){return Q(t,"DT_ENUM_IDX_BY_IDX",1,3)}async function kA(t){return Q(t,"DT_ENUM_IDX_BY_IDX_OR",1,4)}async function NA(t){return Q(t,"DT_ENUM_IDX_OR",1,3)}var RA=L(U());async function Yi({macro:t,document:e,context:n,position:r},i,s,o){if(t.parent?.macro!==i||t.argIndexInParent!==s||!t.parent.args?.length)return[];let c=(await x({document:e,macro:t.parent.args[0],context:n,position:r}))?.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:RA.CompletionItemKind.Property}))??[]}async function wA(t){return t.macro.argIndexInParent===2?Yi(t,"DT_PHA",2,0):Q(t,"DT_PHA",1,3,e=>!!e.nexusMapsTo.length)}var EA=L(U());async function OH({document:t,macro:e,position:n,context:r},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await x({document:t,macro:e.parent.args[0],context:r,position:n}))?.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:EA.CompletionItemKind.Property}))??[]}async function CA(t){if(t.macro.argIndexInParent===2)return OH(t,"DT_PHA_BY_IDX");if(t.macro.argIndexInParent===3){let e=t.macro.parent?.args?Me(t.macro.parent.args[2].macro):void 0;return typeof e!="number"?[]:Yi(t,"DT_PHA_BY_IDX",3,e)}return Q(t,"DT_PHA_BY_IDX",1,3,e=>!!e.nexusMapsTo.length)}var DA=L(U());async function gl({document:t,macro:e,context:n,position:r},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await x({document:t,macro:e.parent.args[0],context:n,position:r}))?.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:DA.CompletionItemKind.Property}))??[]}async function AA(t){let{macro:e}=t;return e.argIndexInParent===2?gl(t,"DT_PHA_BY_NAME"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Yi(t,"DT_PHA_BY_NAME",3,e.parent.args[2].macro):[]:Q(t,"DT_PHA_BY_NAME",1,3,n=>!!n.nexusMapsTo.length)}async function IA(t){let{macro:e}=t;return e.argIndexInParent===2?gl(t,"DT_PHA_BY_NAME_OR"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Yi(t,"DT_PHA_BY_NAME_OR",3,e.parent.args[2].macro):[]:Q(t,"DT_PHA_BY_NAME_OR",1,3,n=>!!n.nexusMapsTo.length)}async function OA(t){let{macro:e}=t;return e.argIndexInParent===2?Yi(t,"DT_PHA_OR",2,0):Q(t,"DT_PHA_OR",1,3,n=>!!n.nexusMapsTo.length)}async function Kp(t){return Q(t,"DT_PHANDLE",1,2,e=>!!e.ast.getFlatAstValues()?.some(n=>n instanceof ie||n instanceof rt))}async function Ca(t){return Q(t,"DT_PHANDLE_BY_IDX",1,3,e=>!!e.ast.getFlatAstValues()?.some(n=>n instanceof ie||n instanceof rt))}async function MA(t){let{macro:e}=t;return e.argIndexInParent===2?gl(t,"DT_PHANDLE_BY_NAME"):Q(t,"DT_PHANDLE_BY_NAME",1,3,n=>!!n.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof rt))}async function xA(t){return Q(t,"DT_PROP",1,2,e=>!e.nexusMapsTo.length)}async function LA(t){return Q(t,"DT_PROP_BY_IDX",1,3,e=>!e.nexusMapsTo.length)}async function qA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX"?Ca({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE_IDX",3,4,n=>!n.nexusMapsTo.length,()=>Ri({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},x))}async function $A(t){let{macro:e}=t;return e.argIndexInParent===1&&e.parent?.macro==="DT_PROP_BY_PHANDLE"?Kp({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE",2,3,n=>!n.nexusMapsTo.length,()=>bs({...t,macro:{macro:"DT_PHANDLE",args:e.parent?.args?.slice(0,2)}},x))}async function FA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX_OR"?Ca({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE_IDX_OR",3,5,n=>!n.nexusMapsTo.length,()=>Ri({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},x))}async function BA(t){return Q(t,"DT_PROP_HAS_IDX",1,3,e=>!e.nexusMapsTo.length)}async function jA(t){return Q(t,"DT_PROP_HAS_NAME",1,3,e=>!e.nexusMapsTo.length)}async function UA(t){return Q(t,"DT_PROP_LAST",1,2,e=>!e.nexusMapsTo.length)}async function HA(t){return Q(t,"DT_PROP_LEN",1,2,e=>!e.nexusMapsTo.length)}async function VA(t){return Q(t,"DT_PROP_LEN_OR",1,2,e=>!e.nexusMapsTo.length)}async function WA(t){return Q(t,"DT_PROP_OR",1,2,e=>!e.nexusMapsTo.length)}async function zA(t){return Q(t,"DT_STRING_TOKEN",1,2,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}async function GA(t){return Q(t,"DT_STRING_TOKEN_BY_IDX",1,3,e=>{let n=e.ast.getFlatAstValues();return!!n?.length&&n.every(r=>r instanceof re)})}async function YA(t){return Q(t,"DT_STRING_TOKEN_OR",1,3,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}async function KA(t){return Q(t,"DT_STRING_UNQUOTED",1,2,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}async function XA(t){return Q(t,"DT_STRING_UNQUOTED_BY_IDX",1,3,e=>{let n=e.ast.getFlatAstValues();return!!n?.length&&n.every(r=>r instanceof re)})}async function JA(t){return Q(t,"DT_STRING_UNQUOTED_OR",1,3,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}async function QA(t){return Q(t,"DT_STRING_UPPER_TOKEN",1,2,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}async function ZA(t){return Q(t,"DT_STRING_UPPER_TOKEN_BY_IDX",1,3,e=>{let n=e.ast.getFlatAstValues();return!!n?.length&&n.every(r=>r instanceof re)})}async function e0(t){return Q(t,"DT_STRING_UPPER_TOKEN_OR",1,3,e=>{let n=e.ast.getFlatAstValues();return n?.length===1&&n[0]instanceof re})}var yl=L(U());async function t0({macro:t,context:e}){return t.parent?.macro==="DT_ON_BUS"&&t.argIndexInParent===1?e.bindingLoader?.getBusTypes().map(n=>({label:Z(n),kind:yl.CompletionItemKind.Enum}))??[]:t.macro&&"DT_ON_BUS".startsWith(t.macro)?[{label:"DT_ON_BUS(...)",insertText:"DT_ON_BUS($1, $2)",kind:yl.CompletionItemKind.Function,insertTextFormat:yl.InsertTextFormat.Snippet}]:[]}async function n0(t){return Q(t,"DT_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}async function r0(t){return Q(t,"DT_HAS_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}var MH=["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 i0(t,e,n){if(!n)return[];let r=Gi(n,t.position);return r?(await Promise.all([t0,n0,r0,GD,fA,pA,hA,xH,mA,gA,TA,vA,SA,bA,PA,kA,_A,NA,CA,AA,IA,wA,Ca,MA,Kp,OA,LA,$A,qA,FA,xA,BA,jA,UA,HA,VA,WA,zA,GA,YA,KA,XA,JA,QA,ZA,e0].flatMap(async i=>await i({document:n,context:e,macro:r,position:t.position})))).flat():[]}function xH({macro:t}){return t.macro?MH.filter(e=>e.startsWith(t.macro)).map(e=>({label:`${e}(...)`,insertText:`${e}($1)`,kind:Xp.CompletionItemKind.Function,insertTextFormat:Xp.InsertTextFormat.Snippet})):[]}var Dr=L(U());function LH(t){if(!t||t.item===null||!(t.ast instanceof Xe))return[];let e=r=>r.replacedBy?e(r.replacedBy):r,n=r=>{let i=r.parent.deletedProperties.find(s=>s.property===r)?.by;return[r.ast,...r.allReplaced.map(s=>s.ast),...i?[i]:[]].map(s=>{let o=pn(s.fsPath);if(o)return Dr.Location.create(ue(o.fsPath),o.range);if(s instanceof Ne)return Dr.Location.create(ue(s.fsPath),ce(s.propertyName??s));if(s instanceof lt)return Dr.Location.create(ue(s.fsPath),ce(s.propertyName??s))}).filter(s=>s)};if(t.item instanceof Je&&t.ast instanceof Xe)return n(e(t.item));if(t.item instanceof X&&t.ast instanceof Xe&&t.ast.parentNode instanceof lt){let r=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(r)return n(r)}return[]}function qH(t){if(!t)return[];let e=n=>{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("/"))===n)return!0}).map(o=>o.ast)??[],s=n.parent?.deletedNodes.filter(o=>o.node===n&&(o.by.nodeNameOrRef instanceof $e?o.by.nodeNameOrRef!==t.ast:!n.linkedRefLabels.some(a=>a!==t.ast))).map(o=>o.by.nodeNameOrRef)??[];return[...i,...n.linkedRefLabels,...n.linkedNodeNamePaths,...n.definitions,...s].map(o=>{let a=o&&pn(o?.fsPath);if(a)return Dr.Location.create(ue(a.fsPath),a.range);if(o instanceof nt)return Dr.Location.create(ue(o.fsPath),ce(o.name??o));if(o instanceof Ee)return Dr.Location.create(ue(o.fsPath),ce(o.name??o));if(o instanceof $e)return Dr.Location.create(ue(o.fsPath),ce(o));if(o instanceof $e)return Dr.Location.create(ue(o.fsPath),ce(o));if(o instanceof ie)return Dr.Location.create(ue(o.fsPath),ce(o.label??o));if(o instanceof Ne)return Dr.Location.create(ue((o.values??o)?.fsPath),ce(o.values??o))}).filter(o=>o)};if(t.item instanceof X&&!Zt(t.ast))return e(t.item);if(t.ast instanceof gn&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return e(t.ast.parentNode.linksTo);if(t.ast instanceof $e&&t.ast.linksTo)return Zt(t.ast)?[...e(t.ast.linksTo),Dr.Location.create(ue(t.ast.fsPath),ce(t.ast))]:e(t.ast.linksTo);if(t?.ast instanceof re&&t.item instanceof Je&&t.item.parent.name==="aliases"){let n=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(n)return e(n)}return[]}async function s0(t,e){return Rt(t,e,n=>[...qH(n),...LH(n)])}var Ki=L(U());function o0(t){if(!t||t.item===null||!(t.ast instanceof Xe))return[];let e=r=>r.replacedBy?e(r.replacedBy):r,n=r=>[r.ast,...r.allReplaced.map(i=>i.ast),r.parent.deletedProperties.find(i=>i.property===r)?.by??[]].map(i=>{if((i instanceof Ne||i instanceof lt)&&i.propertyName)return Ki.Location.create(ue(i.fsPath),ce(i.propertyName))}).filter(i=>i);if(t.item instanceof Je&&t.ast instanceof Xe)return n(e(t.item));if(t.item instanceof X&&t.ast instanceof Xe&&t.ast.parentNode instanceof lt){let r=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(r)return n(r)}return[]}function a0(t,e){if(!e||!(e.ast instanceof gn))return[];"newName"in t&&(e.ast.parentNode instanceof ie&&t.newName.startsWith("&")?t.newName=t.newName.slice(1):e.ast.parentNode instanceof ys&&t.newName.endsWith(":")&&(t.newName=t.newName.slice(0,-1)));let n=e.ast.value,r=i=>[...i.implementations.filter(s=>s instanceof Ee||s instanceof ut).flatMap(s=>s.labels.map(o=>o.label)),...i.linkedRefLabels.map(s=>s.label)].filter(s=>s?.value===n).map(s=>{if(s)return Ki.Location.create(ue(s.fsPath),ce(s))}).filter(s=>s);return e.item instanceof X&&!Zt(e.ast)?r(e.item):e.ast instanceof gn&&e.ast.parentNode instanceof ie&&e.ast.parentNode.linksTo?r(e.ast.parentNode.linksTo):[]}function c0(t){if(!t||!(t.ast instanceof $e)||t.ast instanceof $e&&t.ast.linksTo===t.runtime.rootNode)return[];let e=n=>{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(n)||c===n)return!0}}).map(o=>o.ast)??[],s=n.parent?.deletedNodes.filter(o=>o.node===n&&o.by.nodeNameOrRef!==t.ast).map(o=>o.by.nodeNameOrRef)??[];return[...i,...n.linkedNodeNamePaths,...n.definitions,...s].map(o=>{if(o instanceof Ee&&o.name)return Ki.Location.create(ue(o.fsPath),ce(o.name));if(o instanceof $e)return Ki.Location.create(ue(o.fsPath),ce(o));if(o instanceof Ne&&o.values?.values[0]?.value&&o.values?.values[0]?.value instanceof re){let a=o.values.values[0].value,c=ce(a),l=a.value.split("/"),u=n.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,Ki.Location.create(ue(o.values.values[0].fsPath),c)}}).filter(o=>o)};return t.item instanceof X&&!Zt(t.ast)?e(t.item):t.ast instanceof $e&&t.ast.linksTo?Zt(t.ast)?[...e(t.ast.linksTo),Ki.Location.create(ue(t.ast.fsPath),ce(t.ast))]:e(t.ast.linksTo):[]}async function l0(t,e){let n={};return(await Rt(t,e,i=>[...c0(i),...a0(t,i),...o0(i)])).forEach(i=>{n[i.uri]??=[],n[i.uri].push(Ki.TextEdit.replace(i.range,t.newName))}),{changes:n}}async function u0(t,e){let n=await Rt(t,e,r=>[...c0(r),...a0(t,r),...o0(r)]);if(n.some(r=>e?.settings.lockRenameEdits?.some(i=>_e(r.uri).startsWith(i))))throw new Error('Path is locked by user setting "lockRenameEdits"');if(n.some(r=>bi(r.uri)))throw new Error("Item was generated using a MACRO.");return{defaultBehavior:!!n.length}}var Aa=L(U());var Da=t=>t.implementations.map(e=>{let n=pn(e.fsPath);return n?Aa.Location.create(ue(n.fsPath),n.range):Aa.Location.create(ue(e.fsPath),ce(e))}).filter(e=>e),d0=t=>t.replacedBy?d0(t.replacedBy):t,Jp=t=>[t.ast,...t.allReplaced.map(e=>e.ast)].map(e=>{let n=pn(e.fsPath);return n?Aa.Location.create(ue(n.fsPath),n.range):Aa.Location.create(ue(e.fsPath),ce(e.propertyName??e))}).filter(e=>e);function $H(t){if(!t||t.item===null||!(t.ast instanceof Xe))return[];if(t.item instanceof Je&&t.ast instanceof Xe)return Jp(d0(t.item));if(t.item instanceof X&&t.ast instanceof Xe&&t.ast.parentNode instanceof lt){let e=t.item.deletedProperties.find(n=>n.by===t.ast.parentNode)?.property;if(e)return Jp(e)}return[]}function FH(t){if(!t)return[];if(t.item instanceof X&&!Zt(t.ast))return Da(t.item);if(t.ast instanceof gn&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return Da(t.ast.parentNode.linksTo);if(t.ast instanceof $e&&t.ast.linksTo)return Da(t.ast.linksTo);if(t?.ast instanceof re&&t.item instanceof Je&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return Da(e)}return[]}function BH(t){if(t?.ast instanceof Tt||t?.ast instanceof vi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof Tt?t.ast.name:t.ast.value);if(e)return[Aa.Location.create(ue(e.macro.fsPath),ce(e.macro.identifier))]}return[]}async function f0(t,e){return Rt(t,e,n=>[...FH(n),...$H(n),...BH(n)])}var jH=["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 Qp({macro:t,document:e,context:n,position:r}){if(jH.some(i=>i===t.parent?.macro)&&t.argIndexInParent===1&&t.parent?.args?.[0])return(await x({document:e,context:n,position:r,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 bs({document:e,context:n,position:r,macro:{macro:"DT_PHANDLE",args:t.parent.args.slice(0,2)}},x))?.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 Ri({document:e,context:n,position:r,macro:{macro:"DT_PHANDLE_BY_IDX",args:t.parent.args.slice(0,3)}},x))?.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 n.getRuntime()).rootNode.getChild(["/","chosen"])?.properties.find(i=>Z(i.name)===t.macro)}async function p0(t,e,n){if(!n)return;let r=Gi(n,t.position);return h0(r,t.position,e,n)}async function h0(t,e,n,r){if(!t?.macro)return;let i=await x({document:r,macro:t,context:n,position:e});if(i)return Da(i);let s=await Qp({document:r,macro:t,context:n,position:e});if(s)return Jp(s);let o=await Ts(r,t.macro,e,n);if(o)return h0(o[0],o[1],n,r)}var Ss=L(U());var Ia=t=>{let e=t.definitions.at(0),n=e&&pn(e.fsPath);return n?Ss.Location.create(ue(n.fsPath),n.range):e?Ss.Location.create(ue(e.fsPath),ce(e)):void 0},Zp=t=>t.replaces?Zp(t.replaces):t,m0=t=>{let e=Zp(t),n=pn(e.ast.fsPath);return n?Ss.Location.create(ue(n.fsPath),n.range):e?Ss.Location.create(ue(e.ast.fsPath),ce(e.ast)):void 0};function UH(t){if(!t||t.item===null||!(t.ast instanceof Xe))return;let e=n=>{let r=pn(n.ast.fsPath);return r?Ss.Location.create(ue(r.fsPath),r.range):Ss.Location.create(ue(n.ast.fsPath),ce(n.ast.propertyName??n.ast))};if(t.item instanceof Je&&t.ast instanceof Xe)return e(Zp(t.item));if(t.item instanceof X&&t.ast instanceof Xe&&t.ast.parentNode instanceof lt){let n=t.item.deletedProperties.find(r=>r.by===t.ast.parentNode)?.property;if(n)return e(Zp(n))}}function HH(t){if(t){if(t.item instanceof X&&!Zt(t.ast))return Ia(t.item);if(t.ast instanceof gn&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return Ia(t.ast.parentNode.linksTo);if(t.ast instanceof $e&&t.ast.linksTo)return Ia(t.ast.linksTo);if(t?.ast instanceof re&&t.item instanceof Je&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return Ia(e)}}}function VH(t){if(t?.ast instanceof Tt||t?.ast instanceof vi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof Tt?t.ast.name:t.ast.value);if(e)return Ss.Location.create(ue(e.macro.fsPath),ce(e.macro.identifier))}}async function g0(t,e){return(await Rt(t,e,n=>[HH(n)||UH(n)||VH(n)])).at(0)}async function y0(t,e,n){if(!n)return;let r=Gi(n,t.position);return T0(r,t.position,e,n)}async function T0(t,e,n,r){if(!t?.macro)return;let i=await x({document:r,macro:t,context:n,position:e});if(i)return Ia(i);let s=await Qp({document:r,macro:t,context:n,position:e});if(s)return m0(s);let o=await Ts(r,t.macro,e,n);if(o)return T0(o[0],o[1],n,r)}var de=L(U());var WH=(t,e,n,r,i)=>{switch(n){case 1:return[{title:"Add semicolon",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),";")]}}}];case 2:return[{title:"Add open curly",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character)," {")]}}}];case 29:return[{title:"Remove white space",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(de.Range.create(de.Position.create(r.range.start.line,t.pos.colEnd),de.Position.create(r.range.end.line,e.pos.col)),"")]}}}];case 3:return[{title:"Add close curly",diagnostics:[r],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),"}")]}}}];case 19:return[{title:"Add '/'",diagnostics:[r],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),"/")]}}}];case 28:return[{title:"Add comma",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),",")]}}}];case 21:return[{title:"Add '/'",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),"/")]}}}];case 23:return[{title:"Remove ';'",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.del(r.range)]}}}];case 34:return[{title:"Complete Keyword '/delete-node/",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(r.range,"/delete-node/")]}}}];case 35:return[{title:"Complete Keyword '/delete-property/",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(r.range,"/delete-property/")]}}}];case 25:return[{title:"Complete Keyword '/delete-property/",diagnostics:[r],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(r.range,"/delete-property/")]}}},{title:"Complete Keyword '/delete-node/",diagnostics:[r],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(r.range,"/delete-node/")]}}}];case 12:return[{title:"Add '>'",diagnostics:[r],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(r.range.end.line,r.range.end.character),">")]}}}];default:return}},zH=(t,e,n,r,i)=>{if(!r?.length)return[];switch(t){case 0:return[{title:i??`Add Property "${r[0].newText.split("=",1)[0].replace(";","").trim()}"`,diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[n]:r}}}];case 27:return[{title:i??"Remove Property",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[n]:r}}}];case 26:return[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[n]:r}}}];case 36:return[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[n]:r}}}];case 25:return r?[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[n]:r}}}]:[];default:return}},GH=(t,e,n,r)=>n?.length?[{title:r??"TODO",diagnostics:[t],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[e]:n}}}]:[];function v0(t){let e=t.context.diagnostics.flatMap(a=>{let c=a.data;if(c?.virtual)return[];switch(c?.type){case"FormattingIssues":return GH(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=>WH(c.firstToken,c.lastToken,l,a,t.textDocument.uri));case"StandardTypeIssue":return c?.items.flatMap(l=>zH(l,a,t.textDocument.uri,c.edit?Array.isArray(c.edit)?c.edit:[c.edit]:void 0,c.codeActionTitle))}}).filter(a=>!!a),n=e.filter(a=>a.kind===de.CodeActionKind.SourceFixAll),r=e.filter(a=>a.title.startsWith("Add Property")),i=e.filter(a=>a.kind!==de.CodeActionKind.SourceFixAll),s=n.flatMap(a=>a.edit?.changes?.[t.textDocument.uri]??[]),o=new Map;return r.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,...n.map(a=>({...a,kind:de.CodeActionKind.QuickFix})),...s.length?[{title:"Fix All",kind:de.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:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:a}}}:[])]}var ee=L(U());function b0(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 Tl=(t,e)=>e.some(n=>b0(t,n.start)>=0&&b0(t,n.end)<=0),YH=async(t,e,n)=>{let r=pt.create(t.pos.line,t.pos.col),i=n.find(s=>Qt(s,e,r));if(i)return Jr(i,e,r)},mr=(t,e)=>{let n=pt.create(e.length-1,e.at(-1)?.length??0),r=[],i;return t.filter(o=>(o instanceof pr||o instanceof hr)&&/^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:pt.create(o.firstToken.pos.line,o instanceof pr?o.firstToken.pos.colEnd:0)};else if(a==="dts-format on"&&i){let c=pt.create(o.lastToken.pos.line,o instanceof pr?o.lastToken.pos.colEnd-1:e[o.lastToken.pos.line-1].length);r.push(et.create(i.start,c)),i=void 0}}),i&&r.push(et.create(i.start,n)),r},Oa=async(t,e,n)=>(await ev(t,e,n))?.allAstItems,ev=async(t,e,n)=>{if(e!==n){let r=new Cr(t,[],void 0,()=>new er(n,t).tokens,!0);return await r.stable,r}},gr=(t,e,n)=>{let r=t.length?n.filter(i=>(Array.isArray(i.raw.edit)?i.raw.edit:i.raw.edit?[i.raw.edit]:void 0)?.every(o=>!Tl(o.range.start,t)&&!Tl(o.range.end,t))):n;return"range"in e&&(r=r.filter(i=>ao(e.range,i.raw.range))),r},Ma=(t,e)=>async n=>{let r=t.filter(a=>!(a instanceof Zr)&&!(a instanceof hr)&&!(a instanceof pr)&&!(a instanceof Er)),i=await YH(n.firstToken,e,r);if(!i||i===n||n.allDescendants.some(a=>a===i))return{level:0};let s=pa(i);return{level:ha(e,s),inAst:i}},qn=(t,e)=>{if(t.insertSpaces)return"".padStart(e," ");let n=Math.floor(e/t.tabSize),r=e%t.tabSize;return`${"".padStart(n," ")}${"".padStart(r," ")}`},Ar=(t,e,n="")=>`${"".padStart(t*e.length,e)}${n}`,S0=t=>{let e=t.parentNode;if(!(!e||!(e instanceof me)))return!(e instanceof rn)||!e.openBracket?S0(e):e};function po(t,e,n,r,i,s,o=!1){if(!o&&mn(e.firstToken,t.firstToken))return r[e.firstToken.pos.line].slice(0,e.firstToken.pos.col).replace(/^\s+/,f=>f.replace(/\t/g," ".repeat(n.tabSize))).length-n.tabSize*i;let a=S0(e);if(!a)return s;let l=po(t,a,n,r,i,s);return!o&&mn(e.firstToken,a.firstToken)?l+=e.firstToken.pos.col-a.firstToken.pos.col:a instanceof rn&&a.openBracket&&++l,l}var ni=(t,e,n)=>t[e]??n,eh=t=>({baseFormattingRules:ni(t,"baseFormattingRules",!0),removeMacroMultiline:ni(t,"removeMacroMultiline",!0),wrapLongLines:ni(t,"wrapLongLines",!0),indentExpressions:ni(t,"indentExpressions",!0),removeEmptyReferences:ni(t,"removeEmptyReferences",!0),removeEmptyRoots:ni(t,"removeEmptyRoots",!1),removeEmptyNodes:ni(t,"removeEmptyNodes",!1),removeDuplicateProperties:ni(t,"removeDuplicateProperties",!0),sortNodesAndProperties:ni(t,"sortNodesAndProperties",!1),sortNodesNodesBy:ni(t,"sortNodesNodesBy","none"),sortPropertiesAlphabetically:ni(t,"sortPropertiesAlphabetically",!1)});var qt=L(U());function _s(t,e,n,r){if(!mn(t,e)){let o=e.prevToken;for(;t!==o;){if(o&&mn(t,o)&&_s(t,o,n,r))return!0;o=o?.prevToken}return null}return r[t.pos.line].slice(0,e.pos.colEnd).replace(/^\s+/,o=>o.replace(/\t/g," ".repeat(n.tabSize))).length>n.wordWrapColumn}async function tv(t,e,n,r,i,s,o=[]){let a=r.split(`
|
|
303
|
+
`),c=mr(e,a),l=r;o.push(...await KH(t,e,n,a,s));let u=gr(c,t,o);switch(l=Jn(xt.create(n,"devicetree",0,r),u),i){case"New Text":return l;case"File Diagnostics":return u}}async function KH(t,e,n,r,i){let s=Ma(e,n);return(await Promise.all(e.flatMap(async a=>await P0(t,a,n,s,r,i)))).flat()}var P0=async(t,e,n,r,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 we?XH(t,e,n,o,u,s,i,r):e instanceof Ne?QH(e,o,u,s,i,l):[]},XH=async(t,e,n,r,i,s,o,a)=>{let c=[];if(e instanceof Ee||e instanceof ut){let l=await JH(e.labels,r,i,o,i.singleIndent);if(l.length>0)c.push(...l);else{let u=e instanceof Ee?e.name:e.reference;u&&_s(u.firstToken,e.openScope??u.lastToken,i,o)&&c.push(Ve(8,n,se(u.firstToken,!1),{edit:[qt.TextEdit.replace(qt.Range.create(se(u.firstToken.prevToken),se(u.firstToken,!1)),`
|
|
304
304
|
${Ar(r,i.singleIndent)}`)],codeActionTitle:`Move ...${u.toString()}... to a new line`}))}}return c.push(...(await Promise.all(e.children.flatMap(l=>P0(t,l,n,a,o,s,r+1)))).flat()),c},JH=(t,e,n,r,i)=>{let s=t.findIndex(c=>_s(c.firstToken,c.lastToken,n,r));if(s===-1)return[];let o=t[s],a=t.find((c,l)=>l>s&&c.firstToken.pos.line!==o.lastToken.pos.line);return[Ve(8,o.firstToken.fsPath,se(o.firstToken,!1),{edit:[qt.TextEdit.replace(qt.Range.create(se(o.firstToken.prevToken),se(o.firstToken,!1)),`
|
|
305
305
|
${Ar(e,i)}`),...a?[qt.TextEdit.replace(qt.Range.create(se(a.firstToken.prevToken),se(a.firstToken,!1))," ")]:[]],codeActionTitle:`Move ...${o.toString()}... to a new line`})]},QH=(t,e,n,r,i,s)=>_s(t.firstToken,t.lastToken,n,i)===!1?[]:t.values?ZH(t.propertyName?.name.length??0,t.values,e,n,r,i,s,t.lastToken):[],ZH=(t,e,n,r,i,s,o,a)=>{for(let[c,l]of e.values.entries()){if(!l)continue;let u=eV(t,l,e.values,c,n,r,i,s,o,c===e.values.length-1&&l.lastToken.nextToken===a?a:void 0);if(u)return u}return[]},th=t=>t instanceof ct||t instanceof Mn&&t.openBracket?t.openBracket??t.firstToken:t.firstToken,eV=(t,e,n,r,i,s,o,a,c,l)=>{let u=e.nextValueSeparator??l??e.lastToken,d=_s(e.firstToken,u,s,a);if(d===!1)return;if(d===null){let b=e.value;return b instanceof ct||b instanceof Mn?_0(e,t,b,i,s,o,a,c,u):b instanceof me?nh(e,t,b,i,s,o,a,c):[]}let f=a[e.firstToken.pos.line].substring(0,e.firstToken.pos.col),p=s.insertSpaces?t+3:Math.trunc((t+3)/s.tabSize),m=s.insertSpaces?0:(t+3)%s.tabSize,h=p+m+(s.insertSpaces?i*s.tabSize:i),y=f.trimStart()!==""?(s.insertSpaces?i*s.tabSize:i)+t+3:h;if(e.firstToken.pos.col===y){let b=e.value;return b instanceof ct||b instanceof Mn?_0(e,t,b,i,s,o,a,c,u):b instanceof me?nh(e,t,b,i,s,o,a,c):void 0}let S=n.slice(r).find(b=>b?.firstToken.pos.line!==e.firstToken.pos.line);return[Ve(8,e.firstToken.fsPath,se(e.firstToken,!1),{edit:[qt.TextEdit.replace(qt.Range.create(se(e.firstToken.prevToken),se(e.firstToken,!1)),`
|
|
306
306
|
${Ar(i,c,qn(s,t+3))}`),...S?[qt.TextEdit.replace(qt.Range.create(se(th(S).prevToken),se(th(S),!1))," ")]:[]],codeActionTitle:`Move ...${e.toString()}... to a new line`},se(e.lastToken))]},_0=(t,e,n,r,i,s,o,a,c)=>{for(let[l,u]of n.values.entries()){if(_s(u.firstToken,l===n.values.length-1?c??u.lastToken:u.lastToken,i,o)===!1)continue;if(u.value instanceof rn)return nh(t,e,u.value,r,i,s,o,a,l!==0);if(l===0)return[];let p=n.values.slice(l).find(h=>h?.firstToken.pos.line!==u.firstToken.pos.line),m=Ar(r,a,qn(i,e+4));return[Ve(8,u.firstToken.fsPath,se(u.firstToken,!1),{edit:[qt.TextEdit.replace(qt.Range.create(se(u.firstToken.prevToken),se(u.firstToken,!1)),`
|
|
307
|
-
${m}`),...p?[qt.TextEdit.replace(qt.Range.create(se(th(p).prevToken),se(th(p),!1))," ")]:[]],codeActionTitle:`Move ...${u.toString()}... to a new line`},se(u.lastToken))]}},nh=(t,e,n,r,i,s,o,a,c=!1,l=0)=>{let u=new Map;n.allDescendants.forEach(v=>{v instanceof me&&!(v.parentNode instanceof
|
|
307
|
+
${m}`),...p?[qt.TextEdit.replace(qt.Range.create(se(th(p).prevToken),se(th(p),!1))," ")]:[]],codeActionTitle:`Move ...${u.toString()}... to a new line`},se(u.lastToken))]}},nh=(t,e,n,r,i,s,o,a,c=!1,l=0)=>{let u=new Map;n.allDescendants.forEach(v=>{v instanceof me&&!(v.parentNode instanceof zt)&&u.set(v.firstToken,v)});let d=Array.from(u.values()).find(v=>_s(v.firstToken,v.lastToken,i,o));if(!d)return;let f=o[d.firstToken.pos.line].substring(0,d.firstToken.pos.col),p=s.indentExpressions?po(t,d,i,o,r,e+4,!0):e+4,m=i.insertSpaces?p:Math.trunc(p/i.tabSize),h=i.insertSpaces?0:p%i.tabSize,y=m+h+(i.insertSpaces?r*i.tabSize:r),S=f.trimStart()!==""?(i.insertSpaces?r*i.tabSize:r)+p:y;if(c&&d.firstToken.pos.col!==S)return[Ve(8,d.firstToken.fsPath,se(d.firstToken,!1),{edit:[qt.TextEdit.replace(qt.Range.create(se(d.firstToken.prevToken),se(d.firstToken,!1)),`
|
|
308
308
|
${Ar(r,a,qn(i,p))}`)],codeActionTitle:`Move ...${d.toString()}... to a new line`},se(d.lastToken))];if(!(d instanceof rn))return[];let b=d.flatJoin;for(let[v,k]of b.entries()){let R=_s(k.expression.firstToken,b?.at(v+1)?.operator.lastToken??d.expression.lastToken,i,o);if(R===!1)continue;let q=s.indentExpressions?po(t,k.expression,i,o,r,e+4,!!R):e+4;if(R===null)return nh(t,e,k.expression,r,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[Ve(8,k.expression.firstToken.fsPath,se(k.expression.firstToken,!1),{edit:[qt.TextEdit.replace(qt.Range.create(se(k.expression.firstToken.prevToken),se(k.expression.firstToken,!1)),`
|
|
309
309
|
${Ar(r,a,qn(i,q))}`),...O?[qt.TextEdit.replace(qt.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 ri=L(U());async function nv(t,e,n,r,i,s){let o=r.split(`
|
|
310
|
-
`),a=mr(e,o),c=r,l=await tV(t,o,e,n,s),u=gr(a,t,l);switch(c=Jn(
|
|
311
|
-
`),a=mr(e,o),c=r,l=await lV(e,s),u=gr(a,t,l);switch(c=Jn(
|
|
312
|
-
`),a=mr(e,o),c=r,l=await uV(e,s),u=gr(a,t,l);switch(c=Jn(
|
|
313
|
-
`),c=mr(e,a),l=e.flatMap(d=>d instanceof we?E0(t,d,n,s,o,a,c):[]),u=Jn(
|
|
310
|
+
`),a=mr(e,o),c=r,l=await tV(t,o,e,n,s),u=gr(a,t,l);switch(c=Jn(xt.create(n,"devicetree",0,r),u),i){case"New Text":return c;case"File Diagnostics":return u}}async function tV(t,e,n,r,i){let s=Ma(n,r);return(await Promise.all(n.flatMap(async a=>await k0(t,e,a,r,s,i)))).flat()}var k0=async(t,e,n,r,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 n instanceof we?nV(t,e,n,r,o,s,i):n instanceof Ne?rV(n,o,u,e,l):[]},nV=async(t,e,n,r,i,s,o)=>{let a=[];return a.push(...(await Promise.all(n.children.flatMap(c=>k0(t,e,c,r,o,s,i+1)))).flat()),a},rV=(t,e,n,r,i)=>t.firstToken.pos.line===t.lastToken.pos.line?[]:t.values?iV(t.propertyName?.name.length??0,t.values,e,n,r,i):[],iV=(t,e,n,r,i,s)=>e.values.flatMap(o=>o?sV(t,o,n,r,i,s):[]),sV=(t,e,n,r,i,s)=>{let o=e.value;return o instanceof ct?aV(e,t,o,n,r,i,s)??[]:o instanceof zt?rh(e,t,o,r,i,s,n):[]},rh=(t,e,n,r,i,s,o)=>{let a=po(t,n,r,i,o,e+4);return n.params.flatMap(c=>oV(c,r,i,s,o,a+n.functionName.name.length+1))},oV=(t,e,n,r,i,s)=>{if(!t)return[];let o=t.firstToken.value==="\\"?t.firstToken.nextToken:t.firstToken;if(!o||o.pos.line===o.prevToken?.pos.line)return[];let a=n[o?.pos.line].slice(0,o.pos.col),c=Ar(i,r,qn(e,s));if(a===c)return[];let l=ri.Position.create(o.pos.line,0),u=ri.Position.create(o.pos.line,o.pos.col),d=ri.Range.create(l,u),f=ri.TextEdit.replace(d,c);return[Ve(5,t.fsPath,l,{edit:f,codeActionTitle:"Fix indentation",templateStrings:[c.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},u)]},aV=(t,e,n,r,i,s,o)=>{for(let[a,c]of n.values.entries()){if(c.value instanceof rn){let u=new Map;return c.value.allDescendants.forEach(f=>{f instanceof me&&!(f.parentNode instanceof zt)&&u.set(f.firstToken,f)}),Array.from(u.values()).flatMap(f=>cV(t,e,f,i,s,o,r))}if(c.value instanceof zt)return rh(t,e,c.value,i,s,o,r)}return[]},cV=(t,e,n,r,i,s,o)=>{if(n.firstToken.pos.line===n.firstToken.prevToken?.pos.line)return n instanceof zt?rh(t,e,n,r,i,s,o):[];let a=po(t,n,r,i,o,e+4);if(!a)return[];let c=Ar(o,s,qn(r,a));if(i[n.firstToken.pos.line].slice(0,n.firstToken.pos.col)===c)return n instanceof zt?rh(t,e,n,r,i,s,o):[];let u=ri.Position.create(n.firstToken.pos.line,0),d=ri.Position.create(n.firstToken.pos.line,n.firstToken.pos.col),f=ri.Range.create(u,d),p=ri.TextEdit.replace(f,c);return[Ve(5,n.fsPath,u,{edit:p,codeActionTitle:"Fix indentation",templateStrings:[c.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},d)]};var N0=L(U());async function rv(t,e,n,r,i,s){let o=r.split(`
|
|
311
|
+
`),a=mr(e,o),c=r,l=await lV(e,s),u=gr(a,t,l);switch(c=Jn(xt.create(n,"devicetree",0,r),u),i){case"New Text":return c;case"File Diagnostics":return u}}async function lV(t,e){return(await Promise.all(t.flatMap(n=>[n,...n.allDescendants]).flatMap(async n=>{if(e.removeEmptyReferences&&n instanceof ut&&!n.labels.length&&n.openScope?.nextToken===n.closeScope||e.removeEmptyNodes&&n instanceof Ee&&!n.labels.length&&n.openScope?.nextToken===n.closeScope||e.removeEmptyRoots&&n instanceof nt&&n.openScope?.nextToken===n.closeScope){let r=n.topComment?.firstToken??n.firstToken,i=n.endComment?.lastToken??n.lastToken;return r.prevToken?.prevToken&&(r.prevToken.prevToken.nextToken=void 0),i.nextToken&&(i.nextToken=void 0),[Ve(13,n.fsPath,se(r,!1),{edit:N0.TextEdit.del(on(r.prevToken,i,!r.prevToken)),codeActionTitle:"Delete node"},se(i))]}}))).flat().filter(n=>!!n)}var iv=L(U());async function sv(t,e,n,r,i,s){let o=r.split(`
|
|
312
|
+
`),a=mr(e,o),c=r,l=await uV(e,s),u=gr(a,t,l);switch(c=Jn(xt.create(n,"devicetree",0,r),u),i){case"New Text":return c;case"File Diagnostics":return u}}async function uV(t,e){return(await Promise.all(t.flatMap(n=>[n,...n.allDescendants]).flatMap(async n=>{if(e.removeEmptyReferences&&n instanceof we){let r=new Map;return n.children.forEach((i,s)=>{if(i instanceof Ne){let o=i.propertyName.name,a=r.get(o);a||(a=[],r.set(o,a));let c;for(let l=s+1;l<n.children.length;l++){let u=n.children[l];if(u instanceof Ne&&u.propertyName.name===o)break;if(u instanceof lt){c=u;break}}a.push({property:i,delete:c})}}),Array.from(r.values()).flatMap(i=>{if(i.length>1)return i.slice(0,-1).flatMap(s=>{let o=s.property.topComment?.firstToken??s.property.firstToken,a=s.property.endComment?.lastToken??s.property.lastToken,c=[];if(c.push(iv.TextEdit.del(on(o.prevToken,a,!o.prevToken))),s.delete){let l=s.delete.firstToken,u=s.delete.lastToken;c.push(iv.TextEdit.del(on(l.prevToken,u,!l.prevToken)))}return Ve(14,s.property.fsPath,se(o,!1),{edit:c,codeActionTitle:"Delete property"},se(a))})})}}))).flat().filter(n=>!!n)}async function ih(t,e,n,r,i,s,o){let a=r.split(`
|
|
313
|
+
`),c=mr(e,a),l=e.flatMap(d=>d instanceof we?E0(t,d,n,s,o,a,c):[]),u=Jn(xt.create(n,"devicetree",0,r),gr(c,t,l));if(l.flatMap(d=>d.raw.edit).filter(d=>!!d).length){let d=new Cr(n,[],void 0,()=>new er(u,n).tokens,!0);switch(await d.stable,i){case"New Text":return ih(t,d.allAstItems,n,u,"New Text",d.includes,d.cPreprocessorParser.allAstItems.filter(f=>f instanceof Er));case"File Diagnostics":return l}}switch(i){case"New Text":return u;case"File Diagnostics":return l}}function E0(t,e,n,r,i,s,o){if(i.some(f=>Qt(e,n,pt.create(f.firstToken.pos.line,f.firstToken.pos.col))||Qt(e,n,pt.create(f.lastToken.pos.line,f.lastToken.pos.colEnd))))return[];let a=[{prop:[],nodes:[],asFound:[]}],c=[],l=r.filter(f=>Qt(e,n,pt.create(f.firstToken.pos.line,f.firstToken.pos.col)));e.children.forEach(f=>{let p=l.filter(m=>gs(f.firstToken,n,pt.create(m.firstToken.pos.line,m.firstToken.pos.col)));p.length!==l.length&&l.length&&(a.push({prop:[],nodes:[],asFound:[]}),l=p),f instanceof Ne?(a.at(-1)?.prop.push(f),a.at(-1)?.asFound.push(f)):f instanceof Ee?(a.at(-1)?.nodes.push(f),a.at(-1)?.asFound.push(f)):f instanceof hn&&a.push({prop:[],nodes:[],asFound:[]})});let u=f=>({start:f.topComment??f,end:f.endComment??f}),d=eh(t.options);return a.forEach(f=>{let p=[...f.prop].sort((R,q)=>dV(R,q,d.sortPropertiesAlphabetically)),m=d.sortNodesNodesBy?[...f.nodes].sort((R,q)=>d.sortNodesNodesBy==="name"?R.name?.value.localeCompare(q.name?.value??"")??0:d.sortNodesNodesBy==="address"?Lt(R.name?.address?.at(0)?.address??[0],q.name?.address?.at(0)?.address??[0]):0):[...f.nodes],h=[...p,...m];if(!h.length||h.every((R,q)=>!h.at(q+1)||gs(R.lastToken,n,pt.create(h.at(q+1).firstToken.pos.line,h.at(q+1).firstToken.pos.col))))return;let{start:y}=u(f.asFound[0]),S=pt.create(y.firstToken.prevToken?.pos.line??y.firstToken.pos.line,y.firstToken.prevToken?.pos.colEnd??y.firstToken.pos.col),b=h.map(R=>{let{start:q,end:O}=u(R),B=q.firstToken.prevToken?.pos.line??q.firstToken.pos.line,Pe=q.firstToken.prevToken?.pos.colEnd??q.firstToken.pos.col,Qe=O.lastToken.pos.line,Et=O.lastToken?.pos.colEnd,ke=B===Qe,dn="";if(ke)dn=s[B].slice(Pe,Et);else{let Sn=s.slice(B,Qe+1);Sn[0]=Sn[0].slice(Pe),Sn[Sn.length-1]=Sn[Sn.length-1].slice(0,Et),dn=Sn.join(`
|
|
314
314
|
`)}return{delete:Si.del(et.create(pt.create(B,Pe),pt.create(Qe,Et))),insert:Si.insert(S,dn),item:R,text:dn}}),v=o.length?b.filter(R=>!Tl(R.delete.range.start,o)&&!Tl(R.delete.range.end,o)):b,k=e instanceof ut?e.reference:e instanceof Ee||e instanceof nt?e.name:void 0;v.length&&c.push(Ve(15,n,se(k?.firstToken??e.firstToken,!1),{edit:b.length===v.length?[...v.map(R=>R.delete),Si.insert(S,v.map(R=>R.text).join(""))]:[],codeActionTitle:`Sort child items. Expected order: ${h.map(R=>R instanceof Ne?`${R.propertyName.name}`:`${R.path?.at(-1)} { ... };`).join(", ")}`},se(k?.lastToken??e.openScope??e.firstToken)))}),c.length?c:e.children.flatMap(f=>f instanceof we?E0(t,f,n,r,i,s,o):[])}var R0={compatible:0,reg:1,ranges:2,status:99};function w0(t){return R0.hasOwnProperty(t)?R0[t]:t.includes(",")?4:3}function dV(t,e,n){let r=w0(t.propertyName?.name??""),i=w0(e.propertyName?.name??"");return r!==i?r-i:n?t.propertyName.name.localeCompare(e.propertyName.name):0}var C0=(t,e,n)=>!!t.split(`
|
|
315
|
-
`).find(r=>r.replace(/^\s+/,i=>i.replace(/\t/g," ".repeat(e))).trimEnd().length>n);async function wi(t,e,n,r,i=[],s=[]){let o=_e(t.textDocument.uri);r??=new er(e,o).tokens;let a=[...r],c=new Cr(o,[],void 0,()=>r,!0);await c.stable,t.options.tabSize??=8,t.options.insertSpaces??=!1;let l=c.issues.filter(m=>co(m.raw,o,!1));if(l?.length)throw new ee.ResponseError(ee.ErrorCodes.InternalError,"Unable to format. File has syntax issues.",l.map(m=>m.diagnostic()));let u=typeof t.options.wordWrapColumn=="number"?t.options.wordWrapColumn:100,d=[];if(n==="File Diagnostics")d=await D0({...t,options:{...t.options,wordWrapColumn:u}},c,i,s,a,e);else if(n==="New Text"){let m=[{removeMacroMultiline:!0,removeEmptyReferences:!0,removeDuplicateProperties:!0,baseFormattingRules:!1,wrapLongLines:!1,indentExpressions:!1},{baseFormattingRules:!0,wrapLongLines:!1,indentExpressions:!1,removeMacroMultiline:!1,removeEmptyReferences:!1,removeEmptyNodes:!1,removeEmptyRoots:!1,removeDuplicateProperties:!1},{wrapLongLines:!0,indentExpressions:!1,baseFormattingRules:!1,removeMacroMultiline:!1,removeEmptyReferences:!1,removeEmptyNodes:!1,removeEmptyRoots:!1,removeDuplicateProperties:!1},{indentExpressions:!0,wrapLongLines:!1,baseFormattingRules:!1,removeMacroMultiline:!1,removeEmptyReferences:!1,removeEmptyNodes:!1,removeEmptyRoots:!1,removeDuplicateProperties:!1}],h=
|
|
316
|
-
`),o=[],a=new Set;Array.from(r.cPreprocessorParser.macros.values()).filter(d=>d.macro.firstToken.pos.line!==d.macro.lastToken.pos.line).forEach(d=>{Array.from({length:d.macro.lastToken.pos.line-d.macro.firstToken.pos.line+1},(f,p)=>d.macro.firstToken.pos.line+p).forEach(f=>a.add(f))}),s.forEach((d,f)=>{if(d.trimEnd().endsWith("\\")&&!a.has(f)){let p=d.slice(0,d.lastIndexOf("\\")-1).trimEnd(),m=ee.Range.create(ee.Position.create(f,p.length),ee.Position.create(f,d.length));o.push(Ve(12,e,m.start,{edit:ee.TextEdit.del(m),codeActionTitle:"Remove \\"},m.end))}});let c=mr(r.allAstItems,s),l=gr(c,t,o),u=Jn(
|
|
317
|
-
`),u=mr(e,l),d=s;c.push(...await fV(t,e,n,r,i,l,a));let f=gr(u,t,c);switch(d=Jn(
|
|
315
|
+
`).find(r=>r.replace(/^\s+/,i=>i.replace(/\t/g," ".repeat(e))).trimEnd().length>n);async function wi(t,e,n,r,i=[],s=[]){let o=_e(t.textDocument.uri);r??=new er(e,o).tokens;let a=[...r],c=new Cr(o,[],void 0,()=>r,!0);await c.stable,t.options.tabSize??=8,t.options.insertSpaces??=!1;let l=c.issues.filter(m=>co(m.raw,o,!1));if(l?.length)throw new ee.ResponseError(ee.ErrorCodes.InternalError,"Unable to format. File has syntax issues.",l.map(m=>m.diagnostic()));let u=typeof t.options.wordWrapColumn=="number"?t.options.wordWrapColumn:100,d=[];if(n==="File Diagnostics")d=await D0({...t,options:{...t.options,wordWrapColumn:u}},c,i,s,a,e);else if(n==="New Text"){let m=[{removeMacroMultiline:!0,removeEmptyReferences:!0,removeDuplicateProperties:!0,baseFormattingRules:!1,wrapLongLines:!1,indentExpressions:!1},{baseFormattingRules:!0,wrapLongLines:!1,indentExpressions:!1,removeMacroMultiline:!1,removeEmptyReferences:!1,removeEmptyNodes:!1,removeEmptyRoots:!1,removeDuplicateProperties:!1},{wrapLongLines:!0,indentExpressions:!1,baseFormattingRules:!1,removeMacroMultiline:!1,removeEmptyReferences:!1,removeEmptyNodes:!1,removeEmptyRoots:!1,removeDuplicateProperties:!1},{indentExpressions:!0,wrapLongLines:!1,baseFormattingRules:!1,removeMacroMultiline:!1,removeEmptyReferences:!1,removeEmptyNodes:!1,removeEmptyRoots:!1,removeDuplicateProperties:!1}],h=xt.create(o,"devicetree",0,e);for(let y of m){let S=await D0({...t,options:{wordWrapColumn:u,...t.options,...y}},c,i,s,a,e);if(!S.length)continue;let b=Jn(h,S);return wi(t,b,n)}}let f=eh(t.options);if(n==="New Text"){let m=e;if(f.removeMacroMultiline&&(m=await A0({...t,options:{...t.options,wordWrapColumn:u}},o,e,c,n)),f.removeDuplicateProperties){let h="";do{h=m;let y=await Oa(o,e,h)??c.allAstItems;m=await sv({...t,options:{...t.options,wordWrapColumn:u}},y,o,m,n,f)}while(m!==h)}if(f.sortNodesAndProperties){let h="";do{h=m;let y=await ev(o,e,h)??c;m=await ih({...t,options:{...t.options,wordWrapColumn:u}},y.allAstItems,o,m,n,y.includes,i)}while(m!==h)}if(f.removeEmptyReferences||f.removeEmptyRoots||f.removeEmptyNodes){let h="";do{h=m;let y=await Oa(o,e,h)??c.allAstItems;m=await rv({...t,options:{...t.options,wordWrapColumn:u}},y,o,m,n,f)}while(m!==h)}if(f.baseFormattingRules){let h=await Oa(o,e,m)??c.allAstItems,y=await I0({...t,options:{...t.options,wordWrapColumn:u}},h,c.includes,i,o,m,n,f,d);d=[],m=y}if(f.indentExpressions){let h=await Oa(o,e,m)??c.allAstItems;m=await nv({...t,options:{...t.options,wordWrapColumn:u}},h,o,m,n,f)}if(f.wrapLongLines&&C0(m,t.options.tabSize,u)){let h="";do{h=m;let y=await Oa(o,e,h)??c.allAstItems;m=await tv({...t,options:{...t.options,wordWrapColumn:u}},y,o,h,"New Text",f,[...d])}while(h!==m)}return m}let p=[];if(f.removeMacroMultiline){let m=await A0({...t,options:{...t.options,wordWrapColumn:u}},o,e,c,n);p.push(...m)}if(f.removeDuplicateProperties){let m=await sv({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,o,e,n,f);p.push(...m)}if(f.sortNodesAndProperties){let m=await ih({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,o,e,n,c.includes,i);p.push(...m)}if(f.removeEmptyReferences||f.removeEmptyRoots||f.removeEmptyNodes){let m=await rv({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,o,e,n,f);p.push(...m)}if(f.baseFormattingRules){let m=await I0({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,c.includes,i,o,e,n,f,[...d]);p.push(...m)}if(f.indentExpressions){let m=await nv({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,o,e,n,f);p.push(...m)}return f.wrapLongLines&&C0(e,t.options.tabSize,u)&&p.push(...await tv({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,o,e,n,f,[...d])),p.filter(m=>!m.raw.virtual)}var D0=async(t,e,n,r,i,s)=>{let o=e.cPreprocessorParser.allAstItems.filter(u=>u instanceof Er),a=[...o.flatMap(u=>{let d=u.ifBlocks.find(p=>p.active),f=u.ifBlocks.filter(p=>!p.active).map(p=>({block:u,branch:p}));return d&&u.elseOption&&f.push({block:u,branch:u.elseOption}),f})];"range"in t?(a=a.filter(u=>ao(t.range,u.block.range)),n.push(...o.filter(u=>ao(t.range,u.range)))):n.push(...o);let c=u=>{let d=u.block.getInValidTokenRangeWhenActiveBlock(u.branch),f=i.filter(m=>!d.has(m)),p=u.block.range;return r.push(u.branch),wi({...t,range:p,options:{...t.options,sortNodesAndProperties:!1}},s,"File Diagnostics",f,n,r)},l=[];return await a.reduce((u,d)=>u.then(async()=>{l.push(...await c(d))}),Promise.resolve()),l};async function A0(t,e,n,r,i){let s=n.split(`
|
|
316
|
+
`),o=[],a=new Set;Array.from(r.cPreprocessorParser.macros.values()).filter(d=>d.macro.firstToken.pos.line!==d.macro.lastToken.pos.line).forEach(d=>{Array.from({length:d.macro.lastToken.pos.line-d.macro.firstToken.pos.line+1},(f,p)=>d.macro.firstToken.pos.line+p).forEach(f=>a.add(f))}),s.forEach((d,f)=>{if(d.trimEnd().endsWith("\\")&&!a.has(f)){let p=d.slice(0,d.lastIndexOf("\\")-1).trimEnd(),m=ee.Range.create(ee.Position.create(f,p.length),ee.Position.create(f,d.length));o.push(Ve(12,e,m.start,{edit:ee.TextEdit.del(m),codeActionTitle:"Remove \\"},m.end))}});let c=mr(r.allAstItems,s),l=gr(c,t,o),u=Jn(xt.create(e,"devicetree",0,n),l);switch(i){case"New Text":return u;case"File Diagnostics":return o}}async function I0(t,e,n,r,i,s,o,a,c=[]){let l=s.split(`
|
|
317
|
+
`),u=mr(e,l),d=s;c.push(...await fV(t,e,n,r,i,l,a));let f=gr(u,t,c);switch(d=Jn(xt.create(i,"devicetree",0,s),f),o){case"New Text":return d;case"File Diagnostics":return f}}async function fV(t,e,n,r,i,s,o){let a=Ma(e,i),c=(await Promise.all(e.flatMap(async u=>await x0(t,u,i,a,s,n,r,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),`
|
|
318
318
|
`);c.push(Ve(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(Ve(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=pV(s,l,i);c.push(...u)}return c}var pV=(t,e,n)=>{let r=[];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=>RE(c,l.range))||r.push(Ve(2,n,c.start,{edit:ee.TextEdit.del(c),codeActionTitle:"Remove whitespace"},c.end))}}),r},oh=(t,e=1,n=!1,r=t.prevToken)=>{if(r){let i=t.pos.line-r.pos.line,s=i-e;if(s&&(i!==2&&e!==0||e===0||n)){let o=ee.Position.create(r.pos.line,r.pos.colEnd),a=ee.Position.create(t.pos.line,e?0:t.pos.col),c=ee.TextEdit.replace(ee.Range.create(o,a),`
|
|
319
319
|
`.repeat(e));return Ve(1,t.fsPath,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 Ve(1,t.fsPath,i,{edit:o,codeActionTitle:"Remove unnecessary new lines",templateStrings:["0"]},s)}},O0=(t,e,n,r="",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),`${`
|
|
320
|
-
`.repeat(i)}${"".padStart(e*n.length,n)}${r}`);return Ve(0,t.fsPath,o,{edit:c,codeActionTitle:"Move to new line"},a)}},av=(t,e,n,r,i="")=>{let s=Ar(e,n,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=wV(r,c);if(s===l)return[];let u=ee.TextEdit.replace(c,s);return[Ve(5,t.fsPath,o,{edit:u,codeActionTitle:"Fix indentation",templateStrings:[s.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},a)]},wt=(t,e,n=1,r=!1)=>{if(!t.nextToken)return[];if(t.nextToken?.pos.line!==t.pos.line){if(r)return[];let c=oh(t.nextToken,0);if(!c)throw new Error("remove new LinesEdit must be defined");return n&&(c.raw.edit.newText=`${" ".repeat(n)}${c.raw.edit.newText}`),[c]}if(n===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[Ve(1,t.fsPath,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(n));return[Ve(1,t.fsPath,c,{edit:l,codeActionTitle:"Insert Space(s)",templateStrings:[n.toString()]})]}let i=t.nextToken.pos.col-t.pos.colEnd;if(i===n&&e[t.pos.line].slice(t.pos.colEnd,t.nextToken.pos.col)===" ".repeat(n))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(n));return[Ve(1,t.fsPath,s,{edit:a,codeActionTitle:i>n?"Remove space(s)":"Insert space(s)",templateStrings:[n.toString()]},o)]},vl=(t,e,n,r,i)=>t.slice(1).flatMap(s=>i&&s.firstToken.prevToken||s.firstToken.pos.line===s.firstToken.prevToken?.pos.line?wt(s.firstToken.prevToken,e):$n(s.firstToken,n,r,e,void 0,1,!0)),hV=async(t,e,n,r,i,s,o,a,c,l)=>{let u=[],d=e.topComment||e.firstToken.prevToken?.value==="{"&&!e.topComment?1:cv(e.firstToken,r);if(u.push(...$n(e.firstToken,s,o,c,void 0,d,!0)),e instanceof Ee||e instanceof ut)if(u.push(...vl(e.labels,c,s,o,!1)),e instanceof Ee){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(),y=h.match(/^(?:0x)?([0-9a-f]+)(?:ull)?$/i)?.at(1),S=[];h.startsWith("0x")&&S.push(10),h.endsWith("ull")&&S.push(11),y!==m&&S.push(9),y&&S.length&&u.push(Ve(S,p.fsPath,se(p.firstToken,!1),{edit:ee.TextEdit.replace(ce(p),y),codeActionTitle:`Change to '${y}'`},se(p.lastToken)))}),e.labels.length&&e.name&&(e.name.firstToken.pos.line!==e.name.firstToken.prevToken?.pos.line?u.push(...$n(e.name.firstToken,s,o,c,void 0,1,!0)):u.push(...wt(e.name.firstToken.prevToken,c)));let f=e.name&&e.openScope?wt(e.name.lastToken,c):[];u.push(...f)}else{e.labels.length&&e.reference?.firstToken.prevToken&&u.push(...wt(e.reference.firstToken.prevToken,c));let f=e.reference&&e.openScope?wt(e.reference.lastToken,c):[];u.push(...f)}else e instanceof nt&&e.firstToken.value==="/"&&e.openScope&&u.push(...wt(e.firstToken,c,1));return u.push(...(await Promise.all(e.children.flatMap(f=>x0(t,f,i,l,c,n,r,a,s+1)))).flat()),e.closeScope&&(e.openScope&&e.closeScope.prevToken===e.openScope?u.push(...wt(e.openScope,c,0)):u.push(...$n(e.closeScope,s,o,c,void 0,1,!0))),e.lastToken.value===";"&&e.closeScope&&u.push(...ah(e.closeScope,e.lastToken)),u},mV=(t,e,n,r,i,s,o)=>{let a=[];if(a.push(...vl(e.labels,o,n,r.singleIndent,!0)),e.labels.length&&e.value?.firstToken.prevToken&&a.push(...wt(e.value.firstToken.prevToken,o)),e.value instanceof sn){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(Ve(9,e.value.fsPath,se(e.value.firstToken,!1),{edit:ee.TextEdit.replace(ce(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=oh(e.firstToken,1,!0);c&&a.push(c),a.push(...av(e.firstToken,n,r.singleIndent,o,qn(r,t+4)))}else a.push(...wt(e.firstToken.prevToken,o,s&&e.firstToken.prevToken===s?0:1));return e.value instanceof me&&a.push(...sh(e.value,o,n,r,i,t+4)),a},gV=(t,e,n,r,i,s)=>{let o=[];return e instanceof ct||e instanceof Mn?e.openBracket&&e.openBracket?.nextToken===e.closeBracket?o.push(...wt(e.openBracket,s,0)):(o.push(...e.values.flatMap(a=>mV(t,a,n,r,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(...wt(e.closeBracket.prevToken,s,0)):o.push(...$n(e.closeBracket,n,r.singleIndent,s,qn(r,t+3),1,!0)))):e instanceof me&&o.push(...sh(e,s,n,r,i,t)),o},sh=(t,e,n,r,i,s)=>t instanceof Wt?yV(t,e):t instanceof rn?TV(t,e,n,r,i,s):[],yV=(t,e)=>{let n=[];return n.push(...wt(t.functionName.lastToken,e,0)),t.lastToken.value===")"&&t.lastToken.prevToken&&n.push(...wt(t.lastToken.prevToken,e,0)),n},TV=(t,e,n,r,i,s)=>{let o=[];if(t.openBracket&&t.openBracket.nextToken&&o.push(...wt(t.openBracket,e,0)),o.push(...sh(t.expression,e,n,r,i,s)),t.join?.forEach(a=>{a.operator.firstToken.prevToken&&o.push(...wt(a.operator.firstToken.prevToken,e)),a.expression.firstToken.prevToken?.pos.line===a.expression.firstToken.pos.line?o.push(...wt(a.expression.firstToken.prevToken,e)):o.push(...$n(a.expression.firstToken,n,r.singleIndent,e,qn(r,s),void 0,void 0,!i.indentExpressions)),o.push(...sh(a.expression,e,n,r,i,s))}),!t.join?.length&&!(t.expression instanceof rn)&&(t.expression instanceof Wt||t.expression instanceof Tt)){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(Ve(7,t.fsPath,a[0].range.start,{edit:a,codeActionTitle:"Remove (...)"},a[a.length-1].range.end))}return t.closeBracket&&t.closeBracket.prevToken&&o.push(...wt(t.closeBracket.prevToken,e,0)),o},vV=(t,e,n,r,i,s)=>{let o=[];return o.push(...vl(e.startLabels,s,n,r.singleIndent,!0)),o.push(...gV(t,e.value,n,r,i,s)),o.push(...vl(e.endLabels,s,n,r.singleIndent,!0)),o},bV=(t,e,n,r,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=O0(c.firstToken,n,r.singleIndent,qn(r,t+3));f&&a.push(f)}else a.push(...wt(u,s,1));else if(o&&c.firstToken.prevToken===o)a.push(...wt(o,s));else{let f=oh(c.firstToken,1,!0);f&&a.push(f),a.push(...av(c.firstToken,n,r.singleIndent,s,qn(r,t+3)))}a.push(...vV(t,c,n,r,i,s)),c.nextValueSeparator&&a.push(...ah(c.lastToken,c.nextValueSeparator))}),a},SV=(t,e,n,r,i)=>{let s=[],{force:o,newLines:a}=M0(t,t.firstToken);return s.push(...$n(t.firstToken,e,n.singleIndent,i,void 0,a,o)),s.push(...vl(t.labels,i,e,n.singleIndent,!0)),t.labels.length&&t.propertyName?.firstToken.prevToken&&s.push(...wt(t.propertyName.firstToken.prevToken,i)),t.values&&(t.propertyName&&s.push(...wt(t.propertyName?.lastToken,i)),s.push(...bV(t.propertyName?.name.length??0,t.values,e,n,r,i,t.assignOperatorToken))),t.lastToken.value===";"&&s.push(...ah(t.children[t.children.length-1].lastToken,t.lastToken)),s},$n=(t,e,n,r,i,s,o,a=!0)=>{let c=[],l=O0(t,e,n,i,s);if(l)c.push(l);else{let u=oh(t,s,o);u&&c.push(u),a&&c.push(...av(t,e,n,r,i))}return c},ah=(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[Ve(1,t.fsPath,s,{edit:a,codeActionTitle:"Remove white space",templateStrings:["0"]},o)]}let n=ee.Position.create(t.pos.line,t.pos.colEnd),r=ee.Position.create(e.pos.line,e.pos.colEnd),i=[ee.TextEdit.insert(n,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),r))];return[Ve(6,t.fsPath,n,{edit:i,codeActionTitle:"Move token",templateStrings:[e.value]},r)]},_V=(t,e,n,r)=>{let i=[];i.push(...$n(t.firstToken,e,n,r));let s=wt(t.keyword.lastToken,r);return i.push(...s),t.lastToken.value===";"&&i.push(...ah(t.children[t.children.length-1].lastToken,t.lastToken)),i},PV=(t,e,n,r)=>{if(!fe(t.fsPath,e))return[];let i=[];i.push(...$n(t.firstToken,0,n,r));let s=wt(t.keyword.lastToken,r);return i.push(...s),i},kV=(t,e,n,r,i,s)=>t.comments.length===1&&t.firstToken.pos.line===t.firstToken.prevToken?.pos.line?[]:t.comments.flatMap((o,a)=>NV(o,t,e,n,r,i,a?a===t.comments.length-1?"last":"comment":"first",s)),ov=(t,e,n="")=>{let r=e?RT(e):void 0;if(!r)return n;let i=lo(e),s=r.propertyName?.name.length??0;return`${`${qn(t,s+(i?4:3)+(n.length-n.trimStart().length))}`}${n.trimStart()}`},cv=(t,e)=>{let n=e.flatMap(r=>[...r.ifBlocks.map(i=>i.expression?.lastToken.nextToken),r.elseOption?.lastToken.nextToken]).some(r=>r===t);return t.prevToken?.value==="{"||n?1:2},M0=(t,e)=>{let n=t.parentNode instanceof we?t.parentNode:void 0,r=n?.children.indexOf(t)??-1;if(r===0&&n?.openScope===e.prevToken)return{newLines:1,force:!0};let i=r>0&&n?.children[r-1];return i instanceof we&&t.firstToken.prevToken===(i.endComment??i).lastToken?{newLines:2,force:!0}:{newLines:void 0,force:void 0}},NV=(t,e,n,r,i,s,o,a)=>{if(!t.firstToken.prevToken)return $n(t.firstToken,r?.level??0,i,s);if(t.firstToken.pos.line===t.firstToken.prevToken?.pos.line)return wt(t.firstToken.prevToken,s,1);if(r===void 0)return[];let c,l;if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof we)c=!0,l=cv(e.firstToken,n);else if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof Ne){let{force:m,newLines:h}=M0(e.astAfterComment,e.firstToken);c=m,l=h}let u=e.astAfterComment instanceof Zr?0:r.level,d=[],f="",p=t.toString();switch(o==="last"&&p.trim()!==""&&t.lastToken.prevToken&&(o="comment",d.push(...$n(t.lastToken.prevToken,u,i,s,ov(a,r?.inAst," ")))),o){case"comment":f=t.firstToken.value==="*"?" ":" * ";break;case"first":break;case"last":f=" ";break}return r?.inAst instanceof we?d.push(...$n(t.firstToken,u,i,s,f,l,c)):d.push(...$n(t.firstToken,u,i,s,ov(a,r?.inAst,f),l,c)),d},RV=(t,e,n,r,i,s)=>{if(!t.firstToken.prevToken)return $n(t.firstToken,n?.level??0,r,i);if(t.firstToken.pos.line===t.firstToken.prevToken.pos.line)return[];let a,c;return!t.astBeforeComment&&t.astAfterComment instanceof we&&(a=!0,c=cv(t.firstToken,e)),$n(t.firstToken,n?.level??0,r,i,ov(s,n?.inAst),c,a)},x0=async(t,e,n,r,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 we?hV(t,e,s,o,n,c,d,a,i,r):e instanceof Ne?SV(e,c,f,a,i):e instanceof hn?_V(e,c,d,i):e instanceof Zr?PV(e,n,d,i):e instanceof hr&&!e.disabled?RV(e,o,await r(e),d,i,f):e instanceof pr&&!e.disabled?kV(e,o,await r(e),d,i,f):[]};function wV(t,e){let n=t[e.start.line],r=t[e.end.line];if(e.start.line===e.end.line)return n.substring(e.start.character,e.end.character);let i=t.slice(e.start.line+1,e.end.line);return[n.substring(e.start.character),...i,r.substring(0,e.end.character)].join(`
|
|
320
|
+
`.repeat(i)}${"".padStart(e*n.length,n)}${r}`);return Ve(0,t.fsPath,o,{edit:c,codeActionTitle:"Move to new line"},a)}},av=(t,e,n,r,i="")=>{let s=Ar(e,n,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=wV(r,c);if(s===l)return[];let u=ee.TextEdit.replace(c,s);return[Ve(5,t.fsPath,o,{edit:u,codeActionTitle:"Fix indentation",templateStrings:[s.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},a)]},wt=(t,e,n=1,r=!1)=>{if(!t.nextToken)return[];if(t.nextToken?.pos.line!==t.pos.line){if(r)return[];let c=oh(t.nextToken,0);if(!c)throw new Error("remove new LinesEdit must be defined");return n&&(c.raw.edit.newText=`${" ".repeat(n)}${c.raw.edit.newText}`),[c]}if(n===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[Ve(1,t.fsPath,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(n));return[Ve(1,t.fsPath,c,{edit:l,codeActionTitle:"Insert Space(s)",templateStrings:[n.toString()]})]}let i=t.nextToken.pos.col-t.pos.colEnd;if(i===n&&e[t.pos.line].slice(t.pos.colEnd,t.nextToken.pos.col)===" ".repeat(n))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(n));return[Ve(1,t.fsPath,s,{edit:a,codeActionTitle:i>n?"Remove space(s)":"Insert space(s)",templateStrings:[n.toString()]},o)]},vl=(t,e,n,r,i)=>t.slice(1).flatMap(s=>i&&s.firstToken.prevToken||s.firstToken.pos.line===s.firstToken.prevToken?.pos.line?wt(s.firstToken.prevToken,e):$n(s.firstToken,n,r,e,void 0,1,!0)),hV=async(t,e,n,r,i,s,o,a,c,l)=>{let u=[],d=e.topComment||e.firstToken.prevToken?.value==="{"&&!e.topComment?1:cv(e.firstToken,r);if(u.push(...$n(e.firstToken,s,o,c,void 0,d,!0)),e instanceof Ee||e instanceof ut)if(u.push(...vl(e.labels,c,s,o,!1)),e instanceof Ee){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(),y=h.match(/^(?:0x)?([0-9a-f]+)(?:ull)?$/i)?.at(1),S=[];h.startsWith("0x")&&S.push(10),h.endsWith("ull")&&S.push(11),y!==m&&S.push(9),y&&S.length&&u.push(Ve(S,p.fsPath,se(p.firstToken,!1),{edit:ee.TextEdit.replace(ce(p),y),codeActionTitle:`Change to '${y}'`},se(p.lastToken)))}),e.labels.length&&e.name&&(e.name.firstToken.pos.line!==e.name.firstToken.prevToken?.pos.line?u.push(...$n(e.name.firstToken,s,o,c,void 0,1,!0)):u.push(...wt(e.name.firstToken.prevToken,c)));let f=e.name&&e.openScope?wt(e.name.lastToken,c):[];u.push(...f)}else{e.labels.length&&e.reference?.firstToken.prevToken&&u.push(...wt(e.reference.firstToken.prevToken,c));let f=e.reference&&e.openScope?wt(e.reference.lastToken,c):[];u.push(...f)}else e instanceof nt&&e.firstToken.value==="/"&&e.openScope&&u.push(...wt(e.firstToken,c,1));return u.push(...(await Promise.all(e.children.flatMap(f=>x0(t,f,i,l,c,n,r,a,s+1)))).flat()),e.closeScope&&(e.openScope&&e.closeScope.prevToken===e.openScope?u.push(...wt(e.openScope,c,0)):u.push(...$n(e.closeScope,s,o,c,void 0,1,!0))),e.lastToken.value===";"&&e.closeScope&&u.push(...ah(e.closeScope,e.lastToken)),u},mV=(t,e,n,r,i,s,o)=>{let a=[];if(a.push(...vl(e.labels,o,n,r.singleIndent,!0)),e.labels.length&&e.value?.firstToken.prevToken&&a.push(...wt(e.value.firstToken.prevToken,o)),e.value instanceof sn){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(Ve(9,e.value.fsPath,se(e.value.firstToken,!1),{edit:ee.TextEdit.replace(ce(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=oh(e.firstToken,1,!0);c&&a.push(c),a.push(...av(e.firstToken,n,r.singleIndent,o,qn(r,t+4)))}else a.push(...wt(e.firstToken.prevToken,o,s&&e.firstToken.prevToken===s?0:1));return e.value instanceof me&&a.push(...sh(e.value,o,n,r,i,t+4)),a},gV=(t,e,n,r,i,s)=>{let o=[];return e instanceof ct||e instanceof Mn?e.openBracket&&e.openBracket?.nextToken===e.closeBracket?o.push(...wt(e.openBracket,s,0)):(o.push(...e.values.flatMap(a=>mV(t,a,n,r,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(...wt(e.closeBracket.prevToken,s,0)):o.push(...$n(e.closeBracket,n,r.singleIndent,s,qn(r,t+3),1,!0)))):e instanceof me&&o.push(...sh(e,s,n,r,i,t)),o},sh=(t,e,n,r,i,s)=>t instanceof zt?yV(t,e):t instanceof rn?TV(t,e,n,r,i,s):[],yV=(t,e)=>{let n=[];return n.push(...wt(t.functionName.lastToken,e,0)),t.lastToken.value===")"&&t.lastToken.prevToken&&n.push(...wt(t.lastToken.prevToken,e,0)),n},TV=(t,e,n,r,i,s)=>{let o=[];if(t.openBracket&&t.openBracket.nextToken&&o.push(...wt(t.openBracket,e,0)),o.push(...sh(t.expression,e,n,r,i,s)),t.join?.forEach(a=>{a.operator.firstToken.prevToken&&o.push(...wt(a.operator.firstToken.prevToken,e)),a.expression.firstToken.prevToken?.pos.line===a.expression.firstToken.pos.line?o.push(...wt(a.expression.firstToken.prevToken,e)):o.push(...$n(a.expression.firstToken,n,r.singleIndent,e,qn(r,s),void 0,void 0,!i.indentExpressions)),o.push(...sh(a.expression,e,n,r,i,s))}),!t.join?.length&&!(t.expression instanceof rn)&&(t.expression instanceof zt||t.expression instanceof Tt)){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(Ve(7,t.fsPath,a[0].range.start,{edit:a,codeActionTitle:"Remove (...)"},a[a.length-1].range.end))}return t.closeBracket&&t.closeBracket.prevToken&&o.push(...wt(t.closeBracket.prevToken,e,0)),o},vV=(t,e,n,r,i,s)=>{let o=[];return o.push(...vl(e.startLabels,s,n,r.singleIndent,!0)),o.push(...gV(t,e.value,n,r,i,s)),o.push(...vl(e.endLabels,s,n,r.singleIndent,!0)),o},bV=(t,e,n,r,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=O0(c.firstToken,n,r.singleIndent,qn(r,t+3));f&&a.push(f)}else a.push(...wt(u,s,1));else if(o&&c.firstToken.prevToken===o)a.push(...wt(o,s));else{let f=oh(c.firstToken,1,!0);f&&a.push(f),a.push(...av(c.firstToken,n,r.singleIndent,s,qn(r,t+3)))}a.push(...vV(t,c,n,r,i,s)),c.nextValueSeparator&&a.push(...ah(c.lastToken,c.nextValueSeparator))}),a},SV=(t,e,n,r,i)=>{let s=[],{force:o,newLines:a}=M0(t,t.firstToken);return s.push(...$n(t.firstToken,e,n.singleIndent,i,void 0,a,o)),s.push(...vl(t.labels,i,e,n.singleIndent,!0)),t.labels.length&&t.propertyName?.firstToken.prevToken&&s.push(...wt(t.propertyName.firstToken.prevToken,i)),t.values&&(t.propertyName&&s.push(...wt(t.propertyName?.lastToken,i)),s.push(...bV(t.propertyName?.name.length??0,t.values,e,n,r,i,t.assignOperatorToken))),t.lastToken.value===";"&&s.push(...ah(t.children[t.children.length-1].lastToken,t.lastToken)),s},$n=(t,e,n,r,i,s,o,a=!0)=>{let c=[],l=O0(t,e,n,i,s);if(l)c.push(l);else{let u=oh(t,s,o);u&&c.push(u),a&&c.push(...av(t,e,n,r,i))}return c},ah=(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[Ve(1,t.fsPath,s,{edit:a,codeActionTitle:"Remove white space",templateStrings:["0"]},o)]}let n=ee.Position.create(t.pos.line,t.pos.colEnd),r=ee.Position.create(e.pos.line,e.pos.colEnd),i=[ee.TextEdit.insert(n,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),r))];return[Ve(6,t.fsPath,n,{edit:i,codeActionTitle:"Move token",templateStrings:[e.value]},r)]},_V=(t,e,n,r)=>{let i=[];i.push(...$n(t.firstToken,e,n,r));let s=wt(t.keyword.lastToken,r);return i.push(...s),t.lastToken.value===";"&&i.push(...ah(t.children[t.children.length-1].lastToken,t.lastToken)),i},PV=(t,e,n,r)=>{if(!fe(t.fsPath,e))return[];let i=[];i.push(...$n(t.firstToken,0,n,r));let s=wt(t.keyword.lastToken,r);return i.push(...s),i},kV=(t,e,n,r,i,s)=>t.comments.length===1&&t.firstToken.pos.line===t.firstToken.prevToken?.pos.line?[]:t.comments.flatMap((o,a)=>NV(o,t,e,n,r,i,a?a===t.comments.length-1?"last":"comment":"first",s)),ov=(t,e,n="")=>{let r=e?RT(e):void 0;if(!r)return n;let i=lo(e),s=r.propertyName?.name.length??0;return`${`${qn(t,s+(i?4:3)+(n.length-n.trimStart().length))}`}${n.trimStart()}`},cv=(t,e)=>{let n=e.flatMap(r=>[...r.ifBlocks.map(i=>i.expression?.lastToken.nextToken),r.elseOption?.lastToken.nextToken]).some(r=>r===t);return t.prevToken?.value==="{"||n?1:2},M0=(t,e)=>{let n=t.parentNode instanceof we?t.parentNode:void 0,r=n?.children.indexOf(t)??-1;if(r===0&&n?.openScope===e.prevToken)return{newLines:1,force:!0};let i=r>0&&n?.children[r-1];return i instanceof we&&t.firstToken.prevToken===(i.endComment??i).lastToken?{newLines:2,force:!0}:{newLines:void 0,force:void 0}},NV=(t,e,n,r,i,s,o,a)=>{if(!t.firstToken.prevToken)return $n(t.firstToken,r?.level??0,i,s);if(t.firstToken.pos.line===t.firstToken.prevToken?.pos.line)return wt(t.firstToken.prevToken,s,1);if(r===void 0)return[];let c,l;if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof we)c=!0,l=cv(e.firstToken,n);else if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof Ne){let{force:m,newLines:h}=M0(e.astAfterComment,e.firstToken);c=m,l=h}let u=e.astAfterComment instanceof Zr?0:r.level,d=[],f="",p=t.toString();switch(o==="last"&&p.trim()!==""&&t.lastToken.prevToken&&(o="comment",d.push(...$n(t.lastToken.prevToken,u,i,s,ov(a,r?.inAst," ")))),o){case"comment":f=t.firstToken.value==="*"?" ":" * ";break;case"first":break;case"last":f=" ";break}return r?.inAst instanceof we?d.push(...$n(t.firstToken,u,i,s,f,l,c)):d.push(...$n(t.firstToken,u,i,s,ov(a,r?.inAst,f),l,c)),d},RV=(t,e,n,r,i,s)=>{if(!t.firstToken.prevToken)return $n(t.firstToken,n?.level??0,r,i);if(t.firstToken.pos.line===t.firstToken.prevToken.pos.line)return[];let a,c;return!t.astBeforeComment&&t.astAfterComment instanceof we&&(a=!0,c=cv(t.firstToken,e)),$n(t.firstToken,n?.level??0,r,i,ov(s,n?.inAst),c,a)},x0=async(t,e,n,r,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 we?hV(t,e,s,o,n,c,d,a,i,r):e instanceof Ne?SV(e,c,f,a,i):e instanceof hn?_V(e,c,d,i):e instanceof Zr?PV(e,n,d,i):e instanceof hr&&!e.disabled?RV(e,o,await r(e),d,i,f):e instanceof pr&&!e.disabled?kV(e,o,await r(e),d,i,f):[]};function wV(t,e){let n=t[e.start.line],r=t[e.end.line];if(e.start.line===e.end.line)return n.substring(e.start.character,e.end.character);let i=t.slice(e.start.line+1,e.end.line);return[n.substring(e.start.character),...i,r.substring(0,e.end.character)].join(`
|
|
321
321
|
`)}var lh=L(U());var ch=t=>!t||t instanceof Ne?!1:t instanceof xn||ch(t.parentNode);function EV(t){if(!t||!(t.item instanceof Je&&t.item.ast.assignOperatorToken))return[];let e=ch(t?.ast);if(!e&&!(t.ast instanceof Ne&&t.item.ast.values===null)&&!ch(t.beforeAst)&&!ch(t.afterAst))return[];let n=-1;if(t.item.ast.values===null?n=0:n=(t.item.ast.values?.values.findIndex(i=>i&&ET(i,t.beforeAst))??-1)+1,n===-1&&(n=0),t.item.name==="compatible"){let s=t.item.parent.nodeTypes.filter(c=>c).at(-1),o=t.item.ast.quickValues,a;return o?.some(c=>c)&&s instanceof St&&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=>{let l=[];if(t.runtime.context.settings.autoAddMissingPropertiesOnCompletion){let u=pa(t.ast);if(u&&t.item?.parent&&t.runtime.context.bindingLoader?.type==="Zephyr"){let d=t.item.parent,f=t.runtime.context.bindingLoader.getZephyrContextBinding()?.find(h=>h.compatible===c);Object.values(f?.properties??{}).filter(h=>h.required).filter(h=>t.item?.parent?.properties.every(y=>y.name!==h.name)).forEach(h=>{let y=Kc(h.type)[0],S=Vf(d,u,h.name,y,t.runtime);S&&l.push(S)})}}return{label:`"${c}"`,documentation:t.runtime.context.bindingLoader?.getBindingDocumentation(c),textEdit:lh.TextEdit.replace(t.ast.range,`"${c}"`),additionalTextEdits:l,kind:lh.CompletionItemKind.Variable,insertText:e?c:`"${c}"`}}))}let r=t.item.parent.nodeType;return r instanceof St?r.properties.find(i=>i.name===t.item?.name)?.getPropertyCompletionItems(t.item,n,e)??[]:[]}function CV(t){if(!t||!(t.item instanceof Je&&t.ast instanceof Xe&&t.item.ast.values==null||t.item instanceof X)||Zt(t.ast)||t.beforeAst?.parentNode instanceof hn)return[];let e=n=>n.nodeType?.getPropertyListCompletionItems(n)??[];return t.item instanceof Je?e(t.item.parent):e(t.item)}async function L0(t,e){return Rt(t,e,n=>[...EV(n),...CV(n)])}var uh=L(U());async function DV(t){if(t?.ast instanceof Tt||t?.ast instanceof vi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t?.ast instanceof Tt?t.ast.name:t.ast.value);if(e){let n=Gc(t.ast),r=(await t.runtime.context.getAllStableParsers()).at(-1);if(n){let i=n?.evaluate(r.cPreprocessorParser.macros);return{contents:{kind:uh.MarkupKind.Markdown,value:["```cpp",`#define ${e.macro.toString()} // = ${i}${typeof i=="number"?` (0x${i.toString(16)})`:""}`,"```"].join(`
|
|
322
322
|
`)},range:ce(t.ast)}}return{contents:{kind:uh.MarkupKind.Markdown,value:["```cpp",`#define ${e.macro.toString()} // = ${t.ast?.evaluate(r.cPreprocessorParser.macros)}`,"```"].join(`
|
|
323
323
|
`)},range:ce(t.ast)}}}}async function AV(t){if(!t)return;let e=(await t.runtime.context.getAllStableParsers()).at(-1);if(t?.ast instanceof $e){let n=t.ast.linksTo;if(n)return{contents:n.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}if(t?.ast.parentNode instanceof ie){let n=t.ast.parentNode.linksTo;if(n)return{contents:n.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}if(t?.ast instanceof re&&t.item instanceof Je&&t.item.parent.name==="aliases"){let n=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(n)return{contents:n.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}if(t?.item instanceof X)return{contents:t.item.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}function IV(t){if(t?.item instanceof Je&&t.ast instanceof Xe){let e=t.item.onHover(),n=t.item.parent.nodeType?.getOnPropertyHover(t.item.name);if(e||n)return{contents:{kind:uh.MarkupKind.Markdown,value:`${e?.value??""}
|
|
@@ -326,7 +326,7 @@ ${n?.value??""}`},range:ce(t.ast)}}}function q0(t,e){return Rt(t,e,async n=>[awa
|
|
|
326
326
|
${i.value}
|
|
327
327
|
`}).join(`
|
|
328
328
|
|
|
329
|
-
`)}}:{contents:{kind:_i.Markdown,value:`No node matched compat ${t.macro.args[0].macro}`}}}async function W0(t){let e=await Rp(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function z0(t,e){return!!await Pp(t,e)}async function G0({macro:t,context:e}){if(!(t.macro!=="DT_HAS_ALIAS"||t.args?.length!==1))return z0(t.args[0].macro,e)}async function Y0(t){let e=await G0(t);if(e!==void 0)return{contents:{kind:_i.Markdown,value:e?"1":"0"}}}var X0=L(U());async function bl(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 K0({document:t,macro:e,context:n,position:r},i){if(e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});switch(e.macro){case"DT_NODE_FULL_NAME":return bl(s,"Quoted");case"DT_NODE_FULL_NAME_TOKEN":return bl(s,"Token");case"DT_NODE_FULL_NAME_UNQUOTED":return bl(s,"Unquoted");case"DT_NODE_FULL_NAME_UPPER_TOKEN":return bl(s,"Upper Token")}}async function J0(t){let e=await K0(t,x);if(e)return{contents:{kind:X0.MarkupKind.Markdown,value:e}}}var eI=L(U());async function Q0(t){return t?.pathString}async function Z0({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_NODE_PATH"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});return Q0(s)}async function tI(t){let e=await Z0(t,x);if(e)return{contents:{kind:eI.MarkupKind.Markdown,value:`"${e}"`}}}async function nI(t){let e=await Ep(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var sI=L(U());async function rI(t){return t?.labels.map(e=>e.label)}async function iI({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_NODELABEL_STRING_ARRAY"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});return rI(s)}async function oI(t){let e=await iI(t,x);if(e)return{contents:{kind:sI.MarkupKind.Markdown,value:`{ ${e.map(n=>`"${n}"`).join(", ")} }`}}}async function aI(t){let e=await Cp(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function cI(t){let e=await Ap(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var uI=L(U());async function lI({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_SAME_NODE"||e.args?.length!==2)return;if(await n?.getRuntime()){let o=await i({document:t,macro:e.args[0],context:n,position:r}),a=await i({document:t,macro:e.args[1],context:n,position:r});return!!a&&!!o&&a===o}}async function dI(t){let e=await lI(t,x);if(e!==void 0)return{contents:{kind:uI.MarkupKind.Markdown,value:e?"1":"0"}}}var pI=L(U());async function fI({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return await Ra(o,s[1].macro,a)}async function hI(t){let e=await fI(t,x);return e?{contents:{kind:pI.MarkupKind.Markdown,value:e.toString()}}:void 0}var gI=L(U());async function mI({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return vs(o,s[1].macro,a,s[3].macro,n)}async function yI(t){let e=await mI(t,x);return e?{contents:{kind:gI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function TI(t){let e=await Ri(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function vI(t){let e=await $p(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var Sl=L(U());async function ht(t,e){if(e){if(typeof e=="boolean")return{contents:{kind:Sl.MarkupKind.Markdown,value:e?"1":"0"}};if(typeof e=="string")return{contents:{kind:Sl.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(n=>typeof n=="number"))return{contents:{kind:Sl.MarkupKind.Markdown,value:e.length===1?e[0].toString():`{${e.join(", ")}}`}};if(e.every(n=>typeof n=="string"))return{contents:{kind:Sl.MarkupKind.Markdown,value:e.length===1?`"${e[0]}"`:`{${e.map(n=>`"${n}"`).join(", ")}}`}}}}async function bI(t){let e=await yp(t,x);return ht(t.context,e)}var lv=L(U());async function SI(t){let e=await Tp(t,x);if(e===!0)return{contents:{kind:lv.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof X?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:lv.MarkupKind.Markdown,value:e.toString()}}}async function _I(t){let e=await Na(t,x);return ht(t.context,e)}async function PI({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX"||e.args?.length!==4)return;let s=await Ni(await i({document:t,macro:e.args[0],context:n,position:r}),e.args[1].macro,e.args[2].macro);return await wn(s,e.args[3].macro,n)}async function kI(t){return ht(t.context,await PI(t,x))}async function NI(t){let e=await Ip(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var EI=L(U());async function RI(t){return t?.nodes.filter(e=>!e.disabled).length??0}async function wI({document:t,macro:e,context:n,position:r},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:n,position:r});return RI(s)}async function CI(t){let e=await wI(t,x);return e!==void 0?{contents:{kind:EI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function DI(t){let e=await bs(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var II=L(U());async function AI({document:t,macro:e,context:n,position:r},i){let s=e.args;if(e.macro!=="DT_PHA"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:n,position:r});return vs(o,s[1].macro,0,s[2].macro,n)}async function OI(t){let e=await AI(t,x);return e?{contents:{kind:II.MarkupKind.Markdown,value:e.toString()}}:void 0}var MI=L(U());async function xI(t){let e=await Lp(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:MI.MarkupKind.Markdown,value:e.toString()}}:void 0}var qI=L(U());async function LI({document:t,macro:e,context:n,position:r},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:n,position:r});return vs(o,s[1].macro,s[2].macro,s[3].macro,n)}async function $I(t){let e=await LI(t,x);return e?{contents:{kind:qI.MarkupKind.Markdown,value:e.toString()}}:void 0}var FI=L(U());async function BI(t){let e=await qp(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:FI.MarkupKind.Markdown,value:e.toString()}}:void 0}var jI=L(U());async function UI(t){let e=await Fp(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:jI.MarkupKind.Markdown,value:e.toString()}}:void 0}var HI=L(U());async function VI(t){let e=await Mp(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:HI.MarkupKind.Markdown,value:e.toString()}}:void 0}var zI=L(U());async function WI({document:t,macro:e,context:n,position:r},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:n,position:r});return await Ra(o,s[1].macro,0)}async function GI(t){let e=await WI(t,x);return e?{contents:{kind:zI.MarkupKind.Markdown,value:e.toString()}}:void 0}var YI=L(U());async function KI(t){let e=await xp(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:YI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function XI({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_PROP_BY_PHANDLE"||e.args?.length!==3)return;let s=await Ni(await i({document:t,macro:e.args[0],context:n,position:r}),e.args[1].macro);return wn(s,e.args[2].macro,n)}async function JI(t){return ht(t.context,await XI(t,x))}async function QI(t){return ht(t.context,await Bp(t,x))}var tO=L(U());var ZI=L(require("util"));async function dh(t,e,n,r){let i=t?.properties.find(o=>Z(o.name)===e);if(!i)return;let s=i?.ast.quickValues?.at(n);if(s!==void 0)return ZI.default.isDeepStrictEqual(Me(r),s)}async function eO({document:t,macro:e,context:n,position:r},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:n,position:r});return await dh(o,s[1].macro,0,s[2].macro)}async function nO(t){let e=await eO(t,x);return e!==void 0?{contents:{kind:tO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var iO=L(U());async function rO({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return await dh(o,s[1].macro,a,s[3].macro)}async function sO(t){let e=await rO(t,x);return e!==void 0?{contents:{kind:iO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var cO=L(U());async function oO(t,e,n,r){let i=await wn(t,e,r);if(i===void 0)return!1;if(n=typeof n=="number"?n:Me(n??"0"),typeof n=="number")return Array.isArray(i)?i.length<n:n===0}async function aO({document:t,macro:e,context:n,position:r},i){let s=e.args;return e.macro!=="DT_PROP_HAS_IDX"||s?.length!==3?void 0:!!await oO(await i({document:t,macro:s[0],context:n,position:r}),s[1].macro,s[2].macro,n)}async function lO(t){let e=await aO(t,x);return e===void 0?void 0:{contents:{kind:cO.MarkupKind.Markdown,value:e?"1":"0"}}}var fO=L(U());async function uO(t,e,n,r){let i=t?.properties.find(u=>Z(u.name)===e),s=i?.parent.nodeType;if(!s||!(s instanceof St)||await wn(t,e,r)===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()===n)??-1;return l===-1?void 0:l}async function dO({document:t,macro:e,context:n,position:r},i){let s=e.args;return e.macro!=="DT_PROP_HAS_NAME"||s?.length!==3?void 0:!!await uO(await i({document:t,macro:s[0],context:n,position:r}),s[1].macro,s[2].macro,n)}async function pO(t){let e=await dO(t,x);return e===void 0?void 0:{contents:{kind:fO.MarkupKind.Markdown,value:e?"1":"0"}}}async function hO(t){let e=await wp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var gO=L(U());async function mO({document:t,macro:e,context:n,position:r},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:n,position:r});return o?jp(o,s[1].macro):void 0}async function yO(t){let e=await mO(t,x);return e?{contents:{kind:gO.MarkupKind.Markdown,value:e.toString()}}:void 0}var TO=L(U());async function vO(t){let e=await Up(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:TO.MarkupKind.Markdown,value:e.toString()}}:void 0}var uv=L(U());async function bO(t,e,n){let r=await wn(t,e,n);if(r===!0)return!0;if(!r)return;let i=r.at(-1);if(i)return r.length===1&&r[0]instanceof X?r[0]:i}async function SO({document:t,macro:e,context:n,position:r},i){if(!(e.macro!=="DT_PROP_LAST"||e.args?.length!==2))return bO(await i({document:t,macro:e.args[0],context:n,position:r}),e.args[1].macro,n)}async function _O(t){let e=await SO(t,x);if(e===!0)return{contents:{kind:uv.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof X?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:uv.MarkupKind.Markdown,value:e.toString()}}}var kO=L(U());async function PO({document:t,macro:e,context:n,position:r},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:n,position:r});return o?Ea(o,s[1].macro):void 0}async function NO(t){let e=await PO(t,x);if(e)return{contents:{kind:kO.MarkupKind.Markdown,value:e.toString()}}}var wO=L(U());async function fh(t,e,n){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[n]instanceof re)return Z(i[n].value)}async function RO({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return o?fh(o,s[1].macro,a):void 0}async function EO(t){let e=await RO(t,x);if(e)return{contents:{kind:wO.MarkupKind.Markdown,value:e.toString()}}}var CO=L(U());async function DO(t){let e=await Hp(t,x);if(e)return e instanceof X?ht(t.context,e):{contents:{kind:CO.MarkupKind.Markdown,value:e.toString()}}}var OO=L(U());async function AO(t,e,n){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[n]instanceof re)return i[n].value}async function IO({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return o?AO(o,s[1].macro,a):void 0}async function MO(t){let e=await IO(t,x);if(e)return{contents:{kind:OO.MarkupKind.Markdown,value:e.toString()}}}var LO=L(U());async function xO({document:t,macro:e,context:n,position:r},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:n,position:r});return o?Vp(o,s[1].macro):void 0}async function qO(t){let e=await xO(t,x);if(e)return{contents:{kind:LO.MarkupKind.Markdown,value:e.toString()}}}var $O=L(U());async function FO(t){let e=await Wp(t,x);if(e)return e instanceof X?ht(t.context,e):{contents:{kind:$O.MarkupKind.Markdown,value:e.toString()}}}var UO=L(U());async function BO(t,e,n){return(await fh(t,e,n))?.toUpperCase()}async function jO({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return o?BO(o,s[1].macro,a):void 0}async function HO(t){let e=await jO(t,x);if(e)return{contents:{kind:UO.MarkupKind.Markdown,value:e.toString()}}}var WO=L(U());async function VO({document:t,macro:e,context:n,position:r},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:n,position:r});return o?zp(o,s[1].macro):void 0}async function zO(t){let e=await VO(t,x);if(e)return{contents:{kind:WO.MarkupKind.Markdown,value:e.toString()}}}var GO=L(U());async function YO(t){let e=await Gp(t,x);if(e)return e instanceof X?ht(t.context,e):{contents:{kind:GO.MarkupKind.Markdown,value:e.toString()}}}async function KO(t){let e=await bp(t,x);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var QO=L(U());async function XO(t,e){if(!t)return;let n=t.nodeType?.onBus;return n?Z(n)===e:!1}async function JO(t,e){let n=t.macro.args;if(t.macro.macro!=="DT_ON_BUS"||n?.length!==2)return;let r=await e({...t,macro:n[0]});return await XO(r,n[1].macro)}async function ZO(t){let e=await JO(t,x);return e!==void 0?{contents:{kind:QO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function eM(t){let e=await _p(t);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var rM=L(U());async function tM(t,e){return!!await Sp(t,e)}async function nM(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_HAS_CHOSEN"||e?.length!==1))return await tM(t.context,e[0].macro)}async function iM(t){let e=await nM(t);return e!==void 0?{contents:{kind:rM.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function OV(t){return[KO,ZO,eM,iM,$0,F0,H0,CI,V0,W0,Y0,hO,NI,cI,tI,J0,nI,oI,aI,dI].reduce((e,n)=>e.then(r=>r||n(t)),Promise.resolve(void 0))}async function MV(t){return[sO,nO,hI,VI,GI,KI,yI,xI,$I,BI,OI,TI,vI,DI,UI,SI,JI,kI,QI,lO,pO,bI,_O,yO,vO,_I,EO,NO,DO,MO,qO,FO,HO,zO,YO].reduce((e,n)=>e.then(r=>r||n(t)),Promise.resolve(void 0))}async function sM(t,e,n){if(n)try{let r=Gi(n,t.position);return await oM(r,t.position,e,n)}catch{}}async function oM(t,e,n,r){if(!t?.macro)return;let i=await OV({position:e,context:n,document:r,macro:t})||await MV({position:e,context:n,document:r,macro:t});if(i)return i;let s=await x({document:r,macro:t,context:n,position:e});if(s)return{contents:s.toMarkupContent(n.macros)};let o=await Ts(r,t.macro,e,n);if(o)return oM(o[0],o[1],n,r)}var Tc=require("path"),hP=require("fs");var dv=(t,e,n)=>{let r=t instanceof RegExp?aM(t,n):t,i=e instanceof RegExp?aM(e,n):e,s=r!==null&&i!=null&&xV(r,i,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+i.length)}},aM=(t,e)=>{let n=e.match(t);return n?n[0]:null},xV=(t,e,n)=>{let r,i,s,o,a,c=n.indexOf(t),l=n.indexOf(e,c+1),u=c;if(c>=0&&l>0){if(t===e)return[c,l];for(r=[],s=n.length;u>=0&&!a;){if(u===c)r.push(u),c=n.indexOf(t,u+1);else if(r.length===1){let d=r.pop();d!==void 0&&(a=[d,l])}else i=r.pop(),i!==void 0&&i<s&&(s=i,o=l),l=n.indexOf(e,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(a=[s,o])}return a};var cM="\0SLASH"+Math.random()+"\0",lM="\0OPEN"+Math.random()+"\0",pv="\0CLOSE"+Math.random()+"\0",uM="\0COMMA"+Math.random()+"\0",dM="\0PERIOD"+Math.random()+"\0",LV=new RegExp(cM,"g"),qV=new RegExp(lM,"g"),$V=new RegExp(pv,"g"),FV=new RegExp(uM,"g"),BV=new RegExp(dM,"g"),jV=/\\\\/g,UV=/\\{/g,HV=/\\}/g,VV=/\\,/g,WV=/\\\./g,zV=1e5;function fv(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function GV(t){return t.replace(jV,cM).replace(UV,lM).replace(HV,pv).replace(VV,uM).replace(WV,dM)}function YV(t){return t.replace(LV,"\\").replace(qV,"{").replace($V,"}").replace(FV,",").replace(BV,".")}function fM(t){if(!t)return[""];let e=[],n=dv("{","}",t);if(!n)return t.split(",");let{pre:r,body:i,post:s}=n,o=r.split(",");o[o.length-1]+="{"+i+"}";let a=fM(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function pM(t,e={}){if(!t)return[];let{max:n=zV}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),_l(GV(t),n,!0).map(YV)}function KV(t){return"{"+t+"}"}function XV(t){return/^-?0\d/.test(t)}function JV(t,e){return t<=e}function QV(t,e){return t>=e}function _l(t,e,n){let r=[],i=dv("{","}",t);if(!i)return[t];let s=i.pre,o=i.post.length?_l(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let c=s+"{"+i.body+"}"+o[a];r.push(c)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=a||c,u=i.body.indexOf(",")>=0;if(!l&&!u)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+pv+i.post,_l(t,e,!0)):[t];let d;if(l)d=i.body.split(/\.\./);else if(d=fM(i.body),d.length===1&&d[0]!==void 0&&(d=_l(d[0],e,!1).map(KV),d.length===1))return o.map(p=>i.pre+d[0]+p);let f;if(l&&d[0]!==void 0&&d[1]!==void 0){let p=fv(d[0]),m=fv(d[1]),h=Math.max(d[0].length,d[1].length),y=d.length===3&&d[2]!==void 0?Math.max(Math.abs(fv(d[2])),1):1,S=JV;m<p&&(y*=-1,S=QV);let v=d.some(XV);f=[];for(let k=p;S(k,m)&&f.length<e;k+=y){let R;if(c)R=String.fromCharCode(k),R==="\\"&&(R="");else if(R=String(k),v){let q=h-R.length;if(q>0){let O=new Array(q+1).join("0");k<0?R="-"+O+R.slice(1):R=O+R}}f.push(R)}}else{f=[];for(let p=0;p<d.length;p++)f.push.apply(f,_l(d[p],e,!1))}for(let p=0;p<f.length;p++)for(let m=0;m<o.length&&r.length<e;m++){let h=s+f[p]+o[m];(!n||l||h)&&r.push(h)}}return r}var Pl=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var ZV={"[: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]},kl=t=>t.replace(/[[\]\\-]/g,"\\$&"),eW=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),hM=t=>t.join(""),mM=(t,e)=>{let n=e;if(t.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=n+1,o=!1,a=!1,c=!1,l=!1,u=n,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===n+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[y,[S,b,v]]of Object.entries(ZV))if(t.startsWith(y,s)){if(d)return["$.",!1,t.length-n,!0];s+=y.length,v?i.push(S):r.push(S),a=a||b;continue e}}if(c=!1,d){h>d?r.push(kl(d)+"-"+kl(h)):h===d&&r.push(kl(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){r.push(kl(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}r.push(kl(h)),s++}if(u<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,t.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let h=r[0].length===2?r[0].slice(-1):r[0];return[eW(h),!1,u-n,!1]}let f="["+(l?"^":"")+hM(r)+"]",p="["+(l?"":"^")+hM(i)+"]";return[r.length&&i.length?"("+f+"|"+p+")":r.length?f:p,a,u-n,!0]};var ii=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!0}={})=>n?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 nr,tW=new Set(["!","?","+","*","@"]),hv=t=>tW.has(t),gM=t=>hv(t.type),nW=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),rW=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),iW=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),yM=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),sW="(?!(?:^|/)\\.\\.?(?:$|/))",ph="(?!\\.)",oW=new Set(["[","."]),aW=new Set(["..","."]),cW=new Set("().*{}+?[]^$\\!"),lW=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),mv="[^/]",TM=mv+"*?",vM=mv+"+?",uW=0,ho=class{type;#e;#n;#r=!1;#t=[];#o;#h;#a;#d=!1;#l;#c;#s=!1;id=++uW;get depth(){return(this.#o?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#o?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,n,r={}){this.type=e,e&&(this.#n=!0),this.#o=n,this.#e=this.#o?this.#o.#e:this,this.#l=this.#e===this?r:this.#e.#l,this.#a=this.#e===this?[]:this.#e.#a,e==="!"&&!this.#e.#d&&this.#a.push(this),this.#h=this.#o?this.#o.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#c=this.#t.map(e=>String(e)).join("")}#T(){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 n=e,r=n.#o;for(;r;){for(let i=n.#h+1;!r.type&&i<r.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[i])}n=r,r=n.#o}}return this}push(...e){for(let n of e)if(n!==""){if(typeof n!="string"&&!(n instanceof nr&&n.#o===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let e=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.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.#h===0)return!0;let e=this.#o;for(let n=0;n<this.#h;n++){let r=e.#t[n];if(!(r instanceof nr&&r.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.#t.length:0;return this.#h===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let n=new nr(this.type,e);for(let r of this.#t)n.copyIn(r);return n}static#v(e,n,r,i,s){let o=i.maxExtglobRecursion??2,a=!1,c=!1,l=-1,u=!1;if(n.type===null){let h=r,y="";for(;h<e.length;){let S=e.charAt(h++);if(a||S==="\\"){a=!a,y+=S;continue}if(c){h===l+1?(S==="^"||S==="!")&&(u=!0):S==="]"&&!(h===l+2&&u)&&(c=!1),y+=S;continue}else if(S==="["){c=!0,l=h,u=!1,y+=S;continue}if(!i.noext&&hv(S)&&e.charAt(h)==="("&&s<=o){n.push(y),y="";let v=new nr(S,n);h=nr.#v(e,v,h,i,s+1),n.push(v);continue}y+=S}return n.push(y),h}let d=r+1,f=new nr(null,n),p=[],m="";for(;d<e.length;){let h=e.charAt(d++);if(a||h==="\\"){a=!a,m+=h;continue}if(c){d===l+1?(h==="^"||h==="!")&&(u=!0):h==="]"&&!(d===l+2&&u)&&(c=!1),m+=h;continue}else if(h==="["){c=!0,l=d,u=!1,m+=h;continue}if(!i.noext&&hv(h)&&e.charAt(d)==="("&&(s<=o||n&&n.#_(h))){let S=n&&n.#_(h)?0:1;f.push(m),m="";let b=new nr(h,f);f.push(b),d=nr.#v(e,b,d,i,s+S);continue}if(h==="|"){f.push(m),m="",p.push(f),f=new nr(null,n);continue}if(h===")")return m===""&&n.#t.length===0&&(n.#s=!0),f.push(m),m="",n.push(...p,f),d;m+=h}return n.type=null,n.#n=void 0,n.#t=[e.substring(r-1)],d}#g(e){return this.#p(e,rW)}#p(e,n=nW){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#_(r.type,n)}#_(e,n=iW){return!!n.get(this.type)?.includes(e)}#m(e,n){let r=e.#t[0],i=new nr(null,r,this.options);i.#t.push(""),r.push(i),this.#k(e,n)}#k(e,n){let r=e.#t[0];this.#t.splice(n,1,...r.#t);for(let i of r.#t)typeof i=="object"&&(i.#o=this);this.#c=void 0}#N(e){return!!yM.get(this.type)?.has(e)}#y(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#N(n.type)}#P(e){let n=yM.get(this.type),r=e.#t[0],i=n?.get(r.type);if(!i)return!1;this.#t=r.#t;for(let s of this.#t)typeof s=="object"&&(s.#o=this);this.type=i,this.#c=void 0,this.#s=!1}static fromGlob(e,n={}){let r=new nr(null,void 0,n);return nr.#v(e,r,0,n,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[n,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#l.nocase&&!this.#l.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let a=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,a),{_src:n,_glob:e})}get options(){return this.#l}toRegExpSource(e){let n=e??!!this.#l.dot;if(this.#e===this&&(this.#b(),this.#T()),!gM(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(p=>typeof p!="string"),l=this.#t.map(p=>{let[m,h,y,S]=typeof p=="string"?nr.#R(p,this.#n,c):p.toRegExpSource(e);return this.#n=this.#n||y,this.#r=this.#r||S,m}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&aW.has(this.#t[0]))){let m=oW,h=n&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),y=!n&&!e&&m.has(l.charAt(0));u=h?sW:y?ph:""}let d="";return this.isEnd()&&this.#e.#d&&this.#o?.type==="!"&&(d="(?:$|\\/)"),[u+l+d,ii(l),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#f(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),l=this;return l.#t=[c],l.type=null,l.#n=void 0,[c,ii(this.toString()),!1,!1]}let o=!r||e||n||!ph?"":this.#f(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#s)a=(this.isStart()&&!n?ph:"")+vM;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?ph:"")+TM+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,ii(s),this.#n=!!this.#n,this.#r]}#b(){if(gM(this)){let e=0,n=!1;do{n=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#b(),this.#p(i)?(n=!1,this.#k(i,r)):this.#g(i)?(n=!1,this.#m(i,r)):this.#y(i)&&(n=!1,this.#P(i)))}}while(!n&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#b();this.#c=void 0}#f(e){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,i,s,o]=n.toRegExpSource(e);return this.#r=this.#r||o,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#R(e,n,r=!1){let i=!1,s="",o=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(i){i=!1,s+=(cW.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=r&&/^[*]+$/.test(e)?vM:TM,n=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?s+="\\\\":i=!0;continue}if(l==="["){let[u,d,f,p]=mM(e,c);if(f){s+=u,o=o||d,c+=f-1,n=n||p;continue}}if(l==="?"){s+=mv,n=!0;continue}s+=lW(l)}return[s,ii(e),!!n,o]}};nr=ho;var xa=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!1}={})=>n?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var Fn=(t,e,n={})=>(Pl(e),!n.nocomment&&e.charAt(0)==="#"?!1:new yr(e,n).match(t)),dW=/^\*+([^+@!?\*\[\(]*)$/,fW=t=>e=>!e.startsWith(".")&&e.endsWith(t),pW=t=>e=>e.endsWith(t),hW=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),mW=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),gW=/^\*+\.\*+$/,yW=t=>!t.startsWith(".")&&t.includes("."),TW=t=>t!=="."&&t!==".."&&t.includes("."),vW=/^\.\*+$/,bW=t=>t!=="."&&t!==".."&&t.startsWith("."),SW=/^\*+$/,_W=t=>t.length!==0&&!t.startsWith("."),PW=t=>t.length!==0&&t!=="."&&t!=="..",kW=/^\?+([^+@!?\*\[\(]*)?$/,NW=([t,e=""])=>{let n=_M([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},RW=([t,e=""])=>{let n=PM([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},wW=([t,e=""])=>{let n=PM([t]);return e?r=>n(r)&&r.endsWith(e):n},EW=([t,e=""])=>{let n=_M([t]);return e?r=>n(r)&&r.endsWith(e):n},_M=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},PM=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},kM=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",bM={win32:{sep:"\\"},posix:{sep:"/"}},CW=kM==="win32"?bM.win32.sep:bM.posix.sep;Fn.sep=CW;var Ft=Symbol("globstar **");Fn.GLOBSTAR=Ft;var DW="[^/]",AW=DW+"*?",IW="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",OW="(?:(?!(?:\\/|^)\\.).)*?",MW=(t,e={})=>n=>Fn(n,t,e);Fn.filter=MW;var Ir=(t,e={})=>Object.assign({},t,e),xW=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Fn;let e=Fn;return Object.assign((r,i,s={})=>e(r,i,Ir(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,Ir(t,s))}static defaults(i){return e.defaults(Ir(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,Ir(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Ir(t,s))}},unescape:(r,i={})=>e.unescape(r,Ir(t,i)),escape:(r,i={})=>e.escape(r,Ir(t,i)),filter:(r,i={})=>e.filter(r,Ir(t,i)),defaults:r=>e.defaults(Ir(t,r)),makeRe:(r,i={})=>e.makeRe(r,Ir(t,i)),braceExpand:(r,i={})=>e.braceExpand(r,Ir(t,i)),match:(r,i,s={})=>e.match(r,i,Ir(t,s)),sep:e.sep,GLOBSTAR:Ft})};Fn.defaults=xW;var NM=(t,e={})=>(Pl(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:pM(t,{max:e.braceExpandMax}));Fn.braceExpand=NM;var LW=(t,e={})=>new yr(t,e).makeRe();Fn.makeRe=LW;var qW=(t,e,n={})=>{let r=new yr(e,n);return t=t.filter(i=>r.match(i)),r.options.nonull&&!t.length&&t.push(e),t};Fn.match=qW;var SM=/[?*]|[+@!]\(.*?\)|\[|\]/,$W=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),yr=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,n={}){Pl(e),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=e,this.platform=n.platform||kM,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.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 n of e)if(typeof n!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),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]==="?"||!SM.test(s[2]))&&!SM.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 r=0;r<e.length;r++)for(let i=0;i<e[r].length;i++)e[r][i]==="**"&&(e[r][i]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):n>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let i=r;for(;n[i+1]==="**";)i++;i!==r&&n.splice(r,i-r)}return n})}levelOneOptimize(e){return e.map(n=>(n=n.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(n=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(n=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(n=!0,e.splice(r-1,2),r-=2)}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let o=i;for(;r[o+1]==="**";)o++;o>i&&r.splice(i+1,o-i);let a=r[i+1],c=r[i+2],l=r[i+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;n=!0,r.splice(i,1);let u=r.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<r.length-1;o++){let a=r[o];o===1&&a===""&&r[0]===""||(a==="."||a==="")&&(n=!0,r.splice(o,1),o--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let o=r[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let r=n+1;r<e.length;r++){let i=this.partsMatch(e[n],e[r],!this.preserveMultipleSlashes);if(i){e[n]=[],e[r]=i;break}}return e.filter(n=>n.length)}partsMatch(e,n,r=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<n.length;)if(e[i]===n[s])o.push(a==="b"?n[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&n[s]===e[i+1])o.push(e[i]),i++;else if(r&&n[s]==="**"&&e[i]===n[s+1])o.push(n[s]),s++;else if(e[i]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(n[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(n[s]),i++,s++}else return!1;return e.length===n.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)n=!n,r++;r&&(this.pattern=e.slice(r)),this.negate=n}matchOne(e,n,r=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),u=!l&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),d=c?3:a?0:void 0,f=u?3:l?0:void 0;if(typeof d=="number"&&typeof f=="number"){let[p,m]=[e[d],n[f]];p.toLowerCase()===m.toLowerCase()&&(n[f]=p,s=f,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),n.includes(Ft)?this.#e(e,n,r,i,s):this.#r(e,n,r,i,s)}#e(e,n,r,i,s){let o=n.indexOf(Ft,s),a=n.lastIndexOf(Ft),[c,l,u]=r?[n.slice(s,o),n.slice(o+1),[]]:[n.slice(s,o),n.slice(o+1,a),n.slice(a+1)];if(c.length){let b=e.slice(i,i+c.length);if(!this.#r(b,c,r,0,0))return!1;i+=c.length,s+=c.length}let d=0;if(u.length){if(u.length+i>e.length)return!1;let b=e.length-u.length;if(this.#r(e,u,r,b,0))d=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(b--,!this.#r(e,u,r,b,0)))return!1;d=u.length+1}}if(!l.length){let b=!!d;for(let v=i;v<e.length-d;v++){let k=String(e[v]);if(b=!0,k==="."||k===".."||!this.options.dot&&k.startsWith("."))return!1}return r||b}let f=[[[],0]],p=f[0],m=0,h=[0];for(let b of l)b===Ft?(h.push(m),p=[[],0],f.push(p)):(p[0].push(b),m++);let y=f.length-1,S=e.length-d;for(let b of f)b[1]=S-(h[y--]+b[0].length);return!!this.#n(e,f,i,0,r,0,!!d)}#n(e,n,r,i,s,o,a){let c=n[i];if(!c){for(let d=r;d<e.length;d++){a=!0;let f=e[d];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[l,u]=c;for(;r<=u;){if(this.#r(e.slice(0,r+l.length),l,s,r,0)&&o<this.maxGlobstarRecursion){let p=this.#n(e,n,r+l.length,i+1,s,o+1,a);if(p!==!1)return p}let f=e[r];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;r++}return s||null}#r(e,n,r,i,s){let o,a,c,l;for(o=i,a=s,l=e.length,c=n.length;o<l&&a<c;o++,a++){this.debug("matchOne loop");let u=n[a],d=e[o];if(this.debug(n,u,d),u===!1||u===Ft)return!1;let f;if(typeof u=="string"?(f=d===u,this.debug("string match",u,d,f)):(f=u.test(d),this.debug("pattern match",u,d,f)),!f)return!1}if(o===l&&a===c)return!0;if(o===l)return r;if(a===c)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return NM(this.pattern,this.options)}parse(e){Pl(e);let n=this.options;if(e==="**")return Ft;if(e==="")return"";let r,i=null;(r=e.match(SW))?i=n.dot?PW:_W:(r=e.match(dW))?i=(n.nocase?n.dot?mW:hW:n.dot?pW:fW)(r[1]):(r=e.match(kW))?i=(n.nocase?n.dot?RW:NW:n.dot?wW:EW)(r):(r=e.match(gW))?i=n.dot?TW:yW:(r=e.match(vW))&&(i=bW);let s=ho.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 n=this.options,r=n.noglobstar?AW:n.dot?IW:OW,i=new Set(n.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"?$W(d):d===Ft?Ft:d._src});l.forEach((d,f)=>{let p=l[f+1],m=l[f-1];d!==Ft||m===Ft||(m===void 0?p!==void 0&&p!==Ft?l[f+1]="(?:\\/|"+r+"\\/)?"+p:l[f]=r:p===void 0?l[f-1]=m+"(?:\\/|\\/"+r+")?":p!==Ft&&(l[f-1]=m+"(?:\\/|\\/"+r+"\\/)"+p,l[f+1]=Ft))});let u=l.filter(d=>d!==Ft);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,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let r=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(r.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return Fn.defaults(e).Minimatch}};Fn.AST=ho;Fn.Minimatch=yr;Fn.escape=xa;Fn.unescape=ii;var KM=require("node:url");var La=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,wM=new Set,gv=typeof process=="object"&&process?process:{},EM=(t,e,n,r)=>{typeof gv.emitWarning=="function"?gv.emitWarning(t,e,n,r):console.error(`[${n}] ${e}: ${t}`)},hh=globalThis.AbortController,RM=globalThis.AbortSignal;if(typeof hh>"u"){RM=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},hh=class{constructor(){e()}signal=new RM;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let t=gv.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,EM("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 FW=t=>!wM.has(t),GRe=Symbol("type"),Ps=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),CM=t=>Ps(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?qa:null:null,qa=class extends Array{constructor(e){super(e),this.fill(0)}},yv=class t{heap;length;static#e=!1;static create(e){let n=CM(e);if(!n)return[];t.#e=!0;let r=new t(e,n);return t.#e=!1,r}constructor(e,n){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Nl=class t{#e;#n;#r;#t;#o;#h;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#d;#l;#c;#s;#T;#v;#g;#p;#_;#m;#k;#N;#y;#P;#b;#f;static unsafeExposeInternals(e){return{starts:e.#N,ttls:e.#y,sizes:e.#k,keyMap:e.#l,keyList:e.#c,valList:e.#s,next:e.#T,prev:e.#v,get head(){return e.#g},get tail(){return e.#p},free:e.#_,isBackgroundFetch:n=>e.#u(n),backgroundFetch:(n,r,i,s)=>e.#$(n,r,i,s),moveToTail:n=>e.#B(n),indexes:n=>e.#E(n),rindexes:n=>e.#C(n),isStale:n=>e.#S(n)}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#d}get size(){return this.#a}get fetchMethod(){return this.#o}get memoMethod(){return this.#h}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:n=0,ttl:r,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:y,memoMethod:S,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:R,ignoreFetchAbort:q}=e;if(n!==0&&!Ps(n))throw new TypeError("max option must be a nonnegative integer");let O=n?CM(n):Array;if(!O)throw new Error("invalid max value: "+n);if(this.#e=n,this.#n=p,this.maxEntrySize=m||this.#n,this.sizeCalculation=h,this.sizeCalculation){if(!this.#n&&!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(S!==void 0&&typeof S!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#h=S,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=y,this.#b=!!y,this.#l=new Map,this.#c=new Array(n).fill(void 0),this.#s=new Array(n).fill(void 0),this.#T=new O(n),this.#v=new O(n),this.#g=0,this.#p=0,this.#_=yv.create(n),this.#a=0,this.#d=0,typeof l=="function"&&(this.#r=l),typeof u=="function"?(this.#t=u,this.#m=[]):(this.#t=void 0,this.#m=void 0),this.#P=!!this.#r,this.#f=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!k,this.allowStaleOnFetchAbort=!!R,this.ignoreFetchAbort=!!q,this.maxEntrySize!==0){if(this.#n!==0&&!Ps(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Ps(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=Ps(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Ps(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(this.#e===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#n){let B="LRU_CACHE_UNBOUNDED";FW(B)&&(wM.add(B),EM("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,t))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#R(){let e=new qa(this.#e),n=new qa(this.#e);this.#y=e,this.#N=n,this.#I=(s,o,a=La.now())=>{if(n[s]=o!==0?a:0,e[s]=o,o!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#S(s)&&this.#A(this.#c[s],"expire")},o+1);c.unref&&c.unref()}},this.#w=s=>{n[s]=e[s]!==0?La.now():0},this.#i=(s,o)=>{if(e[o]){let a=e[o],c=n[o];if(!a||!c)return;s.ttl=a,s.start=c,s.now=r||i();let l=s.now-c;s.remainingTTL=a-l}};let r=0,i=()=>{let s=La.now();if(this.ttlResolution>0){r=s;let o=setTimeout(()=>r=0,this.ttlResolution);o.unref&&o.unref()}return s};this.getRemainingTTL=s=>{let o=this.#l.get(s);if(o===void 0)return 0;let a=e[o],c=n[o];if(!a||!c)return 1/0;let l=(r||i())-c;return a-l},this.#S=s=>{let o=n[s],a=e[s];return!!a&&!!o&&(r||i())-o>a}}#w=()=>{};#i=()=>{};#I=()=>{};#S=()=>!1;#D(){let e=new qa(this.#e);this.#d=0,this.#k=e,this.#O=n=>{this.#d-=e[n],e[n]=0},this.#x=(n,r,i,s)=>{if(this.#u(r))return 0;if(!Ps(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,n),!Ps(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.#M=(n,r,i)=>{if(e[n]=r,this.#n){let s=this.#n-e[n];for(;this.#d>s;)this.#q(!0)}this.#d+=e[n],i&&(i.entrySize=r,i.totalCalculatedSize=this.#d)}}#O=e=>{};#M=(e,n,r)=>{};#x=(e,n,r,i)=>{if(r||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 n=this.#p;!(!this.#L(n)||((e||!this.#S(n))&&(yield n),n===this.#g));)n=this.#v[n]}*#C({allowStale:e=this.allowStale}={}){if(this.#a)for(let n=this.#g;!(!this.#L(n)||((e||!this.#S(n))&&(yield n),n===this.#p));)n=this.#T[n]}#L(e){return e!==void 0&&this.#l.get(this.#c[e])===e}*entries(){for(let e of this.#E())this.#s[e]!==void 0&&this.#c[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#c[e],this.#s[e]])}*rentries(){for(let e of this.#C())this.#s[e]!==void 0&&this.#c[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#c[e],this.#s[e]])}*keys(){for(let e of this.#E()){let n=this.#c[e];n!==void 0&&!this.#u(this.#s[e])&&(yield n)}}*rkeys(){for(let e of this.#C()){let n=this.#c[e];n!==void 0&&!this.#u(this.#s[e])&&(yield n)}}*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.#C())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,n={}){for(let r of this.#E()){let i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#c[r],this))return this.get(this.#c[r],n)}}forEach(e,n=this){for(let r of this.#E()){let i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(n,s,this.#c[r],this)}}rforEach(e,n=this){for(let r of this.#C()){let i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(n,s,this.#c[r],this)}}purgeStale(){let e=!1;for(let n of this.#C({allowStale:!0}))this.#S(n)&&(this.#A(this.#c[n],"expire"),e=!0);return e}info(e){let n=this.#l.get(e);if(n===void 0)return;let r=this.#s[n],i=this.#u(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#y&&this.#N){let o=this.#y[n],a=this.#N[n];if(o&&a){let c=o-(La.now()-a);s.ttl=c,s.start=Date.now()}}return this.#k&&(s.size=this.#k[n]),s}dump(){let e=[];for(let n of this.#E({allowStale:!0})){let r=this.#c[n],i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let o={value:s};if(this.#y&&this.#N){o.ttl=this.#y[n];let a=La.now()-this.#N[n];o.start=Math.floor(Date.now()-a)}this.#k&&(o.size=this.#k[n]),e.unshift([r,o])}return e}load(e){this.clear();for(let[n,r]of e){if(r.start){let i=Date.now()-r.start;r.start=La.now()-i}this.set(n,r.value,r)}}set(e,n,r={}){if(n===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=r,{noUpdateTTL:l=this.noUpdateTTL}=r,u=this.#x(e,n,r.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.#l.get(e);if(d===void 0)d=this.#a===0?this.#p:this.#_.length!==0?this.#_.pop():this.#a===this.#e?this.#q(!1):this.#a,this.#c[d]=e,this.#s[d]=n,this.#l.set(e,d),this.#T[this.#p]=d,this.#v[d]=this.#p,this.#p=d,this.#a++,this.#M(d,u,c),c&&(c.set="add"),l=!1;else{this.#B(d);let f=this.#s[d];if(n!==f){if(this.#b&&this.#u(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=f;p!==void 0&&!o&&(this.#P&&this.#r?.(p,e,"set"),this.#f&&this.#m?.push([p,e,"set"]))}else o||(this.#P&&this.#r?.(f,e,"set"),this.#f&&this.#m?.push([f,e,"set"]));if(this.#O(d),this.#M(d,u,c),this.#s[d]=n,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.#y&&this.#R(),this.#y&&(l||this.#I(d,i,s),c&&this.#i(c,d)),!o&&this.#f&&this.#m){let f=this.#m,p;for(;p=f?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#a;){let e=this.#s[this.#g];if(this.#q(!0),this.#u(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#m){let e=this.#m,n;for(;n=e?.shift();)this.#t?.(...n)}}}#q(e){let n=this.#g,r=this.#c[n],i=this.#s[n];return this.#b&&this.#u(i)?i.__abortController.abort(new Error("evicted")):(this.#P||this.#f)&&(this.#P&&this.#r?.(i,r,"evict"),this.#f&&this.#m?.push([i,r,"evict"])),this.#O(n),e&&(this.#c[n]=void 0,this.#s[n]=void 0,this.#_.push(n)),this.#a===1?(this.#g=this.#p=0,this.#_.length=0):this.#g=this.#T[n],this.#l.delete(r),this.#a--,n}has(e,n={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=n,s=this.#l.get(e);if(s!==void 0){let o=this.#s[s];if(this.#u(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#S(s))i&&(i.has="stale",this.#i(i,s));else return r&&this.#w(s),i&&(i.has="hit",this.#i(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,n={}){let{allowStale:r=this.allowStale}=n,i=this.#l.get(e);if(i===void 0||!r&&this.#S(i))return;let s=this.#s[i];return this.#u(s)?s.__staleWhileFetching:s}#$(e,n,r,i){let s=n===void 0?void 0:this.#s[n];if(this.#u(s))return s;let o=new hh,{signal:a}=r;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:r,context:i},l=(h,y=!1)=>{let{aborted:S}=o.signal,b=r.ignoreFetchAbort&&h!==void 0;if(r.status&&(S&&!y?(r.status.fetchAborted=!0,r.status.fetchError=o.signal.reason,b&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),S&&!b&&!y)return d(o.signal.reason);let v=p;return this.#s[n]===p&&(h===void 0?v.__staleWhileFetching?this.#s[n]=v.__staleWhileFetching:this.#A(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,h,c.options))),h},u=h=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=h),d(h)),d=h=>{let{aborted:y}=o.signal,S=y&&r.allowStaleOnFetchAbort,b=S||r.allowStaleOnFetchRejection,v=b||r.noDeleteOnFetchRejection,k=p;if(this.#s[n]===p&&(!v||k.__staleWhileFetching===void 0?this.#A(e,"fetch"):S||(this.#s[n]=k.__staleWhileFetching)),b)return r.status&&k.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),k.__staleWhileFetching;if(k.__returned===k)throw h},f=(h,y)=>{let S=this.#o?.(e,s,c);S&&S instanceof Promise&&S.then(b=>h(b===void 0?void 0:b),y),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(h(void 0),r.allowStaleOnFetchAbort&&(h=b=>l(b,!0)))})};r.status&&(r.status.fetchDispatched=!0);let p=new Promise(f).then(l,u),m=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return n===void 0?(this.set(e,m,{...c.options,status:void 0}),n=this.#l.get(e)):this.#s[n]=m,m}#u(e){if(!this.#b)return!1;let n=e;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof hh}async fetch(e,n={}){let{allowStale:r=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:y=!1,status:S,signal:b}=n;if(!this.#b)return S&&(S.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:S});let v={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:p,status:S,signal:b},k=this.#l.get(e);if(k===void 0){S&&(S.fetch="miss");let R=this.#$(e,k,v,h);return R.__returned=R}else{let R=this.#s[k];if(this.#u(R)){let Qe=r&&R.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",Qe&&(S.returnedStale=!0)),Qe?R.__staleWhileFetching:R.__returned=R}let q=this.#S(k);if(!y&&!q)return S&&(S.fetch="hit"),this.#B(k),i&&this.#w(k),S&&this.#i(S,k),R;let O=this.#$(e,k,v,h),Pe=O.__staleWhileFetching!==void 0&&r;return S&&(S.fetch=q?"stale":"refresh",Pe&&q&&(S.returnedStale=!0)),Pe?O.__staleWhileFetching:O.__returned=O}}async forceFetch(e,n={}){let r=await this.fetch(e,n);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,n={}){let r=this.#h;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=n,a=this.get(e,o);if(!s&&a!==void 0)return a;let c=r(e,a,{options:o,context:i});return this.set(e,c,o),c}get(e,n={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=n,a=this.#l.get(e);if(a!==void 0){let c=this.#s[a],l=this.#u(c);return o&&this.#i(o,a),this.#S(a)?(o&&(o.get="stale"),l?(o&&r&&c.__staleWhileFetching!==void 0&&(o.returnedStale=!0),r?c.__staleWhileFetching:void 0):(s||this.#A(e,"expire"),o&&r&&(o.returnedStale=!0),r?c:void 0)):(o&&(o.get="hit"),l?c.__staleWhileFetching:(this.#B(a),i&&this.#w(a),c))}else o&&(o.get="miss")}#F(e,n){this.#v[n]=e,this.#T[e]=n}#B(e){e!==this.#p&&(e===this.#g?this.#g=this.#T[e]:this.#F(this.#v[e],this.#T[e]),this.#F(this.#p,e),this.#p=e)}delete(e){return this.#A(e,"delete")}#A(e,n){let r=!1;if(this.#a!==0){let i=this.#l.get(e);if(i!==void 0)if(r=!0,this.#a===1)this.#j(n);else{this.#O(i);let s=this.#s[i];if(this.#u(s)?s.__abortController.abort(new Error("deleted")):(this.#P||this.#f)&&(this.#P&&this.#r?.(s,e,n),this.#f&&this.#m?.push([s,e,n])),this.#l.delete(e),this.#c[i]=void 0,this.#s[i]=void 0,i===this.#p)this.#p=this.#v[i];else if(i===this.#g)this.#g=this.#T[i];else{let o=this.#v[i];this.#T[o]=this.#T[i];let a=this.#T[i];this.#v[a]=this.#v[i]}this.#a--,this.#_.push(i)}}if(this.#f&&this.#m?.length){let i=this.#m,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#j("delete")}#j(e){for(let n of this.#C({allowStale:!0})){let r=this.#s[n];if(this.#u(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#c[n];this.#P&&this.#r?.(r,i,e),this.#f&&this.#m?.push([r,i,e])}}if(this.#l.clear(),this.#s.fill(void 0),this.#c.fill(void 0),this.#y&&this.#N&&(this.#y.fill(0),this.#N.fill(0)),this.#k&&this.#k.fill(0),this.#g=0,this.#p=0,this.#_.length=0,this.#d=0,this.#a=0,this.#f&&this.#m){let n=this.#m,r;for(;r=n?.shift();)this.#t?.(...r)}}};var Ba=require("node:path"),FM=require("node:url"),Di=require("fs"),KW=L(require("node:fs"),1),Rs=require("node:fs/promises");var Sh=require("node:events"),kv=L(require("node:stream"),1),MM=require("node:string_decoder"),DM=typeof process=="object"&&process?process:{stdout:null,stderr:null},BW=t=>!!t&&typeof t=="object"&&(t instanceof Ns||t instanceof kv.default||jW(t)||UW(t)),jW=t=>!!t&&typeof t=="object"&&t instanceof Sh.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==kv.default.Writable.prototype.pipe,UW=t=>!!t&&typeof t=="object"&&t instanceof Sh.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",Xi=Symbol("EOF"),Ji=Symbol("maybeEmitEnd"),ks=Symbol("emittedEnd"),mh=Symbol("emittingEnd"),Rl=Symbol("emittedError"),gh=Symbol("closed"),AM=Symbol("read"),yh=Symbol("flush"),IM=Symbol("flushChunk"),si=Symbol("encoding"),$a=Symbol("decoder"),an=Symbol("flowing"),wl=Symbol("paused"),Fa=Symbol("resume"),cn=Symbol("buffer"),Bn=Symbol("pipes"),ln=Symbol("bufferLength"),Tv=Symbol("bufferPush"),Th=Symbol("bufferShift"),En=Symbol("objectMode"),Bt=Symbol("destroyed"),vv=Symbol("error"),bv=Symbol("emitData"),OM=Symbol("emitEnd"),Sv=Symbol("emitEnd2"),Ei=Symbol("async"),_v=Symbol("abort"),vh=Symbol("aborted"),El=Symbol("signal"),mo=Symbol("dataListeners"),Tr=Symbol("discarded"),Cl=t=>Promise.resolve().then(t),HW=t=>t(),VW=t=>t==="end"||t==="finish"||t==="prefinish",WW=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,zW=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),bh=class{src;dest;opts;ondrain;constructor(e,n,r){this.src=e,this.dest=n,this.opts=r,this.ondrain=()=>e[Fa](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Pv=class extends bh{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,n,r){super(e,n,r),this.proxyErrors=i=>n.emit("error",i),e.on("error",this.proxyErrors)}},GW=t=>!!t.objectMode,YW=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",Ns=class extends Sh.EventEmitter{[an]=!1;[wl]=!1;[Bn]=[];[cn]=[];[En];[si];[Ei];[$a];[Xi]=!1;[ks]=!1;[mh]=!1;[gh]=!1;[Rl]=null;[ln]=0;[Bt]=!1;[El];[vh]=!1;[mo]=0;[Tr]=!1;writable=!0;readable=!0;constructor(...e){let n=e[0]||{};if(super(),n.objectMode&&typeof n.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");GW(n)?(this[En]=!0,this[si]=null):YW(n)?(this[si]=n.encoding,this[En]=!1):(this[En]=!1,this[si]=null),this[Ei]=!!n.async,this[$a]=this[si]?new MM.StringDecoder(this[si]):null,n&&n.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[cn]}),n&&n.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Bn]});let{signal:r}=n;r&&(this[El]=r,r.aborted?this[_v]():r.addEventListener("abort",()=>this[_v]()))}get bufferLength(){return this[ln]}get encoding(){return this[si]}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[En]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ei]}set async(e){this[Ei]=this[Ei]||!!e}[_v](){this[vh]=!0,this.emit("abort",this[El]?.reason),this.destroy(this[El]?.reason)}get aborted(){return this[vh]}set aborted(e){}write(e,n,r){if(this[vh])return!1;if(this[Xi])throw new Error("write after end");if(this[Bt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof n=="function"&&(r=n,n="utf8"),n||(n="utf8");let i=this[Ei]?Cl:HW;if(!this[En]&&!Buffer.isBuffer(e)){if(zW(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(WW(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[En]?(this[an]&&this[ln]!==0&&this[yh](!0),this[an]?this.emit("data",e):this[Tv](e),this[ln]!==0&&this.emit("readable"),r&&i(r),this[an]):e.length?(typeof e=="string"&&!(n===this[si]&&!this[$a]?.lastNeed)&&(e=Buffer.from(e,n)),Buffer.isBuffer(e)&&this[si]&&(e=this[$a].write(e)),this[an]&&this[ln]!==0&&this[yh](!0),this[an]?this.emit("data",e):this[Tv](e),this[ln]!==0&&this.emit("readable"),r&&i(r),this[an]):(this[ln]!==0&&this.emit("readable"),r&&i(r),this[an])}read(e){if(this[Bt])return null;if(this[Tr]=!1,this[ln]===0||e===0||e&&e>this[ln])return this[Ji](),null;this[En]&&(e=null),this[cn].length>1&&!this[En]&&(this[cn]=[this[si]?this[cn].join(""):Buffer.concat(this[cn],this[ln])]);let n=this[AM](e||null,this[cn][0]);return this[Ji](),n}[AM](e,n){if(this[En])this[Th]();else{let r=n;e===r.length||e===null?this[Th]():typeof r=="string"?(this[cn][0]=r.slice(e),n=r.slice(0,e),this[ln]-=e):(this[cn][0]=r.subarray(e),n=r.subarray(0,e),this[ln]-=e)}return this.emit("data",n),!this[cn].length&&!this[Xi]&&this.emit("drain"),n}end(e,n,r){return typeof e=="function"&&(r=e,e=void 0),typeof n=="function"&&(r=n,n="utf8"),e!==void 0&&this.write(e,n),r&&this.once("end",r),this[Xi]=!0,this.writable=!1,(this[an]||!this[wl])&&this[Ji](),this}[Fa](){this[Bt]||(!this[mo]&&!this[Bn].length&&(this[Tr]=!0),this[wl]=!1,this[an]=!0,this.emit("resume"),this[cn].length?this[yh]():this[Xi]?this[Ji]():this.emit("drain"))}resume(){return this[Fa]()}pause(){this[an]=!1,this[wl]=!0,this[Tr]=!1}get destroyed(){return this[Bt]}get flowing(){return this[an]}get paused(){return this[wl]}[Tv](e){this[En]?this[ln]+=1:this[ln]+=e.length,this[cn].push(e)}[Th](){return this[En]?this[ln]-=1:this[ln]-=this[cn][0].length,this[cn].shift()}[yh](e=!1){do;while(this[IM](this[Th]())&&this[cn].length);!e&&!this[cn].length&&!this[Xi]&&this.emit("drain")}[IM](e){return this.emit("data",e),this[an]}pipe(e,n){if(this[Bt])return e;this[Tr]=!1;let r=this[ks];return n=n||{},e===DM.stdout||e===DM.stderr?n.end=!1:n.end=n.end!==!1,n.proxyErrors=!!n.proxyErrors,r?n.end&&e.end():(this[Bn].push(n.proxyErrors?new Pv(this,e,n):new bh(this,e,n)),this[Ei]?Cl(()=>this[Fa]()):this[Fa]()),e}unpipe(e){let n=this[Bn].find(r=>r.dest===e);n&&(this[Bn].length===1?(this[an]&&this[mo]===0&&(this[an]=!1),this[Bn]=[]):this[Bn].splice(this[Bn].indexOf(n),1),n.unpipe())}addListener(e,n){return this.on(e,n)}on(e,n){let r=super.on(e,n);if(e==="data")this[Tr]=!1,this[mo]++,!this[Bn].length&&!this[an]&&this[Fa]();else if(e==="readable"&&this[ln]!==0)super.emit("readable");else if(VW(e)&&this[ks])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Rl]){let i=n;this[Ei]?Cl(()=>i.call(this,this[Rl])):i.call(this,this[Rl])}return r}removeListener(e,n){return this.off(e,n)}off(e,n){let r=super.off(e,n);return e==="data"&&(this[mo]=this.listeners("data").length,this[mo]===0&&!this[Tr]&&!this[Bn].length&&(this[an]=!1)),r}removeAllListeners(e){let n=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[mo]=0,!this[Tr]&&!this[Bn].length&&(this[an]=!1)),n}get emittedEnd(){return this[ks]}[Ji](){!this[mh]&&!this[ks]&&!this[Bt]&&this[cn].length===0&&this[Xi]&&(this[mh]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[gh]&&this.emit("close"),this[mh]=!1)}emit(e,...n){let r=n[0];if(e!=="error"&&e!=="close"&&e!==Bt&&this[Bt])return!1;if(e==="data")return!this[En]&&!r?!1:this[Ei]?(Cl(()=>this[bv](r)),!0):this[bv](r);if(e==="end")return this[OM]();if(e==="close"){if(this[gh]=!0,!this[ks]&&!this[Bt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Rl]=r,super.emit(vv,r);let s=!this[El]||this.listeners("error").length?super.emit("error",r):!1;return this[Ji](),s}else if(e==="resume"){let s=super.emit("resume");return this[Ji](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...n);return this[Ji](),i}[bv](e){for(let r of this[Bn])r.dest.write(e)===!1&&this.pause();let n=this[Tr]?!1:super.emit("data",e);return this[Ji](),n}[OM](){return this[ks]?!1:(this[ks]=!0,this.readable=!1,this[Ei]?(Cl(()=>this[Sv]()),!0):this[Sv]())}[Sv](){if(this[$a]){let n=this[$a].end();if(n){for(let r of this[Bn])r.dest.write(n);this[Tr]||super.emit("data",n)}}for(let n of this[Bn])n.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[En]||(e.dataLength=0);let n=this.promise();return this.on("data",r=>{e.push(r),this[En]||(e.dataLength+=r.length)}),await n,e}async concat(){if(this[En])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[si]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,n)=>{this.on(Bt,()=>n(new Error("stream destroyed"))),this.on("error",r=>n(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Tr]=!1;let e=!1,n=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return n();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Xi])return n();let s,o,a=d=>{this.off("data",c),this.off("end",l),this.off(Bt,u),n(),o(d)},c=d=>{this.off("error",a),this.off("end",l),this.off(Bt,u),this.pause(),s({value:d,done:!!this[Xi]})},l=()=>{this.off("error",a),this.off("data",c),this.off(Bt,u),n(),s({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((d,f)=>{o=f,s=d,this.once(Bt,u),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:n,return:n,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Tr]=!1;let e=!1,n=()=>(this.pause(),this.off(vv,n),this.off(Bt,n),this.off("end",n),e=!0,{done:!0,value:void 0}),r=()=>{if(e)return n();let i=this.read();return i===null?n():{done:!1,value:i}};return this.once("end",n),this.once(vv,n),this.once(Bt,n),{next:r,throw:n,return:n,[Symbol.iterator](){return this}}}destroy(e){if(this[Bt])return e?this.emit("error",e):this.emit(Bt),this;this[Bt]=!0,this[Tr]=!0,this[cn].length=0,this[ln]=0;let n=this;return typeof n.close=="function"&&!this[gh]&&n.close(),e?this.emit("error",e):this.emit(Bt),this}static get isStream(){return BW}};var XW=Di.realpathSync.native,Al={lstatSync:Di.lstatSync,readdir:Di.readdir,readdirSync:Di.readdirSync,readlinkSync:Di.readlinkSync,realpathSync:XW,promises:{lstat:Rs.lstat,readdir:Rs.readdir,readlink:Rs.readlink,realpath:Rs.realpath}},BM=t=>!t||t===Al||t===KW?Al:{...Al,...t,promises:{...Al.promises,...t.promises||{}}},jM=/^\\\\\?\\([a-z]:)\\?$/i,JW=t=>t.replace(/\//g,"\\").replace(jM,"$1\\"),QW=/[\\\/]/,Mr=0,UM=1,HM=2,Ci=4,VM=6,WM=8,go=10,zM=12,Or=15,Dl=~Or,Nv=16,xM=32,Il=64,oi=128,_h=256,kh=512,LM=Il|oi|kh,ZW=1023,Rv=t=>t.isFile()?WM:t.isDirectory()?Ci:t.isSymbolicLink()?go:t.isCharacterDevice()?HM:t.isBlockDevice()?VM:t.isSocket()?zM:t.isFIFO()?UM:Mr,qM=new Map,Ol=t=>{let e=qM.get(t);if(e)return e;let n=t.normalize("NFKD");return qM.set(t,n),n},$M=new Map,Ph=t=>{let e=$M.get(t);if(e)return e;let n=Ol(t.toLowerCase());return $M.set(t,n),n},Nh=class extends Nl{constructor(){super({max:256})}},wv=class extends Nl{constructor(e=16*1024){super({maxSize:e,sizeCalculation:n=>n.length+1})}},GM=Symbol("PathScurry setAsCwd"),Cn=class{name;root;roots;parent;nocase;isCWD=!1;#e;#n;get dev(){return this.#n}#r;get mode(){return this.#r}#t;get nlink(){return this.#t}#o;get uid(){return this.#o}#h;get gid(){return this.#h}#a;get rdev(){return this.#a}#d;get blksize(){return this.#d}#l;get ino(){return this.#l}#c;get size(){return this.#c}#s;get blocks(){return this.#s}#T;get atimeMs(){return this.#T}#v;get mtimeMs(){return this.#v}#g;get ctimeMs(){return this.#g}#p;get birthtimeMs(){return this.#p}#_;get atime(){return this.#_}#m;get mtime(){return this.#m}#k;get ctime(){return this.#k}#N;get birthtime(){return this.#N}#y;#P;#b;#f;#R;#w;#i;#I;#S;#D;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,n=Mr,r,i,s,o,a){this.name=e,this.#y=s?Ph(e):Ol(e),this.#i=n&ZW,this.nocase=s,this.roots=i,this.root=r||this,this.#I=o,this.#b=a.fullpath,this.#R=a.relative,this.#w=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=BM(a.fs)}depth(){return this.#P!==void 0?this.#P:this.parent?this.#P=this.parent.depth()+1:this.#P=0}childrenCache(){return this.#I}resolve(e){if(!e)return this;let n=this.getRootString(e),i=e.substring(n.length).split(this.splitSep);return n?this.getRoot(n).#O(i):this.#O(i)}#O(e){let n=this;for(let r of e)n=n.child(r);return n}children(){let e=this.#I.get(this);if(e)return e;let n=Object.assign([],{provisional:0});return this.#I.set(this,n),this.#i&=~Nv,n}child(e,n){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Ph(e):Ol(e);for(let c of r)if(c.#y===i)return c;let s=this.parent?this.sep:"",o=this.#b?this.#b+s+e:void 0,a=this.newChild(e,Mr,{...n,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=oi),r.push(a),a}relative(){if(this.isCWD)return"";if(this.#R!==void 0)return this.#R;let e=this.name,n=this.parent;if(!n)return this.#R=this.name;let r=n.relative();return r+(!r||!n.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let e=this.name,n=this.parent;if(!n)return this.#w=this.fullpathPosix();let r=n.relativePosix();return r+(!r||!n.parent?"":"/")+e}fullpath(){if(this.#b!==void 0)return this.#b;let e=this.name,n=this.parent;if(!n)return this.#b=this.name;let i=n.fullpath()+(n.parent?this.sep:"")+e;return this.#b=i}fullpathPosix(){if(this.#f!==void 0)return this.#f;if(this.sep==="/")return this.#f=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#f=`//?/${i}`:this.#f=i}let e=this.parent,n=e.fullpathPosix(),r=n+(!n||!e.parent?"":"/")+this.name;return this.#f=r}isUnknown(){return(this.#i&Or)===Mr}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&Or)===WM}isDirectory(){return(this.#i&Or)===Ci}isCharacterDevice(){return(this.#i&Or)===HM}isBlockDevice(){return(this.#i&Or)===VM}isFIFO(){return(this.#i&Or)===UM}isSocket(){return(this.#i&Or)===zM}isSymbolicLink(){return(this.#i&go)===go}lstatCached(){return this.#i&xM?this:void 0}readlinkCached(){return this.#S}realpathCached(){return this.#D}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#S)return!0;if(!this.parent)return!1;let e=this.#i⩔return!(e!==Mr&&e!==go||this.#i&_h||this.#i&oi)}calledReaddir(){return!!(this.#i&Nv)}isENOENT(){return!!(this.#i&oi)}isNamed(e){return this.nocase?this.#y===Ph(e):this.#y===Ol(e)}async readlink(){let e=this.#S;if(e)return e;if(this.canReadlink()&&this.parent)try{let n=await this.#e.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(n);if(r)return this.#S=r}catch(n){this.#u(n.code);return}}readlinkSync(){let e=this.#S;if(e)return e;if(this.canReadlink()&&this.parent)try{let n=this.#e.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(n);if(r)return this.#S=r}catch(n){this.#u(n.code);return}}#M(e){this.#i|=Nv;for(let n=e.provisional;n<e.length;n++){let r=e[n];r&&r.#x()}}#x(){this.#i&oi||(this.#i=(this.#i|oi)&Dl,this.#E())}#E(){let e=this.children();e.provisional=0;for(let n of e)n.#x()}#C(){this.#i|=kh,this.#L()}#L(){if(this.#i&Il)return;let e=this.#i;(e&Or)===Ci&&(e&=Dl),this.#i=e|Il,this.#E()}#q(e=""){e==="ENOTDIR"||e==="EPERM"?this.#L():e==="ENOENT"?this.#x():this.children().provisional=0}#$(e=""){e==="ENOTDIR"?this.parent.#L():e==="ENOENT"&&this.#x()}#u(e=""){let n=this.#i;n|=_h,e==="ENOENT"&&(n|=oi),(e==="EINVAL"||e==="UNKNOWN")&&(n&=Dl),this.#i=n,e==="ENOTDIR"&&this.parent&&this.parent.#L()}#F(e,n){return this.#A(e,n)||this.#B(e,n)}#B(e,n){let r=Rv(e),i=this.newChild(e.name,r,{parent:this}),s=i.#i⩔return s!==Ci&&s!==go&&s!==Mr&&(i.#i|=Il),n.unshift(i),n.provisional++,i}#A(e,n){for(let r=n.provisional;r<n.length;r++){let i=n[r];if((this.nocase?Ph(e.name):Ol(e.name))===i.#y)return this.#j(e,i,r,n)}}#j(e,n,r,i){let s=n.name;return n.#i=n.#i&Dl|Rv(e),s!==e.name&&(n.name=e.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(n)),i.provisional++,n}async lstat(){if((this.#i&oi)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#$(e.code)}}lstatSync(){if((this.#i&oi)===0)try{return this.#W(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#$(e.code)}}#W(e){let{atime:n,atimeMs:r,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:y,rdev:S,size:b,uid:v}=e;this.#_=n,this.#T=r,this.#N=i,this.#p=s,this.#d=o,this.#s=a,this.#k=c,this.#g=l,this.#n=u,this.#h=d,this.#l=f,this.#r=p,this.#m=m,this.#v=h,this.#t=y,this.#a=S,this.#c=b,this.#o=v;let k=Rv(e);this.#i=this.#i&Dl|k|xM,k!==Mr&&k!==Ci&&k!==go&&(this.#i|=Il)}#H=[];#V=!1;#z(e){this.#V=!1;let n=this.#H.slice();this.#H.length=0,n.forEach(r=>r(null,e))}readdirCB(e,n=!1){if(!this.canReaddir()){n?e(null,[]):queueMicrotask(()=>e(null,[]));return}let r=this.children();if(this.calledReaddir()){let s=r.slice(0,r.provisional);n?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),r.provisional=0;else{for(let a of o)this.#F(a,r);this.#M(r)}this.#z(r.slice(0,r.provisional))})}#U;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let n=this.fullpath();if(this.#U)await this.#U;else{let r=()=>{};this.#U=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(n,{withFileTypes:!0}))this.#F(i,e);this.#M(e)}catch(i){this.#q(i.code),e.provisional=0}this.#U=void 0,r()}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 n=this.fullpath();try{for(let r of this.#e.readdirSync(n,{withFileTypes:!0}))this.#F(r,e);this.#M(e)}catch(r){this.#q(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&LM)return!1;let e=Or&this.#i;return e===Mr||e===Ci||e===go}shouldWalk(e,n){return(this.#i&Ci)===Ci&&!(this.#i&LM)&&!e.has(this)&&(!n||n(this))}async realpath(){if(this.#D)return this.#D;if(!((kh|_h|oi)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#D=this.resolve(e)}catch{this.#C()}}realpathSync(){if(this.#D)return this.#D;if(!((kh|_h|oi)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#D=this.resolve(e)}catch{this.#C()}}[GM](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let n=new Set([]),r=[],i=this;for(;i&&i.parent;)n.add(i),i.#R=r.join(this.sep),i.#w=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!n.has(i);)i.#R=void 0,i.#w=void 0,i=i.parent}},Rh=class t extends Cn{sep="\\";splitSep=QW;constructor(e,n=Mr,r,i,s,o,a){super(e,n,r,i,s,o,a)}newChild(e,n=Mr,r={}){return new t(e,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return Ba.win32.parse(e).root}getRoot(e){if(e=JW(e.toUpperCase()),e===this.root.name)return this.root;for(let[n,r]of Object.entries(this.roots))if(this.sameRoot(e,n))return this.roots[e]=r;return this.roots[e]=new ja(e,this).root}sameRoot(e,n=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(jM,"$1\\"),e===n}},wh=class t extends Cn{splitSep="/";sep="/";constructor(e,n=Mr,r,i,s,o,a){super(e,n,r,i,s,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,n=Mr,r={}){return new t(e,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}},Eh=class{root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),n,r,{nocase:i,childrenCacheSize:s=16*1024,fs:o=Al}={}){this.#t=BM(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,FM.fileURLToPath)(e));let a=n.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new Nh,this.#n=new Nh,this.#r=new wv(s);let c=a.substring(this.rootPath.length).split(r);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.#t),this.roots[this.rootPath]=this.root;let l=this.root,u=c.length-1,d=n.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.#r}resolve(...e){let n="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(n=n?`${o}/${n}`:o,this.isAbsolute(o)))break}let r=this.#e.get(n);if(r!==void 0)return r;let i=this.cwd.resolve(n).fullpath();return this.#e.set(n,i),i}resolvePosix(...e){let n="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(n=n?`${o}/${n}`:o,this.isAbsolute(o)))break}let r=this.#n.get(n);if(r!==void 0)return r;let i=this.cwd.resolve(n).fullpathPosix();return this.#n.set(n,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,n={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r}=n;if(e.canReaddir()){let i=await e.readdir();return r?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,n={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0}=n;return e.canReaddir()?r?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:n}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e.withFileTypes,e=this.cwd);let r=await e.readlink();return n?r:r?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:n}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e.withFileTypes,e=this.cwd);let r=e.readlinkSync();return n?r:r?.fullpath()}async realpath(e=this.cwd,{withFileTypes:n}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e.withFileTypes,e=this.cwd);let r=await e.realpath();return n?r:r?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:n}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e.withFileTypes,e=this.cwd);let r=e.realpathSync();return n?r:r?.fullpath()}async walk(e=this.cwd,n={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=n,a=[];(!s||s(e))&&a.push(r?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 y=()=>{--h===0&&f()};for(let S of m)(!s||s(S))&&a.push(r?S:S.fullpath()),i&&S.isSymbolicLink()?S.realpath().then(b=>b?.isUnknown()?b.lstat():b).then(b=>b?.shouldWalk(c,o)?l(b,y):y()):S.shouldWalk(c,o)?l(S,y):y()},!0)},u=e;return new Promise((d,f)=>{l(u,p=>{if(p)return f(p);d(a)})})}walkSync(e=this.cwd,n={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=n,a=[];(!s||s(e))&&a.push(r?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(r?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,n={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd),this.stream(e,n)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,n={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=n;(!s||s(e))&&(yield r?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 r?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,n={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=n,a=new Ns({objectMode:!0});(!s||s(e))&&a.write(r?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=(y,S,b=!1)=>{if(y)return a.emit("error",y);if(i&&!b){let v=[];for(let k of S)k.isSymbolicLink()&&v.push(k.realpath().then(R=>R?.isUnknown()?R.lstat():R));if(v.length){Promise.all(v).then(()=>m(null,S,!0));return}}for(let v of S)v&&(!s||s(v))&&(a.write(r?v:v.fullpath())||(f=!0));u--;for(let v of S){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,n={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=n,a=new Ns({objectMode:!0}),c=new Set;(!s||s(e))&&a.write(r?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(r?h:h.fullpath())||(f=!0));u--;for(let h of m){let y=h;if(h.isSymbolicLink()){if(!(i&&(y=h.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(c,o)&&l.push(y)}}f&&!a.flowing&&a.once("drain",d)};return d(),a}chdir(e=this.cwd){let n=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[GM](n)}},ja=class extends Eh{sep="\\";constructor(e=process.cwd(),n={}){let{nocase:r=!0}=n;super(e,Ba.win32,"\\",{...n,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Ba.win32.parse(e).root.toUpperCase()}newRoot(e){return new Rh(this.rootPath,Ci,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Ua=class extends Eh{sep="/";constructor(e=process.cwd(),n={}){let{nocase:r=!1}=n;super(e,Ba.posix,"/",{...n,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new wh(this.rootPath,Ci,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Ml=class extends Ua{constructor(e=process.cwd(),n={}){let{nocase:r=!0}=n;super(e,{...n,nocase:r})}},QRe=process.platform==="win32"?Rh:wh,YM=process.platform==="win32"?ja:process.platform==="darwin"?Ml:Ua;var ez=t=>t.length>=1,tz=t=>t.length>=1,Ha=class t{#e;#n;#r;length;#t;#o;#h;#a;#d;#l;#c=!0;constructor(e,n,r,i){if(!ez(e))throw new TypeError("empty pattern list");if(!tz(n))throw new TypeError("empty glob list");if(n.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,r<0||r>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=n,this.#r=r,this.#t=i,this.#r===0){if(this.isUNC()){let[s,o,a,c,...l]=this.#e,[u,d,f,p,...m]=this.#n;l[0]===""&&(l.shift(),m.shift());let h=[s,o,a,c,""].join("/"),y=[u,d,f,p,""].join("/");this.#e=[h,...l],this.#n=[y,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[a,...c]=this.#n;o[0]===""&&(o.shift(),c.shift());let l=s+"/",u=a+"/";this.#e=[l,...o],this.#n=[u,...c],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===Ft}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#h=this.#h||(this.#r===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new t(this.#e,this.#n,this.#r+1,this.#t),this.#o.#l=this.#l,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.#t==="win32"&&this.#r===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.#t==="win32"&&this.#r===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#l!==void 0?this.#l:this.#l=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#r===0?e:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#c)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#c?!1:(this.#c=!1,!0)}};var nz=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Va=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:n,nocase:r,noext:i,noglobstar:s,platform:o=nz}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:n,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let n=new yr(e,this.mmopts);for(let r=0;r<n.set.length;r++){let i=n.set[r],s=n.globParts[r];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let o=new Ha(i,s,0,this.platform),a=new yr(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 n=e.fullpath(),r=`${n}/`,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(n)||o.match(r))return!0;return!1}childrenIgnored(e){let n=e.fullpath()+"/",r=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(n))return!0;return!1}};var Ev=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,n){return this.store.get(e.fullpath())?.has(n.globString())}storeWalked(e,n){let r=e.fullpath(),i=this.store.get(r);i?i.add(n.globString()):this.store.set(r,new Set([n.globString()]))}},Cv=class{store=new Map;add(e,n,r){let i=(n?2:0)|(r?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,n])=>[e,!!(n&2),!!(n&1)])}},Dv=class{store=new Map;add(e,n){if(!e.canReaddir())return;let r=this.store.get(e);r?r.find(i=>i.globString()===n.globString())||r.push(n):this.store.set(e,[n])}get(e){let n=this.store.get(e);if(!n)throw new Error("attempting to walk unknown path");return n}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},xl=class t{hasWalkedCache;matches=new Cv;subwalks=new Dv;patterns;follow;dot;opts;constructor(e,n){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=n?n.copy():new Ev}processPatterns(e,n){this.patterns=n;let r=n.map(i=>[e,i]);for(let[i,s]of r){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===Ft){(!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,n){let r=this.subwalks.get(e),i=this.child();for(let s of n)for(let o of r){let a=o.isAbsolute(),c=o.pattern(),l=o.rest();c===Ft?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,n,r,i){if((this.dot||!e.name.startsWith("."))&&(n.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,n):e.isSymbolicLink()&&(r&&n.checkFollowGlobstar()?this.subwalks.add(e,r):n.markFollowGlobstar()&&this.subwalks.add(e,n)))),r){let s=r.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,r.rest(),i);else if(s===".."){let o=e.parent||e;this.subwalks.add(o,r)}else s instanceof RegExp&&this.testRegExp(e,s,r.rest(),i)}}testRegExp(e,n,r,i){n.test(e.name)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}testString(e,n,r,i){e.isNamed(n)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}};var rz=(t,e)=>typeof t=="string"?new Va([t],e):Array.isArray(t)?new Va(t,e):t,Ch=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#n;#r;signal;maxDepth;includeChildMatches;constructor(e,n,r){if(this.patterns=e,this.path=n,this.opts=r,this.#r=!r.posix&&r.platform==="win32"?"\\":"/",this.includeChildMatches=r.includeChildMatches!==!1,(r.ignore||!this.includeChildMatches)&&(this.#n=rz(r.ignore??[],r),!this.includeChildMatches&&typeof this.#n.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=r.maxDepth||1/0,r.signal&&(this.signal=r.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#n?.ignored?.(e)}#o(e){return!!this.#n?.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,n){if(n&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||await e.realpath(),!r)return;e=r}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,n)}matchCheckTest(e,n){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!n||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,n){if(n&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||e.realpathSync(),!r)return;e=r}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,n)}matchFinish(e,n){if(this.#t(e))return;if(!this.includeChildMatches&&this.#n?.add){let s=`${e.relativePosix()}/**`;this.#n.add(s)}let r=this.opts.absolute===void 0?n:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(r){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.#r)?"."+this.#r:"";this.matchEmit(s?o+s+i:"."+i)}}async match(e,n,r){let i=await this.matchCheck(e,r);i&&this.matchFinish(i,n)}matchSync(e,n,r){let i=this.matchCheckSync(e,r);i&&this.matchFinish(i,n)}walkCB(e,n,r){this.signal?.aborted&&r(),this.walkCB2(e,n,new xl(this.opts),r)}walkCB2(e,n,r,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,n,r,i));return}r.processPatterns(e,n);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of r.matches.entries())this.#t(a)||(s++,this.match(a,c,l).then(()=>o()));for(let a of r.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,r,o):a.readdirCB((l,u)=>this.walkCB3(a,u,r,o),!0)}o()}walkCB3(e,n,r,i){r=r.filterEntries(e,n);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of r.matches.entries())this.#t(a)||(s++,this.match(a,c,l).then(()=>o()));for(let[a,c]of r.subwalks.entries())s++,this.walkCB2(a,c,r.child(),o);o()}walkCBSync(e,n,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,n,new xl(this.opts),r)}walkCB2Sync(e,n,r,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,n,r,i));return}r.processPatterns(e,n);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of r.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let a of r.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirSync();this.walkCB3Sync(a,c,r,o)}o()}walkCB3Sync(e,n,r,i){r=r.filterEntries(e,n);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of r.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let[a,c]of r.subwalks.entries())s++,this.walkCB2Sync(a,c,r.child(),o);o()}},Ll=class extends Ch{matches=new Set;constructor(e,n,r){super(e,n,r)}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,n)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?n(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}},ql=class extends Ch{results;constructor(e,n,r){super(e,n,r),this.results=new Ns({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 iz=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ai=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,n){if(!n)throw new TypeError("glob options required");if(this.withFileTypes=!!n.withFileTypes,this.signal=n.signal,this.follow=!!n.follow,this.dot=!!n.dot,this.dotRelative=!!n.dotRelative,this.nodir=!!n.nodir,this.mark=!!n.mark,n.cwd?(n.cwd instanceof URL||n.cwd.startsWith("file://"))&&(n.cwd=(0,KM.fileURLToPath)(n.cwd)):this.cwd="",this.cwd=n.cwd||"",this.root=n.root,this.magicalBraces=!!n.magicalBraces,this.nobrace=!!n.nobrace,this.noext=!!n.noext,this.realpath=!!n.realpath,this.absolute=n.absolute,this.includeChildMatches=n.includeChildMatches!==!1,this.noglobstar=!!n.noglobstar,this.matchBase=!!n.matchBase,this.maxDepth=typeof n.maxDepth=="number"?n.maxDepth:1/0,this.stat=!!n.stat,this.ignore=n.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(n.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=e,this.platform=n.platform||iz,this.opts={...n,platform:this.platform},n.scurry){if(this.scurry=n.scurry,n.nocase!==void 0&&n.nocase!==n.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=n.platform==="win32"?ja:n.platform==="darwin"?Ml:n.platform?Ua:YM;this.scurry=new c(this.cwd,{nocase:n.nocase,fs:n.fs})}this.nocase=this.scurry.nocase;let r=this.platform==="darwin"||this.platform==="win32",i={...n,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:r,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 yr(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 Ha(c,u,0,this.platform)})}async walk(){return[...await new Ll(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 Ll(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 ql(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 ql(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 Av=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let n of t)if(new yr(n,e).hasMagic())return!0;return!1};function Dh(t,e={}){return new ai(t,e).streamSync()}function JM(t,e={}){return new ai(t,e).stream()}function QM(t,e={}){return new ai(t,e).walkSync()}async function XM(t,e={}){return new ai(t,e).walk()}function Ah(t,e={}){return new ai(t,e).iterateSync()}function ZM(t,e={}){return new ai(t,e).iterate()}var sz=Dh,oz=Object.assign(JM,{sync:Dh}),az=Ah,cz=Object.assign(ZM,{sync:Ah}),lz=Object.assign(QM,{stream:Dh,iterate:Ah}),yo=Object.assign(XM,{glob:XM,globSync:QM,sync:lz,globStream:JM,stream:oz,globStreamSync:Dh,streamSync:sz,globIterate:ZM,iterate:cz,globIterateSync:Ah,iterateSync:az,Glob:ai,hasMagic:Av,escape:xa,unescape:ii});yo.glob=yo;var mP=L(fS()),HF=L(BF());var pP={};UB(pP,{$id:()=>vQ,$schema:()=>TQ,default:()=>kQ,definitions:()=>SQ,properties:()=>PQ,title:()=>bQ,type:()=>_Q});var TQ="http://json-schema.org/draft-07/schema#",vQ="http://json-schema.org/draft-07/schema#",bQ="Core schema meta-schema",SQ={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:[]}},_Q=["object","boolean"],PQ={$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:"#"}},kQ={$schema:TQ,$id:vQ,title:bQ,definitions:SQ,type:_Q,properties:PQ,default:!0};var vr=L(U());var ag=class extends Yc{constructor(n,r){super();this.ajv=n;this.schemaKey=r;this.validate=this.ajv.getSchema(this.schemaKey)}getIssue(n,r){let i=[];if(r.disabled){let o=r.getProperty("status");return r.implementations.forEach(a=>i.push(F(21,a.firstToken,a.lastToken,a,{severity:vr.DiagnosticSeverity.Hint,linkedTo:[...o?.ast?[o?.ast]:[]],tags:[vr.DiagnosticTag.Unnecessary]}))),i}let s=X.toJson(r);try{this.validate?(this.validate(s),this.validate.errors&&(this.validate.errors.forEach(o=>i.push(...NQ(n,o,r,this.schemaKey))),console.log(this.schemaKey,`${r.pathString}`,this.validate.errors,s))):console.log("no validate")}catch(o){console.log(this.schemaKey,`${r.pathString}`,this.schemaKey,o)}return i}getOnPropertyHover(n){let r=(this.validate?.schema).properties?.[n];if(r&&typeof r=="object"&&"description"in r)return{kind:vr.MarkupKind.Markdown,value:[...r.description?["### Description",Array.isArray(r.description)?r.description.join(`
|
|
329
|
+
`)}}:{contents:{kind:_i.Markdown,value:`No node matched compat ${t.macro.args[0].macro}`}}}async function W0(t){let e=await Rp(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function z0(t,e){return!!await Pp(t,e)}async function G0({macro:t,context:e}){if(!(t.macro!=="DT_HAS_ALIAS"||t.args?.length!==1))return z0(t.args[0].macro,e)}async function Y0(t){let e=await G0(t);if(e!==void 0)return{contents:{kind:_i.Markdown,value:e?"1":"0"}}}var X0=L(U());async function bl(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 K0({document:t,macro:e,context:n,position:r},i){if(e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});switch(e.macro){case"DT_NODE_FULL_NAME":return bl(s,"Quoted");case"DT_NODE_FULL_NAME_TOKEN":return bl(s,"Token");case"DT_NODE_FULL_NAME_UNQUOTED":return bl(s,"Unquoted");case"DT_NODE_FULL_NAME_UPPER_TOKEN":return bl(s,"Upper Token")}}async function J0(t){let e=await K0(t,x);if(e)return{contents:{kind:X0.MarkupKind.Markdown,value:e}}}var eI=L(U());async function Q0(t){return t?.pathString}async function Z0({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_NODE_PATH"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});return Q0(s)}async function tI(t){let e=await Z0(t,x);if(e)return{contents:{kind:eI.MarkupKind.Markdown,value:`"${e}"`}}}async function nI(t){let e=await Ep(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var sI=L(U());async function rI(t){return t?.labels.map(e=>e.label)}async function iI({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_NODELABEL_STRING_ARRAY"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:n,position:r});return rI(s)}async function oI(t){let e=await iI(t,x);if(e)return{contents:{kind:sI.MarkupKind.Markdown,value:`{ ${e.map(n=>`"${n}"`).join(", ")} }`}}}async function aI(t){let e=await Cp(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function cI(t){let e=await Ap(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var uI=L(U());async function lI({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_SAME_NODE"||e.args?.length!==2)return;if(await n?.getRuntime()){let o=await i({document:t,macro:e.args[0],context:n,position:r}),a=await i({document:t,macro:e.args[1],context:n,position:r});return!!a&&!!o&&a===o}}async function dI(t){let e=await lI(t,x);if(e!==void 0)return{contents:{kind:uI.MarkupKind.Markdown,value:e?"1":"0"}}}var pI=L(U());async function fI({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return await Ra(o,s[1].macro,a)}async function hI(t){let e=await fI(t,x);return e?{contents:{kind:pI.MarkupKind.Markdown,value:e.toString()}}:void 0}var gI=L(U());async function mI({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return vs(o,s[1].macro,a,s[3].macro,n)}async function yI(t){let e=await mI(t,x);return e?{contents:{kind:gI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function TI(t){let e=await Ri(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function vI(t){let e=await $p(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var Sl=L(U());async function ht(t,e){if(e){if(typeof e=="boolean")return{contents:{kind:Sl.MarkupKind.Markdown,value:e?"1":"0"}};if(typeof e=="string")return{contents:{kind:Sl.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(n=>typeof n=="number"))return{contents:{kind:Sl.MarkupKind.Markdown,value:e.length===1?e[0].toString():`{${e.join(", ")}}`}};if(e.every(n=>typeof n=="string"))return{contents:{kind:Sl.MarkupKind.Markdown,value:e.length===1?`"${e[0]}"`:`{${e.map(n=>`"${n}"`).join(", ")}}`}}}}async function bI(t){let e=await yp(t,x);return ht(t.context,e)}var lv=L(U());async function SI(t){let e=await Tp(t,x);if(e===!0)return{contents:{kind:lv.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof X?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:lv.MarkupKind.Markdown,value:e.toString()}}}async function _I(t){let e=await Na(t,x);return ht(t.context,e)}async function PI({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX"||e.args?.length!==4)return;let s=await Ni(await i({document:t,macro:e.args[0],context:n,position:r}),e.args[1].macro,e.args[2].macro);return await wn(s,e.args[3].macro,n)}async function kI(t){return ht(t.context,await PI(t,x))}async function NI(t){let e=await Ip(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var EI=L(U());async function RI(t){return t?.nodes.filter(e=>!e.disabled).length??0}async function wI({document:t,macro:e,context:n,position:r},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:n,position:r});return RI(s)}async function CI(t){let e=await wI(t,x);return e!==void 0?{contents:{kind:EI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function DI(t){let e=await bs(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var II=L(U());async function AI({document:t,macro:e,context:n,position:r},i){let s=e.args;if(e.macro!=="DT_PHA"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:n,position:r});return vs(o,s[1].macro,0,s[2].macro,n)}async function OI(t){let e=await AI(t,x);return e?{contents:{kind:II.MarkupKind.Markdown,value:e.toString()}}:void 0}var MI=L(U());async function xI(t){let e=await Lp(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:MI.MarkupKind.Markdown,value:e.toString()}}:void 0}var qI=L(U());async function LI({document:t,macro:e,context:n,position:r},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:n,position:r});return vs(o,s[1].macro,s[2].macro,s[3].macro,n)}async function $I(t){let e=await LI(t,x);return e?{contents:{kind:qI.MarkupKind.Markdown,value:e.toString()}}:void 0}var FI=L(U());async function BI(t){let e=await qp(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:FI.MarkupKind.Markdown,value:e.toString()}}:void 0}var jI=L(U());async function UI(t){let e=await Fp(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:jI.MarkupKind.Markdown,value:e.toString()}}:void 0}var HI=L(U());async function VI(t){let e=await Mp(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:HI.MarkupKind.Markdown,value:e.toString()}}:void 0}var zI=L(U());async function WI({document:t,macro:e,context:n,position:r},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:n,position:r});return await Ra(o,s[1].macro,0)}async function GI(t){let e=await WI(t,x);return e?{contents:{kind:zI.MarkupKind.Markdown,value:e.toString()}}:void 0}var YI=L(U());async function KI(t){let e=await xp(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:YI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function XI({document:t,macro:e,context:n,position:r},i){if(e.macro!=="DT_PROP_BY_PHANDLE"||e.args?.length!==3)return;let s=await Ni(await i({document:t,macro:e.args[0],context:n,position:r}),e.args[1].macro);return wn(s,e.args[2].macro,n)}async function JI(t){return ht(t.context,await XI(t,x))}async function QI(t){return ht(t.context,await Bp(t,x))}var tO=L(U());var ZI=L(require("util"));async function dh(t,e,n,r){let i=t?.properties.find(o=>Z(o.name)===e);if(!i)return;let s=i?.ast.quickValues?.at(n);if(s!==void 0)return ZI.default.isDeepStrictEqual(Me(r),s)}async function eO({document:t,macro:e,context:n,position:r},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:n,position:r});return await dh(o,s[1].macro,0,s[2].macro)}async function nO(t){let e=await eO(t,x);return e!==void 0?{contents:{kind:tO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var iO=L(U());async function rO({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return await dh(o,s[1].macro,a,s[3].macro)}async function sO(t){let e=await rO(t,x);return e!==void 0?{contents:{kind:iO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var cO=L(U());async function oO(t,e,n,r){let i=await wn(t,e,r);if(i===void 0)return!1;if(n=typeof n=="number"?n:Me(n??"0"),typeof n=="number")return Array.isArray(i)?i.length<n:n===0}async function aO({document:t,macro:e,context:n,position:r},i){let s=e.args;return e.macro!=="DT_PROP_HAS_IDX"||s?.length!==3?void 0:!!await oO(await i({document:t,macro:s[0],context:n,position:r}),s[1].macro,s[2].macro,n)}async function lO(t){let e=await aO(t,x);return e===void 0?void 0:{contents:{kind:cO.MarkupKind.Markdown,value:e?"1":"0"}}}var fO=L(U());async function uO(t,e,n,r){let i=t?.properties.find(u=>Z(u.name)===e),s=i?.parent.nodeType;if(!s||!(s instanceof St)||await wn(t,e,r)===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()===n)??-1;return l===-1?void 0:l}async function dO({document:t,macro:e,context:n,position:r},i){let s=e.args;return e.macro!=="DT_PROP_HAS_NAME"||s?.length!==3?void 0:!!await uO(await i({document:t,macro:s[0],context:n,position:r}),s[1].macro,s[2].macro,n)}async function pO(t){let e=await dO(t,x);return e===void 0?void 0:{contents:{kind:fO.MarkupKind.Markdown,value:e?"1":"0"}}}async function hO(t){let e=await wp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var gO=L(U());async function mO({document:t,macro:e,context:n,position:r},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:n,position:r});return o?jp(o,s[1].macro):void 0}async function yO(t){let e=await mO(t,x);return e?{contents:{kind:gO.MarkupKind.Markdown,value:e.toString()}}:void 0}var TO=L(U());async function vO(t){let e=await Up(t,x);return e instanceof X?ht(t.context,e):e?{contents:{kind:TO.MarkupKind.Markdown,value:e.toString()}}:void 0}var uv=L(U());async function bO(t,e,n){let r=await wn(t,e,n);if(r===!0)return!0;if(!r)return;let i=r.at(-1);if(i)return r.length===1&&r[0]instanceof X?r[0]:i}async function SO({document:t,macro:e,context:n,position:r},i){if(!(e.macro!=="DT_PROP_LAST"||e.args?.length!==2))return bO(await i({document:t,macro:e.args[0],context:n,position:r}),e.args[1].macro,n)}async function _O(t){let e=await SO(t,x);if(e===!0)return{contents:{kind:uv.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof X?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:uv.MarkupKind.Markdown,value:e.toString()}}}var kO=L(U());async function PO({document:t,macro:e,context:n,position:r},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:n,position:r});return o?Ea(o,s[1].macro):void 0}async function NO(t){let e=await PO(t,x);if(e)return{contents:{kind:kO.MarkupKind.Markdown,value:e.toString()}}}var wO=L(U());async function fh(t,e,n){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[n]instanceof re)return Z(i[n].value)}async function RO({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return o?fh(o,s[1].macro,a):void 0}async function EO(t){let e=await RO(t,x);if(e)return{contents:{kind:wO.MarkupKind.Markdown,value:e.toString()}}}var CO=L(U());async function DO(t){let e=await Hp(t,x);if(e)return e instanceof X?ht(t.context,e):{contents:{kind:CO.MarkupKind.Markdown,value:e.toString()}}}var OO=L(U());async function AO(t,e,n){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[n]instanceof re)return i[n].value}async function IO({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return o?AO(o,s[1].macro,a):void 0}async function MO(t){let e=await IO(t,x);if(e)return{contents:{kind:OO.MarkupKind.Markdown,value:e.toString()}}}var LO=L(U());async function xO({document:t,macro:e,context:n,position:r},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:n,position:r});return o?Vp(o,s[1].macro):void 0}async function qO(t){let e=await xO(t,x);if(e)return{contents:{kind:LO.MarkupKind.Markdown,value:e.toString()}}}var $O=L(U());async function FO(t){let e=await Wp(t,x);if(e)return e instanceof X?ht(t.context,e):{contents:{kind:$O.MarkupKind.Markdown,value:e.toString()}}}var UO=L(U());async function BO(t,e,n){return(await fh(t,e,n))?.toUpperCase()}async function jO({document:t,macro:e,context:n,position:r},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:n,position:r}),a=Me(s[2].macro);if(typeof a=="number")return o?BO(o,s[1].macro,a):void 0}async function HO(t){let e=await jO(t,x);if(e)return{contents:{kind:UO.MarkupKind.Markdown,value:e.toString()}}}var WO=L(U());async function VO({document:t,macro:e,context:n,position:r},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:n,position:r});return o?zp(o,s[1].macro):void 0}async function zO(t){let e=await VO(t,x);if(e)return{contents:{kind:WO.MarkupKind.Markdown,value:e.toString()}}}var GO=L(U());async function YO(t){let e=await Gp(t,x);if(e)return e instanceof X?ht(t.context,e):{contents:{kind:GO.MarkupKind.Markdown,value:e.toString()}}}async function KO(t){let e=await bp(t,x);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var QO=L(U());async function XO(t,e){if(!t)return;let n=t.nodeType?.onBus;return n?Z(n)===e:!1}async function JO(t,e){let n=t.macro.args;if(t.macro.macro!=="DT_ON_BUS"||n?.length!==2)return;let r=await e({...t,macro:n[0]});return await XO(r,n[1].macro)}async function ZO(t){let e=await JO(t,x);return e!==void 0?{contents:{kind:QO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function eM(t){let e=await _p(t);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var rM=L(U());async function tM(t,e){return!!await Sp(t,e)}async function nM(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_HAS_CHOSEN"||e?.length!==1))return await tM(t.context,e[0].macro)}async function iM(t){let e=await nM(t);return e!==void 0?{contents:{kind:rM.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function OV(t){return[KO,ZO,eM,iM,$0,F0,H0,CI,V0,W0,Y0,hO,NI,cI,tI,J0,nI,oI,aI,dI].reduce((e,n)=>e.then(r=>r||n(t)),Promise.resolve(void 0))}async function MV(t){return[sO,nO,hI,VI,GI,KI,yI,xI,$I,BI,OI,TI,vI,DI,UI,SI,JI,kI,QI,lO,pO,bI,_O,yO,vO,_I,EO,NO,DO,MO,qO,FO,HO,zO,YO].reduce((e,n)=>e.then(r=>r||n(t)),Promise.resolve(void 0))}async function sM(t,e,n){if(n)try{let r=Gi(n,t.position);return await oM(r,t.position,e,n)}catch{}}async function oM(t,e,n,r){if(!t?.macro)return;let i=await OV({position:e,context:n,document:r,macro:t})||await MV({position:e,context:n,document:r,macro:t});if(i)return i;let s=await x({document:r,macro:t,context:n,position:e});if(s)return{contents:s.toMarkupContent(n.macros)};let o=await Ts(r,t.macro,e,n);if(o)return oM(o[0],o[1],n,r)}var Tc=require("path"),hP=require("fs");var dv=(t,e,n)=>{let r=t instanceof RegExp?aM(t,n):t,i=e instanceof RegExp?aM(e,n):e,s=r!==null&&i!=null&&xV(r,i,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+i.length)}},aM=(t,e)=>{let n=e.match(t);return n?n[0]:null},xV=(t,e,n)=>{let r,i,s,o,a,c=n.indexOf(t),l=n.indexOf(e,c+1),u=c;if(c>=0&&l>0){if(t===e)return[c,l];for(r=[],s=n.length;u>=0&&!a;){if(u===c)r.push(u),c=n.indexOf(t,u+1);else if(r.length===1){let d=r.pop();d!==void 0&&(a=[d,l])}else i=r.pop(),i!==void 0&&i<s&&(s=i,o=l),l=n.indexOf(e,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(a=[s,o])}return a};var cM="\0SLASH"+Math.random()+"\0",lM="\0OPEN"+Math.random()+"\0",pv="\0CLOSE"+Math.random()+"\0",uM="\0COMMA"+Math.random()+"\0",dM="\0PERIOD"+Math.random()+"\0",LV=new RegExp(cM,"g"),qV=new RegExp(lM,"g"),$V=new RegExp(pv,"g"),FV=new RegExp(uM,"g"),BV=new RegExp(dM,"g"),jV=/\\\\/g,UV=/\\{/g,HV=/\\}/g,VV=/\\,/g,WV=/\\\./g,zV=1e5;function fv(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function GV(t){return t.replace(jV,cM).replace(UV,lM).replace(HV,pv).replace(VV,uM).replace(WV,dM)}function YV(t){return t.replace(LV,"\\").replace(qV,"{").replace($V,"}").replace(FV,",").replace(BV,".")}function fM(t){if(!t)return[""];let e=[],n=dv("{","}",t);if(!n)return t.split(",");let{pre:r,body:i,post:s}=n,o=r.split(",");o[o.length-1]+="{"+i+"}";let a=fM(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function pM(t,e={}){if(!t)return[];let{max:n=zV}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),_l(GV(t),n,!0).map(YV)}function KV(t){return"{"+t+"}"}function XV(t){return/^-?0\d/.test(t)}function JV(t,e){return t<=e}function QV(t,e){return t>=e}function _l(t,e,n){let r=[],i=dv("{","}",t);if(!i)return[t];let s=i.pre,o=i.post.length?_l(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let c=s+"{"+i.body+"}"+o[a];r.push(c)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=a||c,u=i.body.indexOf(",")>=0;if(!l&&!u)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+pv+i.post,_l(t,e,!0)):[t];let d;if(l)d=i.body.split(/\.\./);else if(d=fM(i.body),d.length===1&&d[0]!==void 0&&(d=_l(d[0],e,!1).map(KV),d.length===1))return o.map(p=>i.pre+d[0]+p);let f;if(l&&d[0]!==void 0&&d[1]!==void 0){let p=fv(d[0]),m=fv(d[1]),h=Math.max(d[0].length,d[1].length),y=d.length===3&&d[2]!==void 0?Math.max(Math.abs(fv(d[2])),1):1,S=JV;m<p&&(y*=-1,S=QV);let v=d.some(XV);f=[];for(let k=p;S(k,m)&&f.length<e;k+=y){let R;if(c)R=String.fromCharCode(k),R==="\\"&&(R="");else if(R=String(k),v){let q=h-R.length;if(q>0){let O=new Array(q+1).join("0");k<0?R="-"+O+R.slice(1):R=O+R}}f.push(R)}}else{f=[];for(let p=0;p<d.length;p++)f.push.apply(f,_l(d[p],e,!1))}for(let p=0;p<f.length;p++)for(let m=0;m<o.length&&r.length<e;m++){let h=s+f[p]+o[m];(!n||l||h)&&r.push(h)}}return r}var Pl=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var ZV={"[: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]},kl=t=>t.replace(/[[\]\\-]/g,"\\$&"),eW=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),hM=t=>t.join(""),mM=(t,e)=>{let n=e;if(t.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=n+1,o=!1,a=!1,c=!1,l=!1,u=n,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===n+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[y,[S,b,v]]of Object.entries(ZV))if(t.startsWith(y,s)){if(d)return["$.",!1,t.length-n,!0];s+=y.length,v?i.push(S):r.push(S),a=a||b;continue e}}if(c=!1,d){h>d?r.push(kl(d)+"-"+kl(h)):h===d&&r.push(kl(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){r.push(kl(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}r.push(kl(h)),s++}if(u<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,t.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let h=r[0].length===2?r[0].slice(-1):r[0];return[eW(h),!1,u-n,!1]}let f="["+(l?"^":"")+hM(r)+"]",p="["+(l?"":"^")+hM(i)+"]";return[r.length&&i.length?"("+f+"|"+p+")":r.length?f:p,a,u-n,!0]};var ii=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!0}={})=>n?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 nr,tW=new Set(["!","?","+","*","@"]),hv=t=>tW.has(t),gM=t=>hv(t.type),nW=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),rW=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),iW=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),yM=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),sW="(?!(?:^|/)\\.\\.?(?:$|/))",ph="(?!\\.)",oW=new Set(["[","."]),aW=new Set(["..","."]),cW=new Set("().*{}+?[]^$\\!"),lW=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),mv="[^/]",TM=mv+"*?",vM=mv+"+?",uW=0,ho=class{type;#e;#n;#r=!1;#t=[];#o;#h;#a;#d=!1;#l;#c;#s=!1;id=++uW;get depth(){return(this.#o?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#o?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,n,r={}){this.type=e,e&&(this.#n=!0),this.#o=n,this.#e=this.#o?this.#o.#e:this,this.#l=this.#e===this?r:this.#e.#l,this.#a=this.#e===this?[]:this.#e.#a,e==="!"&&!this.#e.#d&&this.#a.push(this),this.#h=this.#o?this.#o.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#c=this.#t.map(e=>String(e)).join("")}#T(){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 n=e,r=n.#o;for(;r;){for(let i=n.#h+1;!r.type&&i<r.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[i])}n=r,r=n.#o}}return this}push(...e){for(let n of e)if(n!==""){if(typeof n!="string"&&!(n instanceof nr&&n.#o===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let e=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.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.#h===0)return!0;let e=this.#o;for(let n=0;n<this.#h;n++){let r=e.#t[n];if(!(r instanceof nr&&r.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.#t.length:0;return this.#h===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let n=new nr(this.type,e);for(let r of this.#t)n.copyIn(r);return n}static#v(e,n,r,i,s){let o=i.maxExtglobRecursion??2,a=!1,c=!1,l=-1,u=!1;if(n.type===null){let h=r,y="";for(;h<e.length;){let S=e.charAt(h++);if(a||S==="\\"){a=!a,y+=S;continue}if(c){h===l+1?(S==="^"||S==="!")&&(u=!0):S==="]"&&!(h===l+2&&u)&&(c=!1),y+=S;continue}else if(S==="["){c=!0,l=h,u=!1,y+=S;continue}if(!i.noext&&hv(S)&&e.charAt(h)==="("&&s<=o){n.push(y),y="";let v=new nr(S,n);h=nr.#v(e,v,h,i,s+1),n.push(v);continue}y+=S}return n.push(y),h}let d=r+1,f=new nr(null,n),p=[],m="";for(;d<e.length;){let h=e.charAt(d++);if(a||h==="\\"){a=!a,m+=h;continue}if(c){d===l+1?(h==="^"||h==="!")&&(u=!0):h==="]"&&!(d===l+2&&u)&&(c=!1),m+=h;continue}else if(h==="["){c=!0,l=d,u=!1,m+=h;continue}if(!i.noext&&hv(h)&&e.charAt(d)==="("&&(s<=o||n&&n.#_(h))){let S=n&&n.#_(h)?0:1;f.push(m),m="";let b=new nr(h,f);f.push(b),d=nr.#v(e,b,d,i,s+S);continue}if(h==="|"){f.push(m),m="",p.push(f),f=new nr(null,n);continue}if(h===")")return m===""&&n.#t.length===0&&(n.#s=!0),f.push(m),m="",n.push(...p,f),d;m+=h}return n.type=null,n.#n=void 0,n.#t=[e.substring(r-1)],d}#g(e){return this.#p(e,rW)}#p(e,n=nW){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#_(r.type,n)}#_(e,n=iW){return!!n.get(this.type)?.includes(e)}#m(e,n){let r=e.#t[0],i=new nr(null,r,this.options);i.#t.push(""),r.push(i),this.#k(e,n)}#k(e,n){let r=e.#t[0];this.#t.splice(n,1,...r.#t);for(let i of r.#t)typeof i=="object"&&(i.#o=this);this.#c=void 0}#N(e){return!!yM.get(this.type)?.has(e)}#y(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#N(n.type)}#P(e){let n=yM.get(this.type),r=e.#t[0],i=n?.get(r.type);if(!i)return!1;this.#t=r.#t;for(let s of this.#t)typeof s=="object"&&(s.#o=this);this.type=i,this.#c=void 0,this.#s=!1}static fromGlob(e,n={}){let r=new nr(null,void 0,n);return nr.#v(e,r,0,n,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[n,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#l.nocase&&!this.#l.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let a=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,a),{_src:n,_glob:e})}get options(){return this.#l}toRegExpSource(e){let n=e??!!this.#l.dot;if(this.#e===this&&(this.#b(),this.#T()),!gM(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(p=>typeof p!="string"),l=this.#t.map(p=>{let[m,h,y,S]=typeof p=="string"?nr.#R(p,this.#n,c):p.toRegExpSource(e);return this.#n=this.#n||y,this.#r=this.#r||S,m}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&aW.has(this.#t[0]))){let m=oW,h=n&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),y=!n&&!e&&m.has(l.charAt(0));u=h?sW:y?ph:""}let d="";return this.isEnd()&&this.#e.#d&&this.#o?.type==="!"&&(d="(?:$|\\/)"),[u+l+d,ii(l),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#f(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),l=this;return l.#t=[c],l.type=null,l.#n=void 0,[c,ii(this.toString()),!1,!1]}let o=!r||e||n||!ph?"":this.#f(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#s)a=(this.isStart()&&!n?ph:"")+vM;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?ph:"")+TM+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,ii(s),this.#n=!!this.#n,this.#r]}#b(){if(gM(this)){let e=0,n=!1;do{n=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#b(),this.#p(i)?(n=!1,this.#k(i,r)):this.#g(i)?(n=!1,this.#m(i,r)):this.#y(i)&&(n=!1,this.#P(i)))}}while(!n&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#b();this.#c=void 0}#f(e){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,i,s,o]=n.toRegExpSource(e);return this.#r=this.#r||o,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#R(e,n,r=!1){let i=!1,s="",o=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(i){i=!1,s+=(cW.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=r&&/^[*]+$/.test(e)?vM:TM,n=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?s+="\\\\":i=!0;continue}if(l==="["){let[u,d,f,p]=mM(e,c);if(f){s+=u,o=o||d,c+=f-1,n=n||p;continue}}if(l==="?"){s+=mv,n=!0;continue}s+=lW(l)}return[s,ii(e),!!n,o]}};nr=ho;var xa=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!1}={})=>n?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var Fn=(t,e,n={})=>(Pl(e),!n.nocomment&&e.charAt(0)==="#"?!1:new yr(e,n).match(t)),dW=/^\*+([^+@!?\*\[\(]*)$/,fW=t=>e=>!e.startsWith(".")&&e.endsWith(t),pW=t=>e=>e.endsWith(t),hW=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),mW=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),gW=/^\*+\.\*+$/,yW=t=>!t.startsWith(".")&&t.includes("."),TW=t=>t!=="."&&t!==".."&&t.includes("."),vW=/^\.\*+$/,bW=t=>t!=="."&&t!==".."&&t.startsWith("."),SW=/^\*+$/,_W=t=>t.length!==0&&!t.startsWith("."),PW=t=>t.length!==0&&t!=="."&&t!=="..",kW=/^\?+([^+@!?\*\[\(]*)?$/,NW=([t,e=""])=>{let n=_M([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},RW=([t,e=""])=>{let n=PM([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},wW=([t,e=""])=>{let n=PM([t]);return e?r=>n(r)&&r.endsWith(e):n},EW=([t,e=""])=>{let n=_M([t]);return e?r=>n(r)&&r.endsWith(e):n},_M=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},PM=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},kM=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",bM={win32:{sep:"\\"},posix:{sep:"/"}},CW=kM==="win32"?bM.win32.sep:bM.posix.sep;Fn.sep=CW;var Ft=Symbol("globstar **");Fn.GLOBSTAR=Ft;var DW="[^/]",AW=DW+"*?",IW="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",OW="(?:(?!(?:\\/|^)\\.).)*?",MW=(t,e={})=>n=>Fn(n,t,e);Fn.filter=MW;var Ir=(t,e={})=>Object.assign({},t,e),xW=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Fn;let e=Fn;return Object.assign((r,i,s={})=>e(r,i,Ir(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,Ir(t,s))}static defaults(i){return e.defaults(Ir(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,Ir(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Ir(t,s))}},unescape:(r,i={})=>e.unescape(r,Ir(t,i)),escape:(r,i={})=>e.escape(r,Ir(t,i)),filter:(r,i={})=>e.filter(r,Ir(t,i)),defaults:r=>e.defaults(Ir(t,r)),makeRe:(r,i={})=>e.makeRe(r,Ir(t,i)),braceExpand:(r,i={})=>e.braceExpand(r,Ir(t,i)),match:(r,i,s={})=>e.match(r,i,Ir(t,s)),sep:e.sep,GLOBSTAR:Ft})};Fn.defaults=xW;var NM=(t,e={})=>(Pl(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:pM(t,{max:e.braceExpandMax}));Fn.braceExpand=NM;var LW=(t,e={})=>new yr(t,e).makeRe();Fn.makeRe=LW;var qW=(t,e,n={})=>{let r=new yr(e,n);return t=t.filter(i=>r.match(i)),r.options.nonull&&!t.length&&t.push(e),t};Fn.match=qW;var SM=/[?*]|[+@!]\(.*?\)|\[|\]/,$W=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),yr=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,n={}){Pl(e),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=e,this.platform=n.platform||kM,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.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 n of e)if(typeof n!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),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]==="?"||!SM.test(s[2]))&&!SM.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 r=0;r<e.length;r++)for(let i=0;i<e[r].length;i++)e[r][i]==="**"&&(e[r][i]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):n>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let i=r;for(;n[i+1]==="**";)i++;i!==r&&n.splice(r,i-r)}return n})}levelOneOptimize(e){return e.map(n=>(n=n.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(n=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(n=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(n=!0,e.splice(r-1,2),r-=2)}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let o=i;for(;r[o+1]==="**";)o++;o>i&&r.splice(i+1,o-i);let a=r[i+1],c=r[i+2],l=r[i+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;n=!0,r.splice(i,1);let u=r.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<r.length-1;o++){let a=r[o];o===1&&a===""&&r[0]===""||(a==="."||a==="")&&(n=!0,r.splice(o,1),o--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let o=r[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let r=n+1;r<e.length;r++){let i=this.partsMatch(e[n],e[r],!this.preserveMultipleSlashes);if(i){e[n]=[],e[r]=i;break}}return e.filter(n=>n.length)}partsMatch(e,n,r=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<n.length;)if(e[i]===n[s])o.push(a==="b"?n[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&n[s]===e[i+1])o.push(e[i]),i++;else if(r&&n[s]==="**"&&e[i]===n[s+1])o.push(n[s]),s++;else if(e[i]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(n[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(n[s]),i++,s++}else return!1;return e.length===n.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)n=!n,r++;r&&(this.pattern=e.slice(r)),this.negate=n}matchOne(e,n,r=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),u=!l&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),d=c?3:a?0:void 0,f=u?3:l?0:void 0;if(typeof d=="number"&&typeof f=="number"){let[p,m]=[e[d],n[f]];p.toLowerCase()===m.toLowerCase()&&(n[f]=p,s=f,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),n.includes(Ft)?this.#e(e,n,r,i,s):this.#r(e,n,r,i,s)}#e(e,n,r,i,s){let o=n.indexOf(Ft,s),a=n.lastIndexOf(Ft),[c,l,u]=r?[n.slice(s,o),n.slice(o+1),[]]:[n.slice(s,o),n.slice(o+1,a),n.slice(a+1)];if(c.length){let b=e.slice(i,i+c.length);if(!this.#r(b,c,r,0,0))return!1;i+=c.length,s+=c.length}let d=0;if(u.length){if(u.length+i>e.length)return!1;let b=e.length-u.length;if(this.#r(e,u,r,b,0))d=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(b--,!this.#r(e,u,r,b,0)))return!1;d=u.length+1}}if(!l.length){let b=!!d;for(let v=i;v<e.length-d;v++){let k=String(e[v]);if(b=!0,k==="."||k===".."||!this.options.dot&&k.startsWith("."))return!1}return r||b}let f=[[[],0]],p=f[0],m=0,h=[0];for(let b of l)b===Ft?(h.push(m),p=[[],0],f.push(p)):(p[0].push(b),m++);let y=f.length-1,S=e.length-d;for(let b of f)b[1]=S-(h[y--]+b[0].length);return!!this.#n(e,f,i,0,r,0,!!d)}#n(e,n,r,i,s,o,a){let c=n[i];if(!c){for(let d=r;d<e.length;d++){a=!0;let f=e[d];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[l,u]=c;for(;r<=u;){if(this.#r(e.slice(0,r+l.length),l,s,r,0)&&o<this.maxGlobstarRecursion){let p=this.#n(e,n,r+l.length,i+1,s,o+1,a);if(p!==!1)return p}let f=e[r];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;r++}return s||null}#r(e,n,r,i,s){let o,a,c,l;for(o=i,a=s,l=e.length,c=n.length;o<l&&a<c;o++,a++){this.debug("matchOne loop");let u=n[a],d=e[o];if(this.debug(n,u,d),u===!1||u===Ft)return!1;let f;if(typeof u=="string"?(f=d===u,this.debug("string match",u,d,f)):(f=u.test(d),this.debug("pattern match",u,d,f)),!f)return!1}if(o===l&&a===c)return!0;if(o===l)return r;if(a===c)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return NM(this.pattern,this.options)}parse(e){Pl(e);let n=this.options;if(e==="**")return Ft;if(e==="")return"";let r,i=null;(r=e.match(SW))?i=n.dot?PW:_W:(r=e.match(dW))?i=(n.nocase?n.dot?mW:hW:n.dot?pW:fW)(r[1]):(r=e.match(kW))?i=(n.nocase?n.dot?RW:NW:n.dot?wW:EW)(r):(r=e.match(gW))?i=n.dot?TW:yW:(r=e.match(vW))&&(i=bW);let s=ho.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 n=this.options,r=n.noglobstar?AW:n.dot?IW:OW,i=new Set(n.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"?$W(d):d===Ft?Ft:d._src});l.forEach((d,f)=>{let p=l[f+1],m=l[f-1];d!==Ft||m===Ft||(m===void 0?p!==void 0&&p!==Ft?l[f+1]="(?:\\/|"+r+"\\/)?"+p:l[f]=r:p===void 0?l[f-1]=m+"(?:\\/|\\/"+r+")?":p!==Ft&&(l[f-1]=m+"(?:\\/|\\/"+r+"\\/)"+p,l[f+1]=Ft))});let u=l.filter(d=>d!==Ft);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,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let r=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(r.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return Fn.defaults(e).Minimatch}};Fn.AST=ho;Fn.Minimatch=yr;Fn.escape=xa;Fn.unescape=ii;var KM=require("node:url");var La=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,wM=new Set,gv=typeof process=="object"&&process?process:{},EM=(t,e,n,r)=>{typeof gv.emitWarning=="function"?gv.emitWarning(t,e,n,r):console.error(`[${n}] ${e}: ${t}`)},hh=globalThis.AbortController,RM=globalThis.AbortSignal;if(typeof hh>"u"){RM=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},hh=class{constructor(){e()}signal=new RM;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let t=gv.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,EM("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 FW=t=>!wM.has(t);var Ps=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),CM=t=>Ps(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?qa:null:null,qa=class extends Array{constructor(e){super(e),this.fill(0)}},yv=class t{heap;length;static#e=!1;static create(e){let n=CM(e);if(!n)return[];t.#e=!0;let r=new t(e,n);return t.#e=!1,r}constructor(e,n){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Nl=class t{#e;#n;#r;#t;#o;#h;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#d;#l;#c;#s;#T;#v;#g;#p;#_;#m;#k;#N;#y;#P;#b;#f;static unsafeExposeInternals(e){return{starts:e.#N,ttls:e.#y,sizes:e.#k,keyMap:e.#l,keyList:e.#c,valList:e.#s,next:e.#T,prev:e.#v,get head(){return e.#g},get tail(){return e.#p},free:e.#_,isBackgroundFetch:n=>e.#u(n),backgroundFetch:(n,r,i,s)=>e.#$(n,r,i,s),moveToTail:n=>e.#B(n),indexes:n=>e.#E(n),rindexes:n=>e.#C(n),isStale:n=>e.#S(n)}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#d}get size(){return this.#a}get fetchMethod(){return this.#o}get memoMethod(){return this.#h}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:n=0,ttl:r,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:y,memoMethod:S,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:R,ignoreFetchAbort:q}=e;if(n!==0&&!Ps(n))throw new TypeError("max option must be a nonnegative integer");let O=n?CM(n):Array;if(!O)throw new Error("invalid max value: "+n);if(this.#e=n,this.#n=p,this.maxEntrySize=m||this.#n,this.sizeCalculation=h,this.sizeCalculation){if(!this.#n&&!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(S!==void 0&&typeof S!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#h=S,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=y,this.#b=!!y,this.#l=new Map,this.#c=new Array(n).fill(void 0),this.#s=new Array(n).fill(void 0),this.#T=new O(n),this.#v=new O(n),this.#g=0,this.#p=0,this.#_=yv.create(n),this.#a=0,this.#d=0,typeof l=="function"&&(this.#r=l),typeof u=="function"?(this.#t=u,this.#m=[]):(this.#t=void 0,this.#m=void 0),this.#P=!!this.#r,this.#f=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!k,this.allowStaleOnFetchAbort=!!R,this.ignoreFetchAbort=!!q,this.maxEntrySize!==0){if(this.#n!==0&&!Ps(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Ps(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=Ps(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Ps(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(this.#e===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#n){let B="LRU_CACHE_UNBOUNDED";FW(B)&&(wM.add(B),EM("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,t))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#R(){let e=new qa(this.#e),n=new qa(this.#e);this.#y=e,this.#N=n,this.#I=(s,o,a=La.now())=>{if(n[s]=o!==0?a:0,e[s]=o,o!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#S(s)&&this.#A(this.#c[s],"expire")},o+1);c.unref&&c.unref()}},this.#w=s=>{n[s]=e[s]!==0?La.now():0},this.#i=(s,o)=>{if(e[o]){let a=e[o],c=n[o];if(!a||!c)return;s.ttl=a,s.start=c,s.now=r||i();let l=s.now-c;s.remainingTTL=a-l}};let r=0,i=()=>{let s=La.now();if(this.ttlResolution>0){r=s;let o=setTimeout(()=>r=0,this.ttlResolution);o.unref&&o.unref()}return s};this.getRemainingTTL=s=>{let o=this.#l.get(s);if(o===void 0)return 0;let a=e[o],c=n[o];if(!a||!c)return 1/0;let l=(r||i())-c;return a-l},this.#S=s=>{let o=n[s],a=e[s];return!!a&&!!o&&(r||i())-o>a}}#w=()=>{};#i=()=>{};#I=()=>{};#S=()=>!1;#D(){let e=new qa(this.#e);this.#d=0,this.#k=e,this.#O=n=>{this.#d-=e[n],e[n]=0},this.#x=(n,r,i,s)=>{if(this.#u(r))return 0;if(!Ps(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,n),!Ps(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.#M=(n,r,i)=>{if(e[n]=r,this.#n){let s=this.#n-e[n];for(;this.#d>s;)this.#q(!0)}this.#d+=e[n],i&&(i.entrySize=r,i.totalCalculatedSize=this.#d)}}#O=e=>{};#M=(e,n,r)=>{};#x=(e,n,r,i)=>{if(r||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 n=this.#p;!(!this.#L(n)||((e||!this.#S(n))&&(yield n),n===this.#g));)n=this.#v[n]}*#C({allowStale:e=this.allowStale}={}){if(this.#a)for(let n=this.#g;!(!this.#L(n)||((e||!this.#S(n))&&(yield n),n===this.#p));)n=this.#T[n]}#L(e){return e!==void 0&&this.#l.get(this.#c[e])===e}*entries(){for(let e of this.#E())this.#s[e]!==void 0&&this.#c[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#c[e],this.#s[e]])}*rentries(){for(let e of this.#C())this.#s[e]!==void 0&&this.#c[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#c[e],this.#s[e]])}*keys(){for(let e of this.#E()){let n=this.#c[e];n!==void 0&&!this.#u(this.#s[e])&&(yield n)}}*rkeys(){for(let e of this.#C()){let n=this.#c[e];n!==void 0&&!this.#u(this.#s[e])&&(yield n)}}*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.#C())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,n={}){for(let r of this.#E()){let i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#c[r],this))return this.get(this.#c[r],n)}}forEach(e,n=this){for(let r of this.#E()){let i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(n,s,this.#c[r],this)}}rforEach(e,n=this){for(let r of this.#C()){let i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(n,s,this.#c[r],this)}}purgeStale(){let e=!1;for(let n of this.#C({allowStale:!0}))this.#S(n)&&(this.#A(this.#c[n],"expire"),e=!0);return e}info(e){let n=this.#l.get(e);if(n===void 0)return;let r=this.#s[n],i=this.#u(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#y&&this.#N){let o=this.#y[n],a=this.#N[n];if(o&&a){let c=o-(La.now()-a);s.ttl=c,s.start=Date.now()}}return this.#k&&(s.size=this.#k[n]),s}dump(){let e=[];for(let n of this.#E({allowStale:!0})){let r=this.#c[n],i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let o={value:s};if(this.#y&&this.#N){o.ttl=this.#y[n];let a=La.now()-this.#N[n];o.start=Math.floor(Date.now()-a)}this.#k&&(o.size=this.#k[n]),e.unshift([r,o])}return e}load(e){this.clear();for(let[n,r]of e){if(r.start){let i=Date.now()-r.start;r.start=La.now()-i}this.set(n,r.value,r)}}set(e,n,r={}){if(n===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=r,{noUpdateTTL:l=this.noUpdateTTL}=r,u=this.#x(e,n,r.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.#l.get(e);if(d===void 0)d=this.#a===0?this.#p:this.#_.length!==0?this.#_.pop():this.#a===this.#e?this.#q(!1):this.#a,this.#c[d]=e,this.#s[d]=n,this.#l.set(e,d),this.#T[this.#p]=d,this.#v[d]=this.#p,this.#p=d,this.#a++,this.#M(d,u,c),c&&(c.set="add"),l=!1;else{this.#B(d);let f=this.#s[d];if(n!==f){if(this.#b&&this.#u(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=f;p!==void 0&&!o&&(this.#P&&this.#r?.(p,e,"set"),this.#f&&this.#m?.push([p,e,"set"]))}else o||(this.#P&&this.#r?.(f,e,"set"),this.#f&&this.#m?.push([f,e,"set"]));if(this.#O(d),this.#M(d,u,c),this.#s[d]=n,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.#y&&this.#R(),this.#y&&(l||this.#I(d,i,s),c&&this.#i(c,d)),!o&&this.#f&&this.#m){let f=this.#m,p;for(;p=f?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#a;){let e=this.#s[this.#g];if(this.#q(!0),this.#u(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#m){let e=this.#m,n;for(;n=e?.shift();)this.#t?.(...n)}}}#q(e){let n=this.#g,r=this.#c[n],i=this.#s[n];return this.#b&&this.#u(i)?i.__abortController.abort(new Error("evicted")):(this.#P||this.#f)&&(this.#P&&this.#r?.(i,r,"evict"),this.#f&&this.#m?.push([i,r,"evict"])),this.#O(n),e&&(this.#c[n]=void 0,this.#s[n]=void 0,this.#_.push(n)),this.#a===1?(this.#g=this.#p=0,this.#_.length=0):this.#g=this.#T[n],this.#l.delete(r),this.#a--,n}has(e,n={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=n,s=this.#l.get(e);if(s!==void 0){let o=this.#s[s];if(this.#u(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#S(s))i&&(i.has="stale",this.#i(i,s));else return r&&this.#w(s),i&&(i.has="hit",this.#i(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,n={}){let{allowStale:r=this.allowStale}=n,i=this.#l.get(e);if(i===void 0||!r&&this.#S(i))return;let s=this.#s[i];return this.#u(s)?s.__staleWhileFetching:s}#$(e,n,r,i){let s=n===void 0?void 0:this.#s[n];if(this.#u(s))return s;let o=new hh,{signal:a}=r;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:r,context:i},l=(h,y=!1)=>{let{aborted:S}=o.signal,b=r.ignoreFetchAbort&&h!==void 0;if(r.status&&(S&&!y?(r.status.fetchAborted=!0,r.status.fetchError=o.signal.reason,b&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),S&&!b&&!y)return d(o.signal.reason);let v=p;return this.#s[n]===p&&(h===void 0?v.__staleWhileFetching?this.#s[n]=v.__staleWhileFetching:this.#A(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,h,c.options))),h},u=h=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=h),d(h)),d=h=>{let{aborted:y}=o.signal,S=y&&r.allowStaleOnFetchAbort,b=S||r.allowStaleOnFetchRejection,v=b||r.noDeleteOnFetchRejection,k=p;if(this.#s[n]===p&&(!v||k.__staleWhileFetching===void 0?this.#A(e,"fetch"):S||(this.#s[n]=k.__staleWhileFetching)),b)return r.status&&k.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),k.__staleWhileFetching;if(k.__returned===k)throw h},f=(h,y)=>{let S=this.#o?.(e,s,c);S&&S instanceof Promise&&S.then(b=>h(b===void 0?void 0:b),y),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(h(void 0),r.allowStaleOnFetchAbort&&(h=b=>l(b,!0)))})};r.status&&(r.status.fetchDispatched=!0);let p=new Promise(f).then(l,u),m=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return n===void 0?(this.set(e,m,{...c.options,status:void 0}),n=this.#l.get(e)):this.#s[n]=m,m}#u(e){if(!this.#b)return!1;let n=e;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof hh}async fetch(e,n={}){let{allowStale:r=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:y=!1,status:S,signal:b}=n;if(!this.#b)return S&&(S.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:S});let v={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:p,status:S,signal:b},k=this.#l.get(e);if(k===void 0){S&&(S.fetch="miss");let R=this.#$(e,k,v,h);return R.__returned=R}else{let R=this.#s[k];if(this.#u(R)){let Qe=r&&R.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",Qe&&(S.returnedStale=!0)),Qe?R.__staleWhileFetching:R.__returned=R}let q=this.#S(k);if(!y&&!q)return S&&(S.fetch="hit"),this.#B(k),i&&this.#w(k),S&&this.#i(S,k),R;let O=this.#$(e,k,v,h),Pe=O.__staleWhileFetching!==void 0&&r;return S&&(S.fetch=q?"stale":"refresh",Pe&&q&&(S.returnedStale=!0)),Pe?O.__staleWhileFetching:O.__returned=O}}async forceFetch(e,n={}){let r=await this.fetch(e,n);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,n={}){let r=this.#h;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=n,a=this.get(e,o);if(!s&&a!==void 0)return a;let c=r(e,a,{options:o,context:i});return this.set(e,c,o),c}get(e,n={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=n,a=this.#l.get(e);if(a!==void 0){let c=this.#s[a],l=this.#u(c);return o&&this.#i(o,a),this.#S(a)?(o&&(o.get="stale"),l?(o&&r&&c.__staleWhileFetching!==void 0&&(o.returnedStale=!0),r?c.__staleWhileFetching:void 0):(s||this.#A(e,"expire"),o&&r&&(o.returnedStale=!0),r?c:void 0)):(o&&(o.get="hit"),l?c.__staleWhileFetching:(this.#B(a),i&&this.#w(a),c))}else o&&(o.get="miss")}#F(e,n){this.#v[n]=e,this.#T[e]=n}#B(e){e!==this.#p&&(e===this.#g?this.#g=this.#T[e]:this.#F(this.#v[e],this.#T[e]),this.#F(this.#p,e),this.#p=e)}delete(e){return this.#A(e,"delete")}#A(e,n){let r=!1;if(this.#a!==0){let i=this.#l.get(e);if(i!==void 0)if(r=!0,this.#a===1)this.#j(n);else{this.#O(i);let s=this.#s[i];if(this.#u(s)?s.__abortController.abort(new Error("deleted")):(this.#P||this.#f)&&(this.#P&&this.#r?.(s,e,n),this.#f&&this.#m?.push([s,e,n])),this.#l.delete(e),this.#c[i]=void 0,this.#s[i]=void 0,i===this.#p)this.#p=this.#v[i];else if(i===this.#g)this.#g=this.#T[i];else{let o=this.#v[i];this.#T[o]=this.#T[i];let a=this.#T[i];this.#v[a]=this.#v[i]}this.#a--,this.#_.push(i)}}if(this.#f&&this.#m?.length){let i=this.#m,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#j("delete")}#j(e){for(let n of this.#C({allowStale:!0})){let r=this.#s[n];if(this.#u(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#c[n];this.#P&&this.#r?.(r,i,e),this.#f&&this.#m?.push([r,i,e])}}if(this.#l.clear(),this.#s.fill(void 0),this.#c.fill(void 0),this.#y&&this.#N&&(this.#y.fill(0),this.#N.fill(0)),this.#k&&this.#k.fill(0),this.#g=0,this.#p=0,this.#_.length=0,this.#d=0,this.#a=0,this.#f&&this.#m){let n=this.#m,r;for(;r=n?.shift();)this.#t?.(...r)}}};var Ba=require("node:path"),FM=require("node:url"),Di=require("fs"),KW=L(require("node:fs"),1),Rs=require("node:fs/promises");var Sh=require("node:events"),kv=L(require("node:stream"),1),MM=require("node:string_decoder"),DM=typeof process=="object"&&process?process:{stdout:null,stderr:null},BW=t=>!!t&&typeof t=="object"&&(t instanceof Ns||t instanceof kv.default||jW(t)||UW(t)),jW=t=>!!t&&typeof t=="object"&&t instanceof Sh.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==kv.default.Writable.prototype.pipe,UW=t=>!!t&&typeof t=="object"&&t instanceof Sh.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",Xi=Symbol("EOF"),Ji=Symbol("maybeEmitEnd"),ks=Symbol("emittedEnd"),mh=Symbol("emittingEnd"),Rl=Symbol("emittedError"),gh=Symbol("closed"),AM=Symbol("read"),yh=Symbol("flush"),IM=Symbol("flushChunk"),si=Symbol("encoding"),$a=Symbol("decoder"),an=Symbol("flowing"),wl=Symbol("paused"),Fa=Symbol("resume"),cn=Symbol("buffer"),Bn=Symbol("pipes"),ln=Symbol("bufferLength"),Tv=Symbol("bufferPush"),Th=Symbol("bufferShift"),En=Symbol("objectMode"),Bt=Symbol("destroyed"),vv=Symbol("error"),bv=Symbol("emitData"),OM=Symbol("emitEnd"),Sv=Symbol("emitEnd2"),Ei=Symbol("async"),_v=Symbol("abort"),vh=Symbol("aborted"),El=Symbol("signal"),mo=Symbol("dataListeners"),Tr=Symbol("discarded"),Cl=t=>Promise.resolve().then(t),HW=t=>t(),VW=t=>t==="end"||t==="finish"||t==="prefinish",WW=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,zW=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),bh=class{src;dest;opts;ondrain;constructor(e,n,r){this.src=e,this.dest=n,this.opts=r,this.ondrain=()=>e[Fa](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Pv=class extends bh{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,n,r){super(e,n,r),this.proxyErrors=i=>n.emit("error",i),e.on("error",this.proxyErrors)}},GW=t=>!!t.objectMode,YW=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",Ns=class extends Sh.EventEmitter{[an]=!1;[wl]=!1;[Bn]=[];[cn]=[];[En];[si];[Ei];[$a];[Xi]=!1;[ks]=!1;[mh]=!1;[gh]=!1;[Rl]=null;[ln]=0;[Bt]=!1;[El];[vh]=!1;[mo]=0;[Tr]=!1;writable=!0;readable=!0;constructor(...e){let n=e[0]||{};if(super(),n.objectMode&&typeof n.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");GW(n)?(this[En]=!0,this[si]=null):YW(n)?(this[si]=n.encoding,this[En]=!1):(this[En]=!1,this[si]=null),this[Ei]=!!n.async,this[$a]=this[si]?new MM.StringDecoder(this[si]):null,n&&n.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[cn]}),n&&n.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Bn]});let{signal:r}=n;r&&(this[El]=r,r.aborted?this[_v]():r.addEventListener("abort",()=>this[_v]()))}get bufferLength(){return this[ln]}get encoding(){return this[si]}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[En]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ei]}set async(e){this[Ei]=this[Ei]||!!e}[_v](){this[vh]=!0,this.emit("abort",this[El]?.reason),this.destroy(this[El]?.reason)}get aborted(){return this[vh]}set aborted(e){}write(e,n,r){if(this[vh])return!1;if(this[Xi])throw new Error("write after end");if(this[Bt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof n=="function"&&(r=n,n="utf8"),n||(n="utf8");let i=this[Ei]?Cl:HW;if(!this[En]&&!Buffer.isBuffer(e)){if(zW(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(WW(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[En]?(this[an]&&this[ln]!==0&&this[yh](!0),this[an]?this.emit("data",e):this[Tv](e),this[ln]!==0&&this.emit("readable"),r&&i(r),this[an]):e.length?(typeof e=="string"&&!(n===this[si]&&!this[$a]?.lastNeed)&&(e=Buffer.from(e,n)),Buffer.isBuffer(e)&&this[si]&&(e=this[$a].write(e)),this[an]&&this[ln]!==0&&this[yh](!0),this[an]?this.emit("data",e):this[Tv](e),this[ln]!==0&&this.emit("readable"),r&&i(r),this[an]):(this[ln]!==0&&this.emit("readable"),r&&i(r),this[an])}read(e){if(this[Bt])return null;if(this[Tr]=!1,this[ln]===0||e===0||e&&e>this[ln])return this[Ji](),null;this[En]&&(e=null),this[cn].length>1&&!this[En]&&(this[cn]=[this[si]?this[cn].join(""):Buffer.concat(this[cn],this[ln])]);let n=this[AM](e||null,this[cn][0]);return this[Ji](),n}[AM](e,n){if(this[En])this[Th]();else{let r=n;e===r.length||e===null?this[Th]():typeof r=="string"?(this[cn][0]=r.slice(e),n=r.slice(0,e),this[ln]-=e):(this[cn][0]=r.subarray(e),n=r.subarray(0,e),this[ln]-=e)}return this.emit("data",n),!this[cn].length&&!this[Xi]&&this.emit("drain"),n}end(e,n,r){return typeof e=="function"&&(r=e,e=void 0),typeof n=="function"&&(r=n,n="utf8"),e!==void 0&&this.write(e,n),r&&this.once("end",r),this[Xi]=!0,this.writable=!1,(this[an]||!this[wl])&&this[Ji](),this}[Fa](){this[Bt]||(!this[mo]&&!this[Bn].length&&(this[Tr]=!0),this[wl]=!1,this[an]=!0,this.emit("resume"),this[cn].length?this[yh]():this[Xi]?this[Ji]():this.emit("drain"))}resume(){return this[Fa]()}pause(){this[an]=!1,this[wl]=!0,this[Tr]=!1}get destroyed(){return this[Bt]}get flowing(){return this[an]}get paused(){return this[wl]}[Tv](e){this[En]?this[ln]+=1:this[ln]+=e.length,this[cn].push(e)}[Th](){return this[En]?this[ln]-=1:this[ln]-=this[cn][0].length,this[cn].shift()}[yh](e=!1){do;while(this[IM](this[Th]())&&this[cn].length);!e&&!this[cn].length&&!this[Xi]&&this.emit("drain")}[IM](e){return this.emit("data",e),this[an]}pipe(e,n){if(this[Bt])return e;this[Tr]=!1;let r=this[ks];return n=n||{},e===DM.stdout||e===DM.stderr?n.end=!1:n.end=n.end!==!1,n.proxyErrors=!!n.proxyErrors,r?n.end&&e.end():(this[Bn].push(n.proxyErrors?new Pv(this,e,n):new bh(this,e,n)),this[Ei]?Cl(()=>this[Fa]()):this[Fa]()),e}unpipe(e){let n=this[Bn].find(r=>r.dest===e);n&&(this[Bn].length===1?(this[an]&&this[mo]===0&&(this[an]=!1),this[Bn]=[]):this[Bn].splice(this[Bn].indexOf(n),1),n.unpipe())}addListener(e,n){return this.on(e,n)}on(e,n){let r=super.on(e,n);if(e==="data")this[Tr]=!1,this[mo]++,!this[Bn].length&&!this[an]&&this[Fa]();else if(e==="readable"&&this[ln]!==0)super.emit("readable");else if(VW(e)&&this[ks])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Rl]){let i=n;this[Ei]?Cl(()=>i.call(this,this[Rl])):i.call(this,this[Rl])}return r}removeListener(e,n){return this.off(e,n)}off(e,n){let r=super.off(e,n);return e==="data"&&(this[mo]=this.listeners("data").length,this[mo]===0&&!this[Tr]&&!this[Bn].length&&(this[an]=!1)),r}removeAllListeners(e){let n=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[mo]=0,!this[Tr]&&!this[Bn].length&&(this[an]=!1)),n}get emittedEnd(){return this[ks]}[Ji](){!this[mh]&&!this[ks]&&!this[Bt]&&this[cn].length===0&&this[Xi]&&(this[mh]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[gh]&&this.emit("close"),this[mh]=!1)}emit(e,...n){let r=n[0];if(e!=="error"&&e!=="close"&&e!==Bt&&this[Bt])return!1;if(e==="data")return!this[En]&&!r?!1:this[Ei]?(Cl(()=>this[bv](r)),!0):this[bv](r);if(e==="end")return this[OM]();if(e==="close"){if(this[gh]=!0,!this[ks]&&!this[Bt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Rl]=r,super.emit(vv,r);let s=!this[El]||this.listeners("error").length?super.emit("error",r):!1;return this[Ji](),s}else if(e==="resume"){let s=super.emit("resume");return this[Ji](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...n);return this[Ji](),i}[bv](e){for(let r of this[Bn])r.dest.write(e)===!1&&this.pause();let n=this[Tr]?!1:super.emit("data",e);return this[Ji](),n}[OM](){return this[ks]?!1:(this[ks]=!0,this.readable=!1,this[Ei]?(Cl(()=>this[Sv]()),!0):this[Sv]())}[Sv](){if(this[$a]){let n=this[$a].end();if(n){for(let r of this[Bn])r.dest.write(n);this[Tr]||super.emit("data",n)}}for(let n of this[Bn])n.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[En]||(e.dataLength=0);let n=this.promise();return this.on("data",r=>{e.push(r),this[En]||(e.dataLength+=r.length)}),await n,e}async concat(){if(this[En])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[si]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,n)=>{this.on(Bt,()=>n(new Error("stream destroyed"))),this.on("error",r=>n(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Tr]=!1;let e=!1,n=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return n();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Xi])return n();let s,o,a=d=>{this.off("data",c),this.off("end",l),this.off(Bt,u),n(),o(d)},c=d=>{this.off("error",a),this.off("end",l),this.off(Bt,u),this.pause(),s({value:d,done:!!this[Xi]})},l=()=>{this.off("error",a),this.off("data",c),this.off(Bt,u),n(),s({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((d,f)=>{o=f,s=d,this.once(Bt,u),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:n,return:n,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Tr]=!1;let e=!1,n=()=>(this.pause(),this.off(vv,n),this.off(Bt,n),this.off("end",n),e=!0,{done:!0,value:void 0}),r=()=>{if(e)return n();let i=this.read();return i===null?n():{done:!1,value:i}};return this.once("end",n),this.once(vv,n),this.once(Bt,n),{next:r,throw:n,return:n,[Symbol.iterator](){return this}}}destroy(e){if(this[Bt])return e?this.emit("error",e):this.emit(Bt),this;this[Bt]=!0,this[Tr]=!0,this[cn].length=0,this[ln]=0;let n=this;return typeof n.close=="function"&&!this[gh]&&n.close(),e?this.emit("error",e):this.emit(Bt),this}static get isStream(){return BW}};var XW=Di.realpathSync.native,Al={lstatSync:Di.lstatSync,readdir:Di.readdir,readdirSync:Di.readdirSync,readlinkSync:Di.readlinkSync,realpathSync:XW,promises:{lstat:Rs.lstat,readdir:Rs.readdir,readlink:Rs.readlink,realpath:Rs.realpath}},BM=t=>!t||t===Al||t===KW?Al:{...Al,...t,promises:{...Al.promises,...t.promises||{}}},jM=/^\\\\\?\\([a-z]:)\\?$/i,JW=t=>t.replace(/\//g,"\\").replace(jM,"$1\\"),QW=/[\\\/]/,Mr=0,UM=1,HM=2,Ci=4,VM=6,WM=8,go=10,zM=12,Or=15,Dl=~Or,Nv=16,xM=32,Il=64,oi=128,_h=256,kh=512,LM=Il|oi|kh,ZW=1023,Rv=t=>t.isFile()?WM:t.isDirectory()?Ci:t.isSymbolicLink()?go:t.isCharacterDevice()?HM:t.isBlockDevice()?VM:t.isSocket()?zM:t.isFIFO()?UM:Mr,qM=new Map,Ol=t=>{let e=qM.get(t);if(e)return e;let n=t.normalize("NFKD");return qM.set(t,n),n},$M=new Map,Ph=t=>{let e=$M.get(t);if(e)return e;let n=Ol(t.toLowerCase());return $M.set(t,n),n},Nh=class extends Nl{constructor(){super({max:256})}},wv=class extends Nl{constructor(e=16*1024){super({maxSize:e,sizeCalculation:n=>n.length+1})}},GM=Symbol("PathScurry setAsCwd"),Cn=class{name;root;roots;parent;nocase;isCWD=!1;#e;#n;get dev(){return this.#n}#r;get mode(){return this.#r}#t;get nlink(){return this.#t}#o;get uid(){return this.#o}#h;get gid(){return this.#h}#a;get rdev(){return this.#a}#d;get blksize(){return this.#d}#l;get ino(){return this.#l}#c;get size(){return this.#c}#s;get blocks(){return this.#s}#T;get atimeMs(){return this.#T}#v;get mtimeMs(){return this.#v}#g;get ctimeMs(){return this.#g}#p;get birthtimeMs(){return this.#p}#_;get atime(){return this.#_}#m;get mtime(){return this.#m}#k;get ctime(){return this.#k}#N;get birthtime(){return this.#N}#y;#P;#b;#f;#R;#w;#i;#I;#S;#D;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,n=Mr,r,i,s,o,a){this.name=e,this.#y=s?Ph(e):Ol(e),this.#i=n&ZW,this.nocase=s,this.roots=i,this.root=r||this,this.#I=o,this.#b=a.fullpath,this.#R=a.relative,this.#w=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=BM(a.fs)}depth(){return this.#P!==void 0?this.#P:this.parent?this.#P=this.parent.depth()+1:this.#P=0}childrenCache(){return this.#I}resolve(e){if(!e)return this;let n=this.getRootString(e),i=e.substring(n.length).split(this.splitSep);return n?this.getRoot(n).#O(i):this.#O(i)}#O(e){let n=this;for(let r of e)n=n.child(r);return n}children(){let e=this.#I.get(this);if(e)return e;let n=Object.assign([],{provisional:0});return this.#I.set(this,n),this.#i&=~Nv,n}child(e,n){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Ph(e):Ol(e);for(let c of r)if(c.#y===i)return c;let s=this.parent?this.sep:"",o=this.#b?this.#b+s+e:void 0,a=this.newChild(e,Mr,{...n,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=oi),r.push(a),a}relative(){if(this.isCWD)return"";if(this.#R!==void 0)return this.#R;let e=this.name,n=this.parent;if(!n)return this.#R=this.name;let r=n.relative();return r+(!r||!n.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let e=this.name,n=this.parent;if(!n)return this.#w=this.fullpathPosix();let r=n.relativePosix();return r+(!r||!n.parent?"":"/")+e}fullpath(){if(this.#b!==void 0)return this.#b;let e=this.name,n=this.parent;if(!n)return this.#b=this.name;let i=n.fullpath()+(n.parent?this.sep:"")+e;return this.#b=i}fullpathPosix(){if(this.#f!==void 0)return this.#f;if(this.sep==="/")return this.#f=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#f=`//?/${i}`:this.#f=i}let e=this.parent,n=e.fullpathPosix(),r=n+(!n||!e.parent?"":"/")+this.name;return this.#f=r}isUnknown(){return(this.#i&Or)===Mr}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&Or)===WM}isDirectory(){return(this.#i&Or)===Ci}isCharacterDevice(){return(this.#i&Or)===HM}isBlockDevice(){return(this.#i&Or)===VM}isFIFO(){return(this.#i&Or)===UM}isSocket(){return(this.#i&Or)===zM}isSymbolicLink(){return(this.#i&go)===go}lstatCached(){return this.#i&xM?this:void 0}readlinkCached(){return this.#S}realpathCached(){return this.#D}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#S)return!0;if(!this.parent)return!1;let e=this.#i⩔return!(e!==Mr&&e!==go||this.#i&_h||this.#i&oi)}calledReaddir(){return!!(this.#i&Nv)}isENOENT(){return!!(this.#i&oi)}isNamed(e){return this.nocase?this.#y===Ph(e):this.#y===Ol(e)}async readlink(){let e=this.#S;if(e)return e;if(this.canReadlink()&&this.parent)try{let n=await this.#e.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(n);if(r)return this.#S=r}catch(n){this.#u(n.code);return}}readlinkSync(){let e=this.#S;if(e)return e;if(this.canReadlink()&&this.parent)try{let n=this.#e.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(n);if(r)return this.#S=r}catch(n){this.#u(n.code);return}}#M(e){this.#i|=Nv;for(let n=e.provisional;n<e.length;n++){let r=e[n];r&&r.#x()}}#x(){this.#i&oi||(this.#i=(this.#i|oi)&Dl,this.#E())}#E(){let e=this.children();e.provisional=0;for(let n of e)n.#x()}#C(){this.#i|=kh,this.#L()}#L(){if(this.#i&Il)return;let e=this.#i;(e&Or)===Ci&&(e&=Dl),this.#i=e|Il,this.#E()}#q(e=""){e==="ENOTDIR"||e==="EPERM"?this.#L():e==="ENOENT"?this.#x():this.children().provisional=0}#$(e=""){e==="ENOTDIR"?this.parent.#L():e==="ENOENT"&&this.#x()}#u(e=""){let n=this.#i;n|=_h,e==="ENOENT"&&(n|=oi),(e==="EINVAL"||e==="UNKNOWN")&&(n&=Dl),this.#i=n,e==="ENOTDIR"&&this.parent&&this.parent.#L()}#F(e,n){return this.#A(e,n)||this.#B(e,n)}#B(e,n){let r=Rv(e),i=this.newChild(e.name,r,{parent:this}),s=i.#i⩔return s!==Ci&&s!==go&&s!==Mr&&(i.#i|=Il),n.unshift(i),n.provisional++,i}#A(e,n){for(let r=n.provisional;r<n.length;r++){let i=n[r];if((this.nocase?Ph(e.name):Ol(e.name))===i.#y)return this.#j(e,i,r,n)}}#j(e,n,r,i){let s=n.name;return n.#i=n.#i&Dl|Rv(e),s!==e.name&&(n.name=e.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(n)),i.provisional++,n}async lstat(){if((this.#i&oi)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#$(e.code)}}lstatSync(){if((this.#i&oi)===0)try{return this.#W(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#$(e.code)}}#W(e){let{atime:n,atimeMs:r,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:y,rdev:S,size:b,uid:v}=e;this.#_=n,this.#T=r,this.#N=i,this.#p=s,this.#d=o,this.#s=a,this.#k=c,this.#g=l,this.#n=u,this.#h=d,this.#l=f,this.#r=p,this.#m=m,this.#v=h,this.#t=y,this.#a=S,this.#c=b,this.#o=v;let k=Rv(e);this.#i=this.#i&Dl|k|xM,k!==Mr&&k!==Ci&&k!==go&&(this.#i|=Il)}#H=[];#V=!1;#z(e){this.#V=!1;let n=this.#H.slice();this.#H.length=0,n.forEach(r=>r(null,e))}readdirCB(e,n=!1){if(!this.canReaddir()){n?e(null,[]):queueMicrotask(()=>e(null,[]));return}let r=this.children();if(this.calledReaddir()){let s=r.slice(0,r.provisional);n?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),r.provisional=0;else{for(let a of o)this.#F(a,r);this.#M(r)}this.#z(r.slice(0,r.provisional))})}#U;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let n=this.fullpath();if(this.#U)await this.#U;else{let r=()=>{};this.#U=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(n,{withFileTypes:!0}))this.#F(i,e);this.#M(e)}catch(i){this.#q(i.code),e.provisional=0}this.#U=void 0,r()}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 n=this.fullpath();try{for(let r of this.#e.readdirSync(n,{withFileTypes:!0}))this.#F(r,e);this.#M(e)}catch(r){this.#q(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&LM)return!1;let e=Or&this.#i;return e===Mr||e===Ci||e===go}shouldWalk(e,n){return(this.#i&Ci)===Ci&&!(this.#i&LM)&&!e.has(this)&&(!n||n(this))}async realpath(){if(this.#D)return this.#D;if(!((kh|_h|oi)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#D=this.resolve(e)}catch{this.#C()}}realpathSync(){if(this.#D)return this.#D;if(!((kh|_h|oi)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#D=this.resolve(e)}catch{this.#C()}}[GM](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let n=new Set([]),r=[],i=this;for(;i&&i.parent;)n.add(i),i.#R=r.join(this.sep),i.#w=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!n.has(i);)i.#R=void 0,i.#w=void 0,i=i.parent}},Rh=class t extends Cn{sep="\\";splitSep=QW;constructor(e,n=Mr,r,i,s,o,a){super(e,n,r,i,s,o,a)}newChild(e,n=Mr,r={}){return new t(e,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return Ba.win32.parse(e).root}getRoot(e){if(e=JW(e.toUpperCase()),e===this.root.name)return this.root;for(let[n,r]of Object.entries(this.roots))if(this.sameRoot(e,n))return this.roots[e]=r;return this.roots[e]=new ja(e,this).root}sameRoot(e,n=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(jM,"$1\\"),e===n}},wh=class t extends Cn{splitSep="/";sep="/";constructor(e,n=Mr,r,i,s,o,a){super(e,n,r,i,s,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,n=Mr,r={}){return new t(e,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}},Eh=class{root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),n,r,{nocase:i,childrenCacheSize:s=16*1024,fs:o=Al}={}){this.#t=BM(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,FM.fileURLToPath)(e));let a=n.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new Nh,this.#n=new Nh,this.#r=new wv(s);let c=a.substring(this.rootPath.length).split(r);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.#t),this.roots[this.rootPath]=this.root;let l=this.root,u=c.length-1,d=n.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.#r}resolve(...e){let n="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(n=n?`${o}/${n}`:o,this.isAbsolute(o)))break}let r=this.#e.get(n);if(r!==void 0)return r;let i=this.cwd.resolve(n).fullpath();return this.#e.set(n,i),i}resolvePosix(...e){let n="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(n=n?`${o}/${n}`:o,this.isAbsolute(o)))break}let r=this.#n.get(n);if(r!==void 0)return r;let i=this.cwd.resolve(n).fullpathPosix();return this.#n.set(n,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,n={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r}=n;if(e.canReaddir()){let i=await e.readdir();return r?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,n={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0}=n;return e.canReaddir()?r?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:n}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e.withFileTypes,e=this.cwd);let r=await e.readlink();return n?r:r?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:n}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e.withFileTypes,e=this.cwd);let r=e.readlinkSync();return n?r:r?.fullpath()}async realpath(e=this.cwd,{withFileTypes:n}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e.withFileTypes,e=this.cwd);let r=await e.realpath();return n?r:r?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:n}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e.withFileTypes,e=this.cwd);let r=e.realpathSync();return n?r:r?.fullpath()}async walk(e=this.cwd,n={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=n,a=[];(!s||s(e))&&a.push(r?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 y=()=>{--h===0&&f()};for(let S of m)(!s||s(S))&&a.push(r?S:S.fullpath()),i&&S.isSymbolicLink()?S.realpath().then(b=>b?.isUnknown()?b.lstat():b).then(b=>b?.shouldWalk(c,o)?l(b,y):y()):S.shouldWalk(c,o)?l(S,y):y()},!0)},u=e;return new Promise((d,f)=>{l(u,p=>{if(p)return f(p);d(a)})})}walkSync(e=this.cwd,n={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=n,a=[];(!s||s(e))&&a.push(r?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(r?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,n={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd),this.stream(e,n)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,n={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=n;(!s||s(e))&&(yield r?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 r?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,n={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=n,a=new Ns({objectMode:!0});(!s||s(e))&&a.write(r?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=(y,S,b=!1)=>{if(y)return a.emit("error",y);if(i&&!b){let v=[];for(let k of S)k.isSymbolicLink()&&v.push(k.realpath().then(R=>R?.isUnknown()?R.lstat():R));if(v.length){Promise.all(v).then(()=>m(null,S,!0));return}}for(let v of S)v&&(!s||s(v))&&(a.write(r?v:v.fullpath())||(f=!0));u--;for(let v of S){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,n={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cn||(n=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=n,a=new Ns({objectMode:!0}),c=new Set;(!s||s(e))&&a.write(r?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(r?h:h.fullpath())||(f=!0));u--;for(let h of m){let y=h;if(h.isSymbolicLink()){if(!(i&&(y=h.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(c,o)&&l.push(y)}}f&&!a.flowing&&a.once("drain",d)};return d(),a}chdir(e=this.cwd){let n=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[GM](n)}},ja=class extends Eh{sep="\\";constructor(e=process.cwd(),n={}){let{nocase:r=!0}=n;super(e,Ba.win32,"\\",{...n,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Ba.win32.parse(e).root.toUpperCase()}newRoot(e){return new Rh(this.rootPath,Ci,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Ua=class extends Eh{sep="/";constructor(e=process.cwd(),n={}){let{nocase:r=!1}=n;super(e,Ba.posix,"/",{...n,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new wh(this.rootPath,Ci,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Ml=class extends Ua{constructor(e=process.cwd(),n={}){let{nocase:r=!0}=n;super(e,{...n,nocase:r})}},JRe=process.platform==="win32"?Rh:wh,YM=process.platform==="win32"?ja:process.platform==="darwin"?Ml:Ua;var ez=t=>t.length>=1,tz=t=>t.length>=1,Ha=class t{#e;#n;#r;length;#t;#o;#h;#a;#d;#l;#c=!0;constructor(e,n,r,i){if(!ez(e))throw new TypeError("empty pattern list");if(!tz(n))throw new TypeError("empty glob list");if(n.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,r<0||r>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=n,this.#r=r,this.#t=i,this.#r===0){if(this.isUNC()){let[s,o,a,c,...l]=this.#e,[u,d,f,p,...m]=this.#n;l[0]===""&&(l.shift(),m.shift());let h=[s,o,a,c,""].join("/"),y=[u,d,f,p,""].join("/");this.#e=[h,...l],this.#n=[y,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[a,...c]=this.#n;o[0]===""&&(o.shift(),c.shift());let l=s+"/",u=a+"/";this.#e=[l,...o],this.#n=[u,...c],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===Ft}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#h=this.#h||(this.#r===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new t(this.#e,this.#n,this.#r+1,this.#t),this.#o.#l=this.#l,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.#t==="win32"&&this.#r===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.#t==="win32"&&this.#r===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#l!==void 0?this.#l:this.#l=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#r===0?e:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#c)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#c?!1:(this.#c=!1,!0)}};var nz=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Va=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:n,nocase:r,noext:i,noglobstar:s,platform:o=nz}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:n,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let n=new yr(e,this.mmopts);for(let r=0;r<n.set.length;r++){let i=n.set[r],s=n.globParts[r];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let o=new Ha(i,s,0,this.platform),a=new yr(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 n=e.fullpath(),r=`${n}/`,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(n)||o.match(r))return!0;return!1}childrenIgnored(e){let n=e.fullpath()+"/",r=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(n))return!0;return!1}};var Ev=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,n){return this.store.get(e.fullpath())?.has(n.globString())}storeWalked(e,n){let r=e.fullpath(),i=this.store.get(r);i?i.add(n.globString()):this.store.set(r,new Set([n.globString()]))}},Cv=class{store=new Map;add(e,n,r){let i=(n?2:0)|(r?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,n])=>[e,!!(n&2),!!(n&1)])}},Dv=class{store=new Map;add(e,n){if(!e.canReaddir())return;let r=this.store.get(e);r?r.find(i=>i.globString()===n.globString())||r.push(n):this.store.set(e,[n])}get(e){let n=this.store.get(e);if(!n)throw new Error("attempting to walk unknown path");return n}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},xl=class t{hasWalkedCache;matches=new Cv;subwalks=new Dv;patterns;follow;dot;opts;constructor(e,n){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=n?n.copy():new Ev}processPatterns(e,n){this.patterns=n;let r=n.map(i=>[e,i]);for(let[i,s]of r){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===Ft){(!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,n){let r=this.subwalks.get(e),i=this.child();for(let s of n)for(let o of r){let a=o.isAbsolute(),c=o.pattern(),l=o.rest();c===Ft?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,n,r,i){if((this.dot||!e.name.startsWith("."))&&(n.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,n):e.isSymbolicLink()&&(r&&n.checkFollowGlobstar()?this.subwalks.add(e,r):n.markFollowGlobstar()&&this.subwalks.add(e,n)))),r){let s=r.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,r.rest(),i);else if(s===".."){let o=e.parent||e;this.subwalks.add(o,r)}else s instanceof RegExp&&this.testRegExp(e,s,r.rest(),i)}}testRegExp(e,n,r,i){n.test(e.name)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}testString(e,n,r,i){e.isNamed(n)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}};var rz=(t,e)=>typeof t=="string"?new Va([t],e):Array.isArray(t)?new Va(t,e):t,Ch=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#n;#r;signal;maxDepth;includeChildMatches;constructor(e,n,r){if(this.patterns=e,this.path=n,this.opts=r,this.#r=!r.posix&&r.platform==="win32"?"\\":"/",this.includeChildMatches=r.includeChildMatches!==!1,(r.ignore||!this.includeChildMatches)&&(this.#n=rz(r.ignore??[],r),!this.includeChildMatches&&typeof this.#n.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=r.maxDepth||1/0,r.signal&&(this.signal=r.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#n?.ignored?.(e)}#o(e){return!!this.#n?.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,n){if(n&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||await e.realpath(),!r)return;e=r}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,n)}matchCheckTest(e,n){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!n||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,n){if(n&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||e.realpathSync(),!r)return;e=r}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,n)}matchFinish(e,n){if(this.#t(e))return;if(!this.includeChildMatches&&this.#n?.add){let s=`${e.relativePosix()}/**`;this.#n.add(s)}let r=this.opts.absolute===void 0?n:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(r){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.#r)?"."+this.#r:"";this.matchEmit(s?o+s+i:"."+i)}}async match(e,n,r){let i=await this.matchCheck(e,r);i&&this.matchFinish(i,n)}matchSync(e,n,r){let i=this.matchCheckSync(e,r);i&&this.matchFinish(i,n)}walkCB(e,n,r){this.signal?.aborted&&r(),this.walkCB2(e,n,new xl(this.opts),r)}walkCB2(e,n,r,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,n,r,i));return}r.processPatterns(e,n);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of r.matches.entries())this.#t(a)||(s++,this.match(a,c,l).then(()=>o()));for(let a of r.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,r,o):a.readdirCB((l,u)=>this.walkCB3(a,u,r,o),!0)}o()}walkCB3(e,n,r,i){r=r.filterEntries(e,n);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of r.matches.entries())this.#t(a)||(s++,this.match(a,c,l).then(()=>o()));for(let[a,c]of r.subwalks.entries())s++,this.walkCB2(a,c,r.child(),o);o()}walkCBSync(e,n,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,n,new xl(this.opts),r)}walkCB2Sync(e,n,r,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,n,r,i));return}r.processPatterns(e,n);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of r.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let a of r.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirSync();this.walkCB3Sync(a,c,r,o)}o()}walkCB3Sync(e,n,r,i){r=r.filterEntries(e,n);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of r.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let[a,c]of r.subwalks.entries())s++,this.walkCB2Sync(a,c,r.child(),o);o()}},Ll=class extends Ch{matches=new Set;constructor(e,n,r){super(e,n,r)}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,n)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?n(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}},ql=class extends Ch{results;constructor(e,n,r){super(e,n,r),this.results=new Ns({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 iz=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ai=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,n){if(!n)throw new TypeError("glob options required");if(this.withFileTypes=!!n.withFileTypes,this.signal=n.signal,this.follow=!!n.follow,this.dot=!!n.dot,this.dotRelative=!!n.dotRelative,this.nodir=!!n.nodir,this.mark=!!n.mark,n.cwd?(n.cwd instanceof URL||n.cwd.startsWith("file://"))&&(n.cwd=(0,KM.fileURLToPath)(n.cwd)):this.cwd="",this.cwd=n.cwd||"",this.root=n.root,this.magicalBraces=!!n.magicalBraces,this.nobrace=!!n.nobrace,this.noext=!!n.noext,this.realpath=!!n.realpath,this.absolute=n.absolute,this.includeChildMatches=n.includeChildMatches!==!1,this.noglobstar=!!n.noglobstar,this.matchBase=!!n.matchBase,this.maxDepth=typeof n.maxDepth=="number"?n.maxDepth:1/0,this.stat=!!n.stat,this.ignore=n.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(n.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=e,this.platform=n.platform||iz,this.opts={...n,platform:this.platform},n.scurry){if(this.scurry=n.scurry,n.nocase!==void 0&&n.nocase!==n.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=n.platform==="win32"?ja:n.platform==="darwin"?Ml:n.platform?Ua:YM;this.scurry=new c(this.cwd,{nocase:n.nocase,fs:n.fs})}this.nocase=this.scurry.nocase;let r=this.platform==="darwin"||this.platform==="win32",i={...n,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:r,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 yr(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 Ha(c,u,0,this.platform)})}async walk(){return[...await new Ll(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 Ll(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 ql(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 ql(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 Av=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let n of t)if(new yr(n,e).hasMagic())return!0;return!1};function Dh(t,e={}){return new ai(t,e).streamSync()}function JM(t,e={}){return new ai(t,e).stream()}function QM(t,e={}){return new ai(t,e).walkSync()}async function XM(t,e={}){return new ai(t,e).walk()}function Ah(t,e={}){return new ai(t,e).iterateSync()}function ZM(t,e={}){return new ai(t,e).iterate()}var sz=Dh,oz=Object.assign(JM,{sync:Dh}),az=Ah,cz=Object.assign(ZM,{sync:Ah}),lz=Object.assign(QM,{stream:Dh,iterate:Ah}),yo=Object.assign(XM,{glob:XM,globSync:QM,sync:lz,globStream:JM,stream:oz,globStreamSync:Dh,streamSync:sz,globIterate:ZM,iterate:cz,globIterateSync:Ah,iterateSync:az,Glob:ai,hasMagic:Av,escape:xa,unescape:ii});yo.glob=yo;var mP=L(fS()),HF=L(BF());var pP={};UB(pP,{$id:()=>vQ,$schema:()=>TQ,default:()=>kQ,definitions:()=>SQ,properties:()=>PQ,title:()=>bQ,type:()=>_Q});var TQ="http://json-schema.org/draft-07/schema#",vQ="http://json-schema.org/draft-07/schema#",bQ="Core schema meta-schema",SQ={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:[]}},_Q=["object","boolean"],PQ={$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:"#"}},kQ={$schema:TQ,$id:vQ,title:bQ,definitions:SQ,type:_Q,properties:PQ,default:!0};var vr=L(U());var ag=class extends Yc{constructor(n,r){super();this.ajv=n;this.schemaKey=r;this.validate=this.ajv.getSchema(this.schemaKey)}getIssue(n,r){let i=[];if(r.disabled){let o=r.getProperty("status");return r.implementations.forEach(a=>i.push(F(21,a.firstToken,a.lastToken,a,{severity:vr.DiagnosticSeverity.Hint,linkedTo:[...o?.ast?[o?.ast]:[]],tags:[vr.DiagnosticTag.Unnecessary]}))),i}let s=X.toJson(r);try{this.validate?(this.validate(s),this.validate.errors&&(this.validate.errors.forEach(o=>i.push(...NQ(n,o,r,this.schemaKey))),console.log(this.schemaKey,`${r.pathString}`,this.validate.errors,s))):console.log("no validate")}catch(o){console.log(this.schemaKey,`${r.pathString}`,this.schemaKey,o)}return i}getOnPropertyHover(n){let r=(this.validate?.schema).properties?.[n];if(r&&typeof r=="object"&&"description"in r)return{kind:vr.MarkupKind.Markdown,value:[...r.description?["### Description",Array.isArray(r.description)?r.description.join(`
|
|
330
330
|
|
|
331
331
|
`):r.description]:[]].join(`
|
|
332
332
|
`)}}getSignatureHelp(){}getPropertyListCompletionItems(n){let r=Object.keys((this.validate?.schema).properties),i=(this.validate?.schema).required;return r.map(s=>{let o=n&&i.some(l=>l===s),a=!!n.properties.some(l=>s===l.name),c="a";return o?c=a?"Y":"!":c=a?"Z":"B",{label:`${s}`,kind:vr.CompletionItemKind.Property,sortText:`${c}${s}`}})??[]}},NQ=(t,e,n,r)=>{let i=RQ(n,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:vr.TextEdit.del(on(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=Wf(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:vr.TextEdit.insert(vr.Position.create(p.pos.line,p.pos.col+1),`
|
|
@@ -339,8 +339,8 @@ ${r}`]})];let o=i.node.implementations[0]instanceof nt?i.node.implementations[0]
|
|
|
339
339
|
${JSON.stringify(e)}
|
|
340
340
|
${r}`]})]},RQ=(t,e)=>jF(t,e.split("/").filter(n=>n)),jF=(t,e)=>{if(e.length===0)return{node:t,remainingInstancePath:""};let n=e[0].split("@"),r=n[0],i=n.at(1)?.split(",").map(o=>Number.parseInt(o,16)),s=t.getNode(r,i);return s?jF(s,e.slice(1)):{node:t,property:t.getProperty(e[0]),remainingInstancePath:e.slice(1).join("/")}};var gP=class t{constructor(){this.schemaIdValidators=new Map;this.ajvMap=new Map}static getNodeCompatible(e){let r=e.getProperty("compatible")?.ast.values;if(!r?.values.some(i=>!(i?.value instanceof re)))return r?.values.map(i=>(i?.value).value)}parseMetaSchema(e,n){yo.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,Tc.resolve)(e,i);try{let s=mP.default.parse((0,hP.readFileSync)(i,"utf-8"));n.addMetaSchema(s),this.schemaIdValidators.set(s.$id,i)}catch{}})}parseBindings(e,n){yo.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,Tc.resolve)(e,i);try{let s=mP.default.parse((0,hP.readFileSync)(i,"utf-8"));n.addSchema(s),this.schemaIdValidators.set(s.$id,i)}catch(s){console.warn(i,s.message)}})}getNodeTypes(e,n,r){let i=`${e.join(";")}::${n.join(";")}`,s=this.ajvMap.get(i);return s||(s=new HF.default({strict:!1,strictSchema:!1,strictNumbers:!1}),s.addMetaSchema(pP),this.ajvMap.set(i,s),e.forEach(c=>this.parseMetaSchema(c,s)),n.forEach(c=>this.parseBindings(c,s))),t.getNodeCompatible(r)?.map(c=>{try{let l=Array.from(this.schemaIdValidators.keys()).find(f=>(0,Tc.basename)(f)===`${c}.yaml#`);if(!l)return;let u=new ag(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())}getBindingDocumentation(e,n,r){let i=`${e.join(";")}::${n.join(";")}`,s=this.ajvMap.get(i);if(!s)return;let o=Array.from(this.schemaIdValidators.keys()).find(d=>(0,Tc.basename)(d)===`${r}.yaml#`);if(!o)return;let a=s.getSchema(o);if(!a)return;let c=a.schema.description,l=a.schema.examples,u=a.schema.maintainers;return{kind:_i.Markdown,value:[...u?["### Maintainers",...u??[]]:[],...c?["### Description",ma(c)]:[],...l?["### Examples","```devicetree",...l??[],"```"]:[]].join(`
|
|
341
341
|
`)}}},UF,cg=()=>(UF??=new gP,UF);var Ws=L(require("path")),zu=require("fs"),KF=L(require("path")),XF=L(fS());var lr=L(U());var VF=()=>{let t=new W("nonposted-mmio",V("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 WF(){let t=Zn();t.noMismatchPropertiesAllowed=!0,t.compatible="simple-bus";let e=t.properties.find(r=>r.name==="compatible");e.required=()=>"required";let n=t.properties.find(r=>r.name==="ranges");return n.required=()=>"required",t.addProperty(VF()),t}var zF=(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(n=>typeof n=="number")?e:void 0;case"uint8-array":return Array.isArray(e)&&e.every(n=>typeof n=="number")?e:void 0;case"string-array":return Array.isArray(e)&&e.every(n=>typeof n=="string")?e:void 0;case"phandle":return;case"phandles":return;case"phandle-array":return;case"path":return;case"compound":return}},lg=(t,e)=>{if(Object.entries(e.properties??{}).forEach(([n,r])=>{r.name=n}),e.extends??=[],e=e.include.reduce((n,r)=>{let i=t.find(s=>(0,Ws.basename)(s.filePath)===r.name);if(i){let s=r["property-blocklist"],o=r["property-allowlist"];e.extends?.push(...n.include.map(c=>(0,Ws.basename)(c.name,".yaml")));let a=r["child-binding"];return n.include=n.include.filter(c=>c!==r),JF(t,i,n,s,o,a)??n}return console.warn(`Unable to find ${r.name}`),n},e),e["child-binding"]){let n=QF(e["child-binding"].include);e["child-binding"].include=n,e["child-binding"].rawInclude=[...n],e["child-binding"]=lg(t,e["child-binding"]),e["child-binding"]&&(e["child-binding"].isChildBinding=!0,e["child-binding"].filePath=e.filePath)}if(!e.include.length)return e},JF=(t,e,n,r=[],i,s)=>{let o=lg(t,e),a=lg(t,n);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=r?.some(y=>y===p)||i&&!i.some(y=>y===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:[],isChildBinding:!0},JF(t,o["child-binding"],a["child-binding"]??{filePath:a.filePath,include:[],rawInclude:[],isChildBinding:!0},s?.["property-blocklist"],s?.["property-allowlist"],s?.["child-binding"])),a},QF=t=>t?typeof t=="string"?[{name:t}]:t.map(e=>typeof e!="string"?e:{name:e}):[],yP=class t{constructor(){this.typeCache=new Map;this.contextBindings=new Map;this.processedFolders=new Set;this.zephyrBindingCache=new Map;this.vendorPrefixMap=new Map}static getCompatibleKeys(e,n){return!n||!n.nodeType?.bus?.length?[e]:[...n.nodeType.bus.map(r=>`${e}::${r}`),e]}getBaseZephyrType(e){let n=e.split(":");return Array.from(this.zephyrBindingCache.keys()).filter(i=>n.some(s=>i.startsWith(s))).flatMap(i=>this.zephyrBindingCache.get(i)).find(i=>i.filePath.endsWith(`${Ws.default.sep}base.yaml`))}getBaseNodeType(e,n){let r=this.getBaseZephyrType(n),i=r?ug(r,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 re);if(i?.length)return i.map(s=>s?.value?{name:s.value.value,ast:s.value}:void 0)}getNodeTypes(e,n){let r=t.getNodeCompatible(e)?.filter(a=>!!a),i=r?.flatMap(a=>t.getCompatibleKeys(a.name,e.parent).map(c=>this.typeCache.get(n)?.get(c)?.(e)).filter(c=>!!c))??[];if(!i.length){let a;if(e.pathString==="/zephyr,user"){let c={},l={properties:c,filePath:"",include:[],rawInclude:[],isChildBinding:!1},u=(d,f)=>{c[d]={name:d,type:f}};e.properties.forEach(d=>{if(d.name.endsWith("-gpios")){u(d.name,"phandle-array");return}let f=d.ast.values?.values.map(m=>m?.value),p=f?.filter(m=>!!m);if(f===void 0||p===void 0)u(d.name,"boolean");else if(p.every(m=>m instanceof re))u(d.name,f.length>1?"string-array":"string");else if(p.every(m=>m instanceof Mn))u(d.name,"uint8-array");else if(p.every(m=>m instanceof ct)){let m=p.flatMap(h=>h.values);m.every(h=>h.value instanceof me)?u(d.name,m.length>1?"array":"int"):m.every(h=>h.value instanceof ie||h.value instanceof rt)?u(d.name,m.length>1?"phandles":"phandle"):u(d.name,"phandle-array")}else u(d.name,"compound")}),a=ug(l,e)}if(a){a.warnMismatchProperties=!1;let c=a.properties.find(l=>l.name==="compatible");c&&(c.required=()=>"optional")}return{type:[a??uo(e)],issues:[]}}let s=this.getBusTypes(),o=r?.flatMap(a=>{let c=t.getCompatibleKeys(a.name,e.parent).some(l=>this.typeCache.get(n)?.has(l));if(!c){let l=s.filter(u=>this.typeCache.get(n)?.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:lr.DiagnosticSeverity.Hint,tags:[lr.DiagnosticTag.Unnecessary],templateStrings:[a.name]})]})??[];return{type:i.length?i:[uo(e)],issues:o}}processVendorPrefix(e){let n=Ws.default.join(e,"vendor-prefixes.txt");if(!(0,zu.existsSync)(n))return;let r=(0,zu.readFileSync)(n,"utf-8"),i=/^(?!#)(\S+)\s+(.+)$/gm;Array.from(r.matchAll(i),s=>[s[1].trim(),s[2].trim()]).forEach(([s,o])=>{this.vendorPrefixMap.set(s,o)})}loadTypeAndCache(e,n){e=Array.isArray(e)?e:[e];let r=e.filter(a=>this.processedFolders.has(a)).flatMap(a=>Array.from(this.zephyrBindingCache.entries()).flatMap(([c,l])=>c.startsWith(a)?[l]:[]));r.push(...e.filter(a=>!this.processedFolders.has(a)).flatMap(a=>(this.processVendorPrefix(a),this.processedFolders.add(a),yo.sync("**/*.yaml",{cwd:a,ignore:"test/*"}).map(l=>{if(l=(0,Ws.resolve)(a,l),this.zephyrBindingCache.has(l))return this.zephyrBindingCache.get(l);try{let u=XF.default.parse((0,zu.readFileSync)(l,"utf-8")),d=QF(u?.include),f={...u,bus:u.bus?Array.isArray(u.bus)?u.bus:[u.bus]:void 0,include:d,rawInclude:[...d],filePath:l};return this.zephyrBindingCache.set(l,f),f}catch(u){console.warn(u)}}).filter(l=>!!l))));let i=r.map(a=>lg(r,a)).filter(a=>!!a&&!a.include.length),s=this.typeCache.get(n);s||(s=new Map,this.typeCache.set(n,s));let o=this.contextBindings.get(n);if(o||(o=new Map,this.contextBindings.set(n,o)),i.forEach(a=>{o.set(a.compatible??"",a)}),wQ(i,s,this.vendorPrefixMap),!s.has("simple-bus")){let a=this.getBaseZephyrType(n);if(a){let c=EQ(a);s.set("simple-bus",()=>c)}}}getBindings(e){return Array.from(this.typeCache.get(e)?.keys()??[]).map(n=>n.split("::",1)[0])}getBindingVendorString(e){let n=e.split(",",1)[0];return this.vendorPrefixMap.get(n)}getBindingDocumentation(e,n){let r=this.contextBindings.get(e)?.get(n);if(!r)return;let i=this.getBindingVendorString(r.compatible??"");return{kind:lr.MarkupKind.Markdown,value:[...i?["### Vendor",...i?[i]:[]]:[],...r.description?["### Description",ma(r.description)]:[]].join(`
|
|
342
|
-
`)}}getZephyrContextBinding(e){return Array.from(this.contextBindings.get(e)?.values()??[])}getBusTypes(){let e=Array.from(this.zephyrBindingCache.values()).flatMap(n=>n.bus?.filter(r=>!!r)??[]).filter(n=>!!n);return Array.from(new Set(e))}getDocumentLinks(e,n){let r=this.zephyrBindingCache.get(_e(e.uri));if(!r)return[];let i=e.getText();return ZF(r).map(a=>{let l=new RegExp(a.name).exec(i);if(l){let u=e.positionAt(l.index),d=e.positionAt(l.index+l[0].length),f=Array.from(this.zephyrBindingCache.keys()).find(p=>p.endsWith(`${KF.default.sep}${a.name}`)&&n.some(m=>p.startsWith(m)));return f?{range:lr.Range.create(u,d),target:ue(f)}:void 0}}).filter(a=>!!a)}resetCache(e){this.typeCache.delete(e)}};function ZF(t){return[...t.rawInclude,...t["child-binding"]?ZF(t["child-binding"]):[]].flat()}var GF,Li=()=>(GF??=new yP,GF),wQ=(t,e,n)=>t.forEach(r=>{r.compatible&&e.set(r["on-bus"]?`${r.compatible}::${r["on-bus"]}`:r.compatible,i=>ug(r,i,n))}),ug=(t,e,n)=>{let r=uo(e);r.compatible=t.compatible,r.description=t.description,r.bindingsPath=t.filePath,r.zephyrBinding=t,r.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),r.onBus=t["on-bus"],t.extends?.forEach(o=>r.extends.add(o)),r.warnMismatchProperties=!0,n&&t.compatible?.includes(",")&&(r.vendor=n?.get(t.compatible.split(",",1)[0]));let s=Object.keys(t).filter(o=>o.endsWith("-cells")).map(o=>({specifier:o.replace(/-cells$/,""),values:t[o]}));if(r.cellsValues=s,Object.entries(t.properties??{}).forEach(([o,a])=>{eB(r,o,a)}),t["child-binding"]){let o=t["child-binding"];r.childNodeType=a=>{let c=ug(o,a);return c.hasParentBinding=!0,c}}return r},EQ=t=>{let e=WF();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 r=Object.keys(t).filter(i=>i.endsWith("-cells")).map(i=>({specifier:i.replace(/-cells$/,""),values:t[i]}));return e.cellsValues=r,Object.entries(t.properties??{}).forEach(([i,s])=>{eB(e,i,s)}),e},eB=(t,e,n)=>{let r=t.properties.find(i=>i.getNameMatch(e));if(r&&typeof r.name=="string"){r.name!=="reg"?r.required=()=>n.required?"required":"optional":n.required&&(r.required=()=>"required"),r.values=()=>n.enum??[],r.constValue=zF(n.type,n.const),r.bindingType=n.type;let i=r.additionalTypeCheck;r.additionalTypeCheck=(s,o)=>[...YF(n,e,r)(s,o),...i?.(s,o)??[]]}else{let i=n.type==="compound"?r?.type:Kc(n.type);i??=Kc(n.type);let s=new W(e,i,n.required?"required":"optional",void 0,n.enum);s.additionalTypeCheck=(o,a)=>{let c=[...r?.additionalTypeCheck?.(o,a)??[],...YF(n,e,s)(o,a)];return s.signatureArgs??=r?.signatureArgs,s.signatureArgsCyclic??=!!r?.signatureArgsCyclic,c},s.description=n.description?[n.description]:r?.description,s.bindingType=n.type,s.constValue=zF(n.type,n.const),t.addProperty(s)}},YF=(t,e,n)=>{let r=t;return(i,s)=>{let o=i.parent.root,a=[];if(r.const){let l=i.ast.getFlatAstValues();if(l?.length==1&&l.every(u=>u instanceof me)){let u=l.map(p=>p.evaluate(s)),d=Array.isArray(r.const)?r.const:[r.const];if(!(d.length===u.length&&u.every((p,m)=>typeof p=="number"&&Number.isNaN(p)||d[m]===p))){let p=i.ast.values??i.ast;a.push(F(24,p.firstToken,p.lastToken,p,{templateStrings:[`Binding expects values to be "${r.type}" with value: ${r.const}`]}))}}}if(r.deprecated&&a.push(F(14,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:lr.DiagnosticSeverity.Warning,tags:[lr.DiagnosticTag.Deprecated],templateStrings:[i.name]})),(r.type==="phandle"||r.type==="phandles"||r.type==="path")&&Be(i.ast.values)?.forEach(u=>{Rr(u,o)||a.push(F(22,u.firstToken,u.lastToken,u))}),r.type==="path"&&i.ast.values?.values.at(0)?.value instanceof re){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(r.type==="phandles"&&c){let l="";e.endsWith("-gpios")?l="gpio":l=r["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:lr.DiagnosticSeverity.Warning,linkedTo:[d.ast],templateStrings:[i.name,u.toString()]})))}if(r.type==="phandle-array"){let l=Be(i.ast.values),u=0,d=[],f=0;for(;l&&u<l.length;){let p=l.at(u),m=Rr(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=r["specifier-space"]??e.slice(0,-1);let y=m.getProperty(`#${h}-cells`);if(!y){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 S=y?We(y,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:S-(b?.length??0)},(O,B)=>`${f}_cell${S-(b?.length??0)?B:""}`)]),1+S>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+S;let v=l.slice(u-S,u),k={mappingValuesAst:v,specifierSpace:h,cellCount:S,target:m};i.nexusMapsTo.push(k);let R=m.getProperty(`${h}-map`);if(R){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:[R.ast]}))}v.every(O=>O instanceof me)&&m.spesifierNexusMapping.push({expressions:v,node:i.parent,property:i,specifierSpace:h});let q=i.parent.getProperty(`${h}-names`);p&&q&&(q.ast.quickValues?.at(f)||a.push(F(33,p.firstToken,l[u-1]?.lastToken,i.ast,{severity:lr.DiagnosticSeverity.Warning,linkedTo:[q.ast],templateStrings:[i.name,f.toString()]}))),f++}d.push([`${f}_phandle`,`${f}_cell...`]),n.signatureArgs=d.map(p=>p.map(m=>lr.ParameterInformation.create(m)))}return a}};var Gu=new Map,tB=(t,e)=>{let n=t.zephyrBindings.join(":");return e==="Zephyr"&&(Gu.set(n,(Gu.get(n)??0)+1),Li().loadTypeAndCache(t.zephyrBindings,n)),{files:t,type:e,getNodeTypes:r=>{switch(e){case"Zephyr":return Li().getNodeTypes(r,n);case"DevicetreeOrg":return{type:cg().getNodeTypes(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,r),issues:[]}}},getBindings:()=>{switch(e){case"Zephyr":return Li().getBindings(n);case"DevicetreeOrg":return cg().getBindings()}},getBindingVendorString:r=>{
|
|
342
|
+
`)}}getZephyrContextBinding(e){return Array.from(this.contextBindings.get(e)?.values()??[])}getBusTypes(){let e=Array.from(this.zephyrBindingCache.values()).flatMap(n=>n.bus?.filter(r=>!!r)??[]).filter(n=>!!n);return Array.from(new Set(e))}getDocumentLinks(e,n){let r=this.zephyrBindingCache.get(_e(e.uri));if(!r)return[];let i=e.getText();return ZF(r).map(a=>{let l=new RegExp(a.name).exec(i);if(l){let u=e.positionAt(l.index),d=e.positionAt(l.index+l[0].length),f=Array.from(this.zephyrBindingCache.keys()).find(p=>p.endsWith(`${KF.default.sep}${a.name}`)&&n.some(m=>p.startsWith(m)));return f?{range:lr.Range.create(u,d),target:ue(f)}:void 0}}).filter(a=>!!a)}resetCache(e){this.typeCache.delete(e)}};function ZF(t){return[...t.rawInclude,...t["child-binding"]?ZF(t["child-binding"]):[]].flat()}var GF,Li=()=>(GF??=new yP,GF),wQ=(t,e,n)=>t.forEach(r=>{r.compatible&&e.set(r["on-bus"]?`${r.compatible}::${r["on-bus"]}`:r.compatible,i=>ug(r,i,n))}),ug=(t,e,n)=>{let r=uo(e);r.compatible=t.compatible,r.description=t.description,r.bindingsPath=t.filePath,r.zephyrBinding=t,r.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),r.onBus=t["on-bus"],t.extends?.forEach(o=>r.extends.add(o)),r.warnMismatchProperties=!0,n&&t.compatible?.includes(",")&&(r.vendor=n?.get(t.compatible.split(",",1)[0]));let s=Object.keys(t).filter(o=>o.endsWith("-cells")).map(o=>({specifier:o.replace(/-cells$/,""),values:t[o]}));if(r.cellsValues=s,Object.entries(t.properties??{}).forEach(([o,a])=>{eB(r,o,a)}),t["child-binding"]){let o=t["child-binding"];r.childNodeType=a=>{let c=ug(o,a);return c.hasParentBinding=!0,c}}return r},EQ=t=>{let e=WF();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 r=Object.keys(t).filter(i=>i.endsWith("-cells")).map(i=>({specifier:i.replace(/-cells$/,""),values:t[i]}));return e.cellsValues=r,Object.entries(t.properties??{}).forEach(([i,s])=>{eB(e,i,s)}),e},eB=(t,e,n)=>{let r=t.properties.find(i=>i.getNameMatch(e));if(r&&typeof r.name=="string"){r.name!=="reg"?r.required=()=>n.required?"required":"optional":n.required&&(r.required=()=>"required"),r.values=()=>n.enum??[],r.constValue=zF(n.type,n.const),r.bindingType=n.type;let i=r.additionalTypeCheck;r.additionalTypeCheck=(s,o)=>[...YF(n,e,r)(s,o),...i?.(s,o)??[]]}else{let i=n.type==="compound"?r?.type:Kc(n.type);i??=Kc(n.type);let s=new W(e,i,n.required?"required":"optional",void 0,n.enum);s.additionalTypeCheck=(o,a)=>{let c=[...r?.additionalTypeCheck?.(o,a)??[],...YF(n,e,s)(o,a)];return s.signatureArgs??=r?.signatureArgs,s.signatureArgsCyclic??=!!r?.signatureArgsCyclic,c},s.description=n.description?[n.description]:r?.description,s.bindingType=n.type,s.constValue=zF(n.type,n.const),t.addProperty(s)}},YF=(t,e,n)=>{let r=t;return(i,s)=>{let o=i.parent.root,a=[];if(r.const){let l=i.ast.getFlatAstValues();if(l?.length==1&&l.every(u=>u instanceof me)){let u=l.map(p=>p.evaluate(s)),d=Array.isArray(r.const)?r.const:[r.const];if(!(d.length===u.length&&u.every((p,m)=>typeof p=="number"&&Number.isNaN(p)||d[m]===p))){let p=i.ast.values??i.ast;a.push(F(24,p.firstToken,p.lastToken,p,{templateStrings:[`Binding expects values to be "${r.type}" with value: ${r.const}`]}))}}}if(r.deprecated&&a.push(F(14,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:lr.DiagnosticSeverity.Warning,tags:[lr.DiagnosticTag.Deprecated],templateStrings:[i.name]})),(r.type==="phandle"||r.type==="phandles"||r.type==="path")&&Be(i.ast.values)?.forEach(u=>{Rr(u,o)||a.push(F(22,u.firstToken,u.lastToken,u))}),r.type==="path"&&i.ast.values?.values.at(0)?.value instanceof re){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(r.type==="phandles"&&c){let l="";e.endsWith("-gpios")?l="gpio":l=r["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:lr.DiagnosticSeverity.Warning,linkedTo:[d.ast],templateStrings:[i.name,u.toString()]})))}if(r.type==="phandle-array"){let l=Be(i.ast.values),u=0,d=[],f=0;for(;l&&u<l.length;){let p=l.at(u),m=Rr(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=r["specifier-space"]??e.slice(0,-1);let y=m.getProperty(`#${h}-cells`);if(!y){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 S=y?We(y,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:S-(b?.length??0)},(O,B)=>`${f}_cell${S-(b?.length??0)?B:""}`)]),1+S>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+S;let v=l.slice(u-S,u),k={mappingValuesAst:v,specifierSpace:h,cellCount:S,target:m};i.nexusMapsTo.push(k);let R=m.getProperty(`${h}-map`);if(R){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:[R.ast]}))}v.every(O=>O instanceof me)&&m.spesifierNexusMapping.push({expressions:v,node:i.parent,property:i,specifierSpace:h});let q=i.parent.getProperty(`${h}-names`);p&&q&&(q.ast.quickValues?.at(f)||a.push(F(33,p.firstToken,l[u-1]?.lastToken,i.ast,{severity:lr.DiagnosticSeverity.Warning,linkedTo:[q.ast],templateStrings:[i.name,f.toString()]}))),f++}d.push([`${f}_phandle`,`${f}_cell...`]),n.signatureArgs=d.map(p=>p.map(m=>lr.ParameterInformation.create(m)))}return a}};var Gu=new Map,tB=(t,e)=>{let n=t.zephyrBindings.join(":");return e==="Zephyr"&&(Gu.set(n,(Gu.get(n)??0)+1),Li().loadTypeAndCache(t.zephyrBindings,n)),{files:t,type:e,getNodeTypes:r=>{switch(e){case"Zephyr":return Li().getNodeTypes(r,n);case"DevicetreeOrg":return{type:cg().getNodeTypes(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,r),issues:[]}}},getBindings:()=>{switch(e){case"Zephyr":return Li().getBindings(n);case"DevicetreeOrg":return cg().getBindings()}},getBindingVendorString:r=>{if(e==="Zephyr")return Li().getBindingVendorString(r)},getBindingDocumentation:r=>{switch(e){case"Zephyr":return Li().getBindingDocumentation(n,r);case"DevicetreeOrg":return cg().getBindingDocumentation(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,r)}},getZephyrContextBinding:()=>{if(e==="Zephyr")return Li().getZephyrContextBinding(n)},getBusTypes:()=>{switch(e){case"Zephyr":return Li().getBusTypes();case"DevicetreeOrg":return[]}},getDocumentLinks(r){if(!r)return[];switch(e){case"Zephyr":return Li().getDocumentLinks(r,t.zephyrBindings);case"DevicetreeOrg":return[]}},dispose:()=>{if(e==="Zephyr"){let r=Gu.get(n)??0;r<=1?(Gu.delete(n),Li().resetCache(n)):Gu.set(n,r-1)}}}};var dg=L(U());var CQ=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:dg.FoldingRangeKind.Comment}],TP=t=>!t.openScope||!t.closeScope?.prevToken?t.nodes.flatMap(TP):[{startLine:t.openScope.pos.line,startCharacter:t.openScope.pos.col,endLine:t.closeScope.prevToken.pos.line,endCharacter:t.closeScope.prevToken.pos.col,kind:dg.FoldingRangeKind.Region},...t.nodes.flatMap(TP)],DQ=t=>{let e=[];return[...t.ifBlocks.map(n=>({start:(n.expression??n.keyword).lastToken,end:n.content?.lastToken??(n.expression??n.keyword).lastToken})),t.elseOption?{start:t.elseOption.keyword.lastToken,end:t.elseOption.content?.lastToken}:null].forEach(n=>{!n||!n.end||e.push({startLine:n.start.pos.line,startCharacter:n.start.pos.col,endLine:n.end.pos.line,endCharacter:n.end.pos.colEnd,kind:dg.FoldingRangeKind.Region})}),e},AQ=t=>t instanceof we?TP(t):t instanceof Er?DQ(t):t instanceof pr?CQ(t):[];function nB(t,e){return e.allAstItems.flatMap(n=>[n,...n.allDescendants]).filter(n=>fe(n.fsPath,t)).flatMap(AQ)}var iB=require("fs"),sB=require("path"),On=L(U());function IQ(t){if(!t||!(t.ast instanceof $e)&&!(t.ast instanceof gn))return[];let e=n=>n.nodeType?.bindingsPath?[On.Location.create(ue(n.nodeType.bindingsPath),On.Range.create(On.Position.create(0,0),On.Position.create(0,0)))]:[];return t.item instanceof X&&!Zt(t.ast)?e(t.item):t.ast instanceof gn&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?e(t.ast.parentNode.linksTo):t.ast instanceof $e&&t.ast.linksTo?e(t.ast.linksTo):[]}function OQ(t){if(!t||!t.item||!(t.ast instanceof Xe)||t.runtime.context.bindingLoader?.type!=="Zephyr")return[];let e=t.item instanceof Je?t.item.parent:t.item,n=e.nodeType instanceof St?e.nodeType.zephyrBinding:void 0;if(!n)return[];let r=rB(t.ast.name,n);if(r)return[On.Location.create(ue(n.filePath),r)];let i=(t.runtime.context.bindingLoader?.getZephyrContextBinding?.()??[]).filter(s=>n.extends?.some(o=>(0,sB.basename)(s.filePath)===`${o}.yaml`));for(let s of i){let o=rB(t.ast.name,s);if(o)return[On.Location.create(ue(s.filePath),o)]}return[On.Location.create(ue(n.filePath),On.Range.create(On.Position.create(0,0),On.Position.create(0,0)))]}async function oB(t,e){return Rt(t,e,n=>[...IQ(n),...OQ(n)])}function rB(t,e){let n=e.filePath,r=(0,iB.readFileSync)(n,"utf8");return MQ(r,new RegExp(`(${t}|"${t}")\\s*:`))}function MQ(t,e){let n=t.match(e);if(!n)return;let r=n.index;if(r===void 0)return;let i=t.slice(0,r),s=i.split(`
|
|
343
343
|
`).length-1,o=i.lastIndexOf(`
|
|
344
|
-
`),a=o===-1?r+1:r-o,c=a+n[0].length;return On.Range.create(On.Position.create(s,a),On.Position.create(s,c))}var vc=require("fs");var xQ=(t,e)=>{let n=(0,vc.readFileSync)(t).toString();if(Ln().needsRenew(t,n))Ln().renewLexer(t,n),e(t);else return console.log("file changed event has the same text, skipping.",t)},fg=class{constructor(e,n,r){this.file=e;this.cb=n;this.isFileDirty=r}#e=0;watch(){if(this.count++,this.count===1){console.log("create watch for",this.file);let e=this.file,n=this.cb;this.onChange=()=>{if(console.log("onChange - file watcher",e),this.isFileDirty()){console.log("onChange - file is dirty, skipping");return}xQ(e,n)},(0,vc.watchFile)(e,this.onChange)}}unwatch(){this.count===1&&(console.log("dispose watch for",this.file),(0,vc.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 Ut=L(require("path")),vP=require("fs");var hi=t=>{if(t)return Array.isArray(t)?t:[t]},LQ=t=>({...t,deviceOrgBindingsMetaSchema:hi(t.deviceOrgBindingsMetaSchema),deviceOrgTreeBindings:hi(t.deviceOrgTreeBindings),includePaths:hi(t.includePaths),lockRenameEdits:hi(t.lockRenameEdits),zephyrBindings:hi(t.zephyrBindings),overlays:hi(t.overlays)}),aB=t=>({...t,defaultDeviceOrgBindingsMetaSchema:hi(t.defaultDeviceOrgBindingsMetaSchema),defaultDeviceOrgTreeBindings:hi(t.defaultDeviceOrgTreeBindings),defaultIncludePaths:hi(t.defaultIncludePaths),defaultLockRenameEdits:hi(t.defaultLockRenameEdits),defaultZephyrBindings:hi(t.defaultZephyrBindings),contexts:t.contexts?.map(LQ)}),jr=async(t,e=[],n)=>{let r=n?e.map(s=>_e(s.uri)).sort((s,o)=>s.split(Ut.sep).length-o.split(Ut.sep).length).find(s=>PE(s,n)):void 0;return[...e.at(0)?[{replace:"${workspaceFolder}",fsPath:r??_e(e[0].uri)}]:[],...e.map(s=>({replace:`\${workspaceFolder:${s.name}}`,fsPath:_e(s.uri)}))].forEach(s=>t=t.replaceAll(s.replace,s.fsPath)),t},zs={defaultBindingType:"Zephyr",defaultZephyrBindings:[],defaultIncludePaths:[],defaultDeviceOrgBindingsMetaSchema:[],defaultDeviceOrgTreeBindings:[],contexts:[],defaultLockRenameEdits:[],allowAdhocContexts:!0,autoChangeContext:!0,defaultShowFormattingErrorAsDiagnostics:!0,disableFileWatchers:!1,autoAddMissingPropertiesOnCompletion:!0},bP=async(t,e,n)=>{let r=await jr(t.cwd??"${workspaceFolder}",n,t.dtsFile)??e.cwd,i=await Promise.all((t.includePaths??e.defaultIncludePaths).map(p=>jr(p,n,t.dtsFile))),s=await Promise.all((t.zephyrBindings??e.defaultZephyrBindings).map(p=>jr(p,n,t.dtsFile))),o=t.bindingType??e.defaultBindingType,a=await Promise.all((t.deviceOrgTreeBindings??e.defaultDeviceOrgTreeBindings).map(p=>jr(p,n,t.dtsFile))),c=await Promise.all((t.deviceOrgBindingsMetaSchema??e.defaultDeviceOrgBindingsMetaSchema).map(p=>jr(p,n,t.dtsFile))),l=await Promise.all((t.lockRenameEdits??e.defaultLockRenameEdits).map(p=>jr(p,n,t.dtsFile)));if(r&&o==="Zephyr"&&(!s||s.length===0)&&(s=["./zephyr/dts/bindings"]),!t.dtsFile){console.log("Context is missing dtsFile, skipping...");return}let u=t.dtsFile,d=t.overlays??[],f=t.compileCommands;return r&&(s=s.map(p=>(0,Ut.resolve)(r,p)).filter(p=>(0,vP.existsSync)(p)),a=a?.map(p=>(0,Ut.resolve)(r,p)),c=c.map(p=>(0,Ut.resolve)(r,p)),i=i.map(p=>(0,Ut.resolve)(r,p)),u=(0,Ut.resolve)(r,u),d=d.map(p=>(0,Ut.resolve)(r,p)),l=l.map(p=>(0,Ut.resolve)(r,p)),f=f?(0,Ut.resolve)(r,f):void 0),{ctxName:t.ctxName??(0,Ut.basename)(u),cwd:r?dt(r):void 0,includePaths:i.map(dt),zephyrBindings:s.map(dt),bindingType:o,deviceOrgTreeBindings:a.map(dt),deviceOrgBindingsMetaSchema:c.map(dt),dtsFile:dt(u),overlays:d.map(dt),lockRenameEdits:l.map(dt),compileCommands:f?dt(f):void 0,showFormattingErrorAsDiagnostics:t.showFormattingErrorAsDiagnostics??e.defaultShowFormattingErrorAsDiagnostics,disableFileWatchers:t.disableFileWatchers??e.disableFileWatchers,autoAddMissingPropertiesOnCompletion:t.autoAddMissingPropertiesOnCompletion??e.autoAddMissingPropertiesOnCompletion}},Yu=async(t,e)=>{let n=t.cwd?await jr(t.cwd,e):void 0,r=t.defaultBindingType,i=t.defaultDeviceOrgBindingsMetaSchema=await Promise.all((t.defaultDeviceOrgBindingsMetaSchema??[]).map(d=>jr(d,e))),s=t.defaultDeviceOrgTreeBindings=await Promise.all((t.defaultDeviceOrgTreeBindings??[]).map(d=>jr(d,e))),o=t.defaultIncludePaths=await Promise.all((t.defaultIncludePaths??[]).map(d=>jr(d,e))),a=t.defaultZephyrBindings=await Promise.all((t.defaultZephyrBindings??[]).map(d=>jr(d,e))),c=t.defaultLockRenameEdits=await Promise.all((t.defaultLockRenameEdits??[]).map(d=>jr(d,e)));n&&(o=t.defaultIncludePaths=(t.defaultIncludePaths??[]).map(d=>(0,Ut.resolve)(n,d)),r==="Zephyr"&&!t.defaultZephyrBindings&&(a=["./zephyr/dts/bindings"]),a=a.map(d=>(0,Ut.resolve)(n,d)),i=i.map(d=>(0,Ut.resolve)(n,d)),s=(t.defaultDeviceOrgTreeBindings??[]).map(d=>(0,Ut.resolve)(n,d)),c=c.map(d=>(0,Ut.resolve)(n,d)));let l={cwd:n,defaultDeviceOrgBindingsMetaSchema:i,defaultDeviceOrgTreeBindings:s,defaultIncludePaths:o,defaultZephyrBindings:a,defaultLockRenameEdits:c,defaultBindingType:r,autoChangeContext:t.autoChangeContext??zs.autoChangeContext,allowAdhocContexts:t.allowAdhocContexts??zs.allowAdhocContexts,defaultShowFormattingErrorAsDiagnostics:t.defaultShowFormattingErrorAsDiagnostics??zs.defaultShowFormattingErrorAsDiagnostics,disableFileWatchers:t.disableFileWatchers??!1,autoAddMissingPropertiesOnCompletion:t.autoAddMissingPropertiesOnCompletion??!0},u=(await Promise.all(t.contexts?.map(d=>bP(d,l,e))??[])).filter(d=>!!d).filter(d=>[d.dtsFile,...d.overlays].every(f=>(0,vP.existsSync)(f)&&Ut.default.isAbsolute(f)));return{...l,contexts:u}};var cB=t=>`DT_PROP(${SP(t.parent)}, ${t.name.replaceAll("-","_")}))`,lB=t=>t.parent.labels.map(e=>`DT_PROP(DT_NODELABEL(${e.label.toString()}), ${t.name.replaceAll("-","_")})`);var SP=t=>`DT_PATH(${t.path.slice(1).map(e=>e.replace("@","_").replaceAll("-","_")).join(",")})`,uB=t=>t.labels.map(e=>`DT_NODELABEL(${e.label.toString()})`),dB=t=>{let e=[];return Pi.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 rt&&s.path?.pathParts.at(-1)?.linksTo===t)return!0})?.forEach(i=>e.push(`DT_ALIAS(${i.name.replaceAll("-","_")})`)),e};function qQ(t,e){if(!t||!(t.item instanceof Je)||!(t.ast instanceof Xe))return[];let n=[];return e.settings.bindingType==="Zephyr"&&(n.push({type:"dt_zephyr_macro_prop_node_path",data:cB(t.item)}),lB(t.item).forEach(r=>{n.push({type:"dt_zephyr_macro_prop_node_label",data:r})})),n}function $Q(t,e){if(!t||t.item===null)return[];let n;if(t.item instanceof X?n=t.item:t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?n=t.ast.parentNode.linksTo:t.ast instanceof $e&&t.ast.linksTo&&(n=t.ast.linksTo),!n)return[];let r=[{type:"path",data:n.pathString}];return e.settings.bindingType==="Zephyr"&&(uB(n).forEach(i=>{r.push({type:"dt_zephyr_macro_node_label",data:i})}),r.push({type:"dt_zephyr_macro_node_path",data:SP(n)}),dB(n).forEach(i=>{r.push({type:"dt_zephyr_macro_prop_node_alias",data:i})})),r}async function fB(t,e){return e?Rt(t,e,n=>[...$Q(n,e),...qQ(n,e)]):[]}var pB=L(U());function FQ(t){return!t||!(t.item instanceof Je)?void 0:t.item.parent.nodeType?.getSignatureHelp?.(t.item,t.ast,t.beforeAst,t.afterAst)}async function BQ(t){let e=Gc(t?.ast);if(!e||!e.params.length||!t?.ast||t.ast===e.functionName)return;let r=(await t.runtime.context.getAllStableParsers()).at(-1).cPreprocessorParser.macros.get(e.functionName.name)?.macro.identifier;if(!r||!(r instanceof ei))return;let i=r.params.map(o=>({label:o instanceof Tt?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:[pB.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 hB(t,e){if(e)return(await Rt(t,e,async n=>[await BQ(n)||FQ(n)])).at(0)}var mB=require("timers"),gB=require("events");var _P=class extends gB.EventEmitter{constructor(e=3e3,n=1e3){super(),this.thresholdBytes=e*1024*1024,this.interval=(0,mB.setInterval)(()=>{let r=process.memoryUsage().heapUsed;r>this.thresholdBytes&&this.emit("thresholdExceeded",{usedMb:(r/1024/1024).toFixed(2),thresholdMb:e})},n)}stop(){clearInterval(this.interval)}},jQ=new _P(3e3),yB=()=>{jQ.on("thresholdExceeded",({usedMb:t,thresholdMb:e})=>{console.warn(`[HeapMonitor] Heap usage exceeded ${e}MB: ${t}MB used`),xD(),MD()})};var TB=t=>`0x${t.map((e,n)=>e.toString(16).padStart(n?8:0,"0")).join("")}`;function vB(t,e){let n=e.nodePath,r=e.labels.at(0);e.disabled&&(r+=" <DISABLED>");let i=e.nodePath.split("/").pop()??e.nodePath,s=r?`${r} (${i})`:i,o=t.children.filter(a=>{let c=Xr(e.start,e.size),l=Xr(a.start,a.size),u=
|
|
344
|
+
`),a=o===-1?r+1:r-o,c=a+n[0].length;return On.Range.create(On.Position.create(s,a),On.Position.create(s,c))}var vc=require("fs");var xQ=(t,e)=>{let n=(0,vc.readFileSync)(t).toString();if(Ln().needsRenew(t,n))Ln().renewLexer(t,n),e(t);else return console.log("file changed event has the same text, skipping.",t)},fg=class{constructor(e,n,r){this.file=e;this.cb=n;this.isFileDirty=r}#e=0;watch(){if(this.count++,this.count===1){console.log("create watch for",this.file);let e=this.file,n=this.cb;this.onChange=()=>{if(console.log("onChange - file watcher",e),this.isFileDirty()){console.log("onChange - file is dirty, skipping");return}xQ(e,n)},(0,vc.watchFile)(e,this.onChange)}}unwatch(){this.count===1&&(console.log("dispose watch for",this.file),(0,vc.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 Ut=L(require("path")),vP=require("fs");var hi=t=>{if(t)return Array.isArray(t)?t:[t]},LQ=t=>({...t,deviceOrgBindingsMetaSchema:hi(t.deviceOrgBindingsMetaSchema),deviceOrgTreeBindings:hi(t.deviceOrgTreeBindings),includePaths:hi(t.includePaths),lockRenameEdits:hi(t.lockRenameEdits),zephyrBindings:hi(t.zephyrBindings),overlays:hi(t.overlays)}),aB=t=>({...t,defaultDeviceOrgBindingsMetaSchema:hi(t.defaultDeviceOrgBindingsMetaSchema),defaultDeviceOrgTreeBindings:hi(t.defaultDeviceOrgTreeBindings),defaultIncludePaths:hi(t.defaultIncludePaths),defaultLockRenameEdits:hi(t.defaultLockRenameEdits),defaultZephyrBindings:hi(t.defaultZephyrBindings),contexts:t.contexts?.map(LQ)}),jr=async(t,e=[],n)=>{let r=n?e.map(s=>_e(s.uri)).sort((s,o)=>s.split(Ut.sep).length-o.split(Ut.sep).length).find(s=>PE(s,n)):void 0;return[...e.at(0)?[{replace:"${workspaceFolder}",fsPath:r??_e(e[0].uri)}]:[],...e.map(s=>({replace:`\${workspaceFolder:${s.name}}`,fsPath:_e(s.uri)}))].forEach(s=>t=t.replaceAll(s.replace,s.fsPath)),t},zs={defaultBindingType:"Zephyr",defaultZephyrBindings:[],defaultIncludePaths:[],defaultDeviceOrgBindingsMetaSchema:[],defaultDeviceOrgTreeBindings:[],contexts:[],defaultLockRenameEdits:[],allowAdhocContexts:!0,autoChangeContext:!0,defaultShowFormattingErrorAsDiagnostics:!0,disableFileWatchers:!1,autoAddMissingPropertiesOnCompletion:!0},bP=async(t,e,n)=>{let r=await jr(t.cwd??"${workspaceFolder}",n,t.dtsFile)??e.cwd,i=await Promise.all((t.includePaths??e.defaultIncludePaths).map(p=>jr(p,n,t.dtsFile))),s=await Promise.all((t.zephyrBindings??e.defaultZephyrBindings).map(p=>jr(p,n,t.dtsFile))),o=t.bindingType??e.defaultBindingType,a=await Promise.all((t.deviceOrgTreeBindings??e.defaultDeviceOrgTreeBindings).map(p=>jr(p,n,t.dtsFile))),c=await Promise.all((t.deviceOrgBindingsMetaSchema??e.defaultDeviceOrgBindingsMetaSchema).map(p=>jr(p,n,t.dtsFile))),l=await Promise.all((t.lockRenameEdits??e.defaultLockRenameEdits).map(p=>jr(p,n,t.dtsFile)));if(r&&o==="Zephyr"&&(!s||s.length===0)&&(s=["./zephyr/dts/bindings"]),!t.dtsFile){console.log("Context is missing dtsFile, skipping...");return}let u=t.dtsFile,d=t.overlays??[],f=t.compileCommands;return r&&(s=s.map(p=>(0,Ut.resolve)(r,p)).filter(p=>(0,vP.existsSync)(p)),a=a?.map(p=>(0,Ut.resolve)(r,p)),c=c.map(p=>(0,Ut.resolve)(r,p)),i=i.map(p=>(0,Ut.resolve)(r,p)),u=(0,Ut.resolve)(r,u),d=d.map(p=>(0,Ut.resolve)(r,p)),l=l.map(p=>(0,Ut.resolve)(r,p)),f=f?(0,Ut.resolve)(r,f):void 0),{ctxName:t.ctxName??(0,Ut.basename)(u),cwd:r?dt(r):void 0,includePaths:i.map(dt),zephyrBindings:s.map(dt),bindingType:o,deviceOrgTreeBindings:a.map(dt),deviceOrgBindingsMetaSchema:c.map(dt),dtsFile:dt(u),overlays:d.map(dt),lockRenameEdits:l.map(dt),compileCommands:f?dt(f):void 0,showFormattingErrorAsDiagnostics:t.showFormattingErrorAsDiagnostics??e.defaultShowFormattingErrorAsDiagnostics,disableFileWatchers:t.disableFileWatchers??e.disableFileWatchers,autoAddMissingPropertiesOnCompletion:t.autoAddMissingPropertiesOnCompletion??e.autoAddMissingPropertiesOnCompletion}},Yu=async(t,e)=>{let n=t.cwd?await jr(t.cwd,e):void 0,r=t.defaultBindingType,i=t.defaultDeviceOrgBindingsMetaSchema=await Promise.all((t.defaultDeviceOrgBindingsMetaSchema??[]).map(d=>jr(d,e))),s=t.defaultDeviceOrgTreeBindings=await Promise.all((t.defaultDeviceOrgTreeBindings??[]).map(d=>jr(d,e))),o=t.defaultIncludePaths=await Promise.all((t.defaultIncludePaths??[]).map(d=>jr(d,e))),a=t.defaultZephyrBindings=await Promise.all((t.defaultZephyrBindings??[]).map(d=>jr(d,e))),c=t.defaultLockRenameEdits=await Promise.all((t.defaultLockRenameEdits??[]).map(d=>jr(d,e)));n&&(o=t.defaultIncludePaths=(t.defaultIncludePaths??[]).map(d=>(0,Ut.resolve)(n,d)),r==="Zephyr"&&!t.defaultZephyrBindings&&(a=["./zephyr/dts/bindings"]),a=a.map(d=>(0,Ut.resolve)(n,d)),i=i.map(d=>(0,Ut.resolve)(n,d)),s=(t.defaultDeviceOrgTreeBindings??[]).map(d=>(0,Ut.resolve)(n,d)),c=c.map(d=>(0,Ut.resolve)(n,d)));let l={cwd:n,defaultDeviceOrgBindingsMetaSchema:i,defaultDeviceOrgTreeBindings:s,defaultIncludePaths:o,defaultZephyrBindings:a,defaultLockRenameEdits:c,defaultBindingType:r,autoChangeContext:t.autoChangeContext??zs.autoChangeContext,allowAdhocContexts:t.allowAdhocContexts??zs.allowAdhocContexts,defaultShowFormattingErrorAsDiagnostics:t.defaultShowFormattingErrorAsDiagnostics??zs.defaultShowFormattingErrorAsDiagnostics,disableFileWatchers:t.disableFileWatchers??!1,autoAddMissingPropertiesOnCompletion:t.autoAddMissingPropertiesOnCompletion??!0},u=(await Promise.all(t.contexts?.map(d=>bP(d,l,e))??[])).filter(d=>!!d).filter(d=>[d.dtsFile,...d.overlays].every(f=>(0,vP.existsSync)(f)&&Ut.default.isAbsolute(f)));return{...l,contexts:u}};var cB=t=>`DT_PROP(${SP(t.parent)}, ${t.name.replaceAll("-","_")}))`,lB=t=>t.parent.labels.map(e=>`DT_PROP(DT_NODELABEL(${e.label.toString()}), ${t.name.replaceAll("-","_")})`);var SP=t=>`DT_PATH(${t.path.slice(1).map(e=>e.replace("@","_").replaceAll("-","_")).join(",")})`,uB=t=>t.labels.map(e=>`DT_NODELABEL(${e.label.toString()})`),dB=t=>{let e=[];return Pi.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 rt&&s.path?.pathParts.at(-1)?.linksTo===t)return!0})?.forEach(i=>e.push(`DT_ALIAS(${i.name.replaceAll("-","_")})`)),e};function qQ(t,e){if(!t||!(t.item instanceof Je)||!(t.ast instanceof Xe))return[];let n=[];return e.settings.bindingType==="Zephyr"&&(n.push({type:"dt_zephyr_macro_prop_node_path",data:cB(t.item)}),lB(t.item).forEach(r=>{n.push({type:"dt_zephyr_macro_prop_node_label",data:r})})),n}function $Q(t,e){if(!t||t.item===null)return[];let n;if(t.item instanceof X?n=t.item:t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?n=t.ast.parentNode.linksTo:t.ast instanceof $e&&t.ast.linksTo&&(n=t.ast.linksTo),!n)return[];let r=[{type:"path",data:n.pathString}];return e.settings.bindingType==="Zephyr"&&(uB(n).forEach(i=>{r.push({type:"dt_zephyr_macro_node_label",data:i})}),r.push({type:"dt_zephyr_macro_node_path",data:SP(n)}),dB(n).forEach(i=>{r.push({type:"dt_zephyr_macro_prop_node_alias",data:i})})),r}async function fB(t,e){return e?Rt(t,e,n=>[...$Q(n,e),...qQ(n,e)]):[]}var pB=L(U());function FQ(t){return!t||!(t.item instanceof Je)?void 0:t.item.parent.nodeType?.getSignatureHelp?.(t.item,t.ast,t.beforeAst,t.afterAst)}async function BQ(t){let e=Gc(t?.ast);if(!e||!e.params.length||!t?.ast||t.ast===e.functionName)return;let r=(await t.runtime.context.getAllStableParsers()).at(-1).cPreprocessorParser.macros.get(e.functionName.name)?.macro.identifier;if(!r||!(r instanceof ei))return;let i=r.params.map(o=>({label:o instanceof Tt?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:[pB.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 hB(t,e){if(e)return(await Rt(t,e,async n=>[await BQ(n)||FQ(n)])).at(0)}var mB=require("timers"),gB=require("events");var _P=class extends gB.EventEmitter{constructor(e=3e3,n=1e3){super(),this.thresholdBytes=e*1024*1024,this.interval=(0,mB.setInterval)(()=>{let r=process.memoryUsage().heapUsed;r>this.thresholdBytes&&this.emit("thresholdExceeded",{usedMb:(r/1024/1024).toFixed(2),thresholdMb:e})},n)}stop(){clearInterval(this.interval)}},jQ=new _P(3e3),yB=()=>{jQ.on("thresholdExceeded",({usedMb:t,thresholdMb:e})=>{console.warn(`[HeapMonitor] Heap usage exceeded ${e}MB: ${t}MB used`),xD(),MD()})};var TB=t=>`0x${t.map((e,n)=>e.toString(16).padStart(n?8:0,"0")).join("")}`;function vB(t,e){let n=e.nodePath,r=e.labels.at(0);e.disabled&&(r+=" <DISABLED>");let i=e.nodePath.split("/").pop()??e.nodePath,s=r?`${r} (${i})`:i,o=t.children.filter(a=>{let c=Xr(e.start,e.size),l=Xr(a.start,a.size),u=Lt(e.start,a.start)>=0,d=Lt(c,l)<=0,f=Lt(e.start,a.start)===0&&Lt(e.size,a.size)===0;return u&&d&&!f});if(o.length>0){for(let a of o)vB(a,e);return}t.children.push({name:s,start:e.start,size:e.size,children:[],path:n,disabled:e.disabled})}function UQ(t){let e={};for(let n of t){let r={name:n.name,children:[],path:n.path};for(let i of n.partitions)vB(r,i);e[n.name]=r}return e}function bB(t,e="",n=!0){let r={};for(let d of t.children){let f=`${d.start}-${d.size}`;r[f]||(r[f]=[]),r[f].push(d)}let i="",s=e?n?"\u2514\u2500 ":"\u251C\u2500 ":"",o=[];"start"in t&&t.start.length&&o.push(`start: ${TB(t.start)}`),"size"in t&&t.size.length&&o.push(`size: ${TB(t.size)}`);let a=o.length>0?`[${o.join(", ")}]`:"",c=t.name;i+=`${e}${s}${c} ${a}
|
|
345
345
|
`;let l=e+(n?" ":"\u2502 "),u=Object.keys(r);return u.forEach((d,f)=>{let p=r[d],m=Array.from(new Set(p.map(b=>b.name))).join(", "),h={};p.forEach(b=>{b.children.forEach(v=>{let k=`${v.start}-${v.size}-${v.name}`;h[k]=v})});let y=Object.values(h),S={name:m,start:p[0].start,size:p[0].size,children:y,path:t.path};i+=bB(S,l,f===u.length-1)}),i}function SB(t){return UQ(t)}function _B(t){return Object.values(t).map(e=>bB(e)).join(`
|
|
346
|
-
`)}var Ie=[],le,Gs,hg=new WeakMap,Ku=new Map;yB();var gg=new Map,kB=t=>{t.settings.disableFileWatchers||t.getContextFiles().forEach(e=>{Ku.has(e)||Ku.set(e,new fg(e,CP,()=>{let n=td(e),r=gg.get(e);return!n||r===void 0?!1:r!==n.version})),Ku.get(e)?.watch()})},RP=async t=>{let e=Ie.indexOf(t);if(e===-1)return;Ju(t,void 0,!0),hg.delete(t),console.log(`(ID: ${t.id}) cleaning Context for [${t.ctxNames.join(",")}]`);let n=await Ks(t);if(J.sendNotification("devicetree/contextDeleted",{ctxNames:t.ctxNames.map(r=>r.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:le===t,type:n.type}),Ie.splice(e,1),await IP(),t===le&&(le=void 0,Ie.length)){let r=Gs?Rn(Ie,{fsPath:Gs}):void 0;r??=Ie[0],console.log("Active context was deleted. Forcing active to",r.id),await bn({id:r.id},!0)}t.settings.disableFileWatchers||t.getContextFiles().map(r=>{Ku.get(r)?.unwatch()}),setTimeout(async()=>{await Oe();let r=new Set(Ie.flatMap(i=>i.getContextFiles()));t.getContextFiles().map(i=>{r.has(i)||Ln().reset(i)})},2e3),t.bindingLoader?.dispose()},HQ=t=>{let e=hg.get(t);if(!e?.abort.signal.aborted)return Promise.all([e?.promise,t.getRuntime()])},Oe=async()=>{await Promise.all(Ie.map(HQ))},wP=async(t,e)=>(await NB(e)).indexOf(t)!==-1,NB=async t=>{let e=await RB(t);return Ie.filter(n=>!e.some(r=>r===n))},RB=async t=>{let e=await NP(t);return Ie.filter(n=>e.contexts.find(r=>Wi(r)===n.id))},VQ=async t=>{let e=await XQ(t);return Ie.filter(n=>e.contexts.find(r=>Wi(r)===n.id))},WQ=async(t,e)=>(await VQ(e)).indexOf(t)!==-1,zQ=async(t,e)=>{if(t===e)return!0;let n=(await t.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath),r=(await e.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath);return r.some(i=>fe(i.resolvedPath,t.parser.fsPath))&&n.length?n.every(i=>r.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=>fe(i,t.parser.fsPath))},GQ=async t=>{if(!await wP(t))return;let e=await NB(),n=await RB(),r=await Uf(e);if(Ie.indexOf(t)===-1)return;let i=await Promise.all(r.flatMap(a=>[...n,...e.filter(c=>c!==a.context)].map(async c=>({context:a.context,same:await zQ(a.context,c)})))),s=t.getContextFiles(),o=r.filter(a=>i.some(c=>c.context===a.context&&c.same)||a.context!==t&&fe(a.context.parser.fsPath,t.parser.fsPath)&&s.some(c=>c&&a.files.indexOf(c)!==-1)).map(a=>a.context);o.length&&await Promise.all(o.map(RP))},J=(0,He.createConnection)(He.ProposedFeatures.all),un=new He.TextDocuments(Lt),EP=!1,mg=!1,wB=!1,EB=!1,CB=!1,PP;J.onInitialize(async t=>{PP=t.workspaceFolders??[],J.console.log(`[Server(${process.pid}) ${PP?.at(0)?.uri} Version 0.10.2 ] Started and initialize received`);let e=t.capabilities;EP=!!(e.workspace&&e.workspace.configuration),mg=!!(e.workspace&&e.workspace.workspaceFolders),wB=!!e.workspace?.diagnostics?.refreshSupport,EB=!!e.workspace?.semanticTokens?.refreshSupport,CB=!!e.workspace?.foldingRange?.refreshSupport;let n={capabilities:{typeDefinitionProvider:!0,workspaceSymbolProvider:!0,textDocumentSync:He.TextDocumentSyncKind.Incremental,renameProvider:{prepareProvider:!0},completionProvider:{resolveProvider:!0,triggerCharacters:["&","="," ",'"',"(",","]},codeActionProvider:{codeActionKinds:[He.CodeActionKind.QuickFix,He.CodeActionKind.SourceFixAll]},documentSymbolProvider:!0,semanticTokensProvider:{legend:{tokenTypes:qf,tokenModifiers:$f},full:!0},documentLinkProvider:{resolveProvider:!1},foldingRangeProvider:!0,definitionProvider:!0,declarationProvider:!0,referencesProvider:!0,documentFormattingProvider:!0,documentRangeFormattingProvider:!0,hoverProvider:!0,signatureHelpProvider:{triggerCharacters:["<","("],retriggerCharacters:[" ",","]}}};return mg&&(n.capabilities.workspace={workspaceFolders:{changeNotifications:!0,supported:!0}}),await MB(t.initializationOptions),n});var kP,YQ={tabSize:8,insertSpaces:!1,trimTrailingWhitespace:!0,insertFinalNewline:!0,wordWrapColumn:100},DB=t=>({tabSize:t?.["editor.tabSize"],insertSpaces:t?.["editor.insertSpaces"],trimFinalNewlines:t?.["files.trimFinalNewlines"],trimTrailingWhitespace:t?.["files.trimTrailingWhitespace"],insertFinalNewline:t?.["editor.insertFinalNewline"],wordWrapColumn:t?.["editor.wordWrapColumn"],removeMacroMultiline:t?.["editor.removeMacroMultiline"],wrapLongLines:t?.["editor.wrapLongLines"],indentExpressions:t?.["editor.indentExpressions"],removeEmptyReferences:t?.["editor.removeEmptyReferences"],removeEmptyNodes:t?.["editor.removeEmptyNodes"],removeEmptyRoots:t?.["editor.removeEmptyRoots"],sortNodesAndProperties:t?.["editor.sortNodesAndProperties"]});J.onInitialized(async()=>{if(EP&&(J.client.register(He.DidChangeConfigurationNotification.type,{}),!kP)){let t=await J.workspace.getConfiguration("editor").catch(()=>{}),e=await J.workspace.getConfiguration("files").catch(()=>{}),n=await J.workspace.getConfiguration("[devicetree]").catch(()=>{}),r=DB(n);(t||e||r)&&(kP={...t,...e,...r})}mg&&J.workspace.onDidChangeWorkspaceFolders(async t=>{J.console.log("Workspace folder change event received"),await ed()})});J.onRequest("workspace/workspaceFolders",async()=>PP??null);var KQ=async t=>{let e=AB();return e={...zs,...e},Yu(e,t??await Zu())},NP=async t=>{let e=QQ();return e={...zs,...e},Yu(e,t??await Zu())},XQ=async t=>{let e=ZQ();return e={...zs,...e},Yu(e,t??await Zu())},Qu=async t=>{let e=JQ();return e={...zs,...e},Yu(e,t??await Zu())},Zu=async()=>mg?await J.workspace.getWorkspaceFolders()??[]:[],PB=async t=>{let e=Rn(Ie,{id:Wi(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 n=Wi(t);console.log(`(ID: ${n}) New context [${t.ctxName}]`),console.log(`(ID: ${n}) Settings: ${JSON.stringify(t,void 0," ")}`);let r=(0,Sc.join)((0,Sc.dirname)(t.dtsFile),"dts","bindings"),i=new mp(t,kP??YQ,t.bindingType?tB({zephyrBindings:t.zephyrBindings?[r,...t.zephyrBindings]:[r],deviceOrgBindingsMetaSchema:t.deviceOrgBindingsMetaSchema??[],deviceOrgTreeBindings:t.deviceOrgTreeBindings??[]},t.bindingType):void 0);Ie.push(i);let s=performance.now();await i.stable(),console.log(`(ID: ${n}) New context took ${performance.now()-s}ms to start [${t.ctxName}]`),kB(i);let o=await Ks(i);return J.sendNotification("devicetree/contextCreated",{ctxNames:i.ctxNames.map(a=>a.toString()),id:i.id,...await i.getFileTree(),settings:i.settings,active:i===le,type:o.type}),await GQ(i),await IP(),i},ed=async()=>{let t=await NP(),e=await Qu();e.allowAdhocContexts||(e=await NP());let n=e.contexts.map(Wi),r=Ie.filter(i=>!n.includes(i.id));await Promise.all(r.map(RP)),await t.contexts?.reduce((i,s)=>i.then(async()=>{await PB(s)}),Promise.resolve()),e.allowAdhocContexts&&await(await KQ()).contexts?.reduce((s,o)=>s.then(async()=>{Rn(Ie,{fsPath:o.dtsFile})||await PB(o)}),Promise.resolve()),setTimeout(async()=>{Gs?await bn({fsPath:Gs}):!le&&Ie.length&&(console.log(`No active context using first context (ID: ${Ie[0].id}) [${Ie[0].ctxNames.join(",")}]`),await bn({id:Ie[0].id}))})},Ur,Ys,Xu=new Map,bc=new Map,JQ=()=>!Ys&&!Ur?void 0:{...Ys,...Ur,contexts:[...Ur?.contexts??[],...Array.from(bc.values()),...Array.from(Xu.values())]},AB=()=>!Ys&&!Ur?void 0:{...Ys,...Ur,contexts:[...Array.from(Xu.values())]},QQ=()=>!Ys&&!Ur?void 0:{...Ys,...Ur,contexts:[...Ur?.contexts??[],...Array.from(bc.values())]},ZQ=()=>!Ys&&!Ur?void 0:{...Ur,contexts:[...Ur?.contexts??[]]};function e8(t){let e={...t};for(let n in e)e[n]===null&&delete e[n];return e}var IB=async()=>{let t=await Qu();console.log("Resolved settings",JSON.stringify(t,void 0," ")),J.sendNotification("devicetree/settingsChanged",t),await ed(),Oe().then(()=>{wB&&J.languages.diagnostics.refresh()})},t8=async()=>{let t=le?.getContextFiles();await Promise.all(Array.from(un.keys()).filter(Jt).map(async e=>{t?.some(n=>fe(n,_e(e)))||await J.sendDiagnostics({uri:e,version:un.get(e)?.version,diagnostics:[{severity:He.DiagnosticSeverity.Information,range:He.Range.create(He.Position.create(0,0),He.Position.create(0,0)),message:"File not in active context",source:"devicetree"}]})}))},CP=async t=>{let e=PT(Ie,t);if(e.length)e.sort((n,r)=>n===le?-1:r===le?1:0).forEach(n=>{hg.get(n)?.abort.abort(),le===n&&J.sendNotification("devicetree/activeContextBusyNotification",n.id),J.sendNotification("devicetree/contextBusyNotification",n.id);let r=new AbortController,i=new Promise(s=>{setTimeout(async()=>{if(n.setStaleFsPath(t),r.signal.aborted){console.log("Abort parsing due to new request"),s();return}let o=performance.now(),a=le===n,c=a?OB(n):[],l=n.getContextFiles();if(await n.reevaluate(t),kB(n),l.forEach(p=>Ku.get(p)?.unwatch()),a&&OP(n)?.length&&(DP(n).then(p=>{let m=p.items.map(h=>({uri:h.uri,version:h.version??void 0,diagnostics:h.items}));Ju(n,c.filter(h=>m.every(y=>y.uri!==h.uri))),m.forEach(h=>{J.sendDiagnostics(h)}),nd.set(n,!0)}),Gs)){let p=n.getFsPathParser(Gs);p&&setTimeout(()=>{p.latestSemanticTokensBuilt||J.languages.semanticTokens.refresh()},50)}let[u,d]=await Promise.all([Ks(n),n.getFileTree()]),f={ctxNames:n.ctxNames.map(p=>p.toString()),id:n.id,...d,settings:n.settings,active:a,type:u.type};le===n&&J.sendNotification("devicetree/activeContextStableNotification",f),J.sendNotification("devicetree/contextStableNotification",f),s(),console.log("reevaluate",performance.now()-o)})});hg.set(n,{abort:r,promise:i})});else{if((await Qu()).allowAdhocContexts===!1)return;await ed(),await bn({fsPath:t})}},n8=t=>un.keys().find(e=>fe(_e(e),t)),td=t=>{let e=n8(t);if(e)return un.get(e)},OB=t=>t.getContextFiles().map(e=>({uri:ue(e),version:td(e)?.version,diagnostics:[]})),nd=new WeakMap,Ju=async(t,e=OB(t),n=!1)=>{if(!n&&t!==le)return;let r=performance.now();await Promise.all(e.filter(i=>t===le||!le?.getContextFiles().some(s=>fe(_e(i.uri),s))).map(i=>J.sendDiagnostics({uri:i.uri,version:un.get(i.uri)?.version,diagnostics:[]}))),nd.delete(t),console.log(`(ID: ${t.id})`,"clear workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-r)},pg=new Map,r8=async t=>{let e=pg.get(t);if(e||!EP)return e;pg.delete(t);let n=await J.workspace.getConfiguration({scopeUri:ue(t),section:"[devicetree]"}).catch(()=>{});if(n){let r=DB(n);return pg.set(t,r),r}},DP=async t=>{await t.stable();let e=performance.now(),n=await t.getDiagnostics(),r=await Promise.all(t.getContextFiles().map(async i=>{let s=td(i),o=[];if(s&&t.settings.showFormattingErrorAsDiagnostics){let a=await r8(i);o.push(...(await wi({textDocument:s,options:{...t.formattingOptions,...a}},s.getText(),"File Diagnostics").catch(()=>[])).map(c=>c.diagnostic()))}return{uri:ue(i),kind:He.DocumentDiagnosticReportKind.Full,items:[...n.get(i)??[],...o],version:s?.version??null}}));return console.log(`(ID: ${t.id})`,"workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-e),{items:[...r]}},AP=async t=>{let{items:e}=await DP(t);e.map(n=>({uri:n.uri,version:n.version??void 0,diagnostics:n.items})).forEach(async n=>{J.sendDiagnostics(n)}),nd.set(t,!0)},IP=async()=>{let t=await Promise.all(Ie.map(e=>Ks(e)));console.log("======== Context List ========"),t.forEach(e=>{console.log(`(ID: ${e.ctx.id}) [${e.ctx.ctxNames.join(",")}]`,`[${e.type}]`,le===e.ctx?" [ACTIVE]":"")}),console.log("==============================")},Ks=async(t,e)=>{let n=await wP(t,e),r=!n&&await WQ(t,e);return{ctx:t,type:n?"Ad Hoc":r?"User":"3rd Party"}},bn=async(t,e=!1)=>{if("fsPath"in t){if(!Jt(t.fsPath))return!1;Gs=t.fsPath,console.log("Active File Uri",Gs)}let n=await Qu();if(le&&!e&&!n.autoChangeContext||(await Oe(),!e&&le?.getContextFiles().find(o=>"fsPath"in t&&fe(o,t.fsPath))))return!1;let r=le,i=Rn(Ie,t),s=r!==i;return s&&(r&&Ju(r),le=i,i?(Ks(i).then(async o=>{let a=await i.getFileTree();!i||i!==le&&!Ie.includes(i)||J.sendNotification("devicetree/newActiveContext",{ctxNames:i.ctxNames.map(c=>c.toString()),id:i.id,...a,settings:i.settings,active:le===i,type:o.type})}),OP(i)?.length&&AP(i),await IP()):J.sendNotification("devicetree/newActiveContext",void 0)),CB&&J.languages.foldingRange.refresh(),EB&&J.languages.semanticTokens.refresh(),s},Jt=t=>[".dts",".dtsi",".dtso",".overlay",".keymap"].some(e=>t.endsWith(e));un.listen(J);var OP=t=>t?.getContextFiles()?.filter(e=>td(e));un.onDidSave(t=>{gg.set(_e(t.document.uri),t.document.version)});un.onDidClose(async t=>{let e=_e(t.document.uri);if(!Jt(e))return;gg.delete(e);let n=PT(Ie,e);if(n.length===0){Xu.delete(e),J.sendDiagnostics({uri:t.document.uri,version:un.get(t.document.uri)?.version,diagnostics:[]});return}await Promise.all(n.map(async r=>{!!OP(r)?.filter(s=>s!==e).length?le?.getContextFiles().some(s=>fe(s,e))?le?.getContextFiles().some(s=>fe(s,e))&&(await Ju(le),await AP(le)):J.sendDiagnostics({uri:t.document.uri,version:un.get(t.document.uri)?.version,diagnostics:[]}):await wP(r)?(await RP(r),Xu.delete(r.settings.dtsFile)):Ju(r)}))});un.onDidOpen(async t=>{let e=_e(t.document.uri);if(!Jt(e))return;gg.set(e,t.document.version),await Oe(),t8();let n=Rn(Ie,{fsPath:e});if(console.log("onDidOpen",n?.id,e),n)n!==le?await bn({id:n.id}):n===le&&(!nd.get(n)||n.getContextFiles().some(r=>!fe(r,e)))&&await AP(n);else{let r={ctxName:(0,Sc.basename)(e),dtsFile:e};Xu.set(e,r),await CP(e)}});un.onDidChangeContent(async t=>{let e=_e(t.document.uri);if(!Jt(e))return;let n=t.document.getText(),r=Ln();r.needsRenew(e,n)&&(console.log("Content changed",e),r.renewLexer(e,n),await CP(e))});var MB=async t=>{t?.settings?.devicetree&&(Ur=aB(e8(t.settings.devicetree)),console.log("Configuration changed",JSON.stringify(t,void 0," ")),await IB())};J.onDidChangeConfiguration(async t=>{await MB(t)});J.listen();J.languages.diagnostics.onWorkspace(async()=>{await Oe();let t=le;return t?DP(t).finally(()=>{nd.set(t,!0)}):{items:[]}});J.onDidChangeWatchedFiles(t=>{J.console.log("We received a file change event")});J.onCompletion(async t=>{let e=_e(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return i0(t,le,un.get(t.textDocument.uri));if(!Jt(e))return[];await Oe(),bn({fsPath:e});let n=Hn(e);return n?[...await UD(t,n),...await L0(t,n)]:[]});J.onCompletionResolve(t=>t);var Hn=t=>{let e=AB();return Rn(Ie,{fsPath:t},le,e?.preferredContext)};J.onDocumentSymbol(async t=>{let e=_e(t.textDocument.uri);if(!Jt(e))return[];await Oe();let n=Hn(e);return n?n.getFsPathParser(e)?.getDocumentSymbols(e):[]});J.onWorkspaceSymbol(async()=>{await Oe();let t=le;return t?(await t.getAllStableParsers()).flatMap(e=>e.getWorkspaceSymbols()):[]});J.languages.semanticTokens.on(async t=>{let e=_e(t.textDocument.uri);if(!Jt(e))return{data:[]};try{await Oe();let n=Hn(e),r=new He.SemanticTokensBuilder,i=n?.isInContext(e);return!n||!i?{data:[]}:((await n.getAllStableParsers()).forEach(s=>s.buildSemanticTokens(r,e)),r.build())}catch(n){throw console.log(n),n}});J.onDocumentLinks(async t=>{await Oe();let e=_e(t.textDocument.uri);return Jt(e)?Hn(e)?.getDocumentLinks(e):e.endsWith(".yaml")&&le?le.bindingLoader?.getDocumentLinks?.(un.get(t.textDocument.uri))??[]:[]});J.onPrepareRename(async t=>{let e=_e(t.textDocument.uri);if(!Jt(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return u0(t,n)});J.onRenameRequest(async t=>{let e=_e(t.textDocument.uri);if(!Jt(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return l0(t,n)});J.onReferences(async t=>{let e=_e(t.textDocument.uri);if(!Jt(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return s0(t,n)});J.onDefinition(async t=>{let e=_e(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return p0(t,le,un.get(t.textDocument.uri));if(!Jt(e))return;await Oe(),bn({fsPath:e});let n=Hn(e),r=(await n?.getDocumentLinks(e,t.position))?.filter(i=>i.target).map(i=>He.Location.create(i.target,i.range))??[];return r.length?r:f0(t,n)});J.onDeclaration(async t=>{let e=_e(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return y0(t,le,un.get(t.textDocument.uri));if(!Jt(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return g0(t,n)});J.onCodeAction(async t=>{let e=_e(t.textDocument.uri);if(Jt(e))return v0(t)});var xB=async t=>{let e=_e(t.textDocument.uri);if(!Jt(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);if(!n)return[];if((await n.getSyntaxIssues(void 0,l=>co(l.raw,e,!1)?l:void 0)).get(e)?.length)return[];let i=un.get(t.textDocument.uri)??Ln().getDocument(e),s=i.getText();pg.set(e,t.options);let o=await wi({...t,options:{...n.formattingOptions,...t.options}},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[He.TextEdit.replace(He.Range.create(He.Position.create(0,0),He.Position.create(i.lineCount,c)),o)]};J.onDocumentRangeFormatting(xB);J.onDocumentFormatting(xB);J.onHover(async t=>{let e=_e(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return sM(t,le,un.get(t.textDocument.uri));if(!Jt(e))return;await Oe();let n=Hn(e);return(await q0(t,n)).at(0)});J.onFoldingRanges(async t=>{let e=_e(t.textDocument.uri);if(!Jt(e))return;await Oe();let n=Hn(e),r=n?.isInContext(e);if(!n||!r)return[];let i=(await n.getAllStableParsers()).find(s=>s.getFiles().some(o=>o===e));return i?nB(e,i):[]});J.onTypeDefinition(async t=>{let e=_e(t.textDocument.uri);if(!Jt(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return oB(t,n)});J.onSignatureHelp(async t=>{let e=_e(t.textDocument.uri);if(!Jt(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return hB(t,n)});J.onRequest("devicetree/getContexts",async()=>(await Oe(),Promise.all(Ie.map(async t=>{let e=await Ks(t);return{ctxNames:t.ctxNames.map(n=>n.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:le===t,type:e.type}}))));J.onRequest("devicetree/setActive",async t=>(await Oe(),console.log("devicetree/setActive",t),await bn(t,!0)));J.onRequest("devicetree/getActiveContext",async()=>{if(await Oe(),console.log("devicetree/getActiveContext"),!le)return;let t=await Ks(le);return le?{ctxNames:le.ctxNames.map(e=>e.toString()),id:le.id,...await le.getFileTree(),settings:le.settings,active:!0,type:t.type}:void 0});J.onRequest("devicetree/setDefaultSettings",async t=>{await Oe(),Ys=t,console.log("Integration Settings",t),await IB()});J.onRequest("devicetree/requestContext",async t=>{await Oe();let e=await Zu(),n=await Qu(e),r=await bP(t,n,e);if(!r)throw console.log("Failed to resolve context",t),new Error("Failed to resolve context");console.log("devicetree/requestContext",r);let i=Wi(r),s=Array.from(bc).find(([,c])=>c.ctxName===t.ctxName);if(s){let c=s[0].split(":",1)[0];Rn(Ie,{name:r.ctxName.toString()})?.removeCtxName(r.ctxName),console.log(`Removing integration context with ID ${c} and name ${t.ctxName}`),bc.delete(s[0])}bc.set(`${i}:${t.ctxName}`,t),await ed();let o=Ie.find(c=>c.id===i);if(!o)throw new Error("Failed to create context");let a=await Ks(o,e);return{ctxNames:o.ctxNames.map(c=>c.toString()),id:i,...await o.getFileTree(),settings:o.settings,active:!0,type:a.type}});J.onRequest("devicetree/removeContext",async({id:t,name:e})=>{await Oe(),bc.delete(`${t}:${e}`);let n=Rn(Ie,{id:t});if(n){if(n.removeCtxName(e),n.ctxNames.length){console.log("Context will not be deleted as it is still in use by others");return}await ed()}});J.onRequest("devicetree/compiledDtsOutput",async t=>{if(await Oe(),!t)return;let e=Rn(Ie,{id:t});if(!e||!e.settings.dtsFile){console.log("Context or DTS file not found for ID",t);return}let n=await e.toFullString();return wi({textDocument:{uri:ue(e.settings.dtsFile)},options:e.formattingOptions},n,"New Text").catch(()=>n)});J.onRequest("devicetree/serializedContext",async t=>{if(await Oe(),!t)return;let e=Rn(Ie,{id:t}),n=performance.now();return e?.serialize().finally(()=>{console.info("serializedContext",performance.now()-n)})});J.onRequest("devicetree/activePath",async t=>{if(await Oe(),!le)return;let e=n=>{if(n?.item)return n.item instanceof X?{nodePath:n.item.pathString}:{nodePath:n.item.parent.pathString,propertyName:n.item.name}};return(await Rt(t,le,n=>[e(n)])).at(0)});J.onRequest("devicetree/customActions",async t=>(await Oe(),fB(t,le)));J.onRequest("devicetree/activeFsPath",async t=>{await Oe(),bn({fsPath:t})});J.onRequest("devicetree/formattingText",async t=>{let e=_e(t.textDocument.uri),n=td(e)??Ln().getDocument(e,t.text),r=await wi(t,n.getText(),"New Text");return{text:r,diagnostics:(await wi(t,n.getText(),"File Diagnostics")).map(i=>i.diagnostic()),nonActionableDiagnostics:(await wi(t,r,"File Diagnostics")).map(i=>i.diagnostic())}});J.onRequest("devicetree/formatTextEdits",async t=>{await Oe();let e=Ln().getDocument(_e(t.textDocument.uri),t.text),n=e.positionAt(e.getText().length),r=He.TextEdit.replace(He.Range.create(He.Position.create(0,0),n),""),i=NT(e,t.edits),s=await wi({...t},i,"New Text").catch(()=>i);return r.newText=s,r});J.onRequest("devicetree/diagnosticIssues",async({uri:t,full:e})=>{await Oe();let n=_e(t);bn({fsPath:n});let r=Hn(n);if(!r)return[];let i=e?(await r.getDiagnostics()).get(n):(await r.getSyntaxIssues(void 0,s=>co(s.raw,n,!!e)?s:void 0)).get(n);if(i?.length)return i});J.onRequest("devicetree/evalMacros",async({macros:t,ctxId:e})=>{await Oe();let n=Rn(Ie,{id:e});return n?t.map(r=>{let i=Hc(r,n.macros),s=Me(i);return{macro:r,evaluated:typeof s=="number"?s:i}}):[]});J.onRequest("devicetree/memoryViews",async({ctxId:t})=>{let e=Rn(Ie,{id:t});if(!e)return;await e?.stable();let n=await e.getRuntime(),r=n.rootNode.getMemoryViews(n.context.macros).sort((o,a)=>Dt(o.start,a.start)===0?Dt(a.size,o.size):Dt(o.start,a.start)),i=new Map;r.forEach(o=>{let a=i.get(o.name),c={nodePath:o.nodePath,labels:o.labels,start:o.start,size:o.size,disabled:o.disabled};a?a.partitions.push(c):i.set(o.name,{name:o.name,partitions:[c],path:o.nodePath})});let s=SB(Array.from(i.values()));return{trees:s,treeStr:_B(s)}});J.onRequest("devicetree/zephyrTypeBindings",async t=>{if(await Oe(),!t)return;let e=Rn(Ie,{id:t});return e?.bindingLoader?.getZephyrContextBinding()?.map(n=>({...n,vendor:n.compatible&&e?.bindingLoader?.getBindingVendorString(n.compatible)}))});J.onRequest("devicetree/contextMacroNames",async t=>{if(await Oe(),!t)return;let e=Rn(Ie,{id:t});return Array.from(e?.macros.keys()??[])});J.onRequest("devicetree/locationScopedInformation",async t=>{await Oe();let e=Rn(Ie,{id:t.id}),n=_e(t.textDocument.uri);if(!(!e||!e.isInContext(n)))return new Promise(async r=>{let i=await e.getRuntime(),s=await Rt(t,e,(o,a)=>{let c=i.context.macros,l={};if(!o?.item)return i.rootNode.serialize(l,c,a),[{inNode:!1,inScope:l,parentNode:i.rootNode.pathString}];let u=null;return o.item instanceof X?u=o.item:u=o.item?.parent,u.serialize(l,i.context.macros,a),[{inNode:!0,inScope:l,parentNode:u.pathString}]});r(s[0])})});
|
|
346
|
+
`)}var Ie=[],le,Gs,hg=new WeakMap,Ku=new Map;yB();var gg=new Map,kB=t=>{t.settings.disableFileWatchers||t.getContextFiles().forEach(e=>{Ku.has(e)||Ku.set(e,new fg(e,CP,()=>{let n=td(e),r=gg.get(e);return!n||r===void 0?!1:r!==n.version})),Ku.get(e)?.watch()})},RP=async t=>{let e=Ie.indexOf(t);if(e===-1)return;Ju(t,void 0,!0),hg.delete(t),console.log(`(ID: ${t.id}) cleaning Context for [${t.ctxNames.join(",")}]`);let n=await Ks(t);if(J.sendNotification("devicetree/contextDeleted",{ctxNames:t.ctxNames.map(r=>r.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:le===t,type:n.type}),Ie.splice(e,1),await IP(),t===le&&(le=void 0,Ie.length)){let r=Gs?Rn(Ie,{fsPath:Gs}):void 0;r??=Ie[0],console.log("Active context was deleted. Forcing active to",r.id),await bn({id:r.id},!0)}t.settings.disableFileWatchers||t.getContextFiles().map(r=>{Ku.get(r)?.unwatch()}),setTimeout(async()=>{await Oe();let r=new Set(Ie.flatMap(i=>i.getContextFiles()));t.getContextFiles().map(i=>{r.has(i)||Ln().reset(i)})},2e3),t.bindingLoader?.dispose()},HQ=t=>{let e=hg.get(t);if(!e?.abort.signal.aborted)return Promise.all([e?.promise,t.getRuntime()])},Oe=async()=>{await Promise.all(Ie.map(HQ))},wP=async(t,e)=>(await NB(e)).indexOf(t)!==-1,NB=async t=>{let e=await RB(t);return Ie.filter(n=>!e.some(r=>r===n))},RB=async t=>{let e=await NP(t);return Ie.filter(n=>e.contexts.find(r=>Wi(r)===n.id))},VQ=async t=>{let e=await XQ(t);return Ie.filter(n=>e.contexts.find(r=>Wi(r)===n.id))},WQ=async(t,e)=>(await VQ(e)).indexOf(t)!==-1,zQ=async(t,e)=>{if(t===e)return!0;let n=(await t.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath),r=(await e.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath);return r.some(i=>fe(i.resolvedPath,t.parser.fsPath))&&n.length?n.every(i=>r.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=>fe(i,t.parser.fsPath))},GQ=async t=>{if(!await wP(t))return;let e=await NB(),n=await RB(),r=await Uf(e);if(Ie.indexOf(t)===-1)return;let i=await Promise.all(r.flatMap(a=>[...n,...e.filter(c=>c!==a.context)].map(async c=>({context:a.context,same:await zQ(a.context,c)})))),s=t.getContextFiles(),o=r.filter(a=>i.some(c=>c.context===a.context&&c.same)||a.context!==t&&fe(a.context.parser.fsPath,t.parser.fsPath)&&s.some(c=>c&&a.files.indexOf(c)!==-1)).map(a=>a.context);o.length&&await Promise.all(o.map(RP))},J=(0,He.createConnection)(He.ProposedFeatures.all),un=new He.TextDocuments(xt),EP=!1,mg=!1,wB=!1,EB=!1,CB=!1,PP;J.onInitialize(async t=>{PP=t.workspaceFolders??[],J.console.log(`[Server(${process.pid}) ${PP?.at(0)?.uri} Version 0.10.3 ] Started and initialize received`);let e=t.capabilities;EP=!!(e.workspace&&e.workspace.configuration),mg=!!(e.workspace&&e.workspace.workspaceFolders),wB=!!e.workspace?.diagnostics?.refreshSupport,EB=!!e.workspace?.semanticTokens?.refreshSupport,CB=!!e.workspace?.foldingRange?.refreshSupport;let n={capabilities:{typeDefinitionProvider:!0,workspaceSymbolProvider:!0,textDocumentSync:He.TextDocumentSyncKind.Incremental,renameProvider:{prepareProvider:!0},completionProvider:{resolveProvider:!0,triggerCharacters:["&","="," ",'"',"(",","]},codeActionProvider:{codeActionKinds:[He.CodeActionKind.QuickFix,He.CodeActionKind.SourceFixAll]},documentSymbolProvider:!0,semanticTokensProvider:{legend:{tokenTypes:qf,tokenModifiers:$f},full:!0},documentLinkProvider:{resolveProvider:!1},foldingRangeProvider:!0,definitionProvider:!0,declarationProvider:!0,referencesProvider:!0,documentFormattingProvider:!0,documentRangeFormattingProvider:!0,hoverProvider:!0,signatureHelpProvider:{triggerCharacters:["<","("],retriggerCharacters:[" ",","]}}};return mg&&(n.capabilities.workspace={workspaceFolders:{changeNotifications:!0,supported:!0}}),await MB(t.initializationOptions),n});var kP,YQ={tabSize:8,insertSpaces:!1,trimTrailingWhitespace:!0,insertFinalNewline:!0,wordWrapColumn:100},DB=t=>({tabSize:t?.["editor.tabSize"],insertSpaces:t?.["editor.insertSpaces"],trimFinalNewlines:t?.["files.trimFinalNewlines"],trimTrailingWhitespace:t?.["files.trimTrailingWhitespace"],insertFinalNewline:t?.["editor.insertFinalNewline"],wordWrapColumn:t?.["editor.wordWrapColumn"],removeMacroMultiline:t?.["editor.removeMacroMultiline"],wrapLongLines:t?.["editor.wrapLongLines"],indentExpressions:t?.["editor.indentExpressions"],removeEmptyReferences:t?.["editor.removeEmptyReferences"],removeEmptyNodes:t?.["editor.removeEmptyNodes"],removeEmptyRoots:t?.["editor.removeEmptyRoots"],sortNodesAndProperties:t?.["editor.sortNodesAndProperties"]});J.onInitialized(async()=>{if(EP&&(J.client.register(He.DidChangeConfigurationNotification.type,{}),!kP)){let t=await J.workspace.getConfiguration("editor").catch(()=>{}),e=await J.workspace.getConfiguration("files").catch(()=>{}),n=await J.workspace.getConfiguration("[devicetree]").catch(()=>{}),r=DB(n);(t||e||r)&&(kP={...t,...e,...r})}mg&&J.workspace.onDidChangeWorkspaceFolders(async t=>{J.console.log("Workspace folder change event received"),await ed()})});J.onRequest("workspace/workspaceFolders",async()=>PP??null);var KQ=async t=>{let e=AB();return e={...zs,...e},Yu(e,t??await Zu())},NP=async t=>{let e=QQ();return e={...zs,...e},Yu(e,t??await Zu())},XQ=async t=>{let e=ZQ();return e={...zs,...e},Yu(e,t??await Zu())},Qu=async t=>{let e=JQ();return e={...zs,...e},Yu(e,t??await Zu())},Zu=async()=>mg?await J.workspace.getWorkspaceFolders()??[]:[],PB=async t=>{let e=Rn(Ie,{id:Wi(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 n=Wi(t);console.log(`(ID: ${n}) New context [${t.ctxName}]`),console.log(`(ID: ${n}) Settings: ${JSON.stringify(t,void 0," ")}`);let r=(0,Sc.join)((0,Sc.dirname)(t.dtsFile),"dts","bindings"),i=new mp(t,kP??YQ,t.bindingType?tB({zephyrBindings:t.zephyrBindings?[r,...t.zephyrBindings]:[r],deviceOrgBindingsMetaSchema:t.deviceOrgBindingsMetaSchema??[],deviceOrgTreeBindings:t.deviceOrgTreeBindings??[]},t.bindingType):void 0);Ie.push(i);let s=performance.now();await i.stable(),console.log(`(ID: ${n}) New context took ${performance.now()-s}ms to start [${t.ctxName}]`),kB(i);let o=await Ks(i);return J.sendNotification("devicetree/contextCreated",{ctxNames:i.ctxNames.map(a=>a.toString()),id:i.id,...await i.getFileTree(),settings:i.settings,active:i===le,type:o.type}),await GQ(i),await IP(),i},ed=async()=>{let t=await NP(),e=await Qu();e.allowAdhocContexts||(e=await NP());let n=e.contexts.map(Wi),r=Ie.filter(i=>!n.includes(i.id));await Promise.all(r.map(RP)),await t.contexts?.reduce((i,s)=>i.then(async()=>{await PB(s)}),Promise.resolve()),e.allowAdhocContexts&&await(await KQ()).contexts?.reduce((s,o)=>s.then(async()=>{Rn(Ie,{fsPath:o.dtsFile})||await PB(o)}),Promise.resolve()),setTimeout(async()=>{Gs?await bn({fsPath:Gs}):!le&&Ie.length&&(console.log(`No active context using first context (ID: ${Ie[0].id}) [${Ie[0].ctxNames.join(",")}]`),await bn({id:Ie[0].id}))})},Ur,Ys,Xu=new Map,bc=new Map,JQ=()=>!Ys&&!Ur?void 0:{...Ys,...Ur,contexts:[...Ur?.contexts??[],...Array.from(bc.values()),...Array.from(Xu.values())]},AB=()=>!Ys&&!Ur?void 0:{...Ys,...Ur,contexts:[...Array.from(Xu.values())]},QQ=()=>!Ys&&!Ur?void 0:{...Ys,...Ur,contexts:[...Ur?.contexts??[],...Array.from(bc.values())]},ZQ=()=>!Ys&&!Ur?void 0:{...Ur,contexts:[...Ur?.contexts??[]]};function e8(t){let e={...t};for(let n in e)e[n]===null&&delete e[n];return e}var IB=async()=>{let t=await Qu();console.log("Resolved settings",JSON.stringify(t,void 0," ")),J.sendNotification("devicetree/settingsChanged",t),await ed(),Oe().then(()=>{wB&&J.languages.diagnostics.refresh()})},t8=async()=>{let t=le?.getContextFiles();await Promise.all(Array.from(un.keys()).filter(Ht).map(async e=>{t?.some(n=>fe(n,_e(e)))||await J.sendDiagnostics({uri:e,version:un.get(e)?.version,diagnostics:[{severity:He.DiagnosticSeverity.Information,range:He.Range.create(He.Position.create(0,0),He.Position.create(0,0)),message:"File not in active context",source:"devicetree"}]})}))},CP=async t=>{let e=PT(Ie,t);if(e.length)e.sort((n,r)=>n===le?-1:r===le?1:0).forEach(n=>{hg.get(n)?.abort.abort(),le===n&&J.sendNotification("devicetree/activeContextBusyNotification",n.id),J.sendNotification("devicetree/contextBusyNotification",n.id);let r=new AbortController,i=new Promise(s=>{setTimeout(async()=>{if(n.setStaleFsPath(t),r.signal.aborted){console.log("Abort parsing due to new request"),s();return}let o=performance.now(),a=le===n,c=a?OB(n):[],l=n.getContextFiles();if(await n.reevaluate(t),kB(n),l.forEach(p=>Ku.get(p)?.unwatch()),a&&OP(n)?.length&&(DP(n).then(p=>{let m=p.items.map(h=>({uri:h.uri,version:h.version??void 0,diagnostics:h.items}));Ju(n,c.filter(h=>m.every(y=>y.uri!==h.uri))),m.forEach(h=>{J.sendDiagnostics(h)}),nd.set(n,!0)}),Gs)){let p=n.getFsPathParser(Gs);p&&setTimeout(()=>{p.latestSemanticTokensBuilt||J.languages.semanticTokens.refresh()},50)}let[u,d]=await Promise.all([Ks(n),n.getFileTree()]),f={ctxNames:n.ctxNames.map(p=>p.toString()),id:n.id,...d,settings:n.settings,active:a,type:u.type};le===n&&J.sendNotification("devicetree/activeContextStableNotification",f),J.sendNotification("devicetree/contextStableNotification",f),s(),console.log("reevaluate",performance.now()-o)})});hg.set(n,{abort:r,promise:i})});else{if((await Qu()).allowAdhocContexts===!1)return;await ed(),await bn({fsPath:t})}},n8=t=>un.keys().find(e=>fe(_e(e),t)),td=t=>{let e=n8(t);if(e)return un.get(e)},OB=t=>t.getContextFiles().map(e=>({uri:ue(e),version:td(e)?.version,diagnostics:[]})),nd=new WeakMap,Ju=async(t,e=OB(t),n=!1)=>{if(!n&&t!==le)return;let r=performance.now();await Promise.all(e.filter(i=>t===le||!le?.getContextFiles().some(s=>fe(_e(i.uri),s))).map(i=>J.sendDiagnostics({uri:i.uri,version:un.get(i.uri)?.version,diagnostics:[]}))),nd.delete(t),console.log(`(ID: ${t.id})`,"clear workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-r)},pg=new Map,r8=async t=>{let e=pg.get(t);if(e||!EP)return e;pg.delete(t);let n=await J.workspace.getConfiguration({scopeUri:ue(t),section:"[devicetree]"}).catch(()=>{});if(n){let r=DB(n);return pg.set(t,r),r}},DP=async t=>{await t.stable();let e=performance.now(),n=await t.getDiagnostics(),r=await Promise.all(t.getContextFiles().map(async i=>{let s=td(i),o=[];if(s&&t.settings.showFormattingErrorAsDiagnostics){let a=await r8(i);o.push(...(await wi({textDocument:s,options:{...t.formattingOptions,...a}},s.getText(),"File Diagnostics").catch(()=>[])).map(c=>c.diagnostic()))}return{uri:ue(i),kind:He.DocumentDiagnosticReportKind.Full,items:[...n.get(i)??[],...o],version:s?.version??null}}));return console.log(`(ID: ${t.id})`,"workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-e),{items:[...r]}},AP=async t=>{let{items:e}=await DP(t);e.map(n=>({uri:n.uri,version:n.version??void 0,diagnostics:n.items})).forEach(async n=>{J.sendDiagnostics(n)}),nd.set(t,!0)},IP=async()=>{let t=await Promise.all(Ie.map(e=>Ks(e)));console.log("======== Context List ========"),t.forEach(e=>{console.log(`(ID: ${e.ctx.id}) [${e.ctx.ctxNames.join(",")}]`,`[${e.type}]`,le===e.ctx?" [ACTIVE]":"")}),console.log("==============================")},Ks=async(t,e)=>{let n=await wP(t,e),r=!n&&await WQ(t,e);return{ctx:t,type:n?"Ad Hoc":r?"User":"3rd Party"}},bn=async(t,e=!1)=>{if("fsPath"in t){if(!Ht(t.fsPath))return!1;Gs=t.fsPath,console.log("Active File Uri",Gs)}let n=await Qu();if(le&&!e&&!n.autoChangeContext||(await Oe(),!e&&le?.getContextFiles().find(o=>"fsPath"in t&&fe(o,t.fsPath))))return!1;let r=le,i=Rn(Ie,t),s=r!==i;return s&&(r&&Ju(r),le=i,i?(Ks(i).then(async o=>{let a=await i.getFileTree();!i||i!==le&&!Ie.includes(i)||J.sendNotification("devicetree/newActiveContext",{ctxNames:i.ctxNames.map(c=>c.toString()),id:i.id,...a,settings:i.settings,active:le===i,type:o.type})}),OP(i)?.length&&AP(i),await IP()):J.sendNotification("devicetree/newActiveContext",void 0)),CB&&J.languages.foldingRange.refresh(),EB&&J.languages.semanticTokens.refresh(),s},Ht=t=>[".dts",".dtsi",".dtso",".overlay",".keymap"].some(e=>t.endsWith(e));un.listen(J);var OP=t=>t?.getContextFiles()?.filter(e=>td(e));un.onDidSave(t=>{gg.set(_e(t.document.uri),t.document.version)});un.onDidClose(async t=>{let e=_e(t.document.uri);if(!Ht(e))return;gg.delete(e);let n=PT(Ie,e);if(n.length===0){Xu.delete(e),J.sendDiagnostics({uri:t.document.uri,version:un.get(t.document.uri)?.version,diagnostics:[]});return}await Promise.all(n.map(async r=>{!!OP(r)?.filter(s=>s!==e).length?le?.getContextFiles().some(s=>fe(s,e))?le?.getContextFiles().some(s=>fe(s,e))&&(await Ju(le),await AP(le)):J.sendDiagnostics({uri:t.document.uri,version:un.get(t.document.uri)?.version,diagnostics:[]}):await wP(r)?(await RP(r),Xu.delete(r.settings.dtsFile)):Ju(r)}))});un.onDidOpen(async t=>{let e=_e(t.document.uri);if(!Ht(e))return;gg.set(e,t.document.version),await Oe(),t8();let n=Rn(Ie,{fsPath:e});if(console.log("onDidOpen",n?.id,e),n)n!==le?await bn({id:n.id}):n===le&&(!nd.get(n)||n.getContextFiles().some(r=>!fe(r,e)))&&await AP(n);else{let r={ctxName:(0,Sc.basename)(e),dtsFile:e};Xu.set(e,r),await CP(e)}});un.onDidChangeContent(async t=>{let e=_e(t.document.uri);if(!Ht(e))return;let n=t.document.getText(),r=Ln();r.needsRenew(e,n)&&(console.log("Content changed",e),r.renewLexer(e,n),await CP(e))});var MB=async t=>{t?.settings?.devicetree&&(Ur=aB(e8(t.settings.devicetree)),console.log("Configuration changed",JSON.stringify(t,void 0," ")),await IB())};J.onDidChangeConfiguration(async t=>{await MB(t)});J.listen();J.languages.diagnostics.onWorkspace(async()=>{await Oe();let t=le;return t?DP(t).finally(()=>{nd.set(t,!0)}):{items:[]}});J.onDidChangeWatchedFiles(t=>{J.console.log("We received a file change event")});J.onCompletion(async t=>{let e=_e(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return i0(t,le,un.get(t.textDocument.uri));if(!Ht(e))return[];await Oe(),bn({fsPath:e});let n=Hn(e);return n?[...await UD(t,n),...await L0(t,n)]:[]});J.onCompletionResolve(t=>t);var Hn=t=>{let e=AB();return Rn(Ie,{fsPath:t},le,e?.preferredContext)};J.onDocumentSymbol(async t=>{let e=_e(t.textDocument.uri);if(!Ht(e))return[];await Oe();let n=Hn(e);return n?n.getFsPathParser(e)?.getDocumentSymbols(e):[]});J.onWorkspaceSymbol(async()=>{await Oe();let t=le;return t?(await t.getAllStableParsers()).flatMap(e=>e.getWorkspaceSymbols()):[]});J.languages.semanticTokens.on(async t=>{let e=_e(t.textDocument.uri);if(!Ht(e))return{data:[]};try{await Oe();let n=Hn(e),r=new He.SemanticTokensBuilder,i=n?.isInContext(e);return!n||!i?{data:[]}:((await n.getAllStableParsers()).forEach(s=>s.buildSemanticTokens(r,e)),r.build())}catch(n){throw console.log(n),n}});J.onDocumentLinks(async t=>{await Oe();let e=_e(t.textDocument.uri);return Ht(e)?Hn(e)?.getDocumentLinks(e):e.endsWith(".yaml")&&le?le.bindingLoader?.getDocumentLinks?.(un.get(t.textDocument.uri))??[]:[]});J.onPrepareRename(async t=>{let e=_e(t.textDocument.uri);if(!Ht(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return u0(t,n)});J.onRenameRequest(async t=>{let e=_e(t.textDocument.uri);if(!Ht(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return l0(t,n)});J.onReferences(async t=>{let e=_e(t.textDocument.uri);if(!Ht(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return s0(t,n)});J.onDefinition(async t=>{let e=_e(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return p0(t,le,un.get(t.textDocument.uri));if(!Ht(e))return;await Oe(),bn({fsPath:e});let n=Hn(e),r=(await n?.getDocumentLinks(e,t.position))?.filter(i=>i.target).map(i=>He.Location.create(i.target,i.range))??[];return r.length?r:f0(t,n)});J.onDeclaration(async t=>{let e=_e(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return y0(t,le,un.get(t.textDocument.uri));if(!Ht(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return g0(t,n)});J.onCodeAction(async t=>{let e=_e(t.textDocument.uri);if(Ht(e))return v0(t)});var xB=async t=>{if(!Ht(t.textDocument.uri))return;let e=_e(t.textDocument.uri);if(!Ht(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);if(!n)return[];if((await n.getSyntaxIssues(void 0,l=>co(l.raw,e,!1)?l:void 0)).get(e)?.length)return[];let i=un.get(t.textDocument.uri)??Ln().getDocument(e),s=i.getText();pg.set(e,t.options);let o=await wi({...t,options:{...n.formattingOptions,...t.options}},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[He.TextEdit.replace(He.Range.create(He.Position.create(0,0),He.Position.create(i.lineCount,c)),o)]};J.onDocumentRangeFormatting(xB);J.onDocumentFormatting(xB);J.onHover(async t=>{let e=_e(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return sM(t,le,un.get(t.textDocument.uri));if(!Ht(e))return;await Oe();let n=Hn(e);return(await q0(t,n)).at(0)});J.onFoldingRanges(async t=>{let e=_e(t.textDocument.uri);if(!Ht(e))return;await Oe();let n=Hn(e),r=n?.isInContext(e);if(!n||!r)return[];let i=(await n.getAllStableParsers()).find(s=>s.getFiles().some(o=>o===e));return i?nB(e,i):[]});J.onTypeDefinition(async t=>{let e=_e(t.textDocument.uri);if(!Ht(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return oB(t,n)});J.onSignatureHelp(async t=>{let e=_e(t.textDocument.uri);if(!Ht(e))return;await Oe(),bn({fsPath:e});let n=Hn(e);return hB(t,n)});J.onRequest("devicetree/getContexts",async()=>(await Oe(),Promise.all(Ie.map(async t=>{let e=await Ks(t);return{ctxNames:t.ctxNames.map(n=>n.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:le===t,type:e.type}}))));J.onRequest("devicetree/setActive",async t=>(await Oe(),console.log("devicetree/setActive",t),await bn(t,!0)));J.onRequest("devicetree/getActiveContext",async()=>{if(await Oe(),console.log("devicetree/getActiveContext"),!le)return;let t=await Ks(le);return le?{ctxNames:le.ctxNames.map(e=>e.toString()),id:le.id,...await le.getFileTree(),settings:le.settings,active:!0,type:t.type}:void 0});J.onRequest("devicetree/setDefaultSettings",async t=>{await Oe(),Ys=t,console.log("Integration Settings",t),await IB()});J.onRequest("devicetree/requestContext",async t=>{await Oe();let e=await Zu(),n=await Qu(e),r=await bP(t,n,e);if(!r)throw console.log("Failed to resolve context",t),new Error("Failed to resolve context");console.log("devicetree/requestContext",r);let i=Wi(r),s=Array.from(bc).find(([,c])=>c.ctxName===t.ctxName);if(s){let c=s[0].split(":",1)[0];Rn(Ie,{name:r.ctxName.toString()})?.removeCtxName(r.ctxName),console.log(`Removing integration context with ID ${c} and name ${t.ctxName}`),bc.delete(s[0])}bc.set(`${i}:${t.ctxName}`,t),await ed();let o=Ie.find(c=>c.id===i);if(!o)throw new Error("Failed to create context");let a=await Ks(o,e);return{ctxNames:o.ctxNames.map(c=>c.toString()),id:i,...await o.getFileTree(),settings:o.settings,active:!0,type:a.type}});J.onRequest("devicetree/removeContext",async({id:t,name:e})=>{await Oe(),bc.delete(`${t}:${e}`);let n=Rn(Ie,{id:t});if(n){if(n.removeCtxName(e),n.ctxNames.length){console.log("Context will not be deleted as it is still in use by others");return}await ed()}});J.onRequest("devicetree/compiledDtsOutput",async t=>{if(await Oe(),!t)return;let e=Rn(Ie,{id:t});if(!e||!e.settings.dtsFile){console.log("Context or DTS file not found for ID",t);return}let n=await e.toFullString();return wi({textDocument:{uri:ue(e.settings.dtsFile)},options:e.formattingOptions},n,"New Text").catch(()=>n)});J.onRequest("devicetree/serializedContext",async t=>{if(await Oe(),!t)return;let e=Rn(Ie,{id:t}),n=performance.now();return e?.serialize().finally(()=>{console.info("serializedContext",performance.now()-n)})});J.onRequest("devicetree/activePath",async t=>{if(await Oe(),!le)return;let e=n=>{if(n?.item)return n.item instanceof X?{nodePath:n.item.pathString}:{nodePath:n.item.parent.pathString,propertyName:n.item.name}};return(await Rt(t,le,n=>[e(n)])).at(0)});J.onRequest("devicetree/customActions",async t=>(await Oe(),fB(t,le)));J.onRequest("devicetree/activeFsPath",async t=>{await Oe(),bn({fsPath:t})});J.onRequest("devicetree/formattingText",async t=>{let e=_e(t.textDocument.uri),n=td(e)??Ln().getDocument(e,t.text),r=await wi(t,n.getText(),"New Text");return{text:r,diagnostics:(await wi(t,n.getText(),"File Diagnostics")).map(i=>i.diagnostic()),nonActionableDiagnostics:(await wi(t,r,"File Diagnostics")).map(i=>i.diagnostic())}});J.onRequest("devicetree/formatTextEdits",async t=>{await Oe();let e=Ln().getDocument(_e(t.textDocument.uri),t.text),n=e.positionAt(e.getText().length),r=He.TextEdit.replace(He.Range.create(He.Position.create(0,0),n),""),i=NT(e,t.edits),s=await wi({...t},i,"New Text").catch(()=>i);return r.newText=s,r});J.onRequest("devicetree/diagnosticIssues",async({uri:t,full:e})=>{await Oe();let n=_e(t);bn({fsPath:n});let r=Hn(n);if(!r)return[];let i=e?(await r.getDiagnostics()).get(n):(await r.getSyntaxIssues(void 0,s=>co(s.raw,n,!!e)?s:void 0)).get(n);if(i?.length)return i});J.onRequest("devicetree/evalMacros",async({macros:t,ctxId:e})=>{await Oe();let n=Rn(Ie,{id:e});return n?t.map(r=>{let i=Hc(r,n.macros),s=Me(i);return{macro:r,evaluated:typeof s=="number"?s:i}}):[]});J.onRequest("devicetree/memoryViews",async({ctxId:t})=>{let e=Rn(Ie,{id:t});if(!e)return;await e?.stable();let n=await e.getRuntime(),r=n.rootNode.getMemoryViews(n.context.macros).sort((o,a)=>{let c=Lt(o.start,a.start);return c===0?Lt(a.size,o.size):c}),i=new Map;r.forEach(o=>{let a=i.get(o.name),c={nodePath:o.nodePath,labels:o.labels,start:o.start,size:o.size,disabled:o.disabled};a?a.partitions.push(c):i.set(o.name,{name:o.name,partitions:[c],path:o.nodePath})});let s=SB(Array.from(i.values()));return{trees:s,treeStr:_B(s)}});J.onRequest("devicetree/zephyrTypeBindings",async t=>{if(await Oe(),!t)return;let e=Rn(Ie,{id:t});return e?.bindingLoader?.getZephyrContextBinding()?.map(n=>({...n,vendor:n.compatible&&e?.bindingLoader?.getBindingVendorString(n.compatible)}))});J.onRequest("devicetree/contextMacroNames",async t=>{if(await Oe(),!t)return;let e=Rn(Ie,{id:t});return Array.from(e?.macros.keys()??[])});J.onRequest("devicetree/locationScopedInformation",async t=>{await Oe();let e=Rn(Ie,{id:t.id}),n=_e(t.textDocument.uri);if(!(!e||!e.isInContext(n)))return new Promise(async r=>{let i=await e.getRuntime(),s=await Rt(t,e,(o,a)=>{let c=i.context.macros,l={};if(!o?.item)return i.rootNode.serialize(l,c,a),[{inNode:!1,inScope:l,parentNode:i.rootNode.pathString}];let u=null;return o.item instanceof X?u=o.item:u=o.item?.parent,u.serialize(l,i.context.macros,a),[{inNode:!0,inScope:l,parentNode:u.pathString}]});r(s[0])})});
|