dts-linter 0.4.1 → 0.5.1

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.
@@ -1,68 +1,81 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var Ql=Object.create;var hs=Object.defineProperty;var Kl=Object.getOwnPropertyDescriptor;var eu=Object.getOwnPropertyNames;var tu=Object.getPrototypeOf,nu=Object.prototype.hasOwnProperty;var fe=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),iu=(i,e)=>{for(var t in e)hs(i,t,{get:e[t],enumerable:!0})},su=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of eu(e))!nu.call(i,s)&&s!==t&&hs(i,s,{get:()=>e[s],enumerable:!(n=Kl(e,s))||n.enumerable});return i};var ft=(i,e,t)=>(t=i!=null?Ql(tu(i)):{},su(e||!i||!i.__esModule?hs(t,"default",{value:i,enumerable:!0}):t,i));var en=fe(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.stringArray=ye.array=ye.func=ye.error=ye.number=ye.string=ye.boolean=void 0;function ru(i){return i===!0||i===!1}ye.boolean=ru;function No(i){return typeof i=="string"||i instanceof String}ye.string=No;function ou(i){return typeof i=="number"||i instanceof Number}ye.number=ou;function au(i){return i instanceof Error}ye.error=au;function cu(i){return typeof i=="function"}ye.func=cu;function Po(i){return Array.isArray(i)}ye.array=Po;function lu(i){return Po(i)&&i.every(e=>No(e))}ye.stringArray=lu});var Is=fe(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.Message=P.NotificationType9=P.NotificationType8=P.NotificationType7=P.NotificationType6=P.NotificationType5=P.NotificationType4=P.NotificationType3=P.NotificationType2=P.NotificationType1=P.NotificationType0=P.NotificationType=P.RequestType9=P.RequestType8=P.RequestType7=P.RequestType6=P.RequestType5=P.RequestType4=P.RequestType3=P.RequestType2=P.RequestType1=P.RequestType=P.RequestType0=P.AbstractMessageSignature=P.ParameterStructures=P.ResponseError=P.ErrorCodes=void 0;var Tt=en(),fs;(function(i){i.ParseError=-32700,i.InvalidRequest=-32600,i.MethodNotFound=-32601,i.InvalidParams=-32602,i.InternalError=-32603,i.jsonrpcReservedErrorRangeStart=-32099,i.serverErrorStart=-32099,i.MessageWriteError=-32099,i.MessageReadError=-32098,i.PendingResponseRejected=-32097,i.ConnectionInactive=-32096,i.ServerNotInitialized=-32002,i.UnknownErrorCode=-32001,i.jsonrpcReservedErrorRangeEnd=-32e3,i.serverErrorEnd=-32e3})(fs||(P.ErrorCodes=fs={}));var ds=class i extends Error{constructor(e,t,n){super(t),this.code=Tt.number(e)?e:fs.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,i.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};P.ResponseError=ds;var Ee=class i{constructor(e){this.kind=e}static is(e){return e===i.auto||e===i.byName||e===i.byPosition}toString(){return this.kind}};P.ParameterStructures=Ee;Ee.auto=new Ee("auto");Ee.byPosition=new Ee("byPosition");Ee.byName=new Ee("byName");var G=class{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return Ee.auto}};P.AbstractMessageSignature=G;var ps=class extends G{constructor(e){super(e,0)}};P.RequestType0=ps;var ms=class extends G{constructor(e,t=Ee.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};P.RequestType=ms;var gs=class extends G{constructor(e,t=Ee.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};P.RequestType1=gs;var ys=class extends G{constructor(e){super(e,2)}};P.RequestType2=ys;var ws=class extends G{constructor(e){super(e,3)}};P.RequestType3=ws;var vs=class extends G{constructor(e){super(e,4)}};P.RequestType4=vs;var bs=class extends G{constructor(e){super(e,5)}};P.RequestType5=bs;var _s=class extends G{constructor(e){super(e,6)}};P.RequestType6=_s;var xs=class extends G{constructor(e){super(e,7)}};P.RequestType7=xs;var Ss=class extends G{constructor(e){super(e,8)}};P.RequestType8=Ss;var ks=class extends G{constructor(e){super(e,9)}};P.RequestType9=ks;var Es=class extends G{constructor(e,t=Ee.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};P.NotificationType=Es;var Cs=class extends G{constructor(e){super(e,0)}};P.NotificationType0=Cs;var Ts=class extends G{constructor(e,t=Ee.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};P.NotificationType1=Ts;var Rs=class extends G{constructor(e){super(e,2)}};P.NotificationType2=Rs;var Os=class extends G{constructor(e){super(e,3)}};P.NotificationType3=Os;var As=class extends G{constructor(e){super(e,4)}};P.NotificationType4=As;var Ns=class extends G{constructor(e){super(e,5)}};P.NotificationType5=Ns;var Ps=class extends G{constructor(e){super(e,6)}};P.NotificationType6=Ps;var Ms=class extends G{constructor(e){super(e,7)}};P.NotificationType7=Ms;var js=class extends G{constructor(e){super(e,8)}};P.NotificationType8=js;var Ls=class extends G{constructor(e){super(e,9)}};P.NotificationType9=Ls;var Mo;(function(i){function e(s){let r=s;return r&&Tt.string(r.method)&&(Tt.string(r.id)||Tt.number(r.id))}i.isRequest=e;function t(s){let r=s;return r&&Tt.string(r.method)&&s.id===void 0}i.isNotification=t;function n(s){let r=s;return r&&(r.result!==void 0||!!r.error)&&(Tt.string(r.id)||Tt.number(r.id)||r.id===null)}i.isResponse=n})(Mo||(P.Message=Mo={}))});var Ds=fe(dt=>{"use strict";var jo;Object.defineProperty(dt,"__esModule",{value:!0});dt.LRUCache=dt.LinkedMap=dt.Touch=void 0;var we;(function(i){i.None=0,i.First=1,i.AsOld=i.First,i.Last=2,i.AsNew=i.Last})(we||(dt.Touch=we={}));var li=class{constructor(){this[jo]="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,t=we.None){let n=this._map.get(e);if(n)return t!==we.None&&this.touch(n,t),n.value}set(e,t,n=we.None){let s=this._map.get(e);if(s)s.value=t,n!==we.None&&this.touch(s,n);else{switch(s={key:e,value:t,next:void 0,previous:void 0},n){case we.None:this.addItemLast(s);break;case we.First:this.addItemFirst(s);break;case we.Last:this.addItemLast(s);break;default:this.addItemLast(s);break}this._map.set(e,s),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.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,t){let n=this._state,s=this._head;for(;s;){if(t?e.bind(t)(s.value,s.key,this):e(s.value,s.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");s=s.next}}keys(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let s={value:t.key,done:!1};return t=t.next,s}else return{value:void 0,done:!0}}};return n}values(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let s={value:t.value,done:!1};return t=t.next,s}else return{value:void 0,done:!0}}};return n}entries(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let s={value:[t.key,t.value],done:!1};return t=t.next,s}else return{value:void 0,done:!0}}};return n}[(jo=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.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 t=e.next,n=e.previous;if(!t||!n)throw new Error("Invalid list");t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==we.First&&t!==we.Last)){if(t===we.First){if(e===this._head)return;let n=e.next,s=e.previous;e===this._tail?(s.next=void 0,this._tail=s):(n.previous=s,s.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===we.Last){if(e===this._tail)return;let n=e.next,s=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=s,s.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,n)=>{e.push([n,t])}),e}fromJSON(e){this.clear();for(let[t,n]of e)this.set(t,n)}};dt.LinkedMap=li;var $s=class extends li{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),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,t=we.AsNew){return super.get(e,t)}peek(e){return super.get(e,we.None)}set(e,t){return super.set(e,t,we.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};dt.LRUCache=$s});var Io=fe(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.Disposable=void 0;var Lo;(function(i){function e(t){return{dispose:t}}i.create=e})(Lo||(ui.Disposable=Lo={}))});var pt=fe(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});var Fs;function Ws(){if(Fs===void 0)throw new Error("No runtime abstraction layer installed");return Fs}(function(i){function e(t){if(t===void 0)throw new Error("No runtime abstraction layer provided");Fs=t}i.install=e})(Ws||(Ws={}));zs.default=Ws});var nn=fe(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.Emitter=tn.Event=void 0;var uu=pt(),$o;(function(i){let e={dispose(){}};i.None=function(){return e}})($o||(tn.Event=$o={}));var qs=class{add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let s=0,r=this._callbacks.length;s<r;s++)if(this._callbacks[s]===e)if(this._contexts[s]===t){this._callbacks.splice(s,1),this._contexts.splice(s,1);return}else n=!0;if(n)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 t=[],n=this._callbacks.slice(0),s=this._contexts.slice(0);for(let r=0,o=n.length;r<o;r++)try{t.push(n[r].apply(s[r],e))}catch(a){(0,uu.default)().console.error(a)}return t}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},hi=class i{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,n)=>{this._callbacks||(this._callbacks=new qs),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);let s={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),s.dispose=i._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(s),s}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};tn.Emitter=hi;hi._noop=function(){}});var pi=fe(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.CancellationTokenSource=sn.CancellationToken=void 0;var hu=pt(),fu=en(),Us=nn(),fi;(function(i){i.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Us.Event.None}),i.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Us.Event.None});function e(t){let n=t;return n&&(n===i.None||n===i.Cancelled||fu.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}i.is=e})(fi||(sn.CancellationToken=fi={}));var du=Object.freeze(function(i,e){let t=(0,hu.default)().timer.setTimeout(i.bind(e),0);return{dispose(){t.dispose()}}}),di=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?du:(this._emitter||(this._emitter=new Us.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Bs=class{get token(){return this._token||(this._token=new di),this._token}cancel(){this._token?this._token.cancel():this._token=fi.Cancelled}dispose(){this._token?this._token instanceof di&&this._token.dispose():this._token=fi.None}};sn.CancellationTokenSource=Bs});var Do=fe(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.SharedArrayReceiverStrategy=rn.SharedArraySenderStrategy=void 0;var pu=pi(),Mn;(function(i){i.Continue=0,i.Cancelled=1})(Mn||(Mn={}));var Vs=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let t=new SharedArrayBuffer(4),n=new Int32Array(t,0,1);n[0]=Mn.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){let n=this.buffers.get(t);if(n===void 0)return;let s=new Int32Array(n,0,1);Atomics.store(s,0,Mn.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};rn.SharedArraySenderStrategy=Vs;var Zs=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Mn.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},Hs=class{constructor(e){this.token=new Zs(e)}cancel(){}dispose(){}},Gs=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let t=e.$cancellationData;return t===void 0?new pu.CancellationTokenSource:new Hs(t)}};rn.SharedArrayReceiverStrategy=Gs});var Xs=fe(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.Semaphore=void 0;var mu=pt(),Js=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((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,mu.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 t=e.thunk();t instanceof Promise?t.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};mi.Semaphore=Js});var Wo=fe(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.ReadableStreamMessageReader=mt.AbstractMessageReader=mt.MessageReader=void 0;var Qs=pt(),on=en(),Ys=nn(),gu=Xs(),Fo;(function(i){function e(t){let n=t;return n&&on.func(n.listen)&&on.func(n.dispose)&&on.func(n.onError)&&on.func(n.onClose)&&on.func(n.onPartialMessage)}i.is=e})(Fo||(mt.MessageReader=Fo={}));var gi=class{constructor(){this.errorEmitter=new Ys.Emitter,this.closeEmitter=new Ys.Emitter,this.partialMessageEmitter=new Ys.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: ${on.string(e.message)?e.message:"unknown"}`)}};mt.AbstractMessageReader=gi;var Ks;(function(i){function e(t){let n,s,r,o=new Map,a,c=new Map;if(t===void 0||typeof t=="string")n=t??"utf-8";else{if(n=t.charset??"utf-8",t.contentDecoder!==void 0&&(r=t.contentDecoder,o.set(r.name,r)),t.contentDecoders!==void 0)for(let l of t.contentDecoders)o.set(l.name,l);if(t.contentTypeDecoder!==void 0&&(a=t.contentTypeDecoder,c.set(a.name,a)),t.contentTypeDecoders!==void 0)for(let l of t.contentTypeDecoders)c.set(l.name,l)}return a===void 0&&(a=(0,Qs.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:r,contentDecoders:o,contentTypeDecoder:a,contentTypeDecoders:c}}i.fromOptions=e})(Ks||(Ks={}));var er=class extends gi{constructor(e,t){super(),this.readable=e,this.options=Ks.fromOptions(t),this.buffer=(0,Qs.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new gu.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 t=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),t}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders(!0);if(!n)return;let s=n.get("content-length");if(!s){this.fireError(new Error(`Header must provide a Content-Length property.
3
- ${JSON.stringify(Object.fromEntries(n))}`));return}let r=parseInt(s);if(isNaN(r)){this.fireError(new Error(`Content-Length value must be a number. Got ${s}`));return}this.nextMessageLength=r}let t=this.buffer.tryReadBody(this.nextMessageLength);if(t===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(t):t,s=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(s)}).catch(n=>{this.fireError(n)})}}catch(t){this.fireError(t)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,Qs.default)().timer.setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};mt.ReadableStreamMessageReader=er});var Vo=fe(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.WriteableStreamMessageWriter=gt.AbstractMessageWriter=gt.MessageWriter=void 0;var zo=pt(),jn=en(),yu=Xs(),qo=nn(),wu="Content-Length: ",Uo=`\r
4
- `,Bo;(function(i){function e(t){let n=t;return n&&jn.func(n.dispose)&&jn.func(n.onClose)&&jn.func(n.onError)&&jn.func(n.write)}i.is=e})(Bo||(gt.MessageWriter=Bo={}));var yi=class{constructor(){this.errorEmitter=new qo.Emitter,this.closeEmitter=new qo.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,n){this.errorEmitter.fire([this.asError(e),t,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${jn.string(e.message)?e.message:"unknown"}`)}};gt.AbstractMessageWriter=yi;var tr;(function(i){function e(t){return t===void 0||typeof t=="string"?{charset:t??"utf-8",contentTypeEncoder:(0,zo.default)().applicationJson.encoder}:{charset:t.charset??"utf-8",contentEncoder:t.contentEncoder,contentTypeEncoder:t.contentTypeEncoder??(0,zo.default)().applicationJson.encoder}}i.fromOptions=e})(tr||(tr={}));var nr=class extends yi{constructor(e,t){super(),this.writable=e,this.options=tr.fromOptions(t),this.errorCount=0,this.writeSemaphore=new yu.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let s=[];return s.push(wu,n.byteLength.toString(),Uo),s.push(Uo),this.doWrite(e,s,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,t,n){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(n)}catch(s){return this.handleError(s,e),Promise.reject(s)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}};gt.WriteableStreamMessageWriter=nr});var Zo=fe(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.AbstractMessageBuffer=void 0;var vu=13,bu=10,_u=`\r
5
- `,ir=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let t=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let t=0,n=0,s=0,r=0;e:for(;n<this._chunks.length;){let l=this._chunks[n];for(s=0;s<l.length;){switch(l[s]){case vu:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case bu:switch(t){case 1:t=2;break;case 3:t=4,s++;break e;default:t=0}break;default:t=0}s++}r+=l.byteLength,n++}if(t!==4)return;let o=this._read(r+s),a=new Map,c=this.toString(o,"ascii").split(_u);if(c.length<2)return a;for(let l=0;l<c.length-2;l++){let h=c[l],u=h.indexOf(":");if(u===-1)throw new Error(`Message header must separate key and value using ':'
6
- ${h}`);let d=h.substr(0,u),p=h.substr(u+1).trim();a.set(e?d.toLowerCase():d,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 r=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(r)}if(this._chunks[0].byteLength>e){let r=this._chunks[0],o=this.asNative(r,e);return this._chunks[0]=r.slice(e),this._totalLength-=e,o}let t=this.allocNative(e),n=0,s=0;for(;e>0;){let r=this._chunks[s];if(r.byteLength>e){let o=r.slice(0,e);t.set(o,n),n+=e,this._chunks[s]=r.slice(e),this._totalLength-=e,e-=e}else t.set(r,n),n+=r.byteLength,this._chunks.shift(),this._totalLength-=r.byteLength,e-=r.byteLength}return t}};wi.AbstractMessageBuffer=ir});var Yo=fe(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.createMessageConnection=I.ConnectionOptions=I.MessageStrategy=I.CancellationStrategy=I.CancellationSenderStrategy=I.CancellationReceiverStrategy=I.RequestCancellationReceiverStrategy=I.IdCancellationReceiverStrategy=I.ConnectionStrategy=I.ConnectionError=I.ConnectionErrors=I.LogTraceNotification=I.SetTraceNotification=I.TraceFormat=I.TraceValues=I.Trace=I.NullLogger=I.ProgressType=I.ProgressToken=void 0;var Ho=pt(),K=en(),j=Is(),Go=Ds(),Ln=nn(),sr=pi(),Dn;(function(i){i.type=new j.NotificationType("$/cancelRequest")})(Dn||(Dn={}));var rr;(function(i){function e(t){return typeof t=="string"||typeof t=="number"}i.is=e})(rr||(I.ProgressToken=rr={}));var In;(function(i){i.type=new j.NotificationType("$/progress")})(In||(In={}));var or=class{constructor(){}};I.ProgressType=or;var ar;(function(i){function e(t){return K.func(t)}i.is=e})(ar||(ar={}));I.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var q;(function(i){i[i.Off=0]="Off",i[i.Messages=1]="Messages",i[i.Compact=2]="Compact",i[i.Verbose=3]="Verbose"})(q||(I.Trace=q={}));var Jo;(function(i){i.Off="off",i.Messages="messages",i.Compact="compact",i.Verbose="verbose"})(Jo||(I.TraceValues=Jo={}));(function(i){function e(n){if(!K.string(n))return i.Off;switch(n=n.toLowerCase(),n){case"off":return i.Off;case"messages":return i.Messages;case"compact":return i.Compact;case"verbose":return i.Verbose;default:return i.Off}}i.fromString=e;function t(n){switch(n){case i.Off:return"off";case i.Messages:return"messages";case i.Compact:return"compact";case i.Verbose:return"verbose";default:return"off"}}i.toString=t})(q||(I.Trace=q={}));var Ae;(function(i){i.Text="text",i.JSON="json"})(Ae||(I.TraceFormat=Ae={}));(function(i){function e(t){return K.string(t)?(t=t.toLowerCase(),t==="json"?i.JSON:i.Text):i.Text}i.fromString=e})(Ae||(I.TraceFormat=Ae={}));var cr;(function(i){i.type=new j.NotificationType("$/setTrace")})(cr||(I.SetTraceNotification=cr={}));var vi;(function(i){i.type=new j.NotificationType("$/logTrace")})(vi||(I.LogTraceNotification=vi={}));var $n;(function(i){i[i.Closed=1]="Closed",i[i.Disposed=2]="Disposed",i[i.AlreadyListening=3]="AlreadyListening"})($n||(I.ConnectionErrors=$n={}));var an=class i extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,i.prototype)}};I.ConnectionError=an;var lr;(function(i){function e(t){let n=t;return n&&K.func(n.cancelUndispatched)}i.is=e})(lr||(I.ConnectionStrategy=lr={}));var bi;(function(i){function e(t){let n=t;return n&&(n.kind===void 0||n.kind==="id")&&K.func(n.createCancellationTokenSource)&&(n.dispose===void 0||K.func(n.dispose))}i.is=e})(bi||(I.IdCancellationReceiverStrategy=bi={}));var ur;(function(i){function e(t){let n=t;return n&&n.kind==="request"&&K.func(n.createCancellationTokenSource)&&(n.dispose===void 0||K.func(n.dispose))}i.is=e})(ur||(I.RequestCancellationReceiverStrategy=ur={}));var _i;(function(i){i.Message=Object.freeze({createCancellationTokenSource(t){return new sr.CancellationTokenSource}});function e(t){return bi.is(t)||ur.is(t)}i.is=e})(_i||(I.CancellationReceiverStrategy=_i={}));var xi;(function(i){i.Message=Object.freeze({sendCancellation(t,n){return t.sendNotification(Dn.type,{id:n})},cleanup(t){}});function e(t){let n=t;return n&&K.func(n.sendCancellation)&&K.func(n.cleanup)}i.is=e})(xi||(I.CancellationSenderStrategy=xi={}));var Si;(function(i){i.Message=Object.freeze({receiver:_i.Message,sender:xi.Message});function e(t){let n=t;return n&&_i.is(n.receiver)&&xi.is(n.sender)}i.is=e})(Si||(I.CancellationStrategy=Si={}));var ki;(function(i){function e(t){let n=t;return n&&K.func(n.handleMessage)}i.is=e})(ki||(I.MessageStrategy=ki={}));var Xo;(function(i){function e(t){let n=t;return n&&(Si.is(n.cancellationStrategy)||lr.is(n.connectionStrategy)||ki.is(n.messageStrategy))}i.is=e})(Xo||(I.ConnectionOptions=Xo={}));var We;(function(i){i[i.New=1]="New",i[i.Listening=2]="Listening",i[i.Closed=3]="Closed",i[i.Disposed=4]="Disposed"})(We||(We={}));function xu(i,e,t,n){let s=t!==void 0?t:I.NullLogger,r=0,o=0,a=0,c="2.0",l,h=new Map,u,d=new Map,p=new Map,w,g=new Go.LinkedMap,k=new Map,S=new Set,_=new Map,b=q.Off,E=Ae.Text,O,V=We.New,X=new Ln.Emitter,ge=new Ln.Emitter,Oe=new Ln.Emitter,Xt=new Ln.Emitter,_o=new Ln.Emitter,ut=n&&n.cancellationStrategy?n.cancellationStrategy:Si.Message;function xo(f){if(f===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+f.toString()}function Ml(f){return f===null?"res-unknown-"+(++a).toString():"res-"+f.toString()}function jl(){return"not-"+(++o).toString()}function Ll(f,v){j.Message.isRequest(v)?f.set(xo(v.id),v):j.Message.isResponse(v)?f.set(Ml(v.id),v):f.set(jl(),v)}function Il(f){}function So(){return V===We.Listening}function ko(){return V===We.Closed}function Yt(){return V===We.Disposed}function Eo(){(V===We.New||V===We.Listening)&&(V=We.Closed,ge.fire(void 0))}function $l(f){X.fire([f,void 0,void 0])}function Dl(f){X.fire(f)}i.onClose(Eo),i.onError($l),e.onClose(Eo),e.onError(Dl);function Co(){w||g.size===0||(w=(0,Ho.default)().timer.setImmediate(()=>{w=void 0,Fl()}))}function To(f){j.Message.isRequest(f)?zl(f):j.Message.isNotification(f)?Ul(f):j.Message.isResponse(f)?ql(f):Bl(f)}function Fl(){if(g.size===0)return;let f=g.shift();try{let v=n?.messageStrategy;ki.is(v)?v.handleMessage(f,To):To(f)}finally{Co()}}let Wl=f=>{try{if(j.Message.isNotification(f)&&f.method===Dn.type.method){let v=f.params.id,C=xo(v),N=g.get(C);if(j.Message.isRequest(N)){let B=n?.connectionStrategy,te=B&&B.cancelUndispatched?B.cancelUndispatched(N,Il):void 0;if(te&&(te.error!==void 0||te.result!==void 0)){g.delete(C),_.delete(v),te.id=N.id,ci(te,f.method,Date.now()),e.write(te).catch(()=>s.error("Sending response for canceled message failed."));return}}let H=_.get(v);if(H!==void 0){H.cancel(),ls(f);return}else S.add(v)}Ll(g,f)}finally{Co()}};function zl(f){if(Yt())return;function v(z,Q,U){let ce={jsonrpc:c,id:f.id};z instanceof j.ResponseError?ce.error=z.toJson():ce.result=z===void 0?null:z,ci(ce,Q,U),e.write(ce).catch(()=>s.error("Sending response failed."))}function C(z,Q,U){let ce={jsonrpc:c,id:f.id,error:z.toJson()};ci(ce,Q,U),e.write(ce).catch(()=>s.error("Sending response failed."))}function N(z,Q,U){z===void 0&&(z=null);let ce={jsonrpc:c,id:f.id,result:z};ci(ce,Q,U),e.write(ce).catch(()=>s.error("Sending response failed."))}Hl(f);let H=h.get(f.method),B,te;H&&(B=H.type,te=H.handler);let ie=Date.now();if(te||l){let z=f.id??String(Date.now()),Q=bi.is(ut.receiver)?ut.receiver.createCancellationTokenSource(z):ut.receiver.createCancellationTokenSource(f);f.id!==null&&S.has(f.id)&&Q.cancel(),f.id!==null&&_.set(z,Q);try{let U;if(te)if(f.params===void 0){if(B!==void 0&&B.numberOfParams!==0){C(new j.ResponseError(j.ErrorCodes.InvalidParams,`Request ${f.method} defines ${B.numberOfParams} params but received none.`),f.method,ie);return}U=te(Q.token)}else if(Array.isArray(f.params)){if(B!==void 0&&B.parameterStructures===j.ParameterStructures.byName){C(new j.ResponseError(j.ErrorCodes.InvalidParams,`Request ${f.method} defines parameters by name but received parameters by position`),f.method,ie);return}U=te(...f.params,Q.token)}else{if(B!==void 0&&B.parameterStructures===j.ParameterStructures.byPosition){C(new j.ResponseError(j.ErrorCodes.InvalidParams,`Request ${f.method} defines parameters by position but received parameters by name`),f.method,ie);return}U=te(f.params,Q.token)}else l&&(U=l(f.method,f.params,Q.token));let ce=U;U?ce.then?ce.then(xe=>{_.delete(z),v(xe,f.method,ie)},xe=>{_.delete(z),xe instanceof j.ResponseError?C(xe,f.method,ie):xe&&K.string(xe.message)?C(new j.ResponseError(j.ErrorCodes.InternalError,`Request ${f.method} failed with message: ${xe.message}`),f.method,ie):C(new j.ResponseError(j.ErrorCodes.InternalError,`Request ${f.method} failed unexpectedly without providing any details.`),f.method,ie)}):(_.delete(z),v(U,f.method,ie)):(_.delete(z),N(U,f.method,ie))}catch(U){_.delete(z),U instanceof j.ResponseError?v(U,f.method,ie):U&&K.string(U.message)?C(new j.ResponseError(j.ErrorCodes.InternalError,`Request ${f.method} failed with message: ${U.message}`),f.method,ie):C(new j.ResponseError(j.ErrorCodes.InternalError,`Request ${f.method} failed unexpectedly without providing any details.`),f.method,ie)}}else C(new j.ResponseError(j.ErrorCodes.MethodNotFound,`Unhandled method ${f.method}`),f.method,ie)}function ql(f){if(!Yt())if(f.id===null)f.error?s.error(`Received response message without id: Error is:
7
- ${JSON.stringify(f.error,void 0,4)}`):s.error("Received response message without id. No further error information provided.");else{let v=f.id,C=k.get(v);if(Gl(f,C),C!==void 0){k.delete(v);try{if(f.error){let N=f.error;C.reject(new j.ResponseError(N.code,N.message,N.data))}else if(f.result!==void 0)C.resolve(f.result);else throw new Error("Should never happen.")}catch(N){N.message?s.error(`Response handler '${C.method}' failed with message: ${N.message}`):s.error(`Response handler '${C.method}' failed unexpectedly.`)}}}}function Ul(f){if(Yt())return;let v,C;if(f.method===Dn.type.method){let N=f.params.id;S.delete(N),ls(f);return}else{let N=d.get(f.method);N&&(C=N.handler,v=N.type)}if(C||u)try{if(ls(f),C)if(f.params===void 0)v!==void 0&&v.numberOfParams!==0&&v.parameterStructures!==j.ParameterStructures.byName&&s.error(`Notification ${f.method} defines ${v.numberOfParams} params but received none.`),C();else if(Array.isArray(f.params)){let N=f.params;f.method===In.type.method&&N.length===2&&rr.is(N[0])?C({token:N[0],value:N[1]}):(v!==void 0&&(v.parameterStructures===j.ParameterStructures.byName&&s.error(`Notification ${f.method} defines parameters by name but received parameters by position`),v.numberOfParams!==f.params.length&&s.error(`Notification ${f.method} defines ${v.numberOfParams} params but received ${N.length} arguments`)),C(...N))}else v!==void 0&&v.parameterStructures===j.ParameterStructures.byPosition&&s.error(`Notification ${f.method} defines parameters by position but received parameters by name`),C(f.params);else u&&u(f.method,f.params)}catch(N){N.message?s.error(`Notification handler '${f.method}' failed with message: ${N.message}`):s.error(`Notification handler '${f.method}' failed unexpectedly.`)}else Oe.fire(f)}function Bl(f){if(!f){s.error("Received empty message.");return}s.error(`Received message which is neither a response nor a notification message:
8
- ${JSON.stringify(f,null,4)}`);let v=f;if(K.string(v.id)||K.number(v.id)){let C=v.id,N=k.get(C);N&&N.reject(new Error("The received response has neither a result nor an error property."))}}function ht(f){if(f!=null)switch(b){case q.Verbose:return JSON.stringify(f,null,4);case q.Compact:return JSON.stringify(f);default:return}}function Vl(f){if(!(b===q.Off||!O))if(E===Ae.Text){let v;(b===q.Verbose||b===q.Compact)&&f.params&&(v=`Params: ${ht(f.params)}
2
+ "use strict";var eu=Object.create;var fi=Object.defineProperty;var tu=Object.getOwnPropertyDescriptor;var nu=Object.getOwnPropertyNames;var su=Object.getPrototypeOf,iu=Object.prototype.hasOwnProperty;var de=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),ru=(s,e)=>{for(var t in e)fi(s,t,{get:e[t],enumerable:!0})},ou=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nu(e))!iu.call(s,i)&&i!==t&&fi(s,i,{get:()=>e[i],enumerable:!(n=tu(e,i))||n.enumerable});return s};var dt=(s,e,t)=>(t=s!=null?eu(su(s)):{},ou(e||!s||!s.__esModule?fi(t,"default",{value:s,enumerable:!0}):t,s));var en=de(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.stringArray=ye.array=ye.func=ye.error=ye.number=ye.string=ye.boolean=void 0;function au(s){return s===!0||s===!1}ye.boolean=au;function Po(s){return typeof s=="string"||s instanceof String}ye.string=Po;function cu(s){return typeof s=="number"||s instanceof Number}ye.number=cu;function lu(s){return s instanceof Error}ye.error=lu;function uu(s){return typeof s=="function"}ye.func=uu;function Mo(s){return Array.isArray(s)}ye.array=Mo;function fu(s){return Mo(s)&&s.every(e=>Po(e))}ye.stringArray=fu});var Ii=de(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.Message=P.NotificationType9=P.NotificationType8=P.NotificationType7=P.NotificationType6=P.NotificationType5=P.NotificationType4=P.NotificationType3=P.NotificationType2=P.NotificationType1=P.NotificationType0=P.NotificationType=P.RequestType9=P.RequestType8=P.RequestType7=P.RequestType6=P.RequestType5=P.RequestType4=P.RequestType3=P.RequestType2=P.RequestType1=P.RequestType=P.RequestType0=P.AbstractMessageSignature=P.ParameterStructures=P.ResponseError=P.ErrorCodes=void 0;var Rt=en(),di;(function(s){s.ParseError=-32700,s.InvalidRequest=-32600,s.MethodNotFound=-32601,s.InvalidParams=-32602,s.InternalError=-32603,s.jsonrpcReservedErrorRangeStart=-32099,s.serverErrorStart=-32099,s.MessageWriteError=-32099,s.MessageReadError=-32098,s.PendingResponseRejected=-32097,s.ConnectionInactive=-32096,s.ServerNotInitialized=-32002,s.UnknownErrorCode=-32001,s.jsonrpcReservedErrorRangeEnd=-32e3,s.serverErrorEnd=-32e3})(di||(P.ErrorCodes=di={}));var hi=class s extends Error{constructor(e,t,n){super(t),this.code=Rt.number(e)?e:di.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,s.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};P.ResponseError=hi;var Ee=class s{constructor(e){this.kind=e}static is(e){return e===s.auto||e===s.byName||e===s.byPosition}toString(){return this.kind}};P.ParameterStructures=Ee;Ee.auto=new Ee("auto");Ee.byPosition=new Ee("byPosition");Ee.byName=new Ee("byName");var X=class{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return Ee.auto}};P.AbstractMessageSignature=X;var pi=class extends X{constructor(e){super(e,0)}};P.RequestType0=pi;var mi=class extends X{constructor(e,t=Ee.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};P.RequestType=mi;var gi=class extends X{constructor(e,t=Ee.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};P.RequestType1=gi;var yi=class extends X{constructor(e){super(e,2)}};P.RequestType2=yi;var wi=class extends X{constructor(e){super(e,3)}};P.RequestType3=wi;var bi=class extends X{constructor(e){super(e,4)}};P.RequestType4=bi;var vi=class extends X{constructor(e){super(e,5)}};P.RequestType5=vi;var _i=class extends X{constructor(e){super(e,6)}};P.RequestType6=_i;var xi=class extends X{constructor(e){super(e,7)}};P.RequestType7=xi;var Si=class extends X{constructor(e){super(e,8)}};P.RequestType8=Si;var ki=class extends X{constructor(e){super(e,9)}};P.RequestType9=ki;var Ei=class extends X{constructor(e,t=Ee.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};P.NotificationType=Ei;var Ci=class extends X{constructor(e){super(e,0)}};P.NotificationType0=Ci;var Ri=class extends X{constructor(e,t=Ee.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};P.NotificationType1=Ri;var Ti=class extends X{constructor(e){super(e,2)}};P.NotificationType2=Ti;var Oi=class extends X{constructor(e){super(e,3)}};P.NotificationType3=Oi;var Ni=class extends X{constructor(e){super(e,4)}};P.NotificationType4=Ni;var Ai=class extends X{constructor(e){super(e,5)}};P.NotificationType5=Ai;var Pi=class extends X{constructor(e){super(e,6)}};P.NotificationType6=Pi;var Mi=class extends X{constructor(e){super(e,7)}};P.NotificationType7=Mi;var ji=class extends X{constructor(e){super(e,8)}};P.NotificationType8=ji;var Li=class extends X{constructor(e){super(e,9)}};P.NotificationType9=Li;var jo;(function(s){function e(i){let r=i;return r&&Rt.string(r.method)&&(Rt.string(r.id)||Rt.number(r.id))}s.isRequest=e;function t(i){let r=i;return r&&Rt.string(r.method)&&i.id===void 0}s.isNotification=t;function n(i){let r=i;return r&&(r.result!==void 0||!!r.error)&&(Rt.string(r.id)||Rt.number(r.id)||r.id===null)}s.isResponse=n})(jo||(P.Message=jo={}))});var $i=de(ht=>{"use strict";var Lo;Object.defineProperty(ht,"__esModule",{value:!0});ht.LRUCache=ht.LinkedMap=ht.Touch=void 0;var we;(function(s){s.None=0,s.First=1,s.AsOld=s.First,s.Last=2,s.AsNew=s.Last})(we||(ht.Touch=we={}));var ls=class{constructor(){this[Lo]="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,t=we.None){let n=this._map.get(e);if(n)return t!==we.None&&this.touch(n,t),n.value}set(e,t,n=we.None){let i=this._map.get(e);if(i)i.value=t,n!==we.None&&this.touch(i,n);else{switch(i={key:e,value:t,next:void 0,previous:void 0},n){case we.None:this.addItemLast(i);break;case we.First:this.addItemFirst(i);break;case we.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 t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.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,t){let n=this._state,i=this._head;for(;i;){if(t?e.bind(t)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:t.key,done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}values(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:t.value,done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}entries(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:[t.key,t.value],done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}[(Lo=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.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 t=e.next,n=e.previous;if(!t||!n)throw new Error("Invalid list");t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==we.First&&t!==we.Last)){if(t===we.First){if(e===this._head)return;let n=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===we.Last){if(e===this._tail)return;let n=e.next,i=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,n)=>{e.push([n,t])}),e}fromJSON(e){this.clear();for(let[t,n]of e)this.set(t,n)}};ht.LinkedMap=ls;var Di=class extends ls{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),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,t=we.AsNew){return super.get(e,t)}peek(e){return super.get(e,we.None)}set(e,t){return super.set(e,t,we.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};ht.LRUCache=Di});var Do=de(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.Disposable=void 0;var Io;(function(s){function e(t){return{dispose:t}}s.create=e})(Io||(us.Disposable=Io={}))});var pt=de(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});var Fi;function Wi(){if(Fi===void 0)throw new Error("No runtime abstraction layer installed");return Fi}(function(s){function e(t){if(t===void 0)throw new Error("No runtime abstraction layer provided");Fi=t}s.install=e})(Wi||(Wi={}));zi.default=Wi});var nn=de(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.Emitter=tn.Event=void 0;var du=pt(),$o;(function(s){let e={dispose(){}};s.None=function(){return e}})($o||(tn.Event=$o={}));var Bi=class{add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let i=0,r=this._callbacks.length;i<r;i++)if(this._callbacks[i]===e)if(this._contexts[i]===t){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else n=!0;if(n)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 t=[],n=this._callbacks.slice(0),i=this._contexts.slice(0);for(let r=0,o=n.length;r<o;r++)try{t.push(n[r].apply(i[r],e))}catch(a){(0,du.default)().console.error(a)}return t}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},fs=class s{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,n)=>{this._callbacks||(this._callbacks=new Bi),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),i.dispose=s._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.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)}};tn.Emitter=fs;fs._noop=function(){}});var ps=de(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.CancellationTokenSource=sn.CancellationToken=void 0;var hu=pt(),pu=en(),qi=nn(),ds;(function(s){s.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:qi.Event.None}),s.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:qi.Event.None});function e(t){let n=t;return n&&(n===s.None||n===s.Cancelled||pu.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}s.is=e})(ds||(sn.CancellationToken=ds={}));var mu=Object.freeze(function(s,e){let t=(0,hu.default)().timer.setTimeout(s.bind(e),0);return{dispose(){t.dispose()}}}),hs=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?mu:(this._emitter||(this._emitter=new qi.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Ui=class{get token(){return this._token||(this._token=new hs),this._token}cancel(){this._token?this._token.cancel():this._token=ds.Cancelled}dispose(){this._token?this._token instanceof hs&&this._token.dispose():this._token=ds.None}};sn.CancellationTokenSource=Ui});var Fo=de(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.SharedArrayReceiverStrategy=rn.SharedArraySenderStrategy=void 0;var gu=ps(),Mn;(function(s){s.Continue=0,s.Cancelled=1})(Mn||(Mn={}));var Vi=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let t=new SharedArrayBuffer(4),n=new Int32Array(t,0,1);n[0]=Mn.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){let n=this.buffers.get(t);if(n===void 0)return;let i=new Int32Array(n,0,1);Atomics.store(i,0,Mn.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};rn.SharedArraySenderStrategy=Vi;var Zi=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Mn.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},Hi=class{constructor(e){this.token=new Zi(e)}cancel(){}dispose(){}},Gi=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let t=e.$cancellationData;return t===void 0?new gu.CancellationTokenSource:new Hi(t)}};rn.SharedArrayReceiverStrategy=Gi});var Xi=de(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.Semaphore=void 0;var yu=pt(),Ji=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((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,yu.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 t=e.thunk();t instanceof Promise?t.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};ms.Semaphore=Ji});var zo=de(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.ReadableStreamMessageReader=mt.AbstractMessageReader=mt.MessageReader=void 0;var Qi=pt(),on=en(),Yi=nn(),wu=Xi(),Wo;(function(s){function e(t){let n=t;return n&&on.func(n.listen)&&on.func(n.dispose)&&on.func(n.onError)&&on.func(n.onClose)&&on.func(n.onPartialMessage)}s.is=e})(Wo||(mt.MessageReader=Wo={}));var gs=class{constructor(){this.errorEmitter=new Yi.Emitter,this.closeEmitter=new Yi.Emitter,this.partialMessageEmitter=new Yi.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: ${on.string(e.message)?e.message:"unknown"}`)}};mt.AbstractMessageReader=gs;var Ki;(function(s){function e(t){let n,i,r,o=new Map,a,c=new Map;if(t===void 0||typeof t=="string")n=t??"utf-8";else{if(n=t.charset??"utf-8",t.contentDecoder!==void 0&&(r=t.contentDecoder,o.set(r.name,r)),t.contentDecoders!==void 0)for(let l of t.contentDecoders)o.set(l.name,l);if(t.contentTypeDecoder!==void 0&&(a=t.contentTypeDecoder,c.set(a.name,a)),t.contentTypeDecoders!==void 0)for(let l of t.contentTypeDecoders)c.set(l.name,l)}return a===void 0&&(a=(0,Qi.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:r,contentDecoders:o,contentTypeDecoder:a,contentTypeDecoders:c}}s.fromOptions=e})(Ki||(Ki={}));var er=class extends gs{constructor(e,t){super(),this.readable=e,this.options=Ki.fromOptions(t),this.buffer=(0,Qi.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new wu.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 t=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),t}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders(!0);if(!n)return;let i=n.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property.
3
+ ${JSON.stringify(Object.fromEntries(n))}`));return}let r=parseInt(i);if(isNaN(r)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=r}let t=this.buffer.tryReadBody(this.nextMessageLength);if(t===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(t):t,i=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(i)}).catch(n=>{this.fireError(n)})}}catch(t){this.fireError(t)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,Qi.default)().timer.setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};mt.ReadableStreamMessageReader=er});var Zo=de(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.WriteableStreamMessageWriter=gt.AbstractMessageWriter=gt.MessageWriter=void 0;var Bo=pt(),jn=en(),bu=Xi(),qo=nn(),vu="Content-Length: ",Uo=`\r
4
+ `,Vo;(function(s){function e(t){let n=t;return n&&jn.func(n.dispose)&&jn.func(n.onClose)&&jn.func(n.onError)&&jn.func(n.write)}s.is=e})(Vo||(gt.MessageWriter=Vo={}));var ys=class{constructor(){this.errorEmitter=new qo.Emitter,this.closeEmitter=new qo.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,n){this.errorEmitter.fire([this.asError(e),t,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${jn.string(e.message)?e.message:"unknown"}`)}};gt.AbstractMessageWriter=ys;var tr;(function(s){function e(t){return t===void 0||typeof t=="string"?{charset:t??"utf-8",contentTypeEncoder:(0,Bo.default)().applicationJson.encoder}:{charset:t.charset??"utf-8",contentEncoder:t.contentEncoder,contentTypeEncoder:t.contentTypeEncoder??(0,Bo.default)().applicationJson.encoder}}s.fromOptions=e})(tr||(tr={}));var nr=class extends ys{constructor(e,t){super(),this.writable=e,this.options=tr.fromOptions(t),this.errorCount=0,this.writeSemaphore=new bu.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let i=[];return i.push(vu,n.byteLength.toString(),Uo),i.push(Uo),this.doWrite(e,i,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,t,n){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(n)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}};gt.WriteableStreamMessageWriter=nr});var Ho=de(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.AbstractMessageBuffer=void 0;var _u=13,xu=10,Su=`\r
5
+ `,sr=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let t=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let t=0,n=0,i=0,r=0;e:for(;n<this._chunks.length;){let l=this._chunks[n];for(i=0;i<l.length;){switch(l[i]){case _u:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case xu:switch(t){case 1:t=2;break;case 3:t=4,i++;break e;default:t=0}break;default:t=0}i++}r+=l.byteLength,n++}if(t!==4)return;let o=this._read(r+i),a=new Map,c=this.toString(o,"ascii").split(Su);if(c.length<2)return a;for(let l=0;l<c.length-2;l++){let f=c[l],u=f.indexOf(":");if(u===-1)throw new Error(`Message header must separate key and value using ':'
6
+ ${f}`);let h=f.substr(0,u),p=f.substr(u+1).trim();a.set(e?h.toLowerCase():h,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 r=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(r)}if(this._chunks[0].byteLength>e){let r=this._chunks[0],o=this.asNative(r,e);return this._chunks[0]=r.slice(e),this._totalLength-=e,o}let t=this.allocNative(e),n=0,i=0;for(;e>0;){let r=this._chunks[i];if(r.byteLength>e){let o=r.slice(0,e);t.set(o,n),n+=e,this._chunks[i]=r.slice(e),this._totalLength-=e,e-=e}else t.set(r,n),n+=r.byteLength,this._chunks.shift(),this._totalLength-=r.byteLength,e-=r.byteLength}return t}};ws.AbstractMessageBuffer=sr});var Qo=de(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.createMessageConnection=I.ConnectionOptions=I.MessageStrategy=I.CancellationStrategy=I.CancellationSenderStrategy=I.CancellationReceiverStrategy=I.RequestCancellationReceiverStrategy=I.IdCancellationReceiverStrategy=I.ConnectionStrategy=I.ConnectionError=I.ConnectionErrors=I.LogTraceNotification=I.SetTraceNotification=I.TraceFormat=I.TraceValues=I.Trace=I.NullLogger=I.ProgressType=I.ProgressToken=void 0;var Go=pt(),ee=en(),j=Ii(),Jo=$i(),Ln=nn(),ir=ps(),$n;(function(s){s.type=new j.NotificationType("$/cancelRequest")})($n||($n={}));var rr;(function(s){function e(t){return typeof t=="string"||typeof t=="number"}s.is=e})(rr||(I.ProgressToken=rr={}));var In;(function(s){s.type=new j.NotificationType("$/progress")})(In||(In={}));var or=class{constructor(){}};I.ProgressType=or;var ar;(function(s){function e(t){return ee.func(t)}s.is=e})(ar||(ar={}));I.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var U;(function(s){s[s.Off=0]="Off",s[s.Messages=1]="Messages",s[s.Compact=2]="Compact",s[s.Verbose=3]="Verbose"})(U||(I.Trace=U={}));var Xo;(function(s){s.Off="off",s.Messages="messages",s.Compact="compact",s.Verbose="verbose"})(Xo||(I.TraceValues=Xo={}));(function(s){function e(n){if(!ee.string(n))return s.Off;switch(n=n.toLowerCase(),n){case"off":return s.Off;case"messages":return s.Messages;case"compact":return s.Compact;case"verbose":return s.Verbose;default:return s.Off}}s.fromString=e;function t(n){switch(n){case s.Off:return"off";case s.Messages:return"messages";case s.Compact:return"compact";case s.Verbose:return"verbose";default:return"off"}}s.toString=t})(U||(I.Trace=U={}));var Ne;(function(s){s.Text="text",s.JSON="json"})(Ne||(I.TraceFormat=Ne={}));(function(s){function e(t){return ee.string(t)?(t=t.toLowerCase(),t==="json"?s.JSON:s.Text):s.Text}s.fromString=e})(Ne||(I.TraceFormat=Ne={}));var cr;(function(s){s.type=new j.NotificationType("$/setTrace")})(cr||(I.SetTraceNotification=cr={}));var bs;(function(s){s.type=new j.NotificationType("$/logTrace")})(bs||(I.LogTraceNotification=bs={}));var Dn;(function(s){s[s.Closed=1]="Closed",s[s.Disposed=2]="Disposed",s[s.AlreadyListening=3]="AlreadyListening"})(Dn||(I.ConnectionErrors=Dn={}));var an=class s extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,s.prototype)}};I.ConnectionError=an;var lr;(function(s){function e(t){let n=t;return n&&ee.func(n.cancelUndispatched)}s.is=e})(lr||(I.ConnectionStrategy=lr={}));var vs;(function(s){function e(t){let n=t;return n&&(n.kind===void 0||n.kind==="id")&&ee.func(n.createCancellationTokenSource)&&(n.dispose===void 0||ee.func(n.dispose))}s.is=e})(vs||(I.IdCancellationReceiverStrategy=vs={}));var ur;(function(s){function e(t){let n=t;return n&&n.kind==="request"&&ee.func(n.createCancellationTokenSource)&&(n.dispose===void 0||ee.func(n.dispose))}s.is=e})(ur||(I.RequestCancellationReceiverStrategy=ur={}));var _s;(function(s){s.Message=Object.freeze({createCancellationTokenSource(t){return new ir.CancellationTokenSource}});function e(t){return vs.is(t)||ur.is(t)}s.is=e})(_s||(I.CancellationReceiverStrategy=_s={}));var xs;(function(s){s.Message=Object.freeze({sendCancellation(t,n){return t.sendNotification($n.type,{id:n})},cleanup(t){}});function e(t){let n=t;return n&&ee.func(n.sendCancellation)&&ee.func(n.cleanup)}s.is=e})(xs||(I.CancellationSenderStrategy=xs={}));var Ss;(function(s){s.Message=Object.freeze({receiver:_s.Message,sender:xs.Message});function e(t){let n=t;return n&&_s.is(n.receiver)&&xs.is(n.sender)}s.is=e})(Ss||(I.CancellationStrategy=Ss={}));var ks;(function(s){function e(t){let n=t;return n&&ee.func(n.handleMessage)}s.is=e})(ks||(I.MessageStrategy=ks={}));var Yo;(function(s){function e(t){let n=t;return n&&(Ss.is(n.cancellationStrategy)||lr.is(n.connectionStrategy)||ks.is(n.messageStrategy))}s.is=e})(Yo||(I.ConnectionOptions=Yo={}));var ze;(function(s){s[s.New=1]="New",s[s.Listening=2]="Listening",s[s.Closed=3]="Closed",s[s.Disposed=4]="Disposed"})(ze||(ze={}));function ku(s,e,t,n){let i=t!==void 0?t:I.NullLogger,r=0,o=0,a=0,c="2.0",l,f=new Map,u,h=new Map,p=new Map,w,g=new Jo.LinkedMap,k=new Map,S=new Set,_=new Map,v=U.Off,E=Ne.Text,O,H=ze.New,Y=new Ln.Emitter,ge=new Ln.Emitter,Oe=new Ln.Emitter,Xt=new Ln.Emitter,xo=new Ln.Emitter,ut=n&&n.cancellationStrategy?n.cancellationStrategy:Ss.Message;function So(d){if(d===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+d.toString()}function Ll(d){return d===null?"res-unknown-"+(++a).toString():"res-"+d.toString()}function Il(){return"not-"+(++o).toString()}function Dl(d,b){j.Message.isRequest(b)?d.set(So(b.id),b):j.Message.isResponse(b)?d.set(Ll(b.id),b):d.set(Il(),b)}function $l(d){}function ko(){return H===ze.Listening}function Eo(){return H===ze.Closed}function Yt(){return H===ze.Disposed}function Co(){(H===ze.New||H===ze.Listening)&&(H=ze.Closed,ge.fire(void 0))}function Fl(d){Y.fire([d,void 0,void 0])}function Wl(d){Y.fire(d)}s.onClose(Co),s.onError(Fl),e.onClose(Co),e.onError(Wl);function Ro(){w||g.size===0||(w=(0,Go.default)().timer.setImmediate(()=>{w=void 0,zl()}))}function To(d){j.Message.isRequest(d)?ql(d):j.Message.isNotification(d)?Vl(d):j.Message.isResponse(d)?Ul(d):Zl(d)}function zl(){if(g.size===0)return;let d=g.shift();try{let b=n?.messageStrategy;ks.is(b)?b.handleMessage(d,To):To(d)}finally{Ro()}}let Bl=d=>{try{if(j.Message.isNotification(d)&&d.method===$n.type.method){let b=d.params.id,C=So(b),A=g.get(C);if(j.Message.isRequest(A)){let Z=n?.connectionStrategy,ne=Z&&Z.cancelUndispatched?Z.cancelUndispatched(A,$l):void 0;if(ne&&(ne.error!==void 0||ne.result!==void 0)){g.delete(C),_.delete(b),ne.id=A.id,cs(ne,d.method,Date.now()),e.write(ne).catch(()=>i.error("Sending response for canceled message failed."));return}}let J=_.get(b);if(J!==void 0){J.cancel(),li(d);return}else S.add(b)}Dl(g,d)}finally{Ro()}};function ql(d){if(Yt())return;function b(q,K,V){let ce={jsonrpc:c,id:d.id};q instanceof j.ResponseError?ce.error=q.toJson():ce.result=q===void 0?null:q,cs(ce,K,V),e.write(ce).catch(()=>i.error("Sending response failed."))}function C(q,K,V){let ce={jsonrpc:c,id:d.id,error:q.toJson()};cs(ce,K,V),e.write(ce).catch(()=>i.error("Sending response failed."))}function A(q,K,V){q===void 0&&(q=null);let ce={jsonrpc:c,id:d.id,result:q};cs(ce,K,V),e.write(ce).catch(()=>i.error("Sending response failed."))}Jl(d);let J=f.get(d.method),Z,ne;J&&(Z=J.type,ne=J.handler);let se=Date.now();if(ne||l){let q=d.id??String(Date.now()),K=vs.is(ut.receiver)?ut.receiver.createCancellationTokenSource(q):ut.receiver.createCancellationTokenSource(d);d.id!==null&&S.has(d.id)&&K.cancel(),d.id!==null&&_.set(q,K);try{let V;if(ne)if(d.params===void 0){if(Z!==void 0&&Z.numberOfParams!==0){C(new j.ResponseError(j.ErrorCodes.InvalidParams,`Request ${d.method} defines ${Z.numberOfParams} params but received none.`),d.method,se);return}V=ne(K.token)}else if(Array.isArray(d.params)){if(Z!==void 0&&Z.parameterStructures===j.ParameterStructures.byName){C(new j.ResponseError(j.ErrorCodes.InvalidParams,`Request ${d.method} defines parameters by name but received parameters by position`),d.method,se);return}V=ne(...d.params,K.token)}else{if(Z!==void 0&&Z.parameterStructures===j.ParameterStructures.byPosition){C(new j.ResponseError(j.ErrorCodes.InvalidParams,`Request ${d.method} defines parameters by position but received parameters by name`),d.method,se);return}V=ne(d.params,K.token)}else l&&(V=l(d.method,d.params,K.token));let ce=V;V?ce.then?ce.then(xe=>{_.delete(q),b(xe,d.method,se)},xe=>{_.delete(q),xe instanceof j.ResponseError?C(xe,d.method,se):xe&&ee.string(xe.message)?C(new j.ResponseError(j.ErrorCodes.InternalError,`Request ${d.method} failed with message: ${xe.message}`),d.method,se):C(new j.ResponseError(j.ErrorCodes.InternalError,`Request ${d.method} failed unexpectedly without providing any details.`),d.method,se)}):(_.delete(q),b(V,d.method,se)):(_.delete(q),A(V,d.method,se))}catch(V){_.delete(q),V instanceof j.ResponseError?b(V,d.method,se):V&&ee.string(V.message)?C(new j.ResponseError(j.ErrorCodes.InternalError,`Request ${d.method} failed with message: ${V.message}`),d.method,se):C(new j.ResponseError(j.ErrorCodes.InternalError,`Request ${d.method} failed unexpectedly without providing any details.`),d.method,se)}}else C(new j.ResponseError(j.ErrorCodes.MethodNotFound,`Unhandled method ${d.method}`),d.method,se)}function Ul(d){if(!Yt())if(d.id===null)d.error?i.error(`Received response message without id: Error is:
7
+ ${JSON.stringify(d.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let b=d.id,C=k.get(b);if(Xl(d,C),C!==void 0){k.delete(b);try{if(d.error){let A=d.error;C.reject(new j.ResponseError(A.code,A.message,A.data))}else if(d.result!==void 0)C.resolve(d.result);else throw new Error("Should never happen.")}catch(A){A.message?i.error(`Response handler '${C.method}' failed with message: ${A.message}`):i.error(`Response handler '${C.method}' failed unexpectedly.`)}}}}function Vl(d){if(Yt())return;let b,C;if(d.method===$n.type.method){let A=d.params.id;S.delete(A),li(d);return}else{let A=h.get(d.method);A&&(C=A.handler,b=A.type)}if(C||u)try{if(li(d),C)if(d.params===void 0)b!==void 0&&b.numberOfParams!==0&&b.parameterStructures!==j.ParameterStructures.byName&&i.error(`Notification ${d.method} defines ${b.numberOfParams} params but received none.`),C();else if(Array.isArray(d.params)){let A=d.params;d.method===In.type.method&&A.length===2&&rr.is(A[0])?C({token:A[0],value:A[1]}):(b!==void 0&&(b.parameterStructures===j.ParameterStructures.byName&&i.error(`Notification ${d.method} defines parameters by name but received parameters by position`),b.numberOfParams!==d.params.length&&i.error(`Notification ${d.method} defines ${b.numberOfParams} params but received ${A.length} arguments`)),C(...A))}else b!==void 0&&b.parameterStructures===j.ParameterStructures.byPosition&&i.error(`Notification ${d.method} defines parameters by position but received parameters by name`),C(d.params);else u&&u(d.method,d.params)}catch(A){A.message?i.error(`Notification handler '${d.method}' failed with message: ${A.message}`):i.error(`Notification handler '${d.method}' failed unexpectedly.`)}else Oe.fire(d)}function Zl(d){if(!d){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
8
+ ${JSON.stringify(d,null,4)}`);let b=d;if(ee.string(b.id)||ee.number(b.id)){let C=b.id,A=k.get(C);A&&A.reject(new Error("The received response has neither a result nor an error property."))}}function ft(d){if(d!=null)switch(v){case U.Verbose:return JSON.stringify(d,null,4);case U.Compact:return JSON.stringify(d);default:return}}function Hl(d){if(!(v===U.Off||!O))if(E===Ne.Text){let b;(v===U.Verbose||v===U.Compact)&&d.params&&(b=`Params: ${ft(d.params)}
9
9
 
10
- `),O.log(`Sending request '${f.method} - (${f.id})'.`,v)}else Qt("send-request",f)}function Zl(f){if(!(b===q.Off||!O))if(E===Ae.Text){let v;(b===q.Verbose||b===q.Compact)&&(f.params?v=`Params: ${ht(f.params)}
10
+ `),O.log(`Sending request '${d.method} - (${d.id})'.`,b)}else Qt("send-request",d)}function Gl(d){if(!(v===U.Off||!O))if(E===Ne.Text){let b;(v===U.Verbose||v===U.Compact)&&(d.params?b=`Params: ${ft(d.params)}
11
11
 
12
- `:v=`No parameters provided.
12
+ `:b=`No parameters provided.
13
13
 
14
- `),O.log(`Sending notification '${f.method}'.`,v)}else Qt("send-notification",f)}function ci(f,v,C){if(!(b===q.Off||!O))if(E===Ae.Text){let N;(b===q.Verbose||b===q.Compact)&&(f.error&&f.error.data?N=`Error data: ${ht(f.error.data)}
14
+ `),O.log(`Sending notification '${d.method}'.`,b)}else Qt("send-notification",d)}function cs(d,b,C){if(!(v===U.Off||!O))if(E===Ne.Text){let A;(v===U.Verbose||v===U.Compact)&&(d.error&&d.error.data?A=`Error data: ${ft(d.error.data)}
15
15
 
16
- `:f.result?N=`Result: ${ht(f.result)}
16
+ `:d.result?A=`Result: ${ft(d.result)}
17
17
 
18
- `:f.error===void 0&&(N=`No result returned.
18
+ `:d.error===void 0&&(A=`No result returned.
19
19
 
20
- `)),O.log(`Sending response '${v} - (${f.id})'. Processing request took ${Date.now()-C}ms`,N)}else Qt("send-response",f)}function Hl(f){if(!(b===q.Off||!O))if(E===Ae.Text){let v;(b===q.Verbose||b===q.Compact)&&f.params&&(v=`Params: ${ht(f.params)}
20
+ `)),O.log(`Sending response '${b} - (${d.id})'. Processing request took ${Date.now()-C}ms`,A)}else Qt("send-response",d)}function Jl(d){if(!(v===U.Off||!O))if(E===Ne.Text){let b;(v===U.Verbose||v===U.Compact)&&d.params&&(b=`Params: ${ft(d.params)}
21
21
 
22
- `),O.log(`Received request '${f.method} - (${f.id})'.`,v)}else Qt("receive-request",f)}function ls(f){if(!(b===q.Off||!O||f.method===vi.type.method))if(E===Ae.Text){let v;(b===q.Verbose||b===q.Compact)&&(f.params?v=`Params: ${ht(f.params)}
22
+ `),O.log(`Received request '${d.method} - (${d.id})'.`,b)}else Qt("receive-request",d)}function li(d){if(!(v===U.Off||!O||d.method===bs.type.method))if(E===Ne.Text){let b;(v===U.Verbose||v===U.Compact)&&(d.params?b=`Params: ${ft(d.params)}
23
23
 
24
- `:v=`No parameters provided.
24
+ `:b=`No parameters provided.
25
25
 
26
- `),O.log(`Received notification '${f.method}'.`,v)}else Qt("receive-notification",f)}function Gl(f,v){if(!(b===q.Off||!O))if(E===Ae.Text){let C;if((b===q.Verbose||b===q.Compact)&&(f.error&&f.error.data?C=`Error data: ${ht(f.error.data)}
26
+ `),O.log(`Received notification '${d.method}'.`,b)}else Qt("receive-notification",d)}function Xl(d,b){if(!(v===U.Off||!O))if(E===Ne.Text){let C;if((v===U.Verbose||v===U.Compact)&&(d.error&&d.error.data?C=`Error data: ${ft(d.error.data)}
27
27
 
28
- `:f.result?C=`Result: ${ht(f.result)}
28
+ `:d.result?C=`Result: ${ft(d.result)}
29
29
 
30
- `:f.error===void 0&&(C=`No result returned.
30
+ `:d.error===void 0&&(C=`No result returned.
31
31
 
32
- `)),v){let N=f.error?` Request failed: ${f.error.message} (${f.error.code}).`:"";O.log(`Received response '${v.method} - (${f.id})' in ${Date.now()-v.timerStart}ms.${N}`,C)}else O.log(`Received response ${f.id} without active response promise.`,C)}else Qt("receive-response",f)}function Qt(f,v){if(!O||b===q.Off)return;let C={isLSPMessage:!0,type:f,message:v,timestamp:Date.now()};O.log(C)}function Nn(){if(ko())throw new an($n.Closed,"Connection is closed.");if(Yt())throw new an($n.Disposed,"Connection is disposed.")}function Jl(){if(So())throw new an($n.AlreadyListening,"Connection is already listening")}function Xl(){if(!So())throw new Error("Call listen() first.")}function Pn(f){return f===void 0?null:f}function Ro(f){if(f!==null)return f}function Oo(f){return f!=null&&!Array.isArray(f)&&typeof f=="object"}function us(f,v){switch(f){case j.ParameterStructures.auto:return Oo(v)?Ro(v):[Pn(v)];case j.ParameterStructures.byName:if(!Oo(v))throw new Error("Received parameters by name but param is not an object literal.");return Ro(v);case j.ParameterStructures.byPosition:return[Pn(v)];default:throw new Error(`Unknown parameter structure ${f.toString()}`)}}function Ao(f,v){let C,N=f.numberOfParams;switch(N){case 0:C=void 0;break;case 1:C=us(f.parameterStructures,v[0]);break;default:C=[];for(let H=0;H<v.length&&H<N;H++)C.push(Pn(v[H]));if(v.length<N)for(let H=v.length;H<N;H++)C.push(null);break}return C}let Kt={sendNotification:(f,...v)=>{Nn();let C,N;if(K.string(f)){C=f;let B=v[0],te=0,ie=j.ParameterStructures.auto;j.ParameterStructures.is(B)&&(te=1,ie=B);let z=v.length,Q=z-te;switch(Q){case 0:N=void 0;break;case 1:N=us(ie,v[te]);break;default:if(ie===j.ParameterStructures.byName)throw new Error(`Received ${Q} parameters for 'by Name' notification parameter structure.`);N=v.slice(te,z).map(U=>Pn(U));break}}else{let B=v;C=f.method,N=Ao(f,B)}let H={jsonrpc:c,method:C,params:N};return Zl(H),e.write(H).catch(B=>{throw s.error("Sending notification failed."),B})},onNotification:(f,v)=>{Nn();let C;return K.func(f)?u=f:v&&(K.string(f)?(C=f,d.set(f,{type:void 0,handler:v})):(C=f.method,d.set(f.method,{type:f,handler:v}))),{dispose:()=>{C!==void 0?d.delete(C):u=void 0}}},onProgress:(f,v,C)=>{if(p.has(v))throw new Error(`Progress handler for token ${v} already registered`);return p.set(v,C),{dispose:()=>{p.delete(v)}}},sendProgress:(f,v,C)=>Kt.sendNotification(In.type,{token:v,value:C}),onUnhandledProgress:Xt.event,sendRequest:(f,...v)=>{Nn(),Xl();let C,N,H;if(K.string(f)){C=f;let z=v[0],Q=v[v.length-1],U=0,ce=j.ParameterStructures.auto;j.ParameterStructures.is(z)&&(U=1,ce=z);let xe=v.length;sr.CancellationToken.is(Q)&&(xe=xe-1,H=Q);let Ge=xe-U;switch(Ge){case 0:N=void 0;break;case 1:N=us(ce,v[U]);break;default:if(ce===j.ParameterStructures.byName)throw new Error(`Received ${Ge} parameters for 'by Name' request parameter structure.`);N=v.slice(U,xe).map(Yl=>Pn(Yl));break}}else{let z=v;C=f.method,N=Ao(f,z);let Q=f.numberOfParams;H=sr.CancellationToken.is(z[Q])?z[Q]:void 0}let B=r++,te;H&&(te=H.onCancellationRequested(()=>{let z=ut.sender.sendCancellation(Kt,B);return z===void 0?(s.log(`Received no promise from cancellation strategy when cancelling id ${B}`),Promise.resolve()):z.catch(()=>{s.log(`Sending cancellation messages for id ${B} failed`)})}));let ie={jsonrpc:c,id:B,method:C,params:N};return Vl(ie),typeof ut.sender.enableCancellation=="function"&&ut.sender.enableCancellation(ie),new Promise(async(z,Q)=>{let U=Ge=>{z(Ge),ut.sender.cleanup(B),te?.dispose()},ce=Ge=>{Q(Ge),ut.sender.cleanup(B),te?.dispose()},xe={method:C,timerStart:Date.now(),resolve:U,reject:ce};try{k.set(B,xe),await e.write(ie)}catch(Ge){throw k.delete(B),xe.reject(new j.ResponseError(j.ErrorCodes.MessageWriteError,Ge.message?Ge.message:"Unknown reason")),s.error("Sending request failed."),Ge}})},onRequest:(f,v)=>{Nn();let C=null;return ar.is(f)?(C=void 0,l=f):K.string(f)?(C=null,v!==void 0&&(C=f,h.set(f,{handler:v,type:void 0}))):v!==void 0&&(C=f.method,h.set(f.method,{type:f,handler:v})),{dispose:()=>{C!==null&&(C!==void 0?h.delete(C):l=void 0)}}},hasPendingResponse:()=>k.size>0,trace:async(f,v,C)=>{let N=!1,H=Ae.Text;C!==void 0&&(K.boolean(C)?N=C:(N=C.sendNotification||!1,H=C.traceFormat||Ae.Text)),b=f,E=H,b===q.Off?O=void 0:O=v,N&&!ko()&&!Yt()&&await Kt.sendNotification(cr.type,{value:q.toString(f)})},onError:X.event,onClose:ge.event,onUnhandledNotification:Oe.event,onDispose:_o.event,end:()=>{e.end()},dispose:()=>{if(Yt())return;V=We.Disposed,_o.fire(void 0);let f=new j.ResponseError(j.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let v of k.values())v.reject(f);k=new Map,_=new Map,S=new Set,g=new Go.LinkedMap,K.func(e.dispose)&&e.dispose(),K.func(i.dispose)&&i.dispose()},listen:()=>{Nn(),Jl(),V=We.Listening,i.listen(Wl)},inspect:()=>{(0,Ho.default)().console.log("inspect")}};return Kt.onNotification(vi.type,f=>{if(b===q.Off||!O)return;let v=b===q.Verbose||b===q.Compact;O.log(f.message,v?f.verbose:void 0)}),Kt.onNotification(In.type,f=>{let v=p.get(f.token);v?v(f.value):Xt.fire(f)}),Kt}I.createMessageConnection=xu});var Ei=fe(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.ProgressType=y.ProgressToken=y.createMessageConnection=y.NullLogger=y.ConnectionOptions=y.ConnectionStrategy=y.AbstractMessageBuffer=y.WriteableStreamMessageWriter=y.AbstractMessageWriter=y.MessageWriter=y.ReadableStreamMessageReader=y.AbstractMessageReader=y.MessageReader=y.SharedArrayReceiverStrategy=y.SharedArraySenderStrategy=y.CancellationToken=y.CancellationTokenSource=y.Emitter=y.Event=y.Disposable=y.LRUCache=y.Touch=y.LinkedMap=y.ParameterStructures=y.NotificationType9=y.NotificationType8=y.NotificationType7=y.NotificationType6=y.NotificationType5=y.NotificationType4=y.NotificationType3=y.NotificationType2=y.NotificationType1=y.NotificationType0=y.NotificationType=y.ErrorCodes=y.ResponseError=y.RequestType9=y.RequestType8=y.RequestType7=y.RequestType6=y.RequestType5=y.RequestType4=y.RequestType3=y.RequestType2=y.RequestType1=y.RequestType0=y.RequestType=y.Message=y.RAL=void 0;y.MessageStrategy=y.CancellationStrategy=y.CancellationSenderStrategy=y.CancellationReceiverStrategy=y.ConnectionError=y.ConnectionErrors=y.LogTraceNotification=y.SetTraceNotification=y.TraceFormat=y.TraceValues=y.Trace=void 0;var Z=Is();Object.defineProperty(y,"Message",{enumerable:!0,get:function(){return Z.Message}});Object.defineProperty(y,"RequestType",{enumerable:!0,get:function(){return Z.RequestType}});Object.defineProperty(y,"RequestType0",{enumerable:!0,get:function(){return Z.RequestType0}});Object.defineProperty(y,"RequestType1",{enumerable:!0,get:function(){return Z.RequestType1}});Object.defineProperty(y,"RequestType2",{enumerable:!0,get:function(){return Z.RequestType2}});Object.defineProperty(y,"RequestType3",{enumerable:!0,get:function(){return Z.RequestType3}});Object.defineProperty(y,"RequestType4",{enumerable:!0,get:function(){return Z.RequestType4}});Object.defineProperty(y,"RequestType5",{enumerable:!0,get:function(){return Z.RequestType5}});Object.defineProperty(y,"RequestType6",{enumerable:!0,get:function(){return Z.RequestType6}});Object.defineProperty(y,"RequestType7",{enumerable:!0,get:function(){return Z.RequestType7}});Object.defineProperty(y,"RequestType8",{enumerable:!0,get:function(){return Z.RequestType8}});Object.defineProperty(y,"RequestType9",{enumerable:!0,get:function(){return Z.RequestType9}});Object.defineProperty(y,"ResponseError",{enumerable:!0,get:function(){return Z.ResponseError}});Object.defineProperty(y,"ErrorCodes",{enumerable:!0,get:function(){return Z.ErrorCodes}});Object.defineProperty(y,"NotificationType",{enumerable:!0,get:function(){return Z.NotificationType}});Object.defineProperty(y,"NotificationType0",{enumerable:!0,get:function(){return Z.NotificationType0}});Object.defineProperty(y,"NotificationType1",{enumerable:!0,get:function(){return Z.NotificationType1}});Object.defineProperty(y,"NotificationType2",{enumerable:!0,get:function(){return Z.NotificationType2}});Object.defineProperty(y,"NotificationType3",{enumerable:!0,get:function(){return Z.NotificationType3}});Object.defineProperty(y,"NotificationType4",{enumerable:!0,get:function(){return Z.NotificationType4}});Object.defineProperty(y,"NotificationType5",{enumerable:!0,get:function(){return Z.NotificationType5}});Object.defineProperty(y,"NotificationType6",{enumerable:!0,get:function(){return Z.NotificationType6}});Object.defineProperty(y,"NotificationType7",{enumerable:!0,get:function(){return Z.NotificationType7}});Object.defineProperty(y,"NotificationType8",{enumerable:!0,get:function(){return Z.NotificationType8}});Object.defineProperty(y,"NotificationType9",{enumerable:!0,get:function(){return Z.NotificationType9}});Object.defineProperty(y,"ParameterStructures",{enumerable:!0,get:function(){return Z.ParameterStructures}});var hr=Ds();Object.defineProperty(y,"LinkedMap",{enumerable:!0,get:function(){return hr.LinkedMap}});Object.defineProperty(y,"LRUCache",{enumerable:!0,get:function(){return hr.LRUCache}});Object.defineProperty(y,"Touch",{enumerable:!0,get:function(){return hr.Touch}});var Su=Io();Object.defineProperty(y,"Disposable",{enumerable:!0,get:function(){return Su.Disposable}});var Qo=nn();Object.defineProperty(y,"Event",{enumerable:!0,get:function(){return Qo.Event}});Object.defineProperty(y,"Emitter",{enumerable:!0,get:function(){return Qo.Emitter}});var Ko=pi();Object.defineProperty(y,"CancellationTokenSource",{enumerable:!0,get:function(){return Ko.CancellationTokenSource}});Object.defineProperty(y,"CancellationToken",{enumerable:!0,get:function(){return Ko.CancellationToken}});var ea=Do();Object.defineProperty(y,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return ea.SharedArraySenderStrategy}});Object.defineProperty(y,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return ea.SharedArrayReceiverStrategy}});var fr=Wo();Object.defineProperty(y,"MessageReader",{enumerable:!0,get:function(){return fr.MessageReader}});Object.defineProperty(y,"AbstractMessageReader",{enumerable:!0,get:function(){return fr.AbstractMessageReader}});Object.defineProperty(y,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return fr.ReadableStreamMessageReader}});var dr=Vo();Object.defineProperty(y,"MessageWriter",{enumerable:!0,get:function(){return dr.MessageWriter}});Object.defineProperty(y,"AbstractMessageWriter",{enumerable:!0,get:function(){return dr.AbstractMessageWriter}});Object.defineProperty(y,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return dr.WriteableStreamMessageWriter}});var ku=Zo();Object.defineProperty(y,"AbstractMessageBuffer",{enumerable:!0,get:function(){return ku.AbstractMessageBuffer}});var de=Yo();Object.defineProperty(y,"ConnectionStrategy",{enumerable:!0,get:function(){return de.ConnectionStrategy}});Object.defineProperty(y,"ConnectionOptions",{enumerable:!0,get:function(){return de.ConnectionOptions}});Object.defineProperty(y,"NullLogger",{enumerable:!0,get:function(){return de.NullLogger}});Object.defineProperty(y,"createMessageConnection",{enumerable:!0,get:function(){return de.createMessageConnection}});Object.defineProperty(y,"ProgressToken",{enumerable:!0,get:function(){return de.ProgressToken}});Object.defineProperty(y,"ProgressType",{enumerable:!0,get:function(){return de.ProgressType}});Object.defineProperty(y,"Trace",{enumerable:!0,get:function(){return de.Trace}});Object.defineProperty(y,"TraceValues",{enumerable:!0,get:function(){return de.TraceValues}});Object.defineProperty(y,"TraceFormat",{enumerable:!0,get:function(){return de.TraceFormat}});Object.defineProperty(y,"SetTraceNotification",{enumerable:!0,get:function(){return de.SetTraceNotification}});Object.defineProperty(y,"LogTraceNotification",{enumerable:!0,get:function(){return de.LogTraceNotification}});Object.defineProperty(y,"ConnectionErrors",{enumerable:!0,get:function(){return de.ConnectionErrors}});Object.defineProperty(y,"ConnectionError",{enumerable:!0,get:function(){return de.ConnectionError}});Object.defineProperty(y,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return de.CancellationReceiverStrategy}});Object.defineProperty(y,"CancellationSenderStrategy",{enumerable:!0,get:function(){return de.CancellationSenderStrategy}});Object.defineProperty(y,"CancellationStrategy",{enumerable:!0,get:function(){return de.CancellationStrategy}});Object.defineProperty(y,"MessageStrategy",{enumerable:!0,get:function(){return de.MessageStrategy}});var Eu=pt();y.RAL=Eu.default});var ia=fe(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});var ta=require("util"),tt=Ei(),Ci=class i extends tt.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return i.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new ta.TextDecoder(t).decode(e)}asNative(e,t){return t===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,t):Buffer.from(e,0,t)}allocNative(e){return Buffer.allocUnsafe(e)}};Ci.emptyBuffer=Buffer.allocUnsafe(0);var pr=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),tt.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),tt.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),tt.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),tt.Disposable.create(()=>this.stream.off("data",e))}},mr=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),tt.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),tt.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),tt.Disposable.create(()=>this.stream.off("end",e))}write(e,t){return new Promise((n,s)=>{let r=o=>{o==null?n():s(o)};typeof e=="string"?this.stream.write(e,t,r):this.stream.write(e,r)})}end(){this.stream.end()}},na=Object.freeze({messageBuffer:Object.freeze({create:i=>new Ci(i)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(i,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(i,void 0,0),e.charset))}catch(t){return Promise.reject(t)}}}),decoder:Object.freeze({name:"application/json",decode:(i,e)=>{try{return i instanceof Buffer?Promise.resolve(JSON.parse(i.toString(e.charset))):Promise.resolve(JSON.parse(new ta.TextDecoder(e.charset).decode(i)))}catch(t){return Promise.reject(t)}}})}),stream:Object.freeze({asReadableStream:i=>new pr(i),asWritableStream:i=>new mr(i)}),console,timer:Object.freeze({setTimeout(i,e,...t){let n=setTimeout(i,e,...t);return{dispose:()=>clearTimeout(n)}},setImmediate(i,...e){let t=setImmediate(i,...e);return{dispose:()=>clearImmediate(t)}},setInterval(i,e,...t){let n=setInterval(i,e,...t);return{dispose:()=>clearInterval(n)}}})});function gr(){return na}(function(i){function e(){tt.RAL.install(na)}i.install=e})(gr||(gr={}));yr.default=gr});var xr=fe(W=>{"use strict";var Cu=W&&W.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Tu=W&&W.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Cu(e,i,t)};Object.defineProperty(W,"__esModule",{value:!0});W.createMessageConnection=W.createServerSocketTransport=W.createClientSocketTransport=W.createServerPipeTransport=W.createClientPipeTransport=W.generateRandomPipeName=W.StreamMessageWriter=W.StreamMessageReader=W.SocketMessageWriter=W.SocketMessageReader=W.PortMessageWriter=W.PortMessageReader=W.IPCMessageWriter=W.IPCMessageReader=void 0;var cn=ia();cn.default.install();var sa=require("path"),Ru=require("os"),Ou=require("crypto"),Oi=require("net"),Ne=Ei();Tu(Ei(),W);var wr=class extends Ne.AbstractMessageReader{constructor(e){super(),this.process=e;let t=this.process;t.on("error",n=>this.fireError(n)),t.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),Ne.Disposable.create(()=>this.process.off("message",e))}};W.IPCMessageReader=wr;var vr=class extends Ne.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let t=this.process;t.on("error",n=>this.fireError(n)),t.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,t=>{t?(this.errorCount++,this.handleError(t,e)):this.errorCount=0}),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};W.IPCMessageWriter=vr;var br=class extends Ne.AbstractMessageReader{constructor(e){super(),this.onData=new Ne.Emitter,e.on("close",()=>this.fireClose),e.on("error",t=>this.fireError(t)),e.on("message",t=>{this.onData.fire(t)})}listen(e){return this.onData.event(e)}};W.PortMessageReader=br;var _r=class extends Ne.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",t=>this.fireError(t))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};W.PortMessageWriter=_r;var Rt=class extends Ne.ReadableStreamMessageReader{constructor(e,t="utf-8"){super((0,cn.default)().stream.asReadableStream(e),t)}};W.SocketMessageReader=Rt;var Ot=class extends Ne.WriteableStreamMessageWriter{constructor(e,t){super((0,cn.default)().stream.asWritableStream(e),t),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};W.SocketMessageWriter=Ot;var Ti=class extends Ne.ReadableStreamMessageReader{constructor(e,t){super((0,cn.default)().stream.asReadableStream(e),t)}};W.StreamMessageReader=Ti;var Ri=class extends Ne.WriteableStreamMessageWriter{constructor(e,t){super((0,cn.default)().stream.asWritableStream(e),t)}};W.StreamMessageWriter=Ri;var ra=process.env.XDG_RUNTIME_DIR,Au=new Map([["linux",107],["darwin",103]]);function Nu(){let i=(0,Ou.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${i}-sock`;let e;ra?e=sa.join(ra,`vscode-ipc-${i}.sock`):e=sa.join(Ru.tmpdir(),`vscode-${i}.sock`);let t=Au.get(process.platform);return t!==void 0&&e.length>t&&(0,cn.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${t} characters.`),e}W.generateRandomPipeName=Nu;function Pu(i,e="utf-8"){let t,n=new Promise((s,r)=>{t=s});return new Promise((s,r)=>{let o=(0,Oi.createServer)(a=>{o.close(),t([new Rt(a,e),new Ot(a,e)])});o.on("error",r),o.listen(i,()=>{o.removeListener("error",r),s({onConnected:()=>n})})})}W.createClientPipeTransport=Pu;function Mu(i,e="utf-8"){let t=(0,Oi.createConnection)(i);return[new Rt(t,e),new Ot(t,e)]}W.createServerPipeTransport=Mu;function ju(i,e="utf-8"){let t,n=new Promise((s,r)=>{t=s});return new Promise((s,r)=>{let o=(0,Oi.createServer)(a=>{o.close(),t([new Rt(a,e),new Ot(a,e)])});o.on("error",r),o.listen(i,"127.0.0.1",()=>{o.removeListener("error",r),s({onConnected:()=>n})})})}W.createClientSocketTransport=ju;function Lu(i,e="utf-8"){let t=(0,Oi.createConnection)(i,"127.0.0.1");return[new Rt(t,e),new Ot(t,e)]}W.createServerSocketTransport=Lu;function Iu(i){let e=i;return e.read!==void 0&&e.addListener!==void 0}function $u(i){let e=i;return e.write!==void 0&&e.addListener!==void 0}function Du(i,e,t,n){t||(t=Ne.NullLogger);let s=Iu(i)?new Ti(i):i,r=$u(e)?new Ri(e):e;return Ne.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Ne.createMessageConnection)(s,r,t,n)}W.createMessageConnection=Du});var aa=fe((yp,oa)=>{"use strict";oa.exports=xr()});var xl=ft(require("child_process")),ct=ft(require("fs")),Sl=ft(require("path")),kl=ft(xr()),as=ft(aa());var Y={};iu(Y,{BRAND:()=>uh,DIRTY:()=>At,EMPTY_PATH:()=>qu,INVALID:()=>M,NEVER:()=>Gh,OK:()=>ve,ParseStatus:()=>pe,Schema:()=>D,ZodAny:()=>vt,ZodArray:()=>rt,ZodBigInt:()=>Pt,ZodBoolean:()=>Mt,ZodBranded:()=>Wn,ZodCatch:()=>Bt,ZodDate:()=>jt,ZodDefault:()=>Ut,ZodDiscriminatedUnion:()=>Pi,ZodEffects:()=>Ie,ZodEnum:()=>zt,ZodError:()=>Ce,ZodFirstPartyTypeKind:()=>L,ZodFunction:()=>ji,ZodIntersection:()=>Dt,ZodIssueCode:()=>x,ZodLazy:()=>Ft,ZodLiteral:()=>Wt,ZodMap:()=>pn,ZodNaN:()=>gn,ZodNativeEnum:()=>qt,ZodNever:()=>ze,ZodNull:()=>It,ZodNullable:()=>Ye,ZodNumber:()=>Nt,ZodObject:()=>Te,ZodOptional:()=>je,ZodParsedType:()=>R,ZodPipeline:()=>zn,ZodPromise:()=>bt,ZodReadonly:()=>Vt,ZodRecord:()=>Mi,ZodSchema:()=>D,ZodSet:()=>mn,ZodString:()=>wt,ZodSymbol:()=>fn,ZodTransformer:()=>Ie,ZodTuple:()=>Xe,ZodType:()=>D,ZodUndefined:()=>Lt,ZodUnion:()=>$t,ZodUnknown:()=>st,ZodVoid:()=>dn,addIssueToContext:()=>T,any:()=>vh,array:()=>Sh,bigint:()=>ph,boolean:()=>wa,coerce:()=>Hh,custom:()=>ma,date:()=>mh,datetimeRegex:()=>da,defaultErrorMap:()=>nt,discriminatedUnion:()=>Th,effect:()=>Fh,enum:()=>Ih,function:()=>Mh,getErrorMap:()=>ln,getParsedType:()=>Je,instanceof:()=>fh,intersection:()=>Rh,isAborted:()=>Ai,isAsync:()=>un,isDirty:()=>Ni,isValid:()=>yt,late:()=>hh,lazy:()=>jh,literal:()=>Lh,makeIssue:()=>Fn,map:()=>Nh,nan:()=>dh,nativeEnum:()=>$h,never:()=>_h,null:()=>wh,nullable:()=>zh,number:()=>ya,object:()=>kh,objectUtil:()=>Sr,oboolean:()=>Zh,onumber:()=>Vh,optional:()=>Wh,ostring:()=>Bh,pipeline:()=>Uh,preprocess:()=>qh,promise:()=>Dh,quotelessJson:()=>Fu,record:()=>Ah,set:()=>Ph,setErrorMap:()=>zu,strictObject:()=>Eh,string:()=>ga,symbol:()=>gh,transformer:()=>Fh,tuple:()=>Oh,undefined:()=>yh,union:()=>Ch,unknown:()=>bh,util:()=>F,void:()=>xh});var F;(function(i){i.assertEqual=s=>{};function e(s){}i.assertIs=e;function t(s){throw new Error}i.assertNever=t,i.arrayToEnum=s=>{let r={};for(let o of s)r[o]=o;return r},i.getValidEnumValues=s=>{let r=i.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(let a of r)o[a]=s[a];return i.objectValues(o)},i.objectValues=s=>i.objectKeys(s).map(function(r){return s[r]}),i.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let r=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&r.push(o);return r},i.find=(s,r)=>{for(let o of s)if(r(o))return o},i.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,r=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(r)}i.joinValues=n,i.jsonStringifyReplacer=(s,r)=>typeof r=="bigint"?r.toString():r})(F||(F={}));var Sr;(function(i){i.mergeShapes=(e,t)=>({...e,...t})})(Sr||(Sr={}));var R=F.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Je=i=>{switch(typeof i){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(i)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(i)?R.array:i===null?R.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?R.promise:typeof Map<"u"&&i instanceof Map?R.map:typeof Set<"u"&&i instanceof Set?R.set:typeof Date<"u"&&i instanceof Date?R.date:R.object;default:return R.unknown}};var x=F.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Fu=i=>JSON.stringify(i,null,2).replace(/"([^"]+)":/g,"$1:"),Ce=class i extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(r){return r.message},n={_errors:[]},s=r=>{for(let o of r.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let a=n,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return s(this),n}static assert(e){if(!(e instanceof i))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,F.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Ce.create=i=>new Ce(i);var Wu=(i,e)=>{let t;switch(i.code){case x.invalid_type:i.received===R.undefined?t="Required":t=`Expected ${i.expected}, received ${i.received}`;break;case x.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(i.expected,F.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:t=`Unrecognized key(s) in object: ${F.joinValues(i.keys,", ")}`;break;case x.invalid_union:t="Invalid input";break;case x.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${F.joinValues(i.options)}`;break;case x.invalid_enum_value:t=`Invalid enum value. Expected ${F.joinValues(i.options)}, received '${i.received}'`;break;case x.invalid_arguments:t="Invalid function arguments";break;case x.invalid_return_type:t="Invalid function return type";break;case x.invalid_date:t="Invalid date";break;case x.invalid_string:typeof i.validation=="object"?"includes"in i.validation?(t=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?t=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?t=`Invalid input: must end with "${i.validation.endsWith}"`:F.assertNever(i.validation):i.validation!=="regex"?t=`Invalid ${i.validation}`:t="Invalid";break;case x.too_small:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:t="Invalid input";break;case x.too_big:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="bigint"?t=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:t="Invalid input";break;case x.custom:t="Invalid input";break;case x.invalid_intersection_types:t="Intersection results could not be merged";break;case x.not_multiple_of:t=`Number must be a multiple of ${i.multipleOf}`;break;case x.not_finite:t="Number must be finite";break;default:t=e.defaultError,F.assertNever(i)}return{message:t}},nt=Wu;var ca=nt;function zu(i){ca=i}function ln(){return ca}var Fn=i=>{let{data:e,path:t,errorMaps:n,issueData:s}=i,r=[...t,...s.path||[]],o={...s,path:r};if(s.message!==void 0)return{...s,path:r,message:s.message};let a="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)a=l(o,{data:e,defaultError:a}).message;return{...s,path:r,message:a}},qu=[];function T(i,e){let t=ln(),n=Fn({issueData:e,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,t,t===nt?void 0:nt].filter(s=>!!s)});i.common.issues.push(n)}var pe=class i{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return M;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t){let r=await s.key,o=await s.value;n.push({key:r,value:o})}return i.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:r,value:o}=s;if(r.status==="aborted"||o.status==="aborted")return M;r.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[r.value]=o.value)}return{status:e.value,value:n}}},M=Object.freeze({status:"aborted"}),At=i=>({status:"dirty",value:i}),ve=i=>({status:"valid",value:i}),Ai=i=>i.status==="aborted",Ni=i=>i.status==="dirty",yt=i=>i.status==="valid",un=i=>typeof Promise<"u"&&i instanceof Promise;var A;(function(i){i.errToObj=e=>typeof e=="string"?{message:e}:e||{},i.toString=e=>typeof e=="string"?e:e?.message})(A||(A={}));var Le=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},la=(i,e)=>{if(yt(e))return{success:!0,data:e.value};if(!i.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Ce(i.common.issues);return this._error=t,this._error}}};function $(i){if(!i)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=i;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{let{message:c}=i;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??t??a.defaultError}},description:s}}var D=class{get description(){return this._def.description}_getType(e){return Je(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Je(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pe,ctx:{common:e.parent.common,data:e.data,parsedType:Je(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(un(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Je(e)},s=this._parseSync({data:e,path:n.path,parent:n});return la(n,s)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Je(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return yt(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>yt(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Je(e)},s=this._parse({data:e,path:n.path,parent:n}),r=await(un(s)?s:Promise.resolve(s));return la(n,r)}refine(e,t){let n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,r)=>{let o=e(s),a=()=>r.addIssue({code:x.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Ie({schema:this,typeName:L.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return je.create(this,this._def)}nullable(){return Ye.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rt.create(this)}promise(){return bt.create(this,this._def)}or(e){return $t.create([this,e],this._def)}and(e){return Dt.create(this,e,this._def)}transform(e){return new Ie({...$(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Ut({...$(this._def),innerType:this,defaultValue:t,typeName:L.ZodDefault})}brand(){return new Wn({typeName:L.ZodBranded,type:this,...$(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Bt({...$(this._def),innerType:this,catchValue:t,typeName:L.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return zn.create(this,e)}readonly(){return Vt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Uu=/^c[^\s-]{8,}$/i,Bu=/^[0-9a-z]+$/,Vu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zu=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Hu=/^[a-z0-9_-]{21}$/i,Gu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ju=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Xu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",kr,Qu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ku=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,eh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,th=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ih=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ha="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",sh=new RegExp(`^${ha}$`);function fa(i){let e="[0-5]\\d";i.precision?e=`${e}\\.\\d{${i.precision}}`:i.precision==null&&(e=`${e}(\\.\\d+)?`);let t=i.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function rh(i){return new RegExp(`^${fa(i)}$`)}function da(i){let e=`${ha}T${fa(i)}`,t=[];return t.push(i.local?"Z?":"Z"),i.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function oh(i,e){return!!((e==="v4"||!e)&&Qu.test(i)||(e==="v6"||!e)&&eh.test(i))}function ah(i,e){if(!Gu.test(i))return!1;try{let[t]=i.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function ch(i,e){return!!((e==="v4"||!e)&&Ku.test(i)||(e==="v6"||!e)&&th.test(i))}var wt=class i extends D{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let r=this._getOrReturnCtx(e);return T(r,{code:x.invalid_type,expected:R.string,received:r.parsedType}),M}let n=new pe,s;for(let r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(s=this._getOrReturnCtx(e,s),T(s,{code:x.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")e.data.length>r.value&&(s=this._getOrReturnCtx(e,s),T(s,{code:x.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){let o=e.data.length>r.value,a=e.data.length<r.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?T(s,{code:x.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&T(s,{code:x.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")Xu.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"email",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")kr||(kr=new RegExp(Yu,"u")),kr.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"emoji",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")Zu.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"uuid",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")Hu.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"nanoid",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")Uu.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"cuid",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")Bu.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"cuid2",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")Vu.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"ulid",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),T(s,{validation:"url",code:x.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"regex",code:x.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(s=this._getOrReturnCtx(e,s),T(s,{code:x.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(s=this._getOrReturnCtx(e,s),T(s,{code:x.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(s=this._getOrReturnCtx(e,s),T(s,{code:x.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?da(r).test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{code:x.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?sh.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{code:x.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?rh(r).test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{code:x.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?Ju.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"duration",code:x.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?oh(e.data,r.version)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"ip",code:x.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?ah(e.data,r.alg)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"jwt",code:x.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?ch(e.data,r.version)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"cidr",code:x.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?nh.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"base64",code:x.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?ih.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"base64url",code:x.invalid_string,message:r.message}),n.dirty()):F.assertNever(r);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:x.invalid_string,...A.errToObj(n)})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...A.errToObj(e)})}url(e){return this._addCheck({kind:"url",...A.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...A.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...A.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...A.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...A.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...A.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...A.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...A.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...A.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...A.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...A.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...A.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...A.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...A.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...A.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...A.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...A.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...A.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...A.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...A.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...A.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...A.errToObj(t)})}nonempty(e){return this.min(1,A.errToObj(e))}trim(){return new i({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new i({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new i({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};wt.create=i=>new wt({checks:[],typeName:L.ZodString,coerce:i?.coerce??!1,...$(i)});function lh(i,e){let t=(i.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,r=Number.parseInt(i.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return r%o/10**s}var Nt=class i extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){let r=this._getOrReturnCtx(e);return T(r,{code:x.invalid_type,expected:R.number,received:r.parsedType}),M}let n,s=new pe;for(let r of this._def.checks)r.kind==="int"?F.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),T(n,{code:x.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="multipleOf"?lh(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),T(n,{code:x.not_finite,message:r.message}),s.dirty()):F.assertNever(r);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,n,s){return new i({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:A.toString(s)}]})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:A.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:A.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&F.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Nt.create=i=>new Nt({checks:[],typeName:L.ZodNumber,coerce:i?.coerce||!1,...$(i)});var Pt=class i extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let n,s=new pe;for(let r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),T(n,{code:x.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):F.assertNever(r);return{status:s.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return T(t,{code:x.invalid_type,expected:R.bigint,received:t.parsedType}),M}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,n,s){return new i({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:A.toString(s)}]})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Pt.create=i=>new Pt({checks:[],typeName:L.ZodBigInt,coerce:i?.coerce??!1,...$(i)});var Mt=class extends D{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.boolean,received:n.parsedType}),M}return ve(e.data)}};Mt.create=i=>new Mt({typeName:L.ZodBoolean,coerce:i?.coerce||!1,...$(i)});var jt=class i extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let r=this._getOrReturnCtx(e);return T(r,{code:x.invalid_type,expected:R.date,received:r.parsedType}),M}if(Number.isNaN(e.data.getTime())){let r=this._getOrReturnCtx(e);return T(r,{code:x.invalid_date}),M}let n=new pe,s;for(let r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(s=this._getOrReturnCtx(e,s),T(s,{code:x.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(s=this._getOrReturnCtx(e,s),T(s,{code:x.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):F.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:A.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:A.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};jt.create=i=>new jt({checks:[],coerce:i?.coerce||!1,typeName:L.ZodDate,...$(i)});var fn=class extends D{_parse(e){if(this._getType(e)!==R.symbol){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.symbol,received:n.parsedType}),M}return ve(e.data)}};fn.create=i=>new fn({typeName:L.ZodSymbol,...$(i)});var Lt=class extends D{_parse(e){if(this._getType(e)!==R.undefined){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.undefined,received:n.parsedType}),M}return ve(e.data)}};Lt.create=i=>new Lt({typeName:L.ZodUndefined,...$(i)});var It=class extends D{_parse(e){if(this._getType(e)!==R.null){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.null,received:n.parsedType}),M}return ve(e.data)}};It.create=i=>new It({typeName:L.ZodNull,...$(i)});var vt=class extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return ve(e.data)}};vt.create=i=>new vt({typeName:L.ZodAny,...$(i)});var st=class extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ve(e.data)}};st.create=i=>new st({typeName:L.ZodUnknown,...$(i)});var ze=class extends D{_parse(e){let t=this._getOrReturnCtx(e);return T(t,{code:x.invalid_type,expected:R.never,received:t.parsedType}),M}};ze.create=i=>new ze({typeName:L.ZodNever,...$(i)});var dn=class extends D{_parse(e){if(this._getType(e)!==R.undefined){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.void,received:n.parsedType}),M}return ve(e.data)}};dn.create=i=>new dn({typeName:L.ZodVoid,...$(i)});var rt=class i extends D{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==R.array)return T(t,{code:x.invalid_type,expected:R.array,received:t.parsedType}),M;if(s.exactLength!==null){let o=t.data.length>s.exactLength.value,a=t.data.length<s.exactLength.value;(o||a)&&(T(t,{code:o?x.too_big:x.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(T(t,{code:x.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(T(t,{code:x.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>s.type._parseAsync(new Le(t,o,t.path,a)))).then(o=>pe.mergeArray(n,o));let r=[...t.data].map((o,a)=>s.type._parseSync(new Le(t,o,t.path,a)));return pe.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new i({...this._def,minLength:{value:e,message:A.toString(t)}})}max(e,t){return new i({...this._def,maxLength:{value:e,message:A.toString(t)}})}length(e,t){return new i({...this._def,exactLength:{value:e,message:A.toString(t)}})}nonempty(e){return this.min(1,e)}};rt.create=(i,e)=>new rt({type:i,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...$(e)});function hn(i){if(i instanceof Te){let e={};for(let t in i.shape){let n=i.shape[t];e[t]=je.create(hn(n))}return new Te({...i._def,shape:()=>e})}else return i instanceof rt?new rt({...i._def,type:hn(i.element)}):i instanceof je?je.create(hn(i.unwrap())):i instanceof Ye?Ye.create(hn(i.unwrap())):i instanceof Xe?Xe.create(i.items.map(e=>hn(e))):i}var Te=class i extends D{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=F.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==R.object){let l=this._getOrReturnCtx(e);return T(l,{code:x.invalid_type,expected:R.object,received:l.parsedType}),M}let{status:n,ctx:s}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof ze&&this._def.unknownKeys==="strip"))for(let l in s.data)o.includes(l)||a.push(l);let c=[];for(let l of o){let h=r[l],u=s.data[l];c.push({key:{status:"valid",value:l},value:h._parse(new Le(s,u,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof ze){let l=this._def.unknownKeys;if(l==="passthrough")for(let h of a)c.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(l==="strict")a.length>0&&(T(s,{code:x.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let h of a){let u=s.data[h];c.push({key:{status:"valid",value:h},value:l._parse(new Le(s,u,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let h of c){let u=await h.key,d=await h.value;l.push({key:u,value:d,alwaysSet:h.alwaysSet})}return l}).then(l=>pe.mergeObjectSync(n,l)):pe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return A.errToObj,new i({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let s=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:A.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new i({...this._def,unknownKeys:"strip"})}passthrough(){return new i({...this._def,unknownKeys:"passthrough"})}extend(e){return new i({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new i({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:L.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new i({...this._def,catchall:e})}pick(e){let t={};for(let n of F.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new i({...this._def,shape:()=>t})}omit(e){let t={};for(let n of F.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new i({...this._def,shape:()=>t})}deepPartial(){return hn(this)}partial(e){let t={};for(let n of F.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new i({...this._def,shape:()=>t})}required(e){let t={};for(let n of F.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof je;)r=r._def.innerType;t[n]=r}return new i({...this._def,shape:()=>t})}keyof(){return pa(F.objectKeys(this.shape))}};Te.create=(i,e)=>new Te({shape:()=>i,unknownKeys:"strip",catchall:ze.create(),typeName:L.ZodObject,...$(e)});Te.strictCreate=(i,e)=>new Te({shape:()=>i,unknownKeys:"strict",catchall:ze.create(),typeName:L.ZodObject,...$(e)});Te.lazycreate=(i,e)=>new Te({shape:i,unknownKeys:"strip",catchall:ze.create(),typeName:L.ZodObject,...$(e)});var $t=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(r){for(let a of r)if(a.result.status==="valid")return a.result;for(let a of r)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=r.map(a=>new Ce(a.ctx.common.issues));return T(t,{code:x.invalid_union,unionErrors:o}),M}if(t.common.async)return Promise.all(n.map(async r=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(s);{let r,o=[];for(let c of n){let l={...t,common:{...t.common,issues:[]},parent:null},h=c._parseSync({data:t.data,path:t.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!r&&(r={result:h,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;let a=o.map(c=>new Ce(c));return T(t,{code:x.invalid_union,unionErrors:a}),M}}get options(){return this._def.options}};$t.create=(i,e)=>new $t({options:i,typeName:L.ZodUnion,...$(e)});var it=i=>i instanceof Ft?it(i.schema):i instanceof Ie?it(i.innerType()):i instanceof Wt?[i.value]:i instanceof zt?i.options:i instanceof qt?F.objectValues(i.enum):i instanceof Ut?it(i._def.innerType):i instanceof Lt?[void 0]:i instanceof It?[null]:i instanceof je?[void 0,...it(i.unwrap())]:i instanceof Ye?[null,...it(i.unwrap())]:i instanceof Wn||i instanceof Vt?it(i.unwrap()):i instanceof Bt?it(i._def.innerType):[],Pi=class i extends D{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.object)return T(t,{code:x.invalid_type,expected:R.object,received:t.parsedType}),M;let n=this.discriminator,s=t.data[n],r=this.optionsMap.get(s);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(T(t,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let r of t){let o=it(r.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,r)}}return new i({typeName:L.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...$(n)})}};function Er(i,e){let t=Je(i),n=Je(e);if(i===e)return{valid:!0,data:i};if(t===R.object&&n===R.object){let s=F.objectKeys(e),r=F.objectKeys(i).filter(a=>s.indexOf(a)!==-1),o={...i,...e};for(let a of r){let c=Er(i[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(t===R.array&&n===R.array){if(i.length!==e.length)return{valid:!1};let s=[];for(let r=0;r<i.length;r++){let o=i[r],a=e[r],c=Er(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===R.date&&n===R.date&&+i==+e?{valid:!0,data:i}:{valid:!1}}var Dt=class extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=(r,o)=>{if(Ai(r)||Ai(o))return M;let a=Er(r.value,o.value);return a.valid?((Ni(r)||Ni(o))&&t.dirty(),{status:t.value,value:a.data}):(T(n,{code:x.invalid_intersection_types}),M)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([r,o])=>s(r,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Dt.create=(i,e,t)=>new Dt({left:i,right:e,typeName:L.ZodIntersection,...$(t)});var Xe=class i extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.array)return T(n,{code:x.invalid_type,expected:R.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return T(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(T(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let r=[...n.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Le(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(r).then(o=>pe.mergeArray(t,o)):pe.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new i({...this._def,rest:e})}};Xe.create=(i,e)=>{if(!Array.isArray(i))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xe({items:i,typeName:L.ZodTuple,rest:null,...$(e)})};var Mi=class i extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.object)return T(n,{code:x.invalid_type,expected:R.object,received:n.parsedType}),M;let s=[],r=this._def.keyType,o=this._def.valueType;for(let a in n.data)s.push({key:r._parse(new Le(n,a,n.path,a)),value:o._parse(new Le(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?pe.mergeObjectAsync(t,s):pe.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof D?new i({keyType:e,valueType:t,typeName:L.ZodRecord,...$(n)}):new i({keyType:wt.create(),valueType:e,typeName:L.ZodRecord,...$(t)})}},pn=class extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.map)return T(n,{code:x.invalid_type,expected:R.map,received:n.parsedType}),M;let s=this._def.keyType,r=this._def.valueType,o=[...n.data.entries()].map(([a,c],l)=>({key:s._parse(new Le(n,a,n.path,[l,"key"])),value:r._parse(new Le(n,c,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,h=await c.value;if(l.status==="aborted"||h.status==="aborted")return M;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),a.set(l.value,h.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let c of o){let l=c.key,h=c.value;if(l.status==="aborted"||h.status==="aborted")return M;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),a.set(l.value,h.value)}return{status:t.value,value:a}}}};pn.create=(i,e,t)=>new pn({valueType:e,keyType:i,typeName:L.ZodMap,...$(t)});var mn=class i extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.set)return T(n,{code:x.invalid_type,expected:R.set,received:n.parsedType}),M;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(T(n,{code:x.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(T(n,{code:x.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let r=this._def.valueType;function o(c){let l=new Set;for(let h of c){if(h.status==="aborted")return M;h.status==="dirty"&&t.dirty(),l.add(h.value)}return{status:t.value,value:l}}let a=[...n.data.values()].map((c,l)=>r._parse(new Le(n,c,n.path,l)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,t){return new i({...this._def,minSize:{value:e,message:A.toString(t)}})}max(e,t){return new i({...this._def,maxSize:{value:e,message:A.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};mn.create=(i,e)=>new mn({valueType:i,minSize:null,maxSize:null,typeName:L.ZodSet,...$(e)});var ji=class i extends D{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.function)return T(t,{code:x.invalid_type,expected:R.function,received:t.parsedType}),M;function n(a,c){return Fn({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ln(),nt].filter(l=>!!l),issueData:{code:x.invalid_arguments,argumentsError:c}})}function s(a,c){return Fn({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ln(),nt].filter(l=>!!l),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let r={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof bt){let a=this;return ve(async function(...c){let l=new Ce([]),h=await a._def.args.parseAsync(c,r).catch(p=>{throw l.addIssue(n(c,p)),l}),u=await Reflect.apply(o,this,h);return await a._def.returns._def.type.parseAsync(u,r).catch(p=>{throw l.addIssue(s(u,p)),l})})}else{let a=this;return ve(function(...c){let l=a._def.args.safeParse(c,r);if(!l.success)throw new Ce([n(c,l.error)]);let h=Reflect.apply(o,this,l.data),u=a._def.returns.safeParse(h,r);if(!u.success)throw new Ce([s(h,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new i({...this._def,args:Xe.create(e).rest(st.create())})}returns(e){return new i({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new i({args:e||Xe.create([]).rest(st.create()),returns:t||st.create(),typeName:L.ZodFunction,...$(n)})}},Ft=class extends D{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ft.create=(i,e)=>new Ft({getter:i,typeName:L.ZodLazy,...$(e)});var Wt=class extends D{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return T(t,{received:t.data,code:x.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:e.data}}get value(){return this._def.value}};Wt.create=(i,e)=>new Wt({value:i,typeName:L.ZodLiteral,...$(e)});function pa(i,e){return new zt({values:i,typeName:L.ZodEnum,...$(e)})}var zt=class i extends D{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return T(t,{expected:F.joinValues(n),received:t.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return T(t,{received:t.data,code:x.invalid_enum_value,options:n}),M}return ve(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return i.create(e,{...this._def,...t})}exclude(e,t=this._def){return i.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};zt.create=pa;var qt=class extends D{_parse(e){let t=F.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==R.string&&n.parsedType!==R.number){let s=F.objectValues(t);return T(n,{expected:F.joinValues(s),received:n.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(F.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=F.objectValues(t);return T(n,{received:n.data,code:x.invalid_enum_value,options:s}),M}return ve(e.data)}get enum(){return this._def.values}};qt.create=(i,e)=>new qt({values:i,typeName:L.ZodNativeEnum,...$(e)});var bt=class extends D{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.promise&&t.common.async===!1)return T(t,{code:x.invalid_type,expected:R.promise,received:t.parsedType}),M;let n=t.parsedType===R.promise?t.data:Promise.resolve(t.data);return ve(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};bt.create=(i,e)=>new bt({type:i,typeName:L.ZodPromise,...$(e)});var Ie=class extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,r={addIssue:o=>{T(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),s.type==="preprocess"){let o=s.transform(n.data,r);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return M;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?At(c.value):t.value==="dirty"?At(c.value):c});{if(t.value==="aborted")return M;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?M:a.status==="dirty"?At(a.value):t.value==="dirty"?At(a.value):a}}if(s.type==="refinement"){let o=a=>{let c=s.refinement(a,r);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?M:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?M:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(o))return M;let a=s.transform(o.value,r);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>yt(o)?Promise.resolve(s.transform(o.value,r)).then(a=>({status:t.value,value:a})):M);F.assertNever(s)}};Ie.create=(i,e,t)=>new Ie({schema:i,typeName:L.ZodEffects,effect:e,...$(t)});Ie.createWithPreprocess=(i,e,t)=>new Ie({schema:e,effect:{type:"preprocess",transform:i},typeName:L.ZodEffects,...$(t)});var je=class extends D{_parse(e){return this._getType(e)===R.undefined?ve(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};je.create=(i,e)=>new je({innerType:i,typeName:L.ZodOptional,...$(e)});var Ye=class extends D{_parse(e){return this._getType(e)===R.null?ve(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ye.create=(i,e)=>new Ye({innerType:i,typeName:L.ZodNullable,...$(e)});var Ut=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===R.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ut.create=(i,e)=>new Ut({innerType:i,typeName:L.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...$(e)});var Bt=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return un(s)?s.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Bt.create=(i,e)=>new Bt({innerType:i,typeName:L.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...$(e)});var gn=class extends D{_parse(e){if(this._getType(e)!==R.nan){let n=this._getOrReturnCtx(e);return T(n,{code:x.invalid_type,expected:R.nan,received:n.parsedType}),M}return{status:"valid",value:e.data}}};gn.create=i=>new gn({typeName:L.ZodNaN,...$(i)});var uh=Symbol("zod_brand"),Wn=class extends D{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},zn=class i extends D{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let r=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?M:r.status==="dirty"?(t.dirty(),At(r.value)):this._def.out._parseAsync({data:r.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?M:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new i({in:e,out:t,typeName:L.ZodPipeline})}},Vt=class extends D{_parse(e){let t=this._def.innerType._parse(e),n=s=>(yt(s)&&(s.value=Object.freeze(s.value)),s);return un(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}};Vt.create=(i,e)=>new Vt({innerType:i,typeName:L.ZodReadonly,...$(e)});function ua(i,e){let t=typeof i=="function"?i(e):typeof i=="string"?{message:i}:i;return typeof t=="string"?{message:t}:t}function ma(i,e={},t){return i?vt.create().superRefine((n,s)=>{let r=i(n);if(r instanceof Promise)return r.then(o=>{if(!o){let a=ua(e,n),c=a.fatal??t??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!r){let o=ua(e,n),a=o.fatal??t??!0;s.addIssue({code:"custom",...o,fatal:a})}}):vt.create()}var hh={object:Te.lazycreate},L;(function(i){i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly"})(L||(L={}));var fh=(i,e={message:`Input not instance of ${i.name}`})=>ma(t=>t instanceof i,e),ga=wt.create,ya=Nt.create,dh=gn.create,ph=Pt.create,wa=Mt.create,mh=jt.create,gh=fn.create,yh=Lt.create,wh=It.create,vh=vt.create,bh=st.create,_h=ze.create,xh=dn.create,Sh=rt.create,kh=Te.create,Eh=Te.strictCreate,Ch=$t.create,Th=Pi.create,Rh=Dt.create,Oh=Xe.create,Ah=Mi.create,Nh=pn.create,Ph=mn.create,Mh=ji.create,jh=Ft.create,Lh=Wt.create,Ih=zt.create,$h=qt.create,Dh=bt.create,Fh=Ie.create,Wh=je.create,zh=Ye.create,qh=Ie.createWithPreprocess,Uh=zn.create,Bh=()=>ga().optional(),Vh=()=>ya().optional(),Zh=()=>wa().optional(),Hh={string:i=>wt.create({...i,coerce:!0}),number:i=>Nt.create({...i,coerce:!0}),boolean:i=>Mt.create({...i,coerce:!0}),bigint:i=>Pt.create({...i,coerce:!0}),date:i=>jt.create({...i,coerce:!0})};var Gh=M;var El=require("node:util"),ne=require("node:path");var qn=class{diff(e,t,n={}){let s;typeof n=="function"?(s=n,n={}):"callback"in n&&(s=n.callback);let r=this.castInput(e,n),o=this.castInput(t,n),a=this.removeEmpty(this.tokenize(r,n)),c=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,c,n,s)}diffWithOptionsObj(e,t,n,s){var r;let o=_=>{if(_=this.postProcess(_,n),s){setTimeout(function(){s(_)},0);return}else return _},a=t.length,c=e.length,l=1,h=a+c;n.maxEditLength!=null&&(h=Math.min(h,n.maxEditLength));let u=(r=n.timeout)!==null&&r!==void 0?r:1/0,d=Date.now()+u,p=[{oldPos:-1,lastComponent:void 0}],w=this.extractCommon(p[0],t,e,0,n);if(p[0].oldPos+1>=c&&w+1>=a)return o(this.buildValues(p[0].lastComponent,t,e));let g=-1/0,k=1/0,S=()=>{for(let _=Math.max(g,-l);_<=Math.min(k,l);_+=2){let b,E=p[_-1],O=p[_+1];E&&(p[_-1]=void 0);let V=!1;if(O){let ge=O.oldPos-_;V=O&&0<=ge&&ge<a}let X=E&&E.oldPos+1<c;if(!V&&!X){p[_]=void 0;continue}if(!X||V&&E.oldPos<O.oldPos?b=this.addToPath(O,!0,!1,0,n):b=this.addToPath(E,!1,!0,1,n),w=this.extractCommon(b,t,e,_,n),b.oldPos+1>=c&&w+1>=a)return o(this.buildValues(b.lastComponent,t,e))||!0;p[_]=b,b.oldPos+1>=c&&(k=Math.min(k,_-1)),w+1>=a&&(g=Math.max(g,_+1))}l++};if(s)(function _(){setTimeout(function(){if(l>h||Date.now()>d)return s(void 0);S()||_()},0)})();else for(;l<=h&&Date.now()<=d;){let _=S();if(_)return _}}addToPath(e,t,n,s,r){let o=e.lastComponent;return o&&!r.oneChangePerToken&&o.added===t&&o.removed===n?{oldPos:e.oldPos+s,lastComponent:{count:o.count+1,added:t,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:t,removed:n,previousComponent:o}}}extractCommon(e,t,n,s,r){let o=t.length,a=n.length,c=e.oldPos,l=c-s,h=0;for(;l+1<o&&c+1<a&&this.equals(n[c+1],t[l+1],r);)l++,c++,h++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return h&&!r.oneChangePerToken&&(e.lastComponent={count:h,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=c,l}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let s=[],r;for(;e;)s.push(e),r=e.previousComponent,delete e.previousComponent,e=r;s.reverse();let o=s.length,a=0,c=0,l=0;for(;a<o;a++){let h=s[a];if(h.removed)h.value=this.join(n.slice(l,l+h.count)),l+=h.count;else{if(!h.added&&this.useLongestToken){let u=t.slice(c,c+h.count);u=u.map(function(d,p){let w=n[l+p];return w.length>d.length?w:d}),h.value=this.join(u)}else h.value=this.join(t.slice(c,c+h.count));c+=h.count,h.added||(l+=h.count)}}return s}};function va(i){return i.includes(`\r
33
- `)&&!i.startsWith(`
34
- `)&&!i.match(/[^\r]\n/)}function ba(i){return!i.includes(`\r
35
- `)&&i.includes(`
36
- `)}var Cr=class extends qn{constructor(){super(...arguments),this.tokenize=Xh}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
32
+ `)),b){let A=d.error?` Request failed: ${d.error.message} (${d.error.code}).`:"";O.log(`Received response '${b.method} - (${d.id})' in ${Date.now()-b.timerStart}ms.${A}`,C)}else O.log(`Received response ${d.id} without active response promise.`,C)}else Qt("receive-response",d)}function Qt(d,b){if(!O||v===U.Off)return;let C={isLSPMessage:!0,type:d,message:b,timestamp:Date.now()};O.log(C)}function An(){if(Eo())throw new an(Dn.Closed,"Connection is closed.");if(Yt())throw new an(Dn.Disposed,"Connection is disposed.")}function Yl(){if(ko())throw new an(Dn.AlreadyListening,"Connection is already listening")}function Ql(){if(!ko())throw new Error("Call listen() first.")}function Pn(d){return d===void 0?null:d}function Oo(d){if(d!==null)return d}function No(d){return d!=null&&!Array.isArray(d)&&typeof d=="object"}function ui(d,b){switch(d){case j.ParameterStructures.auto:return No(b)?Oo(b):[Pn(b)];case j.ParameterStructures.byName:if(!No(b))throw new Error("Received parameters by name but param is not an object literal.");return Oo(b);case j.ParameterStructures.byPosition:return[Pn(b)];default:throw new Error(`Unknown parameter structure ${d.toString()}`)}}function Ao(d,b){let C,A=d.numberOfParams;switch(A){case 0:C=void 0;break;case 1:C=ui(d.parameterStructures,b[0]);break;default:C=[];for(let J=0;J<b.length&&J<A;J++)C.push(Pn(b[J]));if(b.length<A)for(let J=b.length;J<A;J++)C.push(null);break}return C}let Kt={sendNotification:(d,...b)=>{An();let C,A;if(ee.string(d)){C=d;let Z=b[0],ne=0,se=j.ParameterStructures.auto;j.ParameterStructures.is(Z)&&(ne=1,se=Z);let q=b.length,K=q-ne;switch(K){case 0:A=void 0;break;case 1:A=ui(se,b[ne]);break;default:if(se===j.ParameterStructures.byName)throw new Error(`Received ${K} parameters for 'by Name' notification parameter structure.`);A=b.slice(ne,q).map(V=>Pn(V));break}}else{let Z=b;C=d.method,A=Ao(d,Z)}let J={jsonrpc:c,method:C,params:A};return Gl(J),e.write(J).catch(Z=>{throw i.error("Sending notification failed."),Z})},onNotification:(d,b)=>{An();let C;return ee.func(d)?u=d:b&&(ee.string(d)?(C=d,h.set(d,{type:void 0,handler:b})):(C=d.method,h.set(d.method,{type:d,handler:b}))),{dispose:()=>{C!==void 0?h.delete(C):u=void 0}}},onProgress:(d,b,C)=>{if(p.has(b))throw new Error(`Progress handler for token ${b} already registered`);return p.set(b,C),{dispose:()=>{p.delete(b)}}},sendProgress:(d,b,C)=>Kt.sendNotification(In.type,{token:b,value:C}),onUnhandledProgress:Xt.event,sendRequest:(d,...b)=>{An(),Ql();let C,A,J;if(ee.string(d)){C=d;let q=b[0],K=b[b.length-1],V=0,ce=j.ParameterStructures.auto;j.ParameterStructures.is(q)&&(V=1,ce=q);let xe=b.length;ir.CancellationToken.is(K)&&(xe=xe-1,J=K);let Ge=xe-V;switch(Ge){case 0:A=void 0;break;case 1:A=ui(ce,b[V]);break;default:if(ce===j.ParameterStructures.byName)throw new Error(`Received ${Ge} parameters for 'by Name' request parameter structure.`);A=b.slice(V,xe).map(Kl=>Pn(Kl));break}}else{let q=b;C=d.method,A=Ao(d,q);let K=d.numberOfParams;J=ir.CancellationToken.is(q[K])?q[K]:void 0}let Z=r++,ne;J&&(ne=J.onCancellationRequested(()=>{let q=ut.sender.sendCancellation(Kt,Z);return q===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${Z}`),Promise.resolve()):q.catch(()=>{i.log(`Sending cancellation messages for id ${Z} failed`)})}));let se={jsonrpc:c,id:Z,method:C,params:A};return Hl(se),typeof ut.sender.enableCancellation=="function"&&ut.sender.enableCancellation(se),new Promise(async(q,K)=>{let V=Ge=>{q(Ge),ut.sender.cleanup(Z),ne?.dispose()},ce=Ge=>{K(Ge),ut.sender.cleanup(Z),ne?.dispose()},xe={method:C,timerStart:Date.now(),resolve:V,reject:ce};try{k.set(Z,xe),await e.write(se)}catch(Ge){throw k.delete(Z),xe.reject(new j.ResponseError(j.ErrorCodes.MessageWriteError,Ge.message?Ge.message:"Unknown reason")),i.error("Sending request failed."),Ge}})},onRequest:(d,b)=>{An();let C=null;return ar.is(d)?(C=void 0,l=d):ee.string(d)?(C=null,b!==void 0&&(C=d,f.set(d,{handler:b,type:void 0}))):b!==void 0&&(C=d.method,f.set(d.method,{type:d,handler:b})),{dispose:()=>{C!==null&&(C!==void 0?f.delete(C):l=void 0)}}},hasPendingResponse:()=>k.size>0,trace:async(d,b,C)=>{let A=!1,J=Ne.Text;C!==void 0&&(ee.boolean(C)?A=C:(A=C.sendNotification||!1,J=C.traceFormat||Ne.Text)),v=d,E=J,v===U.Off?O=void 0:O=b,A&&!Eo()&&!Yt()&&await Kt.sendNotification(cr.type,{value:U.toString(d)})},onError:Y.event,onClose:ge.event,onUnhandledNotification:Oe.event,onDispose:xo.event,end:()=>{e.end()},dispose:()=>{if(Yt())return;H=ze.Disposed,xo.fire(void 0);let d=new j.ResponseError(j.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let b of k.values())b.reject(d);k=new Map,_=new Map,S=new Set,g=new Jo.LinkedMap,ee.func(e.dispose)&&e.dispose(),ee.func(s.dispose)&&s.dispose()},listen:()=>{An(),Yl(),H=ze.Listening,s.listen(Bl)},inspect:()=>{(0,Go.default)().console.log("inspect")}};return Kt.onNotification(bs.type,d=>{if(v===U.Off||!O)return;let b=v===U.Verbose||v===U.Compact;O.log(d.message,b?d.verbose:void 0)}),Kt.onNotification(In.type,d=>{let b=p.get(d.token);b?b(d.value):Xt.fire(d)}),Kt}I.createMessageConnection=ku});var Es=de(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.ProgressType=y.ProgressToken=y.createMessageConnection=y.NullLogger=y.ConnectionOptions=y.ConnectionStrategy=y.AbstractMessageBuffer=y.WriteableStreamMessageWriter=y.AbstractMessageWriter=y.MessageWriter=y.ReadableStreamMessageReader=y.AbstractMessageReader=y.MessageReader=y.SharedArrayReceiverStrategy=y.SharedArraySenderStrategy=y.CancellationToken=y.CancellationTokenSource=y.Emitter=y.Event=y.Disposable=y.LRUCache=y.Touch=y.LinkedMap=y.ParameterStructures=y.NotificationType9=y.NotificationType8=y.NotificationType7=y.NotificationType6=y.NotificationType5=y.NotificationType4=y.NotificationType3=y.NotificationType2=y.NotificationType1=y.NotificationType0=y.NotificationType=y.ErrorCodes=y.ResponseError=y.RequestType9=y.RequestType8=y.RequestType7=y.RequestType6=y.RequestType5=y.RequestType4=y.RequestType3=y.RequestType2=y.RequestType1=y.RequestType0=y.RequestType=y.Message=y.RAL=void 0;y.MessageStrategy=y.CancellationStrategy=y.CancellationSenderStrategy=y.CancellationReceiverStrategy=y.ConnectionError=y.ConnectionErrors=y.LogTraceNotification=y.SetTraceNotification=y.TraceFormat=y.TraceValues=y.Trace=void 0;var G=Ii();Object.defineProperty(y,"Message",{enumerable:!0,get:function(){return G.Message}});Object.defineProperty(y,"RequestType",{enumerable:!0,get:function(){return G.RequestType}});Object.defineProperty(y,"RequestType0",{enumerable:!0,get:function(){return G.RequestType0}});Object.defineProperty(y,"RequestType1",{enumerable:!0,get:function(){return G.RequestType1}});Object.defineProperty(y,"RequestType2",{enumerable:!0,get:function(){return G.RequestType2}});Object.defineProperty(y,"RequestType3",{enumerable:!0,get:function(){return G.RequestType3}});Object.defineProperty(y,"RequestType4",{enumerable:!0,get:function(){return G.RequestType4}});Object.defineProperty(y,"RequestType5",{enumerable:!0,get:function(){return G.RequestType5}});Object.defineProperty(y,"RequestType6",{enumerable:!0,get:function(){return G.RequestType6}});Object.defineProperty(y,"RequestType7",{enumerable:!0,get:function(){return G.RequestType7}});Object.defineProperty(y,"RequestType8",{enumerable:!0,get:function(){return G.RequestType8}});Object.defineProperty(y,"RequestType9",{enumerable:!0,get:function(){return G.RequestType9}});Object.defineProperty(y,"ResponseError",{enumerable:!0,get:function(){return G.ResponseError}});Object.defineProperty(y,"ErrorCodes",{enumerable:!0,get:function(){return G.ErrorCodes}});Object.defineProperty(y,"NotificationType",{enumerable:!0,get:function(){return G.NotificationType}});Object.defineProperty(y,"NotificationType0",{enumerable:!0,get:function(){return G.NotificationType0}});Object.defineProperty(y,"NotificationType1",{enumerable:!0,get:function(){return G.NotificationType1}});Object.defineProperty(y,"NotificationType2",{enumerable:!0,get:function(){return G.NotificationType2}});Object.defineProperty(y,"NotificationType3",{enumerable:!0,get:function(){return G.NotificationType3}});Object.defineProperty(y,"NotificationType4",{enumerable:!0,get:function(){return G.NotificationType4}});Object.defineProperty(y,"NotificationType5",{enumerable:!0,get:function(){return G.NotificationType5}});Object.defineProperty(y,"NotificationType6",{enumerable:!0,get:function(){return G.NotificationType6}});Object.defineProperty(y,"NotificationType7",{enumerable:!0,get:function(){return G.NotificationType7}});Object.defineProperty(y,"NotificationType8",{enumerable:!0,get:function(){return G.NotificationType8}});Object.defineProperty(y,"NotificationType9",{enumerable:!0,get:function(){return G.NotificationType9}});Object.defineProperty(y,"ParameterStructures",{enumerable:!0,get:function(){return G.ParameterStructures}});var fr=$i();Object.defineProperty(y,"LinkedMap",{enumerable:!0,get:function(){return fr.LinkedMap}});Object.defineProperty(y,"LRUCache",{enumerable:!0,get:function(){return fr.LRUCache}});Object.defineProperty(y,"Touch",{enumerable:!0,get:function(){return fr.Touch}});var Eu=Do();Object.defineProperty(y,"Disposable",{enumerable:!0,get:function(){return Eu.Disposable}});var Ko=nn();Object.defineProperty(y,"Event",{enumerable:!0,get:function(){return Ko.Event}});Object.defineProperty(y,"Emitter",{enumerable:!0,get:function(){return Ko.Emitter}});var ea=ps();Object.defineProperty(y,"CancellationTokenSource",{enumerable:!0,get:function(){return ea.CancellationTokenSource}});Object.defineProperty(y,"CancellationToken",{enumerable:!0,get:function(){return ea.CancellationToken}});var ta=Fo();Object.defineProperty(y,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return ta.SharedArraySenderStrategy}});Object.defineProperty(y,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return ta.SharedArrayReceiverStrategy}});var dr=zo();Object.defineProperty(y,"MessageReader",{enumerable:!0,get:function(){return dr.MessageReader}});Object.defineProperty(y,"AbstractMessageReader",{enumerable:!0,get:function(){return dr.AbstractMessageReader}});Object.defineProperty(y,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return dr.ReadableStreamMessageReader}});var hr=Zo();Object.defineProperty(y,"MessageWriter",{enumerable:!0,get:function(){return hr.MessageWriter}});Object.defineProperty(y,"AbstractMessageWriter",{enumerable:!0,get:function(){return hr.AbstractMessageWriter}});Object.defineProperty(y,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return hr.WriteableStreamMessageWriter}});var Cu=Ho();Object.defineProperty(y,"AbstractMessageBuffer",{enumerable:!0,get:function(){return Cu.AbstractMessageBuffer}});var he=Qo();Object.defineProperty(y,"ConnectionStrategy",{enumerable:!0,get:function(){return he.ConnectionStrategy}});Object.defineProperty(y,"ConnectionOptions",{enumerable:!0,get:function(){return he.ConnectionOptions}});Object.defineProperty(y,"NullLogger",{enumerable:!0,get:function(){return he.NullLogger}});Object.defineProperty(y,"createMessageConnection",{enumerable:!0,get:function(){return he.createMessageConnection}});Object.defineProperty(y,"ProgressToken",{enumerable:!0,get:function(){return he.ProgressToken}});Object.defineProperty(y,"ProgressType",{enumerable:!0,get:function(){return he.ProgressType}});Object.defineProperty(y,"Trace",{enumerable:!0,get:function(){return he.Trace}});Object.defineProperty(y,"TraceValues",{enumerable:!0,get:function(){return he.TraceValues}});Object.defineProperty(y,"TraceFormat",{enumerable:!0,get:function(){return he.TraceFormat}});Object.defineProperty(y,"SetTraceNotification",{enumerable:!0,get:function(){return he.SetTraceNotification}});Object.defineProperty(y,"LogTraceNotification",{enumerable:!0,get:function(){return he.LogTraceNotification}});Object.defineProperty(y,"ConnectionErrors",{enumerable:!0,get:function(){return he.ConnectionErrors}});Object.defineProperty(y,"ConnectionError",{enumerable:!0,get:function(){return he.ConnectionError}});Object.defineProperty(y,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return he.CancellationReceiverStrategy}});Object.defineProperty(y,"CancellationSenderStrategy",{enumerable:!0,get:function(){return he.CancellationSenderStrategy}});Object.defineProperty(y,"CancellationStrategy",{enumerable:!0,get:function(){return he.CancellationStrategy}});Object.defineProperty(y,"MessageStrategy",{enumerable:!0,get:function(){return he.MessageStrategy}});var Ru=pt();y.RAL=Ru.default});var ia=de(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});var na=require("util"),tt=Es(),Cs=class s extends tt.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return s.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new na.TextDecoder(t).decode(e)}asNative(e,t){return t===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,t):Buffer.from(e,0,t)}allocNative(e){return Buffer.allocUnsafe(e)}};Cs.emptyBuffer=Buffer.allocUnsafe(0);var pr=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),tt.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),tt.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),tt.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),tt.Disposable.create(()=>this.stream.off("data",e))}},mr=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),tt.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),tt.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),tt.Disposable.create(()=>this.stream.off("end",e))}write(e,t){return new Promise((n,i)=>{let r=o=>{o==null?n():i(o)};typeof e=="string"?this.stream.write(e,t,r):this.stream.write(e,r)})}end(){this.stream.end()}},sa=Object.freeze({messageBuffer:Object.freeze({create:s=>new Cs(s)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(s,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(s,void 0,0),e.charset))}catch(t){return Promise.reject(t)}}}),decoder:Object.freeze({name:"application/json",decode:(s,e)=>{try{return s instanceof Buffer?Promise.resolve(JSON.parse(s.toString(e.charset))):Promise.resolve(JSON.parse(new na.TextDecoder(e.charset).decode(s)))}catch(t){return Promise.reject(t)}}})}),stream:Object.freeze({asReadableStream:s=>new pr(s),asWritableStream:s=>new mr(s)}),console,timer:Object.freeze({setTimeout(s,e,...t){let n=setTimeout(s,e,...t);return{dispose:()=>clearTimeout(n)}},setImmediate(s,...e){let t=setImmediate(s,...e);return{dispose:()=>clearImmediate(t)}},setInterval(s,e,...t){let n=setInterval(s,e,...t);return{dispose:()=>clearInterval(n)}}})});function gr(){return sa}(function(s){function e(){tt.RAL.install(sa)}s.install=e})(gr||(gr={}));yr.default=gr});var xr=de(B=>{"use strict";var Tu=B&&B.__createBinding||(Object.create?function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}:function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]}),Ou=B&&B.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Tu(e,s,t)};Object.defineProperty(B,"__esModule",{value:!0});B.createMessageConnection=B.createServerSocketTransport=B.createClientSocketTransport=B.createServerPipeTransport=B.createClientPipeTransport=B.generateRandomPipeName=B.StreamMessageWriter=B.StreamMessageReader=B.SocketMessageWriter=B.SocketMessageReader=B.PortMessageWriter=B.PortMessageReader=B.IPCMessageWriter=B.IPCMessageReader=void 0;var cn=ia();cn.default.install();var ra=require("path"),Nu=require("os"),Au=require("crypto"),Os=require("net"),Ae=Es();Ou(Es(),B);var wr=class extends Ae.AbstractMessageReader{constructor(e){super(),this.process=e;let t=this.process;t.on("error",n=>this.fireError(n)),t.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),Ae.Disposable.create(()=>this.process.off("message",e))}};B.IPCMessageReader=wr;var br=class extends Ae.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let t=this.process;t.on("error",n=>this.fireError(n)),t.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,t=>{t?(this.errorCount++,this.handleError(t,e)):this.errorCount=0}),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};B.IPCMessageWriter=br;var vr=class extends Ae.AbstractMessageReader{constructor(e){super(),this.onData=new Ae.Emitter,e.on("close",()=>this.fireClose),e.on("error",t=>this.fireError(t)),e.on("message",t=>{this.onData.fire(t)})}listen(e){return this.onData.event(e)}};B.PortMessageReader=vr;var _r=class extends Ae.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",t=>this.fireError(t))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};B.PortMessageWriter=_r;var Tt=class extends Ae.ReadableStreamMessageReader{constructor(e,t="utf-8"){super((0,cn.default)().stream.asReadableStream(e),t)}};B.SocketMessageReader=Tt;var Ot=class extends Ae.WriteableStreamMessageWriter{constructor(e,t){super((0,cn.default)().stream.asWritableStream(e),t),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};B.SocketMessageWriter=Ot;var Rs=class extends Ae.ReadableStreamMessageReader{constructor(e,t){super((0,cn.default)().stream.asReadableStream(e),t)}};B.StreamMessageReader=Rs;var Ts=class extends Ae.WriteableStreamMessageWriter{constructor(e,t){super((0,cn.default)().stream.asWritableStream(e),t)}};B.StreamMessageWriter=Ts;var oa=process.env.XDG_RUNTIME_DIR,Pu=new Map([["linux",107],["darwin",103]]);function Mu(){let s=(0,Au.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${s}-sock`;let e;oa?e=ra.join(oa,`vscode-ipc-${s}.sock`):e=ra.join(Nu.tmpdir(),`vscode-${s}.sock`);let t=Pu.get(process.platform);return t!==void 0&&e.length>t&&(0,cn.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${t} characters.`),e}B.generateRandomPipeName=Mu;function ju(s,e="utf-8"){let t,n=new Promise((i,r)=>{t=i});return new Promise((i,r)=>{let o=(0,Os.createServer)(a=>{o.close(),t([new Tt(a,e),new Ot(a,e)])});o.on("error",r),o.listen(s,()=>{o.removeListener("error",r),i({onConnected:()=>n})})})}B.createClientPipeTransport=ju;function Lu(s,e="utf-8"){let t=(0,Os.createConnection)(s);return[new Tt(t,e),new Ot(t,e)]}B.createServerPipeTransport=Lu;function Iu(s,e="utf-8"){let t,n=new Promise((i,r)=>{t=i});return new Promise((i,r)=>{let o=(0,Os.createServer)(a=>{o.close(),t([new Tt(a,e),new Ot(a,e)])});o.on("error",r),o.listen(s,"127.0.0.1",()=>{o.removeListener("error",r),i({onConnected:()=>n})})})}B.createClientSocketTransport=Iu;function Du(s,e="utf-8"){let t=(0,Os.createConnection)(s,"127.0.0.1");return[new Tt(t,e),new Ot(t,e)]}B.createServerSocketTransport=Du;function $u(s){let e=s;return e.read!==void 0&&e.addListener!==void 0}function Fu(s){let e=s;return e.write!==void 0&&e.addListener!==void 0}function Wu(s,e,t,n){t||(t=Ae.NullLogger);let i=$u(s)?new Rs(s):s,r=Fu(e)?new Ts(e):e;return Ae.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Ae.createMessageConnection)(i,r,t,n)}B.createMessageConnection=Wu});var ca=de((Op,aa)=>{"use strict";aa.exports=xr()});var El=dt(require("child_process")),ct=dt(require("fs")),Cl=dt(require("path")),Rl=dt(xr()),ai=dt(ca());var W={};ru(W,{BRAND:()=>hf,DIRTY:()=>Nt,EMPTY_PATH:()=>Uu,INVALID:()=>M,NEVER:()=>Yf,OK:()=>be,ParseStatus:()=>pe,Schema:()=>$,ZodAny:()=>bt,ZodArray:()=>rt,ZodBigInt:()=>Pt,ZodBoolean:()=>Mt,ZodBranded:()=>Wn,ZodCatch:()=>Ut,ZodDate:()=>jt,ZodDefault:()=>qt,ZodDiscriminatedUnion:()=>Ps,ZodEffects:()=>De,ZodEnum:()=>zt,ZodError:()=>Ce,ZodFirstPartyTypeKind:()=>L,ZodFunction:()=>js,ZodIntersection:()=>$t,ZodIssueCode:()=>x,ZodLazy:()=>Ft,ZodLiteral:()=>Wt,ZodMap:()=>pn,ZodNaN:()=>gn,ZodNativeEnum:()=>Bt,ZodNever:()=>Be,ZodNull:()=>It,ZodNullable:()=>Ye,ZodNumber:()=>At,ZodObject:()=>Re,ZodOptional:()=>Le,ZodParsedType:()=>T,ZodPipeline:()=>zn,ZodPromise:()=>vt,ZodReadonly:()=>Vt,ZodRecord:()=>Ms,ZodSchema:()=>$,ZodSet:()=>mn,ZodString:()=>wt,ZodSymbol:()=>dn,ZodTransformer:()=>De,ZodTuple:()=>Xe,ZodType:()=>$,ZodUndefined:()=>Lt,ZodUnion:()=>Dt,ZodUnknown:()=>it,ZodVoid:()=>hn,addIssueToContext:()=>R,any:()=>xf,array:()=>Cf,bigint:()=>yf,boolean:()=>ba,coerce:()=>Xf,custom:()=>ga,date:()=>wf,datetimeRegex:()=>pa,defaultErrorMap:()=>nt,discriminatedUnion:()=>Nf,effect:()=>Bf,enum:()=>Ff,function:()=>If,getErrorMap:()=>ln,getParsedType:()=>Je,instanceof:()=>mf,intersection:()=>Af,isAborted:()=>Ns,isAsync:()=>un,isDirty:()=>As,isValid:()=>yt,late:()=>pf,lazy:()=>Df,literal:()=>$f,makeIssue:()=>Fn,map:()=>jf,nan:()=>gf,nativeEnum:()=>Wf,never:()=>kf,null:()=>_f,nullable:()=>Uf,number:()=>wa,object:()=>Rf,objectUtil:()=>Sr,oboolean:()=>Jf,onumber:()=>Gf,optional:()=>qf,ostring:()=>Hf,pipeline:()=>Zf,preprocess:()=>Vf,promise:()=>zf,quotelessJson:()=>zu,record:()=>Mf,set:()=>Lf,setErrorMap:()=>qu,strictObject:()=>Tf,string:()=>ya,symbol:()=>bf,transformer:()=>Bf,tuple:()=>Pf,undefined:()=>vf,union:()=>Of,unknown:()=>Sf,util:()=>z,void:()=>Ef});var z;(function(s){s.assertEqual=i=>{};function e(i){}s.assertIs=e;function t(i){throw new Error}s.assertNever=t,s.arrayToEnum=i=>{let r={};for(let o of i)r[o]=o;return r},s.getValidEnumValues=i=>{let r=s.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of r)o[a]=i[a];return s.objectValues(o)},s.objectValues=i=>s.objectKeys(i).map(function(r){return i[r]}),s.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let r=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&r.push(o);return r},s.find=(i,r)=>{for(let o of i)if(r(o))return o},s.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,r=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(r)}s.joinValues=n,s.jsonStringifyReplacer=(i,r)=>typeof r=="bigint"?r.toString():r})(z||(z={}));var Sr;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Sr||(Sr={}));var T=z.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Je=s=>{switch(typeof s){case"undefined":return T.undefined;case"string":return T.string;case"number":return Number.isNaN(s)?T.nan:T.number;case"boolean":return T.boolean;case"function":return T.function;case"bigint":return T.bigint;case"symbol":return T.symbol;case"object":return Array.isArray(s)?T.array:s===null?T.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?T.promise:typeof Map<"u"&&s instanceof Map?T.map:typeof Set<"u"&&s instanceof Set?T.set:typeof Date<"u"&&s instanceof Date?T.date:T.object;default:return T.unknown}};var x=z.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),zu=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:"),Ce=class s extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(r){return r.message},n={_errors:[]},i=r=>{for(let o of r.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let a=n,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return i(this),n}static assert(e){if(!(e instanceof s))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,z.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Ce.create=s=>new Ce(s);var Bu=(s,e)=>{let t;switch(s.code){case x.invalid_type:s.received===T.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case x.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,z.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:t=`Unrecognized key(s) in object: ${z.joinValues(s.keys,", ")}`;break;case x.invalid_union:t="Invalid input";break;case x.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${z.joinValues(s.options)}`;break;case x.invalid_enum_value:t=`Invalid enum value. Expected ${z.joinValues(s.options)}, received '${s.received}'`;break;case x.invalid_arguments:t="Invalid function arguments";break;case x.invalid_return_type:t="Invalid function return type";break;case x.invalid_date:t="Invalid date";break;case x.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:z.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case x.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case x.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case x.custom:t="Invalid input";break;case x.invalid_intersection_types:t="Intersection results could not be merged";break;case x.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case x.not_finite:t="Number must be finite";break;default:t=e.defaultError,z.assertNever(s)}return{message:t}},nt=Bu;var la=nt;function qu(s){la=s}function ln(){return la}var Fn=s=>{let{data:e,path:t,errorMaps:n,issueData:i}=s,r=[...t,...i.path||[]],o={...i,path:r};if(i.message!==void 0)return{...i,path:r,message:i.message};let a="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)a=l(o,{data:e,defaultError:a}).message;return{...i,path:r,message:a}},Uu=[];function R(s,e){let t=ln(),n=Fn({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===nt?void 0:nt].filter(i=>!!i)});s.common.issues.push(n)}var pe=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return M;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t){let r=await i.key,o=await i.value;n.push({key:r,value:o})}return s.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:r,value:o}=i;if(r.status==="aborted"||o.status==="aborted")return M;r.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[r.value]=o.value)}return{status:e.value,value:n}}},M=Object.freeze({status:"aborted"}),Nt=s=>({status:"dirty",value:s}),be=s=>({status:"valid",value:s}),Ns=s=>s.status==="aborted",As=s=>s.status==="dirty",yt=s=>s.status==="valid",un=s=>typeof Promise<"u"&&s instanceof Promise;var N;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(N||(N={}));var Ie=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ua=(s,e)=>{if(yt(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Ce(s.common.issues);return this._error=t,this._error}}};function D(s){if(!s)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=s;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,a)=>{let{message:c}=s;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??t??a.defaultError}},description:i}}var $=class{get description(){return this._def.description}_getType(e){return Je(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Je(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pe,ctx:{common:e.parent.common,data:e.data,parsedType:Je(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(un(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Je(e)},i=this._parseSync({data:e,path:n.path,parent:n});return ua(n,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Je(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return yt(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>yt(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Je(e)},i=this._parse({data:e,path:n.path,parent:n}),r=await(un(i)?i:Promise.resolve(i));return ua(n,r)}refine(e,t){let n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,r)=>{let o=e(i),a=()=>r.addIssue({code:x.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new De({schema:this,typeName:L.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Le.create(this,this._def)}nullable(){return Ye.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rt.create(this)}promise(){return vt.create(this,this._def)}or(e){return Dt.create([this,e],this._def)}and(e){return $t.create(this,e,this._def)}transform(e){return new De({...D(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new qt({...D(this._def),innerType:this,defaultValue:t,typeName:L.ZodDefault})}brand(){return new Wn({typeName:L.ZodBranded,type:this,...D(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Ut({...D(this._def),innerType:this,catchValue:t,typeName:L.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return zn.create(this,e)}readonly(){return Vt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Vu=/^c[^\s-]{8,}$/i,Zu=/^[0-9a-z]+$/,Hu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Gu=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ju=/^[a-z0-9_-]{21}$/i,Xu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yu=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Qu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ku="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",kr,ef=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,nf=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,sf=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rf=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,of=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,da="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",af=new RegExp(`^${da}$`);function ha(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);let t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function cf(s){return new RegExp(`^${ha(s)}$`)}function pa(s){let e=`${da}T${ha(s)}`,t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function lf(s,e){return!!((e==="v4"||!e)&&ef.test(s)||(e==="v6"||!e)&&nf.test(s))}function uf(s,e){if(!Xu.test(s))return!1;try{let[t]=s.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function ff(s,e){return!!((e==="v4"||!e)&&tf.test(s)||(e==="v6"||!e)&&sf.test(s))}var wt=class s extends ${_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==T.string){let r=this._getOrReturnCtx(e);return R(r,{code:x.invalid_type,expected:T.string,received:r.parsedType}),M}let n=new pe,i;for(let r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),R(i,{code:x.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")e.data.length>r.value&&(i=this._getOrReturnCtx(e,i),R(i,{code:x.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){let o=e.data.length>r.value,a=e.data.length<r.value;(o||a)&&(i=this._getOrReturnCtx(e,i),o?R(i,{code:x.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&R(i,{code:x.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")Qu.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"email",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")kr||(kr=new RegExp(Ku,"u")),kr.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"emoji",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")Gu.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"uuid",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")Ju.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"nanoid",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")Vu.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"cuid",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")Zu.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"cuid2",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")Hu.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"ulid",code:x.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),R(i,{validation:"url",code:x.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"regex",code:x.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(e,i),R(i,{code:x.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(i=this._getOrReturnCtx(e,i),R(i,{code:x.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),R(i,{code:x.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?pa(r).test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{code:x.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?af.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{code:x.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?cf(r).test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{code:x.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?Yu.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"duration",code:x.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?lf(e.data,r.version)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"ip",code:x.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?uf(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"jwt",code:x.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?ff(e.data,r.version)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"cidr",code:x.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?rf.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"base64",code:x.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?of.test(e.data)||(i=this._getOrReturnCtx(e,i),R(i,{validation:"base64url",code:x.invalid_string,message:r.message}),n.dirty()):z.assertNever(r);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:x.invalid_string,...N.errToObj(n)})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};wt.create=s=>new wt({checks:[],typeName:L.ZodString,coerce:s?.coerce??!1,...D(s)});function df(s,e){let t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,r=Number.parseInt(s.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return r%o/10**i}var At=class s extends ${constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==T.number){let r=this._getOrReturnCtx(e);return R(r,{code:x.invalid_type,expected:T.number,received:r.parsedType}),M}let n,i=new pe;for(let r of this._def.checks)r.kind==="int"?z.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{code:x.invalid_type,expected:"integer",received:"float",message:r.message}),i.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),R(n,{code:x.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),R(n,{code:x.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?df(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),R(n,{code:x.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{code:x.not_finite,message:r.message}),i.dirty()):z.assertNever(r);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,n,i){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:N.toString(i)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&z.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};At.create=s=>new At({checks:[],typeName:L.ZodNumber,coerce:s?.coerce||!1,...D(s)});var Pt=class s extends ${constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==T.bigint)return this._getInvalidInput(e);let n,i=new pe;for(let r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),R(n,{code:x.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),R(n,{code:x.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),R(n,{code:x.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):z.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return R(t,{code:x.invalid_type,expected:T.bigint,received:t.parsedType}),M}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,n,i){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:N.toString(i)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Pt.create=s=>new Pt({checks:[],typeName:L.ZodBigInt,coerce:s?.coerce??!1,...D(s)});var Mt=class extends ${_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==T.boolean){let n=this._getOrReturnCtx(e);return R(n,{code:x.invalid_type,expected:T.boolean,received:n.parsedType}),M}return be(e.data)}};Mt.create=s=>new Mt({typeName:L.ZodBoolean,coerce:s?.coerce||!1,...D(s)});var jt=class s extends ${_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==T.date){let r=this._getOrReturnCtx(e);return R(r,{code:x.invalid_type,expected:T.date,received:r.parsedType}),M}if(Number.isNaN(e.data.getTime())){let r=this._getOrReturnCtx(e);return R(r,{code:x.invalid_date}),M}let n=new pe,i;for(let r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),R(i,{code:x.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(i=this._getOrReturnCtx(e,i),R(i,{code:x.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):z.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};jt.create=s=>new jt({checks:[],coerce:s?.coerce||!1,typeName:L.ZodDate,...D(s)});var dn=class extends ${_parse(e){if(this._getType(e)!==T.symbol){let n=this._getOrReturnCtx(e);return R(n,{code:x.invalid_type,expected:T.symbol,received:n.parsedType}),M}return be(e.data)}};dn.create=s=>new dn({typeName:L.ZodSymbol,...D(s)});var Lt=class extends ${_parse(e){if(this._getType(e)!==T.undefined){let n=this._getOrReturnCtx(e);return R(n,{code:x.invalid_type,expected:T.undefined,received:n.parsedType}),M}return be(e.data)}};Lt.create=s=>new Lt({typeName:L.ZodUndefined,...D(s)});var It=class extends ${_parse(e){if(this._getType(e)!==T.null){let n=this._getOrReturnCtx(e);return R(n,{code:x.invalid_type,expected:T.null,received:n.parsedType}),M}return be(e.data)}};It.create=s=>new It({typeName:L.ZodNull,...D(s)});var bt=class extends ${constructor(){super(...arguments),this._any=!0}_parse(e){return be(e.data)}};bt.create=s=>new bt({typeName:L.ZodAny,...D(s)});var it=class extends ${constructor(){super(...arguments),this._unknown=!0}_parse(e){return be(e.data)}};it.create=s=>new it({typeName:L.ZodUnknown,...D(s)});var Be=class extends ${_parse(e){let t=this._getOrReturnCtx(e);return R(t,{code:x.invalid_type,expected:T.never,received:t.parsedType}),M}};Be.create=s=>new Be({typeName:L.ZodNever,...D(s)});var hn=class extends ${_parse(e){if(this._getType(e)!==T.undefined){let n=this._getOrReturnCtx(e);return R(n,{code:x.invalid_type,expected:T.void,received:n.parsedType}),M}return be(e.data)}};hn.create=s=>new hn({typeName:L.ZodVoid,...D(s)});var rt=class s extends ${_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==T.array)return R(t,{code:x.invalid_type,expected:T.array,received:t.parsedType}),M;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(R(t,{code:o?x.too_big:x.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(R(t,{code:x.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(R(t,{code:x.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>i.type._parseAsync(new Ie(t,o,t.path,a)))).then(o=>pe.mergeArray(n,o));let r=[...t.data].map((o,a)=>i.type._parseSync(new Ie(t,o,t.path,a)));return pe.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new s({...this._def,minLength:{value:e,message:N.toString(t)}})}max(e,t){return new s({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new s({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}};rt.create=(s,e)=>new rt({type:s,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...D(e)});function fn(s){if(s instanceof Re){let e={};for(let t in s.shape){let n=s.shape[t];e[t]=Le.create(fn(n))}return new Re({...s._def,shape:()=>e})}else return s instanceof rt?new rt({...s._def,type:fn(s.element)}):s instanceof Le?Le.create(fn(s.unwrap())):s instanceof Ye?Ye.create(fn(s.unwrap())):s instanceof Xe?Xe.create(s.items.map(e=>fn(e))):s}var Re=class s extends ${constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=z.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==T.object){let l=this._getOrReturnCtx(e);return R(l,{code:x.invalid_type,expected:T.object,received:l.parsedType}),M}let{status:n,ctx:i}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Be&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||a.push(l);let c=[];for(let l of o){let f=r[l],u=i.data[l];c.push({key:{status:"valid",value:l},value:f._parse(new Ie(i,u,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Be){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of a)c.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(l==="strict")a.length>0&&(R(i,{code:x.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let f of a){let u=i.data[f];c.push({key:{status:"valid",value:f},value:l._parse(new Ie(i,u,i.path,f)),alwaysSet:f in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of c){let u=await f.key,h=await f.value;l.push({key:u,value:h,alwaysSet:f.alwaysSet})}return l}).then(l=>pe.mergeObjectSync(n,l)):pe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new s({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let i=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:N.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(e){return new s({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new s({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:L.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new s({...this._def,catchall:e})}pick(e){let t={};for(let n of z.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new s({...this._def,shape:()=>t})}omit(e){let t={};for(let n of z.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new s({...this._def,shape:()=>t})}deepPartial(){return fn(this)}partial(e){let t={};for(let n of z.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}return new s({...this._def,shape:()=>t})}required(e){let t={};for(let n of z.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof Le;)r=r._def.innerType;t[n]=r}return new s({...this._def,shape:()=>t})}keyof(){return ma(z.objectKeys(this.shape))}};Re.create=(s,e)=>new Re({shape:()=>s,unknownKeys:"strip",catchall:Be.create(),typeName:L.ZodObject,...D(e)});Re.strictCreate=(s,e)=>new Re({shape:()=>s,unknownKeys:"strict",catchall:Be.create(),typeName:L.ZodObject,...D(e)});Re.lazycreate=(s,e)=>new Re({shape:s,unknownKeys:"strip",catchall:Be.create(),typeName:L.ZodObject,...D(e)});var Dt=class extends ${_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function i(r){for(let a of r)if(a.result.status==="valid")return a.result;for(let a of r)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=r.map(a=>new Ce(a.ctx.common.issues));return R(t,{code:x.invalid_union,unionErrors:o}),M}if(t.common.async)return Promise.all(n.map(async r=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let r,o=[];for(let c of n){let l={...t,common:{...t.common,issues:[]},parent:null},f=c._parseSync({data:t.data,path:t.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!r&&(r={result:f,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;let a=o.map(c=>new Ce(c));return R(t,{code:x.invalid_union,unionErrors:a}),M}}get options(){return this._def.options}};Dt.create=(s,e)=>new Dt({options:s,typeName:L.ZodUnion,...D(e)});var st=s=>s instanceof Ft?st(s.schema):s instanceof De?st(s.innerType()):s instanceof Wt?[s.value]:s instanceof zt?s.options:s instanceof Bt?z.objectValues(s.enum):s instanceof qt?st(s._def.innerType):s instanceof Lt?[void 0]:s instanceof It?[null]:s instanceof Le?[void 0,...st(s.unwrap())]:s instanceof Ye?[null,...st(s.unwrap())]:s instanceof Wn||s instanceof Vt?st(s.unwrap()):s instanceof Ut?st(s._def.innerType):[],Ps=class s extends ${_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.object)return R(t,{code:x.invalid_type,expected:T.object,received:t.parsedType}),M;let n=this.discriminator,i=t.data[n],r=this.optionsMap.get(i);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(R(t,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let r of t){let o=st(r.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,r)}}return new s({typeName:L.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...D(n)})}};function Er(s,e){let t=Je(s),n=Je(e);if(s===e)return{valid:!0,data:s};if(t===T.object&&n===T.object){let i=z.objectKeys(e),r=z.objectKeys(s).filter(a=>i.indexOf(a)!==-1),o={...s,...e};for(let a of r){let c=Er(s[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(t===T.array&&n===T.array){if(s.length!==e.length)return{valid:!1};let i=[];for(let r=0;r<s.length;r++){let o=s[r],a=e[r],c=Er(o,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return t===T.date&&n===T.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}var $t=class extends ${_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(r,o)=>{if(Ns(r)||Ns(o))return M;let a=Er(r.value,o.value);return a.valid?((As(r)||As(o))&&t.dirty(),{status:t.value,value:a.data}):(R(n,{code:x.invalid_intersection_types}),M)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([r,o])=>i(r,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};$t.create=(s,e,t)=>new $t({left:s,right:e,typeName:L.ZodIntersection,...D(t)});var Xe=class s extends ${_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.array)return R(n,{code:x.invalid_type,expected:T.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return R(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(R(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let r=[...n.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Ie(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(r).then(o=>pe.mergeArray(t,o)):pe.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new s({...this._def,rest:e})}};Xe.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xe({items:s,typeName:L.ZodTuple,rest:null,...D(e)})};var Ms=class s extends ${get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.object)return R(n,{code:x.invalid_type,expected:T.object,received:n.parsedType}),M;let i=[],r=this._def.keyType,o=this._def.valueType;for(let a in n.data)i.push({key:r._parse(new Ie(n,a,n.path,a)),value:o._parse(new Ie(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?pe.mergeObjectAsync(t,i):pe.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof $?new s({keyType:e,valueType:t,typeName:L.ZodRecord,...D(n)}):new s({keyType:wt.create(),valueType:e,typeName:L.ZodRecord,...D(t)})}},pn=class extends ${get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.map)return R(n,{code:x.invalid_type,expected:T.map,received:n.parsedType}),M;let i=this._def.keyType,r=this._def.valueType,o=[...n.data.entries()].map(([a,c],l)=>({key:i._parse(new Ie(n,a,n.path,[l,"key"])),value:r._parse(new Ie(n,c,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,f=await c.value;if(l.status==="aborted"||f.status==="aborted")return M;(l.status==="dirty"||f.status==="dirty")&&t.dirty(),a.set(l.value,f.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let c of o){let l=c.key,f=c.value;if(l.status==="aborted"||f.status==="aborted")return M;(l.status==="dirty"||f.status==="dirty")&&t.dirty(),a.set(l.value,f.value)}return{status:t.value,value:a}}}};pn.create=(s,e,t)=>new pn({valueType:e,keyType:s,typeName:L.ZodMap,...D(t)});var mn=class s extends ${_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.set)return R(n,{code:x.invalid_type,expected:T.set,received:n.parsedType}),M;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(R(n,{code:x.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(R(n,{code:x.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let r=this._def.valueType;function o(c){let l=new Set;for(let f of c){if(f.status==="aborted")return M;f.status==="dirty"&&t.dirty(),l.add(f.value)}return{status:t.value,value:l}}let a=[...n.data.values()].map((c,l)=>r._parse(new Ie(n,c,n.path,l)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,t){return new s({...this._def,minSize:{value:e,message:N.toString(t)}})}max(e,t){return new s({...this._def,maxSize:{value:e,message:N.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};mn.create=(s,e)=>new mn({valueType:s,minSize:null,maxSize:null,typeName:L.ZodSet,...D(e)});var js=class s extends ${constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.function)return R(t,{code:x.invalid_type,expected:T.function,received:t.parsedType}),M;function n(a,c){return Fn({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ln(),nt].filter(l=>!!l),issueData:{code:x.invalid_arguments,argumentsError:c}})}function i(a,c){return Fn({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ln(),nt].filter(l=>!!l),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let r={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof vt){let a=this;return be(async function(...c){let l=new Ce([]),f=await a._def.args.parseAsync(c,r).catch(p=>{throw l.addIssue(n(c,p)),l}),u=await Reflect.apply(o,this,f);return await a._def.returns._def.type.parseAsync(u,r).catch(p=>{throw l.addIssue(i(u,p)),l})})}else{let a=this;return be(function(...c){let l=a._def.args.safeParse(c,r);if(!l.success)throw new Ce([n(c,l.error)]);let f=Reflect.apply(o,this,l.data),u=a._def.returns.safeParse(f,r);if(!u.success)throw new Ce([i(f,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new s({...this._def,args:Xe.create(e).rest(it.create())})}returns(e){return new s({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new s({args:e||Xe.create([]).rest(it.create()),returns:t||it.create(),typeName:L.ZodFunction,...D(n)})}},Ft=class extends ${get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ft.create=(s,e)=>new Ft({getter:s,typeName:L.ZodLazy,...D(e)});var Wt=class extends ${_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return R(t,{received:t.data,code:x.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:e.data}}get value(){return this._def.value}};Wt.create=(s,e)=>new Wt({value:s,typeName:L.ZodLiteral,...D(e)});function ma(s,e){return new zt({values:s,typeName:L.ZodEnum,...D(e)})}var zt=class s extends ${_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return R(t,{expected:z.joinValues(n),received:t.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return R(t,{received:t.data,code:x.invalid_enum_value,options:n}),M}return be(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return s.create(e,{...this._def,...t})}exclude(e,t=this._def){return s.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};zt.create=ma;var Bt=class extends ${_parse(e){let t=z.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==T.string&&n.parsedType!==T.number){let i=z.objectValues(t);return R(n,{expected:z.joinValues(i),received:n.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(z.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=z.objectValues(t);return R(n,{received:n.data,code:x.invalid_enum_value,options:i}),M}return be(e.data)}get enum(){return this._def.values}};Bt.create=(s,e)=>new Bt({values:s,typeName:L.ZodNativeEnum,...D(e)});var vt=class extends ${unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.promise&&t.common.async===!1)return R(t,{code:x.invalid_type,expected:T.promise,received:t.parsedType}),M;let n=t.parsedType===T.promise?t.data:Promise.resolve(t.data);return be(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};vt.create=(s,e)=>new vt({type:s,typeName:L.ZodPromise,...D(e)});var De=class extends ${innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,r={addIssue:o=>{R(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),i.type==="preprocess"){let o=i.transform(n.data,r);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return M;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?Nt(c.value):t.value==="dirty"?Nt(c.value):c});{if(t.value==="aborted")return M;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?M:a.status==="dirty"?Nt(a.value):t.value==="dirty"?Nt(a.value):a}}if(i.type==="refinement"){let o=a=>{let c=i.refinement(a,r);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?M:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?M:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(o))return M;let a=i.transform(o.value,r);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>yt(o)?Promise.resolve(i.transform(o.value,r)).then(a=>({status:t.value,value:a})):M);z.assertNever(i)}};De.create=(s,e,t)=>new De({schema:s,typeName:L.ZodEffects,effect:e,...D(t)});De.createWithPreprocess=(s,e,t)=>new De({schema:e,effect:{type:"preprocess",transform:s},typeName:L.ZodEffects,...D(t)});var Le=class extends ${_parse(e){return this._getType(e)===T.undefined?be(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Le.create=(s,e)=>new Le({innerType:s,typeName:L.ZodOptional,...D(e)});var Ye=class extends ${_parse(e){return this._getType(e)===T.null?be(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ye.create=(s,e)=>new Ye({innerType:s,typeName:L.ZodNullable,...D(e)});var qt=class extends ${_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===T.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};qt.create=(s,e)=>new qt({innerType:s,typeName:L.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...D(e)});var Ut=class extends ${_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return un(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ut.create=(s,e)=>new Ut({innerType:s,typeName:L.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...D(e)});var gn=class extends ${_parse(e){if(this._getType(e)!==T.nan){let n=this._getOrReturnCtx(e);return R(n,{code:x.invalid_type,expected:T.nan,received:n.parsedType}),M}return{status:"valid",value:e.data}}};gn.create=s=>new gn({typeName:L.ZodNaN,...D(s)});var hf=Symbol("zod_brand"),Wn=class extends ${_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},zn=class s extends ${_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let r=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?M:r.status==="dirty"?(t.dirty(),Nt(r.value)):this._def.out._parseAsync({data:r.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?M:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new s({in:e,out:t,typeName:L.ZodPipeline})}},Vt=class extends ${_parse(e){let t=this._def.innerType._parse(e),n=i=>(yt(i)&&(i.value=Object.freeze(i.value)),i);return un(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};Vt.create=(s,e)=>new Vt({innerType:s,typeName:L.ZodReadonly,...D(e)});function fa(s,e){let t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function ga(s,e={},t){return s?bt.create().superRefine((n,i)=>{let r=s(n);if(r instanceof Promise)return r.then(o=>{if(!o){let a=fa(e,n),c=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!r){let o=fa(e,n),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):bt.create()}var pf={object:Re.lazycreate},L;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(L||(L={}));var mf=(s,e={message:`Input not instance of ${s.name}`})=>ga(t=>t instanceof s,e),ya=wt.create,wa=At.create,gf=gn.create,yf=Pt.create,ba=Mt.create,wf=jt.create,bf=dn.create,vf=Lt.create,_f=It.create,xf=bt.create,Sf=it.create,kf=Be.create,Ef=hn.create,Cf=rt.create,Rf=Re.create,Tf=Re.strictCreate,Of=Dt.create,Nf=Ps.create,Af=$t.create,Pf=Xe.create,Mf=Ms.create,jf=pn.create,Lf=mn.create,If=js.create,Df=Ft.create,$f=Wt.create,Ff=zt.create,Wf=Bt.create,zf=vt.create,Bf=De.create,qf=Le.create,Uf=Ye.create,Vf=De.createWithPreprocess,Zf=zn.create,Hf=()=>ya().optional(),Gf=()=>wa().optional(),Jf=()=>ba().optional(),Xf={string:s=>wt.create({...s,coerce:!0}),number:s=>At.create({...s,coerce:!0}),boolean:s=>Mt.create({...s,coerce:!0}),bigint:s=>Pt.create({...s,coerce:!0}),date:s=>jt.create({...s,coerce:!0})};var Yf=M;var Tl=require("node:util"),te=require("node:path");var Bn=class{diff(e,t,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let r=this.castInput(e,n),o=this.castInput(t,n),a=this.removeEmpty(this.tokenize(r,n)),c=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,c,n,i)}diffWithOptionsObj(e,t,n,i){var r;let o=_=>{if(_=this.postProcess(_,n),i){setTimeout(function(){i(_)},0);return}else return _},a=t.length,c=e.length,l=1,f=a+c;n.maxEditLength!=null&&(f=Math.min(f,n.maxEditLength));let u=(r=n.timeout)!==null&&r!==void 0?r:1/0,h=Date.now()+u,p=[{oldPos:-1,lastComponent:void 0}],w=this.extractCommon(p[0],t,e,0,n);if(p[0].oldPos+1>=c&&w+1>=a)return o(this.buildValues(p[0].lastComponent,t,e));let g=-1/0,k=1/0,S=()=>{for(let _=Math.max(g,-l);_<=Math.min(k,l);_+=2){let v,E=p[_-1],O=p[_+1];E&&(p[_-1]=void 0);let H=!1;if(O){let ge=O.oldPos-_;H=O&&0<=ge&&ge<a}let Y=E&&E.oldPos+1<c;if(!H&&!Y){p[_]=void 0;continue}if(!Y||H&&E.oldPos<O.oldPos?v=this.addToPath(O,!0,!1,0,n):v=this.addToPath(E,!1,!0,1,n),w=this.extractCommon(v,t,e,_,n),v.oldPos+1>=c&&w+1>=a)return o(this.buildValues(v.lastComponent,t,e))||!0;p[_]=v,v.oldPos+1>=c&&(k=Math.min(k,_-1)),w+1>=a&&(g=Math.max(g,_+1))}l++};if(i)(function _(){setTimeout(function(){if(l>f||Date.now()>h)return i(void 0);S()||_()},0)})();else for(;l<=f&&Date.now()<=h;){let _=S();if(_)return _}}addToPath(e,t,n,i,r){let o=e.lastComponent;return o&&!r.oneChangePerToken&&o.added===t&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:t,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:o}}}extractCommon(e,t,n,i,r){let o=t.length,a=n.length,c=e.oldPos,l=c-i,f=0;for(;l+1<o&&c+1<a&&this.equals(n[c+1],t[l+1],r);)l++,c++,f++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return f&&!r.oneChangePerToken&&(e.lastComponent={count:f,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=c,l}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let i=[],r;for(;e;)i.push(e),r=e.previousComponent,delete e.previousComponent,e=r;i.reverse();let o=i.length,a=0,c=0,l=0;for(;a<o;a++){let f=i[a];if(f.removed)f.value=this.join(n.slice(l,l+f.count)),l+=f.count;else{if(!f.added&&this.useLongestToken){let u=t.slice(c,c+f.count);u=u.map(function(h,p){let w=n[l+p];return w.length>h.length?w:h}),f.value=this.join(u)}else f.value=this.join(t.slice(c,c+f.count));c+=f.count,f.added||(l+=f.count)}}return i}};function va(s){return s.includes(`\r
33
+ `)&&!s.startsWith(`
34
+ `)&&!s.match(/[^\r]\n/)}function _a(s){return!s.includes(`\r
35
+ `)&&s.includes(`
36
+ `)}var Cr=class extends Bn{constructor(){super(...arguments),this.tokenize=Kf}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
37
37
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
38
38
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
39
39
  `)&&(e=e.slice(0,-1)),t.endsWith(`
40
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}},Jh=new Cr;function Tr(i,e,t){return Jh.diff(i,e,t)}function Xh(i,e){e.stripTrailingCr&&(i=i.replace(/\r\n/g,`
41
- `));let t=[],n=i.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let s=0;s<n.length;s++){let r=n[s];s%2&&!e.newlineIsToken?t[t.length-1]+=r:t.push(r)}return t}function Rr(i){return Array.isArray(i)?i.map(e=>Rr(e)):Object.assign(Object.assign({},i),{hunks:i.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map((t,n)=>{var s;return t.startsWith("\\")||t.endsWith("\r")||!((s=e.lines[n+1])===null||s===void 0)&&s.startsWith("\\")?t:t+"\r"})}))})}function Or(i){return Array.isArray(i)?i.map(e=>Or(e)):Object.assign(Object.assign({},i),{hunks:i.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map(t=>t.endsWith("\r")?t.substring(0,t.length-1):t)}))})}function _a(i){return Array.isArray(i)||(i=[i]),!i.some(e=>e.hunks.some(t=>t.lines.some(n=>!n.startsWith("\\")&&n.endsWith("\r"))))}function xa(i){return Array.isArray(i)||(i=[i]),i.some(e=>e.hunks.some(t=>t.lines.some(n=>n.endsWith("\r"))))&&i.every(e=>e.hunks.every(t=>t.lines.every((n,s)=>{var r;return n.startsWith("\\")||n.endsWith("\r")||((r=t.lines[s+1])===null||r===void 0?void 0:r.startsWith("\\"))})))}function Sa(i){let e=i.split(/\n/),t=[],n=0;function s(){let a={};for(t.push(a);n<e.length;){let c=e[n];if(/^(---|\+\+\+|@@)\s/.test(c))break;let l=/^(?:Index:|diff(?: -r \w+)+)\s+/.exec(c);l&&(a.index=c.substring(l[0].length).trim()),n++}for(r(a),r(a),a.hunks=[];n<e.length;){let c=e[n];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(c))break;if(/^@@/.test(c))a.hunks.push(o());else{if(c)throw new Error("Unknown line "+(n+1)+" "+JSON.stringify(c));n++}}}function r(a){let c=/^(---|\+\+\+)\s+/.exec(e[n]);if(c){let l=c[1],h=e[n].substring(3).trim().split(" ",2),u=(h[1]||"").trim(),d=h[0].replace(/\\\\/g,"\\");d.startsWith('"')&&d.endsWith('"')&&(d=d.substr(1,d.length-2)),l==="---"?(a.oldFileName=d,a.oldHeader=u):(a.newFileName=d,a.newHeader=u),n++}}function o(){var a;let c=n,l=e[n++],h=l.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),u={oldStart:+h[1],oldLines:typeof h[2]>"u"?1:+h[2],newStart:+h[3],newLines:typeof h[4]>"u"?1:+h[4],lines:[]};u.oldLines===0&&(u.oldStart+=1),u.newLines===0&&(u.newStart+=1);let d=0,p=0;for(;n<e.length&&(p<u.oldLines||d<u.newLines||!((a=e[n])===null||a===void 0)&&a.startsWith("\\"));n++){let w=e[n].length==0&&n!=e.length-1?" ":e[n][0];if(w==="+"||w==="-"||w===" "||w==="\\")u.lines.push(e[n]),w==="+"?d++:w==="-"?p++:w===" "&&(d++,p++);else throw new Error(`Hunk at line ${c+1} contained invalid line ${e[n]}`)}if(!d&&u.newLines===1&&(u.newLines=0),!p&&u.oldLines===1&&(u.oldLines=0),d!==u.newLines)throw new Error("Added line count did not match for hunk at line "+(c+1));if(p!==u.oldLines)throw new Error("Removed line count did not match for hunk at line "+(c+1));return u}for(;n<e.length;)s();return t}function ka(i,e,t){let n=!0,s=!1,r=!1,o=1;return function a(){if(n&&!r){if(s?o++:n=!1,i+o<=t)return i+o;r=!0}if(!s)return r||(n=!0),e<=i-o?i-o++:(s=!0,a())}}function Ar(i,e,t={}){let n;if(typeof e=="string"?n=Sa(e):Array.isArray(e)?n=e:n=[e],n.length>1)throw new Error("applyPatch only works with a single input.");return Yh(i,n[0],t)}function Yh(i,e,t={}){(t.autoConvertLineEndings||t.autoConvertLineEndings==null)&&(va(i)&&_a(e)?e=Rr(e):ba(i)&&xa(e)&&(e=Or(e)));let n=i.split(`
42
- `),s=e.hunks,r=t.compareLine||((w,g,k,S)=>g===S),o=t.fuzzFactor||0,a=0;if(o<0||!Number.isInteger(o))throw new Error("fuzzFactor must be a non-negative integer");if(!s.length)return i;let c="",l=!1,h=!1;for(let w=0;w<s[s.length-1].lines.length;w++){let g=s[s.length-1].lines[w];g[0]=="\\"&&(c[0]=="+"?l=!0:c[0]=="-"&&(h=!0)),c=g}if(l){if(h){if(!o&&n[n.length-1]=="")return!1}else if(n[n.length-1]=="")n.pop();else if(!o)return!1}else if(h){if(n[n.length-1]!="")n.push("");else if(!o)return!1}function u(w,g,k,S=0,_=!0,b=[],E=0){let O=0,V=!1;for(;S<w.length;S++){let X=w[S],ge=X.length>0?X[0]:" ",Oe=X.length>0?X.substr(1):X;if(ge==="-")if(r(g+1,n[g],ge,Oe))g++,O=0;else return!k||n[g]==null?null:(b[E]=n[g],u(w,g+1,k-1,S,!1,b,E+1));if(ge==="+"){if(!_)return null;b[E]=Oe,E++,O=0,V=!0}if(ge===" ")if(O++,b[E]=n[g],r(g+1,n[g],ge,Oe))E++,_=!0,V=!1,g++;else return V||!k?null:n[g]&&(u(w,g+1,k-1,S+1,!1,b,E+1)||u(w,g+1,k-1,S,!1,b,E+1))||u(w,g,k-1,S+1,!1,b,E)}return E-=O,g-=O,b.length=E,{patchedLines:b,oldLineLastI:g-1}}let d=[],p=0;for(let w=0;w<s.length;w++){let g=s[w],k,S=n.length-g.oldLines+o,_;for(let b=0;b<=o;b++){_=g.oldStart+p-1;let E=ka(_,a,S);for(;_!==void 0&&(k=u(g.lines,_,b),!k);_=E());if(k)break}if(!k)return!1;for(let b=a;b<_;b++)d.push(n[b]);for(let b=0;b<k.patchedLines.length;b++){let E=k.patchedLines[b];d.push(E)}a=k.oldLineLastI+1,p=_+1-g.oldStart}for(let w=a;w<n.length;w++)d.push(n[w]);return d.join(`
43
- `)}var Ea={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Nr(i,e,t,n,s,r,o){let a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context>"u"&&(a.context=4);let c=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){let{callback:h}=a;Tr(t,n,Object.assign(Object.assign({},a),{callback:u=>{let d=l(u);h(d)}}))}else return l(Tr(t,n,a));function l(h){if(!h)return;h.push({value:"",lines:[]});function u(_){return _.map(function(b){return" "+b})}let d=[],p=0,w=0,g=[],k=1,S=1;for(let _=0;_<h.length;_++){let b=h[_],E=b.lines||Qh(b.value);if(b.lines=E,b.added||b.removed){if(!p){let O=h[_-1];p=k,w=S,O&&(g=c>0?u(O.lines.slice(-c)):[],p-=g.length,w-=g.length)}for(let O of E)g.push((b.added?"+":"-")+O);b.added?S+=E.length:k+=E.length}else{if(p)if(E.length<=c*2&&_<h.length-2)for(let O of u(E))g.push(O);else{let O=Math.min(E.length,c);for(let X of u(E.slice(0,O)))g.push(X);let V={oldStart:p,oldLines:k-p+O,newStart:w,newLines:S-w+O,lines:g};d.push(V),p=0,w=0,g=[]}k+=E.length,S+=E.length}}for(let _ of d)for(let b=0;b<_.lines.length;b++)_.lines[b].endsWith(`
44
- `)?_.lines[b]=_.lines[b].slice(0,-1):(_.lines.splice(b+1,0,"\"),b++);return{oldFileName:i,newFileName:e,oldHeader:s,newHeader:r,hunks:d}}}function Li(i,e){if(e||(e=Ea),Array.isArray(i)){if(i.length>1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return i.map(n=>Li(n,e)).join(`
45
- `)}let t=[];e.includeIndex&&i.oldFileName==i.newFileName&&t.push("Index: "+i.oldFileName),e.includeUnderline&&t.push("==================================================================="),e.includeFileHeaders&&(t.push("--- "+i.oldFileName+(typeof i.oldHeader>"u"?"":" "+i.oldHeader)),t.push("+++ "+i.newFileName+(typeof i.newHeader>"u"?"":" "+i.newHeader)));for(let n=0;n<i.hunks.length;n++){let s=i.hunks[n];s.oldLines===0&&(s.oldStart-=1),s.newLines===0&&(s.newStart-=1),t.push("@@ -"+s.oldStart+","+s.oldLines+" +"+s.newStart+","+s.newLines+" @@");for(let r of s.lines)t.push(r)}return t.join(`
40
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}},Qf=new Cr;function Rr(s,e,t){return Qf.diff(s,e,t)}function Kf(s,e){e.stripTrailingCr&&(s=s.replace(/\r\n/g,`
41
+ `));let t=[],n=s.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i<n.length;i++){let r=n[i];i%2&&!e.newlineIsToken?t[t.length-1]+=r:t.push(r)}return t}function Tr(s){return Array.isArray(s)?s.map(e=>Tr(e)):Object.assign(Object.assign({},s),{hunks:s.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map((t,n)=>{var i;return t.startsWith("\\")||t.endsWith("\r")||!((i=e.lines[n+1])===null||i===void 0)&&i.startsWith("\\")?t:t+"\r"})}))})}function Or(s){return Array.isArray(s)?s.map(e=>Or(e)):Object.assign(Object.assign({},s),{hunks:s.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map(t=>t.endsWith("\r")?t.substring(0,t.length-1):t)}))})}function xa(s){return Array.isArray(s)||(s=[s]),!s.some(e=>e.hunks.some(t=>t.lines.some(n=>!n.startsWith("\\")&&n.endsWith("\r"))))}function Sa(s){return Array.isArray(s)||(s=[s]),s.some(e=>e.hunks.some(t=>t.lines.some(n=>n.endsWith("\r"))))&&s.every(e=>e.hunks.every(t=>t.lines.every((n,i)=>{var r;return n.startsWith("\\")||n.endsWith("\r")||((r=t.lines[i+1])===null||r===void 0?void 0:r.startsWith("\\"))})))}function ka(s){let e=s.split(/\n/),t=[],n=0;function i(){let a={};for(t.push(a);n<e.length;){let c=e[n];if(/^(---|\+\+\+|@@)\s/.test(c))break;let l=/^(?:Index:|diff(?: -r \w+)+)\s+/.exec(c);l&&(a.index=c.substring(l[0].length).trim()),n++}for(r(a),r(a),a.hunks=[];n<e.length;){let c=e[n];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(c))break;if(/^@@/.test(c))a.hunks.push(o());else{if(c)throw new Error("Unknown line "+(n+1)+" "+JSON.stringify(c));n++}}}function r(a){let c=/^(---|\+\+\+)\s+/.exec(e[n]);if(c){let l=c[1],f=e[n].substring(3).trim().split(" ",2),u=(f[1]||"").trim(),h=f[0].replace(/\\\\/g,"\\");h.startsWith('"')&&h.endsWith('"')&&(h=h.substr(1,h.length-2)),l==="---"?(a.oldFileName=h,a.oldHeader=u):(a.newFileName=h,a.newHeader=u),n++}}function o(){var a;let c=n,l=e[n++],f=l.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),u={oldStart:+f[1],oldLines:typeof f[2]>"u"?1:+f[2],newStart:+f[3],newLines:typeof f[4]>"u"?1:+f[4],lines:[]};u.oldLines===0&&(u.oldStart+=1),u.newLines===0&&(u.newStart+=1);let h=0,p=0;for(;n<e.length&&(p<u.oldLines||h<u.newLines||!((a=e[n])===null||a===void 0)&&a.startsWith("\\"));n++){let w=e[n].length==0&&n!=e.length-1?" ":e[n][0];if(w==="+"||w==="-"||w===" "||w==="\\")u.lines.push(e[n]),w==="+"?h++:w==="-"?p++:w===" "&&(h++,p++);else throw new Error(`Hunk at line ${c+1} contained invalid line ${e[n]}`)}if(!h&&u.newLines===1&&(u.newLines=0),!p&&u.oldLines===1&&(u.oldLines=0),h!==u.newLines)throw new Error("Added line count did not match for hunk at line "+(c+1));if(p!==u.oldLines)throw new Error("Removed line count did not match for hunk at line "+(c+1));return u}for(;n<e.length;)i();return t}function Ea(s,e,t){let n=!0,i=!1,r=!1,o=1;return function a(){if(n&&!r){if(i?o++:n=!1,s+o<=t)return s+o;r=!0}if(!i)return r||(n=!0),e<=s-o?s-o++:(i=!0,a())}}function Nr(s,e,t={}){let n;if(typeof e=="string"?n=ka(e):Array.isArray(e)?n=e:n=[e],n.length>1)throw new Error("applyPatch only works with a single input.");return ed(s,n[0],t)}function ed(s,e,t={}){(t.autoConvertLineEndings||t.autoConvertLineEndings==null)&&(va(s)&&xa(e)?e=Tr(e):_a(s)&&Sa(e)&&(e=Or(e)));let n=s.split(`
42
+ `),i=e.hunks,r=t.compareLine||((w,g,k,S)=>g===S),o=t.fuzzFactor||0,a=0;if(o<0||!Number.isInteger(o))throw new Error("fuzzFactor must be a non-negative integer");if(!i.length)return s;let c="",l=!1,f=!1;for(let w=0;w<i[i.length-1].lines.length;w++){let g=i[i.length-1].lines[w];g[0]=="\\"&&(c[0]=="+"?l=!0:c[0]=="-"&&(f=!0)),c=g}if(l){if(f){if(!o&&n[n.length-1]=="")return!1}else if(n[n.length-1]=="")n.pop();else if(!o)return!1}else if(f){if(n[n.length-1]!="")n.push("");else if(!o)return!1}function u(w,g,k,S=0,_=!0,v=[],E=0){let O=0,H=!1;for(;S<w.length;S++){let Y=w[S],ge=Y.length>0?Y[0]:" ",Oe=Y.length>0?Y.substr(1):Y;if(ge==="-")if(r(g+1,n[g],ge,Oe))g++,O=0;else return!k||n[g]==null?null:(v[E]=n[g],u(w,g+1,k-1,S,!1,v,E+1));if(ge==="+"){if(!_)return null;v[E]=Oe,E++,O=0,H=!0}if(ge===" ")if(O++,v[E]=n[g],r(g+1,n[g],ge,Oe))E++,_=!0,H=!1,g++;else return H||!k?null:n[g]&&(u(w,g+1,k-1,S+1,!1,v,E+1)||u(w,g+1,k-1,S,!1,v,E+1))||u(w,g,k-1,S+1,!1,v,E)}return E-=O,g-=O,v.length=E,{patchedLines:v,oldLineLastI:g-1}}let h=[],p=0;for(let w=0;w<i.length;w++){let g=i[w],k,S=n.length-g.oldLines+o,_;for(let v=0;v<=o;v++){_=g.oldStart+p-1;let E=Ea(_,a,S);for(;_!==void 0&&(k=u(g.lines,_,v),!k);_=E());if(k)break}if(!k)return!1;for(let v=a;v<_;v++)h.push(n[v]);for(let v=0;v<k.patchedLines.length;v++){let E=k.patchedLines[v];h.push(E)}a=k.oldLineLastI+1,p=_+1-g.oldStart}for(let w=a;w<n.length;w++)h.push(n[w]);return h.join(`
43
+ `)}var Ca={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Ar(s,e,t,n,i,r,o){let a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context>"u"&&(a.context=4);let c=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){let{callback:f}=a;Rr(t,n,Object.assign(Object.assign({},a),{callback:u=>{let h=l(u);f(h)}}))}else return l(Rr(t,n,a));function l(f){if(!f)return;f.push({value:"",lines:[]});function u(_){return _.map(function(v){return" "+v})}let h=[],p=0,w=0,g=[],k=1,S=1;for(let _=0;_<f.length;_++){let v=f[_],E=v.lines||td(v.value);if(v.lines=E,v.added||v.removed){if(!p){let O=f[_-1];p=k,w=S,O&&(g=c>0?u(O.lines.slice(-c)):[],p-=g.length,w-=g.length)}for(let O of E)g.push((v.added?"+":"-")+O);v.added?S+=E.length:k+=E.length}else{if(p)if(E.length<=c*2&&_<f.length-2)for(let O of u(E))g.push(O);else{let O=Math.min(E.length,c);for(let Y of u(E.slice(0,O)))g.push(Y);let H={oldStart:p,oldLines:k-p+O,newStart:w,newLines:S-w+O,lines:g};h.push(H),p=0,w=0,g=[]}k+=E.length,S+=E.length}}for(let _ of h)for(let v=0;v<_.lines.length;v++)_.lines[v].endsWith(`
44
+ `)?_.lines[v]=_.lines[v].slice(0,-1):(_.lines.splice(v+1,0,"\"),v++);return{oldFileName:s,newFileName:e,oldHeader:i,newHeader:r,hunks:h}}}function Ls(s,e){if(e||(e=Ca),Array.isArray(s)){if(s.length>1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return s.map(n=>Ls(n,e)).join(`
45
+ `)}let t=[];e.includeIndex&&s.oldFileName==s.newFileName&&t.push("Index: "+s.oldFileName),e.includeUnderline&&t.push("==================================================================="),e.includeFileHeaders&&(t.push("--- "+s.oldFileName+(typeof s.oldHeader>"u"?"":" "+s.oldHeader)),t.push("+++ "+s.newFileName+(typeof s.newHeader>"u"?"":" "+s.newHeader)));for(let n=0;n<s.hunks.length;n++){let i=s.hunks[n];i.oldLines===0&&(i.oldStart-=1),i.newLines===0&&(i.newStart-=1),t.push("@@ -"+i.oldStart+","+i.oldLines+" +"+i.newStart+","+i.newLines+" @@");for(let r of i.lines)t.push(r)}return t.join(`
46
46
  `)+`
47
- `}function Ca(i,e,t,n,s,r,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){let{callback:a}=o;Nr(i,e,t,n,s,r,Object.assign(Object.assign({},o),{callback:c=>{a(c?Li(c,o.headerOptions):void 0)}}))}else{let a=Nr(i,e,t,n,s,r,o);return a?Li(a,o?.headerOptions):void 0}}function Pr(i,e,t,n,s,r){return Ca(i,i,e,t,n,s,r)}function Qh(i){let e=i.endsWith(`
48
- `),t=i.split(`
47
+ `}function Ra(s,e,t,n,i,r,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){let{callback:a}=o;Ar(s,e,t,n,i,r,Object.assign(Object.assign({},o),{callback:c=>{a(c?Ls(c,o.headerOptions):void 0)}}))}else{let a=Ar(s,e,t,n,i,r,o);return a?Ls(a,o?.headerOptions):void 0}}function Pr(s,e,t,n,i,r){return Ra(s,s,e,t,n,i,r)}function td(s){let e=s.endsWith(`
48
+ `),t=s.split(`
49
49
  `).map(n=>n+`
50
- `);return e?t.pop():t.push(t.pop().slice(0,-1)),t}var Mr=(i,e,t)=>{let n=i instanceof RegExp?Ta(i,t):i,s=e instanceof RegExp?Ta(e,t):e,r=n!==null&&s!=null&&Kh(n,s,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+n.length,r[1]),post:t.slice(r[1]+s.length)}},Ta=(i,e)=>{let t=e.match(i);return t?t[0]:null},Kh=(i,e,t)=>{let n,s,r,o,a,c=t.indexOf(i),l=t.indexOf(e,c+1),h=c;if(c>=0&&l>0){if(i===e)return[c,l];for(n=[],r=t.length;h>=0&&!a;){if(h===c)n.push(h),c=t.indexOf(i,h+1);else if(n.length===1){let u=n.pop();u!==void 0&&(a=[u,l])}else s=n.pop(),s!==void 0&&s<r&&(r=s,o=l),l=t.indexOf(e,h+1);h=c<l&&c>=0?c:l}n.length&&o!==void 0&&(a=[r,o])}return a};var Ra="\0SLASH"+Math.random()+"\0",Oa="\0OPEN"+Math.random()+"\0",Lr="\0CLOSE"+Math.random()+"\0",Aa="\0COMMA"+Math.random()+"\0",Na="\0PERIOD"+Math.random()+"\0",ef=new RegExp(Ra,"g"),tf=new RegExp(Oa,"g"),nf=new RegExp(Lr,"g"),sf=new RegExp(Aa,"g"),rf=new RegExp(Na,"g"),of=/\\\\/g,af=/\\{/g,cf=/\\}/g,lf=/\\,/g,uf=/\\\./g,hf=1e5;function jr(i){return isNaN(i)?i.charCodeAt(0):parseInt(i,10)}function ff(i){return i.replace(of,Ra).replace(af,Oa).replace(cf,Lr).replace(lf,Aa).replace(uf,Na)}function df(i){return i.replace(ef,"\\").replace(tf,"{").replace(nf,"}").replace(sf,",").replace(rf,".")}function Pa(i){if(!i)return[""];let e=[],t=Mr("{","}",i);if(!t)return i.split(",");let{pre:n,body:s,post:r}=t,o=n.split(",");o[o.length-1]+="{"+s+"}";let a=Pa(r);return r.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function Ma(i,e={}){if(!i)return[];let{max:t=hf}=e;return i.slice(0,2)==="{}"&&(i="\\{\\}"+i.slice(2)),Un(ff(i),t,!0).map(df)}function pf(i){return"{"+i+"}"}function mf(i){return/^-?0\d/.test(i)}function gf(i,e){return i<=e}function yf(i,e){return i>=e}function Un(i,e,t){let n=[],s=Mr("{","}",i);if(!s)return[i];let r=s.pre,o=s.post.length?Un(s.post,e,!1):[""];if(/\$$/.test(s.pre))for(let a=0;a<o.length&&a<e;a++){let c=r+"{"+s.body+"}"+o[a];n.push(c)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),l=a||c,h=s.body.indexOf(",")>=0;if(!l&&!h)return s.post.match(/,(?!,).*\}/)?(i=s.pre+"{"+s.body+Lr+s.post,Un(i,e,!0)):[i];let u;if(l)u=s.body.split(/\.\./);else if(u=Pa(s.body),u.length===1&&u[0]!==void 0&&(u=Un(u[0],e,!1).map(pf),u.length===1))return o.map(p=>s.pre+u[0]+p);let d;if(l&&u[0]!==void 0&&u[1]!==void 0){let p=jr(u[0]),w=jr(u[1]),g=Math.max(u[0].length,u[1].length),k=u.length===3&&u[2]!==void 0?Math.abs(jr(u[2])):1,S=gf;w<p&&(k*=-1,S=yf);let b=u.some(mf);d=[];for(let E=p;S(E,w);E+=k){let O;if(c)O=String.fromCharCode(E),O==="\\"&&(O="");else if(O=String(E),b){let V=g-O.length;if(V>0){let X=new Array(V+1).join("0");E<0?O="-"+X+O.slice(1):O=X+O}}d.push(O)}}else{d=[];for(let p=0;p<u.length;p++)d.push.apply(d,Un(u[p],e,!1))}for(let p=0;p<d.length;p++)for(let w=0;w<o.length&&n.length<e;w++){let g=r+d[p]+o[w];(!t||l||g)&&n.push(g)}}return n}var Bn=i=>{if(typeof i!="string")throw new TypeError("invalid pattern");if(i.length>65536)throw new TypeError("pattern is too long")};var wf={"[: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]},Vn=i=>i.replace(/[[\]\\-]/g,"\\$&"),vf=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ja=i=>i.join(""),La=(i,e)=>{let t=e;if(i.charAt(t)!=="[")throw new Error("not in a brace expression");let n=[],s=[],r=t+1,o=!1,a=!1,c=!1,l=!1,h=t,u="";e:for(;r<i.length;){let g=i.charAt(r);if((g==="!"||g==="^")&&r===t+1){l=!0,r++;continue}if(g==="]"&&o&&!c){h=r+1;break}if(o=!0,g==="\\"&&!c){c=!0,r++;continue}if(g==="["&&!c){for(let[k,[S,_,b]]of Object.entries(wf))if(i.startsWith(k,r)){if(u)return["$.",!1,i.length-t,!0];r+=k.length,b?s.push(S):n.push(S),a=a||_;continue e}}if(c=!1,u){g>u?n.push(Vn(u)+"-"+Vn(g)):g===u&&n.push(Vn(g)),u="",r++;continue}if(i.startsWith("-]",r+1)){n.push(Vn(g+"-")),r+=2;continue}if(i.startsWith("-",r+1)){u=g,r+=2;continue}n.push(Vn(g)),r++}if(h<r)return["",!1,0,!1];if(!n.length&&!s.length)return["$.",!1,i.length-t,!0];if(s.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let g=n[0].length===2?n[0].slice(-1):n[0];return[vf(g),!1,h-t,!1]}let d="["+(l?"^":"")+ja(n)+"]",p="["+(l?"":"^")+ja(s)+"]";return[n.length&&s.length?"("+d+"|"+p+")":n.length?d:p,a,h-t,!0]};var qe=(i,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?i.replace(/\[([^\/\\])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?i.replace(/\[([^\/\\{}])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var Re,bf=new Set(["!","?","+","*","@"]),Ir=i=>bf.has(i),Ia=i=>Ir(i.type),_f=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),xf=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Sf=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),$a=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),kf="(?!(?:^|/)\\.\\.?(?:$|/))",Ii="(?!\\.)",Ef=new Set(["[","."]),Cf=new Set(["..","."]),Tf=new Set("().*{}+?[]^$\\!"),Rf=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$r="[^/]",Da=$r+"*?",Fa=$r+"+?",Of=0,Zt=class{type;#e;#n;#i=!1;#t=[];#r;#_;#w;#c=!1;#h;#a;#l=!1;id=++Of;get depth(){return(this.#r?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#r?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,t,n={}){this.type=e,e&&(this.#n=!0),this.#r=t,this.#e=this.#r?this.#r.#e:this,this.#h=this.#e===this?n:this.#e.#h,this.#w=this.#e===this?[]:this.#e.#w,e==="!"&&!this.#e.#c&&this.#w.push(this),this.#_=this.#r?this.#r.#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.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#a=this.#t.map(e=>String(e)).join("")}#s(){if(this!==this.#e)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#w.pop();){if(e.type!=="!")continue;let t=e,n=t.#r;for(;n;){for(let s=t.#_+1;!n.type&&s<n.#t.length;s++)for(let r of e.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(n.#t[s])}t=n,n=t.#r}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Re&&t.#r===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#c&&this.#r?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#r?.isStart())return!1;if(this.#_===0)return!0;let e=this.#r;for(let t=0;t<this.#_;t++){let n=e.#t[t];if(!(n instanceof Re&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#r?.type==="!")return!0;if(!this.#r?.isEnd())return!1;if(!this.type)return this.#r?.isEnd();let e=this.#r?this.#r.#t.length:0;return this.#_===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Re(this.type,e);for(let n of this.#t)t.copyIn(n);return t}static#g(e,t,n,s,r){let o=s.maxExtglobRecursion??2,a=!1,c=!1,l=-1,h=!1;if(t.type===null){let g=n,k="";for(;g<e.length;){let S=e.charAt(g++);if(a||S==="\\"){a=!a,k+=S;continue}if(c){g===l+1?(S==="^"||S==="!")&&(h=!0):S==="]"&&!(g===l+2&&h)&&(c=!1),k+=S;continue}else if(S==="["){c=!0,l=g,h=!1,k+=S;continue}if(!s.noext&&Ir(S)&&e.charAt(g)==="("&&r<=o){t.push(k),k="";let b=new Re(S,t);g=Re.#g(e,b,g,s,r+1),t.push(b);continue}k+=S}return t.push(k),g}let u=n+1,d=new Re(null,t),p=[],w="";for(;u<e.length;){let g=e.charAt(u++);if(a||g==="\\"){a=!a,w+=g;continue}if(c){u===l+1?(g==="^"||g==="!")&&(h=!0):g==="]"&&!(u===l+2&&h)&&(c=!1),w+=g;continue}else if(g==="["){c=!0,l=u,h=!1,w+=g;continue}if(!s.noext&&Ir(g)&&e.charAt(u)==="("&&(r<=o||t&&t.#f(g))){let S=t&&t.#f(g)?0:1;d.push(w),w="";let _=new Re(g,d);d.push(_),u=Re.#g(e,_,u,s,r+S);continue}if(g==="|"){d.push(w),w="",p.push(d),d=new Re(null,t);continue}if(g===")")return w===""&&t.#t.length===0&&(t.#l=!0),d.push(w),w="",t.push(...p,d),u;w+=g}return t.type=null,t.#n=void 0,t.#t=[e.substring(n-1)],u}#x(e){return this.#y(e,xf)}#y(e,t=_f){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#f(n.type,t)}#f(e,t=Sf){return!!t.get(this.type)?.includes(e)}#k(e,t){let n=e.#t[0],s=new Re(null,n,this.options);s.#t.push(""),n.push(s),this.#d(e,t)}#d(e,t){let n=e.#t[0];this.#t.splice(t,1,...n.#t);for(let s of n.#t)typeof s=="object"&&(s.#r=this);this.#a=void 0}#E(e){return!!$a.get(this.type)?.has(e)}#b(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#E(t.type)}#v(e){let t=$a.get(this.type),n=e.#t[0],s=t?.get(n.type);if(!s)return!1;this.#t=n.#t;for(let r of this.#t)typeof r=="object"&&(r.#r=this);this.type=s,this.#a=void 0,this.#l=!1}static fromGlob(e,t={}){let n=new Re(null,void 0,t);return Re.#g(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,s,r]=this.toRegExpSource();if(!(s||this.#n||this.#h.nocase&&!this.#h.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#h.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#h}toRegExpSource(e){let t=e??!!this.#h.dot;if(this.#e===this&&(this.#m(),this.#s()),!Ia(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(p=>typeof p!="string"),l=this.#t.map(p=>{let[w,g,k,S]=typeof p=="string"?Re.#p(p,this.#n,c):p.toRegExpSource(e);return this.#n=this.#n||k,this.#i=this.#i||S,w}).join(""),h="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Cf.has(this.#t[0]))){let w=Ef,g=t&&w.has(l.charAt(0))||l.startsWith("\\.")&&w.has(l.charAt(2))||l.startsWith("\\.\\.")&&w.has(l.charAt(4)),k=!t&&!e&&w.has(l.charAt(0));h=g?kf:k?Ii:""}let u="";return this.isEnd()&&this.#e.#c&&this.#r?.type==="!"&&(u="(?:$|\\/)"),[h+l+u,qe(l),this.#n=!!this.#n,this.#i]}let n=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#S(t);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let c=this.toString(),l=this;return l.#t=[c],l.type=null,l.#n=void 0,[c,qe(this.toString()),!1,!1]}let o=!n||e||t||!Ii?"":this.#S(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!t?Ii:"")+Fa;else{let c=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Ii:"")+Da+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=s+r+c}return[a,qe(r),this.#n=!!this.#n,this.#i]}#m(){if(Ia(this)){let e=0,t=!1;do{t=!0;for(let n=0;n<this.#t.length;n++){let s=this.#t[n];typeof s=="object"&&(s.#m(),this.#y(s)?(t=!1,this.#d(s,n)):this.#x(s)?(t=!1,this.#k(s,n)):this.#b(s)&&(t=!1,this.#v(s)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#m();this.#a=void 0}#S(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[n,s,r,o]=t.toRegExpSource(e);return this.#i=this.#i||o,n}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#p(e,t,n=!1){let s=!1,r="",o=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(s){s=!1,r+=(Tf.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,r+=n&&/^[*]+$/.test(e)?Fa:Da,t=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?r+="\\\\":s=!0;continue}if(l==="["){let[h,u,d,p]=La(e,c);if(d){r+=h,o=o||u,c+=d-1,t=t||p;continue}}if(l==="?"){r+=$r,t=!0;continue}r+=Rf(l)}return[r,qe(e),!!t,o]}};Re=Zt;var yn=(i,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?i.replace(/[?*()[\]{}]/g,"[$&]"):i.replace(/[?*()[\]\\{}]/g,"\\$&"):e?i.replace(/[?*()[\]]/g,"[$&]"):i.replace(/[?*()[\]\\]/g,"\\$&");var Se=(i,e,t={})=>(Bn(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Pe(e,t).match(i)),Af=/^\*+([^+@!?\*\[\(]*)$/,Nf=i=>e=>!e.startsWith(".")&&e.endsWith(i),Pf=i=>e=>e.endsWith(i),Mf=i=>(i=i.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(i)),jf=i=>(i=i.toLowerCase(),e=>e.toLowerCase().endsWith(i)),Lf=/^\*+\.\*+$/,If=i=>!i.startsWith(".")&&i.includes("."),$f=i=>i!=="."&&i!==".."&&i.includes("."),Df=/^\.\*+$/,Ff=i=>i!=="."&&i!==".."&&i.startsWith("."),Wf=/^\*+$/,zf=i=>i.length!==0&&!i.startsWith("."),qf=i=>i.length!==0&&i!=="."&&i!=="..",Uf=/^\?+([^+@!?\*\[\(]*)?$/,Bf=([i,e=""])=>{let t=qa([i]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Vf=([i,e=""])=>{let t=Ua([i]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Zf=([i,e=""])=>{let t=Ua([i]);return e?n=>t(n)&&n.endsWith(e):t},Hf=([i,e=""])=>{let t=qa([i]);return e?n=>t(n)&&n.endsWith(e):t},qa=([i])=>{let e=i.length;return t=>t.length===e&&!t.startsWith(".")},Ua=([i])=>{let e=i.length;return t=>t.length===e&&t!=="."&&t!==".."},Ba=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Wa={win32:{sep:"\\"},posix:{sep:"/"}},Gf=Ba==="win32"?Wa.win32.sep:Wa.posix.sep;Se.sep=Gf;var se=Symbol("globstar **");Se.GLOBSTAR=se;var Jf="[^/]",Xf=Jf+"*?",Yf="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Qf="(?:(?!(?:\\/|^)\\.).)*?",Kf=(i,e={})=>t=>Se(t,i,e);Se.filter=Kf;var $e=(i,e={})=>Object.assign({},i,e),ed=i=>{if(!i||typeof i!="object"||!Object.keys(i).length)return Se;let e=Se;return Object.assign((n,s,r={})=>e(n,s,$e(i,r)),{Minimatch:class extends e.Minimatch{constructor(s,r={}){super(s,$e(i,r))}static defaults(s){return e.defaults($e(i,s)).Minimatch}},AST:class extends e.AST{constructor(s,r,o={}){super(s,r,$e(i,o))}static fromGlob(s,r={}){return e.AST.fromGlob(s,$e(i,r))}},unescape:(n,s={})=>e.unescape(n,$e(i,s)),escape:(n,s={})=>e.escape(n,$e(i,s)),filter:(n,s={})=>e.filter(n,$e(i,s)),defaults:n=>e.defaults($e(i,n)),makeRe:(n,s={})=>e.makeRe(n,$e(i,s)),braceExpand:(n,s={})=>e.braceExpand(n,$e(i,s)),match:(n,s,r={})=>e.match(n,s,$e(i,r)),sep:e.sep,GLOBSTAR:se})};Se.defaults=ed;var Va=(i,e={})=>(Bn(i),e.nobrace||!/\{(?:(?!\{).)*\}/.test(i)?[i]:Ma(i,{max:e.braceExpandMax}));Se.braceExpand=Va;var td=(i,e={})=>new Pe(i,e).makeRe();Se.makeRe=td;var nd=(i,e,t={})=>{let n=new Pe(e,t);return i=i.filter(s=>n.match(s)),n.options.nonull&&!i.length&&i.push(e),i};Se.match=nd;var za=/[?*]|[+@!]\(.*?\)|\[|\]/,id=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Pe=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){Bn(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Ba,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.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 t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let s=this.globParts.map((r,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=r[0]===""&&r[1]===""&&(r[2]==="?"||!za.test(r[2]))&&!za.test(r[3]),l=/^[a-z]:/i.test(r[0]);if(c)return[...r.slice(0,4),...r.slice(4).map(h=>this.parse(h))];if(l)return[r[0],...r.slice(1).map(h=>this.parse(h))]}return r.map(c=>this.parse(c))});if(this.debug(this.pattern,s),this.set=s.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n=0;n<e.length;n++)for(let s=0;s<e[n].length;s++)e[n][s]==="**"&&(e[n][s]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let n=-1;for(;(n=t.indexOf("**",n+1))!==-1;){let s=n;for(;t[s+1]==="**";)s++;s!==n&&t.splice(n,s-n)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((n,s)=>{let r=n[n.length-1];return s==="**"&&r==="**"?n:s===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(n.pop(),n):(n.push(s),n)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let s=1;s<e.length-1;s++){let r=e[s];s===1&&r===""&&e[0]===""||(r==="."||r==="")&&(t=!0,e.splice(s,1),s--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let s=e[n-1];s&&s!=="."&&s!==".."&&s!=="**"&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let s=-1;for(;(s=n.indexOf("**",s+1))!==-1;){let o=s;for(;n[o+1]==="**";)o++;o>s&&n.splice(s+1,o-s);let a=n[s+1],c=n[s+2],l=n[s+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;t=!0,n.splice(s,1);let h=n.slice(0);h[s]="**",e.push(h),s--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(t=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(t=!0,n.pop())}let r=0;for(;(r=n.indexOf("..",r+1))!==-1;){let o=n[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let c=r===1&&n[r+1]==="**"?["."]:[];n.splice(r-1,2,...c),n.length===0&&n.push(""),r-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let s=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(s){e[t]=[],e[n]=s;break}}return e.filter(t=>t.length)}partsMatch(e,t,n=!1){let s=0,r=0,o=[],a="";for(;s<e.length&&r<t.length;)if(e[s]===t[r])o.push(a==="b"?t[r]:e[s]),s++,r++;else if(n&&e[s]==="**"&&t[r]===e[s+1])o.push(e[s]),s++;else if(n&&t[r]==="**"&&e[s]===t[r+1])o.push(t[r]),r++;else if(e[s]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="b")return!1;a="a",o.push(e[s]),s++,r++}else if(t[r]==="*"&&e[s]&&(this.options.dot||!e[s].startsWith("."))&&e[s]!=="**"){if(a==="a")return!1;a="b",o.push(t[r]),s++,r++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let s=0;s<e.length&&e.charAt(s)==="!";s++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let s=0,r=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 t[0]=="string"&&/^[a-z]:$/i.test(t[0]),h=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),u=c?3:a?0:void 0,d=h?3:l?0:void 0;if(typeof u=="number"&&typeof d=="number"){let[p,w]=[e[u],t[d]];p.toLowerCase()===w.toLowerCase()&&(t[d]=p,r=d,s=u)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(se)?this.#e(e,t,n,s,r):this.#i(e,t,n,s,r)}#e(e,t,n,s,r){let o=t.indexOf(se,r),a=t.lastIndexOf(se),[c,l,h]=n?[t.slice(r,o),t.slice(o+1),[]]:[t.slice(r,o),t.slice(o+1,a),t.slice(a+1)];if(c.length){let _=e.slice(s,s+c.length);if(!this.#i(_,c,n,0,0))return!1;s+=c.length,r+=c.length}let u=0;if(h.length){if(h.length+s>e.length)return!1;let _=e.length-h.length;if(this.#i(e,h,n,_,0))u=h.length;else{if(e[e.length-1]!==""||s+h.length===e.length||(_--,!this.#i(e,h,n,_,0)))return!1;u=h.length+1}}if(!l.length){let _=!!u;for(let b=s;b<e.length-u;b++){let E=String(e[b]);if(_=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return n||_}let d=[[[],0]],p=d[0],w=0,g=[0];for(let _ of l)_===se?(g.push(w),p=[[],0],d.push(p)):(p[0].push(_),w++);let k=d.length-1,S=e.length-u;for(let _ of d)_[1]=S-(g[k--]+_[0].length);return!!this.#n(e,d,s,0,n,0,!!u)}#n(e,t,n,s,r,o,a){let c=t[s];if(!c){for(let u=n;u<e.length;u++){a=!0;let d=e[u];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1}return a}let[l,h]=c;for(;n<=h;){if(this.#i(e.slice(0,n+l.length),l,r,n,0)&&o<this.maxGlobstarRecursion){let p=this.#n(e,t,n+l.length,s+1,r,o+1,a);if(p!==!1)return p}let d=e[n];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1;n++}return r||null}#i(e,t,n,s,r){let o,a,c,l;for(o=s,a=r,l=e.length,c=t.length;o<l&&a<c;o++,a++){this.debug("matchOne loop");let h=t[a],u=e[o];if(this.debug(t,h,u),h===!1||h===se)return!1;let d;if(typeof h=="string"?(d=u===h,this.debug("string match",h,u,d)):(d=h.test(u),this.debug("pattern match",h,u,d)),!d)return!1}if(o===l&&a===c)return!0;if(o===l)return n;if(a===c)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Va(this.pattern,this.options)}parse(e){Bn(e);let t=this.options;if(e==="**")return se;if(e==="")return"";let n,s=null;(n=e.match(Wf))?s=t.dot?qf:zf:(n=e.match(Af))?s=(t.nocase?t.dot?jf:Mf:t.dot?Pf:Nf)(n[1]):(n=e.match(Uf))?s=(t.nocase?t.dot?Vf:Bf:t.dot?Zf:Hf)(n):(n=e.match(Lf))?s=t.dot?$f:If:(n=e.match(Df))&&(s=Ff);let r=Zt.fromGlob(e,this.options).toMMPattern();return s&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:s}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?Xf:t.dot?Yf:Qf,s=new Set(t.nocase?["i"]:[]),r=e.map(c=>{let l=c.map(u=>{if(u instanceof RegExp)for(let d of u.flags.split(""))s.add(d);return typeof u=="string"?id(u):u===se?se:u._src});l.forEach((u,d)=>{let p=l[d+1],w=l[d-1];u!==se||w===se||(w===void 0?p!==void 0&&p!==se?l[d+1]="(?:\\/|"+n+"\\/)?"+p:l[d]=n:p===void 0?l[d-1]=w+"(?:\\/|\\/"+n+")?":p!==se&&(l[d-1]=w+"(?:\\/|\\/"+n+"\\/)"+p,l[d+1]=se))});let h=l.filter(u=>u!==se);if(this.partial&&h.length>=1){let u=[];for(let d=1;d<=h.length;d++)u.push(h.slice(0,d).join("/"));return"(?:"+u.join("|")+")"}return h.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];r="^"+o+r+a+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+a+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...s].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,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let s=this.slashSplit(e);this.debug(this.pattern,"split",s);let r=this.set;this.debug(this.pattern,"set",r);let o=s[s.length-1];if(!o)for(let a=s.length-2;!o&&a>=0;a--)o=s[a];for(let a=0;a<r.length;a++){let c=r[a],l=s;if(n.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Se.defaults(e).Minimatch}};Se.AST=Zt;Se.Minimatch=Pe;Se.escape=yn;Se.unescape=qe;var mc=require("node:url");var wn=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ha=new Set,Dr=typeof process=="object"&&process?process:{},Ga=(i,e,t,n)=>{typeof Dr.emitWarning=="function"?Dr.emitWarning(i,e,t,n):console.error(`[${t}] ${e}: ${i}`)},$i=globalThis.AbortController,Za=globalThis.AbortSignal;if(typeof $i>"u"){Za=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,s){this._onabort.push(s)}},$i=class{constructor(){e()}signal=new Za;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let s of this.signal._onabort)s(n);this.signal.onabort?.(n)}}};let i=Dr.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{i&&(i=!1,Ga("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 sd=i=>!Ha.has(i),$m=Symbol("type"),_t=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Ja=i=>_t(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?vn:null:null,vn=class extends Array{constructor(e){super(e),this.fill(0)}},Fr=class i{heap;length;static#e=!1;static create(e){let t=Ja(e);if(!t)return[];i.#e=!0;let n=new i(e,t);return i.#e=!1,n}constructor(e,t){if(!i.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Zn=class i{#e;#n;#i;#t;#r;#_;#w;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#h;#a;#l;#s;#g;#x;#y;#f;#k;#d;#E;#b;#v;#m;#S;#p;#A;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#v,sizes:e.#E,keyMap:e.#a,keyList:e.#l,valList:e.#s,next:e.#g,prev:e.#x,get head(){return e.#y},get tail(){return e.#f},free:e.#k,isBackgroundFetch:t=>e.#u(t),backgroundFetch:(t,n,s,r)=>e.#L(t,n,s,r),moveToTail:t=>e.#D(t),indexes:t=>e.#R(t),rindexes:t=>e.#O(t),isStale:t=>e.#T(t)}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#h}get size(){return this.#c}get fetchMethod(){return this.#_}get memoMethod(){return this.#w}get dispose(){return this.#i}get onInsert(){return this.#t}get disposeAfter(){return this.#r}constructor(e){let{max:t=0,ttl:n,ttlResolution:s=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:c,dispose:l,onInsert:h,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:p,maxSize:w=0,maxEntrySize:g=0,sizeCalculation:k,fetchMethod:S,memoMethod:_,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:V,ignoreFetchAbort:X}=e;if(t!==0&&!_t(t))throw new TypeError("max option must be a nonnegative integer");let ge=t?Ja(t):Array;if(!ge)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=w,this.maxEntrySize=g||this.#n,this.sizeCalculation=k,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(_!==void 0&&typeof _!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#w=_,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#_=S,this.#S=!!S,this.#a=new Map,this.#l=new Array(t).fill(void 0),this.#s=new Array(t).fill(void 0),this.#g=new ge(t),this.#x=new ge(t),this.#y=0,this.#f=0,this.#k=Fr.create(t),this.#c=0,this.#h=0,typeof l=="function"&&(this.#i=l),typeof h=="function"&&(this.#t=h),typeof u=="function"?(this.#r=u,this.#d=[]):(this.#r=void 0,this.#d=void 0),this.#m=!!this.#i,this.#A=!!this.#t,this.#p=!!this.#r,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!V,this.ignoreFetchAbort=!!X,this.maxEntrySize!==0){if(this.#n!==0&&!_t(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!_t(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#W()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=_t(s)||s===0?s:1,this.ttlAutopurge=!!r,this.ttl=n||0,this.ttl){if(!_t(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#o()}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 Oe="LRU_CACHE_UNBOUNDED";sd(Oe)&&(Ha.add(Oe),Ga("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Oe,i))}}getRemainingTTL(e){return this.#a.has(e)?1/0:0}#o(){let e=new vn(this.#e),t=new vn(this.#e);this.#v=e,this.#b=t,this.#N=(r,o,a=wn.now())=>{if(t[r]=o!==0?a:0,e[r]=o,o!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#T(r)&&this.#P(this.#l[r],"expire")},o+1);c.unref&&c.unref()}},this.#M=r=>{t[r]=e[r]!==0?wn.now():0},this.#C=(r,o)=>{if(e[o]){let a=e[o],c=t[o];if(!a||!c)return;r.ttl=a,r.start=c,r.now=n||s();let l=r.now-c;r.remainingTTL=a-l}};let n=0,s=()=>{let r=wn.now();if(this.ttlResolution>0){n=r;let o=setTimeout(()=>n=0,this.ttlResolution);o.unref&&o.unref()}return r};this.getRemainingTTL=r=>{let o=this.#a.get(r);if(o===void 0)return 0;let a=e[o],c=t[o];if(!a||!c)return 1/0;let l=(n||s())-c;return a-l},this.#T=r=>{let o=t[r],a=e[r];return!!a&&!!o&&(n||s())-o>a}}#M=()=>{};#C=()=>{};#N=()=>{};#T=()=>!1;#W(){let e=new vn(this.#e);this.#h=0,this.#E=e,this.#j=t=>{this.#h-=e[t],e[t]=0},this.#z=(t,n,s,r)=>{if(this.#u(n))return 0;if(!_t(s))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(s=r(n,t),!_t(s))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 s},this.#I=(t,n,s)=>{if(e[t]=n,this.#n){let r=this.#n-e[t];for(;this.#h>r;)this.#$(!0)}this.#h+=e[t],s&&(s.entrySize=n,s.totalCalculatedSize=this.#h)}}#j=e=>{};#I=(e,t,n)=>{};#z=(e,t,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#R({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#f;!(!this.#q(t)||((e||!this.#T(t))&&(yield t),t===this.#y));)t=this.#x[t]}*#O({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#y;!(!this.#q(t)||((e||!this.#T(t))&&(yield t),t===this.#f));)t=this.#g[t]}#q(e){return e!==void 0&&this.#a.get(this.#l[e])===e}*entries(){for(let e of this.#R())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*rentries(){for(let e of this.#O())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*keys(){for(let e of this.#R()){let t=this.#l[e];t!==void 0&&!this.#u(this.#s[e])&&(yield t)}}*rkeys(){for(let e of this.#O()){let t=this.#l[e];t!==void 0&&!this.#u(this.#s[e])&&(yield t)}}*values(){for(let e of this.#R())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}*rvalues(){for(let e of this.#O())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#R()){let s=this.#s[n],r=this.#u(s)?s.__staleWhileFetching:s;if(r!==void 0&&e(r,this.#l[n],this))return this.get(this.#l[n],t)}}forEach(e,t=this){for(let n of this.#R()){let s=this.#s[n],r=this.#u(s)?s.__staleWhileFetching:s;r!==void 0&&e.call(t,r,this.#l[n],this)}}rforEach(e,t=this){for(let n of this.#O()){let s=this.#s[n],r=this.#u(s)?s.__staleWhileFetching:s;r!==void 0&&e.call(t,r,this.#l[n],this)}}purgeStale(){let e=!1;for(let t of this.#O({allowStale:!0}))this.#T(t)&&(this.#P(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#a.get(e);if(t===void 0)return;let n=this.#s[t],s=this.#u(n)?n.__staleWhileFetching:n;if(s===void 0)return;let r={value:s};if(this.#v&&this.#b){let o=this.#v[t],a=this.#b[t];if(o&&a){let c=o-(wn.now()-a);r.ttl=c,r.start=Date.now()}}return this.#E&&(r.size=this.#E[t]),r}dump(){let e=[];for(let t of this.#R({allowStale:!0})){let n=this.#l[t],s=this.#s[t],r=this.#u(s)?s.__staleWhileFetching:s;if(r===void 0||n===void 0)continue;let o={value:r};if(this.#v&&this.#b){o.ttl=this.#v[t];let a=wn.now()-this.#b[t];o.start=Math.floor(Date.now()-a)}this.#E&&(o.size=this.#E[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let s=Date.now()-n.start;n.start=wn.now()-s}this.set(t,n.value,n)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:s=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,{noUpdateTTL:l=this.noUpdateTTL}=n,h=this.#z(e,t,n.size||0,a);if(this.maxEntrySize&&h>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#P(e,"set"),this;let u=this.#c===0?void 0:this.#a.get(e);if(u===void 0)u=this.#c===0?this.#f:this.#k.length!==0?this.#k.pop():this.#c===this.#e?this.#$(!1):this.#c,this.#l[u]=e,this.#s[u]=t,this.#a.set(e,u),this.#g[this.#f]=u,this.#x[u]=this.#f,this.#f=u,this.#c++,this.#I(u,h,c),c&&(c.set="add"),l=!1,this.#A&&this.#t?.(t,e,"add");else{this.#D(u);let d=this.#s[u];if(t!==d){if(this.#S&&this.#u(d)){d.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=d;p!==void 0&&!o&&(this.#m&&this.#i?.(p,e,"set"),this.#p&&this.#d?.push([p,e,"set"]))}else o||(this.#m&&this.#i?.(d,e,"set"),this.#p&&this.#d?.push([d,e,"set"]));if(this.#j(u),this.#I(u,h,c),this.#s[u]=t,c){c.set="replace";let p=d&&this.#u(d)?d.__staleWhileFetching:d;p!==void 0&&(c.oldValue=p)}}else c&&(c.set="update");this.#A&&this.onInsert?.(t,e,t===d?"update":"replace")}if(s!==0&&!this.#v&&this.#o(),this.#v&&(l||this.#N(u,s,r),c&&this.#C(c,u)),!o&&this.#p&&this.#d){let d=this.#d,p;for(;p=d?.shift();)this.#r?.(...p)}return this}pop(){try{for(;this.#c;){let e=this.#s[this.#y];if(this.#$(!0),this.#u(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#p&&this.#d){let e=this.#d,t;for(;t=e?.shift();)this.#r?.(...t)}}}#$(e){let t=this.#y,n=this.#l[t],s=this.#s[t];return this.#S&&this.#u(s)?s.__abortController.abort(new Error("evicted")):(this.#m||this.#p)&&(this.#m&&this.#i?.(s,n,"evict"),this.#p&&this.#d?.push([s,n,"evict"])),this.#j(t),e&&(this.#l[t]=void 0,this.#s[t]=void 0,this.#k.push(t)),this.#c===1?(this.#y=this.#f=0,this.#k.length=0):this.#y=this.#g[t],this.#a.delete(n),this.#c--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=t,r=this.#a.get(e);if(r!==void 0){let o=this.#s[r];if(this.#u(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#T(r))s&&(s.has="stale",this.#C(s,r));else return n&&this.#M(r),s&&(s.has="hit",this.#C(s,r)),!0}else s&&(s.has="miss");return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,s=this.#a.get(e);if(s===void 0||!n&&this.#T(s))return;let r=this.#s[s];return this.#u(r)?r.__staleWhileFetching:r}#L(e,t,n,s){let r=t===void 0?void 0:this.#s[t];if(this.#u(r))return r;let o=new $i,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:n,context:s},l=(g,k=!1)=>{let{aborted:S}=o.signal,_=n.ignoreFetchAbort&&g!==void 0;if(n.status&&(S&&!k?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,_&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),S&&!_&&!k)return u(o.signal.reason);let b=p;return this.#s[t]===p&&(g===void 0?b.__staleWhileFetching?this.#s[t]=b.__staleWhileFetching:this.#P(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,g,c.options))),g},h=g=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=g),u(g)),u=g=>{let{aborted:k}=o.signal,S=k&&n.allowStaleOnFetchAbort,_=S||n.allowStaleOnFetchRejection,b=_||n.noDeleteOnFetchRejection,E=p;if(this.#s[t]===p&&(!b||E.__staleWhileFetching===void 0?this.#P(e,"fetch"):S||(this.#s[t]=E.__staleWhileFetching)),_)return n.status&&E.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),E.__staleWhileFetching;if(E.__returned===E)throw g},d=(g,k)=>{let S=this.#_?.(e,r,c);S&&S instanceof Promise&&S.then(_=>g(_===void 0?void 0:_),k),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(g(void 0),n.allowStaleOnFetchAbort&&(g=_=>l(_,!0)))})};n.status&&(n.status.fetchDispatched=!0);let p=new Promise(d).then(l,h),w=Object.assign(p,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return t===void 0?(this.set(e,w,{...c.options,status:void 0}),t=this.#a.get(e)):this.#s[t]=w,w}#u(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof $i}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:g,forceRefresh:k=!1,status:S,signal:_}=t;if(!this.#S)return S&&(S.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:S});let b={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:h,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:w,ignoreFetchAbort:p,status:S,signal:_},E=this.#a.get(e);if(E===void 0){S&&(S.fetch="miss");let O=this.#L(e,E,b,g);return O.__returned=O}else{let O=this.#s[E];if(this.#u(O)){let Xt=n&&O.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",Xt&&(S.returnedStale=!0)),Xt?O.__staleWhileFetching:O.__returned=O}let V=this.#T(E);if(!k&&!V)return S&&(S.fetch="hit"),this.#D(E),s&&this.#M(E),S&&this.#C(S,E),O;let X=this.#L(e,E,b,g),Oe=X.__staleWhileFetching!==void 0&&n;return S&&(S.fetch=V?"stale":"refresh",Oe&&V&&(S.returnedStale=!0)),Oe?X.__staleWhileFetching:X.__returned=X}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let n=this.#w;if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:r,...o}=t,a=this.get(e,o);if(!r&&a!==void 0)return a;let c=n(e,a,{options:o,context:s});return this.set(e,c,o),c}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=t,a=this.#a.get(e);if(a!==void 0){let c=this.#s[a],l=this.#u(c);return o&&this.#C(o,a),this.#T(a)?(o&&(o.get="stale"),l?(o&&n&&c.__staleWhileFetching!==void 0&&(o.returnedStale=!0),n?c.__staleWhileFetching:void 0):(r||this.#P(e,"expire"),o&&n&&(o.returnedStale=!0),n?c:void 0)):(o&&(o.get="hit"),l?c.__staleWhileFetching:(this.#D(a),s&&this.#M(a),c))}else o&&(o.get="miss")}#U(e,t){this.#x[t]=e,this.#g[e]=t}#D(e){e!==this.#f&&(e===this.#y?this.#y=this.#g[e]:this.#U(this.#x[e],this.#g[e]),this.#U(this.#f,e),this.#f=e)}delete(e){return this.#P(e,"delete")}#P(e,t){let n=!1;if(this.#c!==0){let s=this.#a.get(e);if(s!==void 0)if(n=!0,this.#c===1)this.#F(t);else{this.#j(s);let r=this.#s[s];if(this.#u(r)?r.__abortController.abort(new Error("deleted")):(this.#m||this.#p)&&(this.#m&&this.#i?.(r,e,t),this.#p&&this.#d?.push([r,e,t])),this.#a.delete(e),this.#l[s]=void 0,this.#s[s]=void 0,s===this.#f)this.#f=this.#x[s];else if(s===this.#y)this.#y=this.#g[s];else{let o=this.#x[s];this.#g[o]=this.#g[s];let a=this.#g[s];this.#x[a]=this.#x[s]}this.#c--,this.#k.push(s)}}if(this.#p&&this.#d?.length){let s=this.#d,r;for(;r=s?.shift();)this.#r?.(...r)}return n}clear(){return this.#F("delete")}#F(e){for(let t of this.#O({allowStale:!0})){let n=this.#s[t];if(this.#u(n))n.__abortController.abort(new Error("deleted"));else{let s=this.#l[t];this.#m&&this.#i?.(n,s,e),this.#p&&this.#d?.push([n,s,e])}}if(this.#a.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#v&&this.#b&&(this.#v.fill(0),this.#b.fill(0)),this.#E&&this.#E.fill(0),this.#y=0,this.#f=0,this.#k.length=0,this.#h=0,this.#c=0,this.#p&&this.#d){let t=this.#d,n;for(;n=t?.shift();)this.#r?.(...n)}}};var xn=require("node:path"),rc=require("node:url"),et=require("fs"),pd=ft(require("node:fs"),1),kt=require("node:fs/promises");var Bi=require("node:events"),Zr=ft(require("node:stream"),1),ec=require("node:string_decoder"),Xa=typeof process=="object"&&process?process:{stdout:null,stderr:null},rd=i=>!!i&&typeof i=="object"&&(i instanceof St||i instanceof Zr.default||od(i)||ad(i)),od=i=>!!i&&typeof i=="object"&&i instanceof Bi.EventEmitter&&typeof i.pipe=="function"&&i.pipe!==Zr.default.Writable.prototype.pipe,ad=i=>!!i&&typeof i=="object"&&i instanceof Bi.EventEmitter&&typeof i.write=="function"&&typeof i.end=="function",ot=Symbol("EOF"),at=Symbol("maybeEmitEnd"),xt=Symbol("emittedEnd"),Di=Symbol("emittingEnd"),Hn=Symbol("emittedError"),Fi=Symbol("closed"),Ya=Symbol("read"),Wi=Symbol("flush"),Qa=Symbol("flushChunk"),Ue=Symbol("encoding"),bn=Symbol("decoder"),le=Symbol("flowing"),Gn=Symbol("paused"),_n=Symbol("resume"),ue=Symbol("buffer"),ke=Symbol("pipes"),he=Symbol("bufferLength"),Wr=Symbol("bufferPush"),zi=Symbol("bufferShift"),be=Symbol("objectMode"),re=Symbol("destroyed"),zr=Symbol("error"),qr=Symbol("emitData"),Ka=Symbol("emitEnd"),Ur=Symbol("emitEnd2"),Qe=Symbol("async"),Br=Symbol("abort"),qi=Symbol("aborted"),Jn=Symbol("signal"),Ht=Symbol("dataListeners"),Me=Symbol("discarded"),Xn=i=>Promise.resolve().then(i),cd=i=>i(),ld=i=>i==="end"||i==="finish"||i==="prefinish",ud=i=>i instanceof ArrayBuffer||!!i&&typeof i=="object"&&i.constructor&&i.constructor.name==="ArrayBuffer"&&i.byteLength>=0,hd=i=>!Buffer.isBuffer(i)&&ArrayBuffer.isView(i),Ui=class{src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[_n](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Vr=class extends Ui{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=s=>t.emit("error",s),e.on("error",this.proxyErrors)}},fd=i=>!!i.objectMode,dd=i=>!i.objectMode&&!!i.encoding&&i.encoding!=="buffer",St=class extends Bi.EventEmitter{[le]=!1;[Gn]=!1;[ke]=[];[ue]=[];[be];[Ue];[Qe];[bn];[ot]=!1;[xt]=!1;[Di]=!1;[Fi]=!1;[Hn]=null;[he]=0;[re]=!1;[Jn];[qi]=!1;[Ht]=0;[Me]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");fd(t)?(this[be]=!0,this[Ue]=null):dd(t)?(this[Ue]=t.encoding,this[be]=!1):(this[be]=!1,this[Ue]=null),this[Qe]=!!t.async,this[bn]=this[Ue]?new ec.StringDecoder(this[Ue]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[ue]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[ke]});let{signal:n}=t;n&&(this[Jn]=n,n.aborted?this[Br]():n.addEventListener("abort",()=>this[Br]()))}get bufferLength(){return this[he]}get encoding(){return this[Ue]}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[be]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Qe]}set async(e){this[Qe]=this[Qe]||!!e}[Br](){this[qi]=!0,this.emit("abort",this[Jn]?.reason),this.destroy(this[Jn]?.reason)}get aborted(){return this[qi]}set aborted(e){}write(e,t,n){if(this[qi])return!1;if(this[ot])throw new Error("write after end");if(this[re])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(n=t,t="utf8"),t||(t="utf8");let s=this[Qe]?Xn:cd;if(!this[be]&&!Buffer.isBuffer(e)){if(hd(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(ud(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[be]?(this[le]&&this[he]!==0&&this[Wi](!0),this[le]?this.emit("data",e):this[Wr](e),this[he]!==0&&this.emit("readable"),n&&s(n),this[le]):e.length?(typeof e=="string"&&!(t===this[Ue]&&!this[bn]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Ue]&&(e=this[bn].write(e)),this[le]&&this[he]!==0&&this[Wi](!0),this[le]?this.emit("data",e):this[Wr](e),this[he]!==0&&this.emit("readable"),n&&s(n),this[le]):(this[he]!==0&&this.emit("readable"),n&&s(n),this[le])}read(e){if(this[re])return null;if(this[Me]=!1,this[he]===0||e===0||e&&e>this[he])return this[at](),null;this[be]&&(e=null),this[ue].length>1&&!this[be]&&(this[ue]=[this[Ue]?this[ue].join(""):Buffer.concat(this[ue],this[he])]);let t=this[Ya](e||null,this[ue][0]);return this[at](),t}[Ya](e,t){if(this[be])this[zi]();else{let n=t;e===n.length||e===null?this[zi]():typeof n=="string"?(this[ue][0]=n.slice(e),t=n.slice(0,e),this[he]-=e):(this[ue][0]=n.subarray(e),t=n.subarray(0,e),this[he]-=e)}return this.emit("data",t),!this[ue].length&&!this[ot]&&this.emit("drain"),t}end(e,t,n){return typeof e=="function"&&(n=e,e=void 0),typeof t=="function"&&(n=t,t="utf8"),e!==void 0&&this.write(e,t),n&&this.once("end",n),this[ot]=!0,this.writable=!1,(this[le]||!this[Gn])&&this[at](),this}[_n](){this[re]||(!this[Ht]&&!this[ke].length&&(this[Me]=!0),this[Gn]=!1,this[le]=!0,this.emit("resume"),this[ue].length?this[Wi]():this[ot]?this[at]():this.emit("drain"))}resume(){return this[_n]()}pause(){this[le]=!1,this[Gn]=!0,this[Me]=!1}get destroyed(){return this[re]}get flowing(){return this[le]}get paused(){return this[Gn]}[Wr](e){this[be]?this[he]+=1:this[he]+=e.length,this[ue].push(e)}[zi](){return this[be]?this[he]-=1:this[he]-=this[ue][0].length,this[ue].shift()}[Wi](e=!1){do;while(this[Qa](this[zi]())&&this[ue].length);!e&&!this[ue].length&&!this[ot]&&this.emit("drain")}[Qa](e){return this.emit("data",e),this[le]}pipe(e,t){if(this[re])return e;this[Me]=!1;let n=this[xt];return t=t||{},e===Xa.stdout||e===Xa.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[ke].push(t.proxyErrors?new Vr(this,e,t):new Ui(this,e,t)),this[Qe]?Xn(()=>this[_n]()):this[_n]()),e}unpipe(e){let t=this[ke].find(n=>n.dest===e);t&&(this[ke].length===1?(this[le]&&this[Ht]===0&&(this[le]=!1),this[ke]=[]):this[ke].splice(this[ke].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e==="data")this[Me]=!1,this[Ht]++,!this[ke].length&&!this[le]&&this[_n]();else if(e==="readable"&&this[he]!==0)super.emit("readable");else if(ld(e)&&this[xt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Hn]){let s=t;this[Qe]?Xn(()=>s.call(this,this[Hn])):s.call(this,this[Hn])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e==="data"&&(this[Ht]=this.listeners("data").length,this[Ht]===0&&!this[Me]&&!this[ke].length&&(this[le]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Ht]=0,!this[Me]&&!this[ke].length&&(this[le]=!1)),t}get emittedEnd(){return this[xt]}[at](){!this[Di]&&!this[xt]&&!this[re]&&this[ue].length===0&&this[ot]&&(this[Di]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Fi]&&this.emit("close"),this[Di]=!1)}emit(e,...t){let n=t[0];if(e!=="error"&&e!=="close"&&e!==re&&this[re])return!1;if(e==="data")return!this[be]&&!n?!1:this[Qe]?(Xn(()=>this[qr](n)),!0):this[qr](n);if(e==="end")return this[Ka]();if(e==="close"){if(this[Fi]=!0,!this[xt]&&!this[re])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[Hn]=n,super.emit(zr,n);let r=!this[Jn]||this.listeners("error").length?super.emit("error",n):!1;return this[at](),r}else if(e==="resume"){let r=super.emit("resume");return this[at](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let s=super.emit(e,...t);return this[at](),s}[qr](e){for(let n of this[ke])n.dest.write(e)===!1&&this.pause();let t=this[Me]?!1:super.emit("data",e);return this[at](),t}[Ka](){return this[xt]?!1:(this[xt]=!0,this.readable=!1,this[Qe]?(Xn(()=>this[Ur]()),!0):this[Ur]())}[Ur](){if(this[bn]){let t=this[bn].end();if(t){for(let n of this[ke])n.dest.write(t);this[Me]||super.emit("data",t)}}for(let t of this[ke])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[be]||(e.dataLength=0);let t=this.promise();return this.on("data",n=>{e.push(n),this[be]||(e.dataLength+=n.length)}),await t,e}async concat(){if(this[be])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Ue]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(re,()=>t(new Error("stream destroyed"))),this.on("error",n=>t(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Me]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[ot])return t();let r,o,a=u=>{this.off("data",c),this.off("end",l),this.off(re,h),t(),o(u)},c=u=>{this.off("error",a),this.off("end",l),this.off(re,h),this.pause(),r({value:u,done:!!this[ot]})},l=()=>{this.off("error",a),this.off("data",c),this.off(re,h),t(),r({done:!0,value:void 0})},h=()=>a(new Error("stream destroyed"));return new Promise((u,d)=>{o=d,r=u,this.once(re,h),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Me]=!1;let e=!1,t=()=>(this.pause(),this.off(zr,t),this.off(re,t),this.off("end",t),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return t();let s=this.read();return s===null?t():{done:!1,value:s}};return this.once("end",t),this.once(zr,t),this.once(re,t),{next:n,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[re])return e?this.emit("error",e):this.emit(re),this;this[re]=!0,this[Me]=!0,this[ue].length=0,this[he]=0;let t=this;return typeof t.close=="function"&&!this[Fi]&&t.close(),e?this.emit("error",e):this.emit(re),this}static get isStream(){return rd}};var md=et.realpathSync.native,Qn={lstatSync:et.lstatSync,readdir:et.readdir,readdirSync:et.readdirSync,readlinkSync:et.readlinkSync,realpathSync:md,promises:{lstat:kt.lstat,readdir:kt.readdir,readlink:kt.readlink,realpath:kt.realpath}},oc=i=>!i||i===Qn||i===pd?Qn:{...Qn,...i,promises:{...Qn.promises,...i.promises||{}}},ac=/^\\\\\?\\([a-z]:)\\?$/i,gd=i=>i.replace(/\//g,"\\").replace(ac,"$1\\"),yd=/[\\\/]/,Fe=0,cc=1,lc=2,Ke=4,uc=6,hc=8,Gt=10,fc=12,De=15,Yn=~De,Hr=16,tc=32,Kn=64,Be=128,Vi=256,Hi=512,nc=Kn|Be|Hi,wd=1023,Gr=i=>i.isFile()?hc:i.isDirectory()?Ke:i.isSymbolicLink()?Gt:i.isCharacterDevice()?lc:i.isBlockDevice()?uc:i.isSocket()?fc:i.isFIFO()?cc:Fe,ic=new Map,ei=i=>{let e=ic.get(i);if(e)return e;let t=i.normalize("NFKD");return ic.set(i,t),t},sc=new Map,Zi=i=>{let e=sc.get(i);if(e)return e;let t=ei(i.toLowerCase());return sc.set(i,t),t},Gi=class extends Zn{constructor(){super({max:256})}},Jr=class extends Zn{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},dc=Symbol("PathScurry setAsCwd"),_e=class{name;root;roots;parent;nocase;isCWD=!1;#e;#n;get dev(){return this.#n}#i;get mode(){return this.#i}#t;get nlink(){return this.#t}#r;get uid(){return this.#r}#_;get gid(){return this.#_}#w;get rdev(){return this.#w}#c;get blksize(){return this.#c}#h;get ino(){return this.#h}#a;get size(){return this.#a}#l;get blocks(){return this.#l}#s;get atimeMs(){return this.#s}#g;get mtimeMs(){return this.#g}#x;get ctimeMs(){return this.#x}#y;get birthtimeMs(){return this.#y}#f;get atime(){return this.#f}#k;get mtime(){return this.#k}#d;get ctime(){return this.#d}#E;get birthtime(){return this.#E}#b;#v;#m;#S;#p;#A;#o;#M;#C;#N;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Fe,n,s,r,o,a){this.name=e,this.#b=r?Zi(e):ei(e),this.#o=t&wd,this.nocase=r,this.roots=s,this.root=n||this,this.#M=o,this.#m=a.fullpath,this.#p=a.relative,this.#A=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=oc(a.fs)}depth(){return this.#v!==void 0?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#M}resolve(e){if(!e)return this;let t=this.getRootString(e),s=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#T(s):this.#T(s)}#T(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#M.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#M.set(this,t),this.#o&=~Hr,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),s=this.nocase?Zi(e):ei(e);for(let c of n)if(c.#b===s)return c;let r=this.parent?this.sep:"",o=this.#m?this.#m+r+e:void 0,a=this.newChild(e,Fe,{...t,parent:this,fullpath:o});return this.canReaddir()||(a.#o|=Be),n.push(a),a}relative(){if(this.isCWD)return"";if(this.#p!==void 0)return this.#p;let e=this.name,t=this.parent;if(!t)return this.#p=this.name;let n=t.relative();return n+(!n||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let e=this.name,t=this.parent;if(!t)return this.#A=this.fullpathPosix();let n=t.relativePosix();return n+(!n||!t.parent?"":"/")+e}fullpath(){if(this.#m!==void 0)return this.#m;let e=this.name,t=this.parent;if(!t)return this.#m=this.name;let s=t.fullpath()+(t.parent?this.sep:"")+e;return this.#m=s}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep==="/")return this.#S=this.fullpath();if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(s)?this.#S=`//?/${s}`:this.#S=s}let e=this.parent,t=e.fullpathPosix(),n=t+(!t||!e.parent?"":"/")+this.name;return this.#S=n}isUnknown(){return(this.#o&De)===Fe}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.#o&De)===hc}isDirectory(){return(this.#o&De)===Ke}isCharacterDevice(){return(this.#o&De)===lc}isBlockDevice(){return(this.#o&De)===uc}isFIFO(){return(this.#o&De)===cc}isSocket(){return(this.#o&De)===fc}isSymbolicLink(){return(this.#o&Gt)===Gt}lstatCached(){return this.#o&tc?this:void 0}readlinkCached(){return this.#C}realpathCached(){return this.#N}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#C)return!0;if(!this.parent)return!1;let e=this.#o&De;return!(e!==Fe&&e!==Gt||this.#o&Vi||this.#o&Be)}calledReaddir(){return!!(this.#o&Hr)}isENOENT(){return!!(this.#o&Be)}isNamed(e){return this.nocase?this.#b===Zi(e):this.#b===ei(e)}async readlink(){let e=this.#C;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(t);if(n)return this.#C=n}catch(t){this.#$(t.code);return}}readlinkSync(){let e=this.#C;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(t);if(n)return this.#C=n}catch(t){this.#$(t.code);return}}#W(e){this.#o|=Hr;for(let t=e.provisional;t<e.length;t++){let n=e[t];n&&n.#j()}}#j(){this.#o&Be||(this.#o=(this.#o|Be)&Yn,this.#I())}#I(){let e=this.children();e.provisional=0;for(let t of e)t.#j()}#z(){this.#o|=Hi,this.#R()}#R(){if(this.#o&Kn)return;let e=this.#o;(e&De)===Ke&&(e&=Yn),this.#o=e|Kn,this.#I()}#O(e=""){e==="ENOTDIR"||e==="EPERM"?this.#R():e==="ENOENT"?this.#j():this.children().provisional=0}#q(e=""){e==="ENOTDIR"?this.parent.#R():e==="ENOENT"&&this.#j()}#$(e=""){let t=this.#o;t|=Vi,e==="ENOENT"&&(t|=Be),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Yn),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#R()}#L(e,t){return this.#U(e,t)||this.#u(e,t)}#u(e,t){let n=Gr(e),s=this.newChild(e.name,n,{parent:this}),r=s.#o&De;return r!==Ke&&r!==Gt&&r!==Fe&&(s.#o|=Kn),t.unshift(s),t.provisional++,s}#U(e,t){for(let n=t.provisional;n<t.length;n++){let s=t[n];if((this.nocase?Zi(e.name):ei(e.name))===s.#b)return this.#D(e,s,n,t)}}#D(e,t,n,s){let r=t.name;return t.#o=t.#o&Yn|Gr(e),r!==e.name&&(t.name=e.name),n!==s.provisional&&(n===s.length-1?s.pop():s.splice(n,1),s.unshift(t)),s.provisional++,t}async lstat(){if((this.#o&Be)===0)try{return this.#P(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#q(e.code)}}lstatSync(){if((this.#o&Be)===0)try{return this.#P(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#q(e.code)}}#P(e){let{atime:t,atimeMs:n,birthtime:s,birthtimeMs:r,blksize:o,blocks:a,ctime:c,ctimeMs:l,dev:h,gid:u,ino:d,mode:p,mtime:w,mtimeMs:g,nlink:k,rdev:S,size:_,uid:b}=e;this.#f=t,this.#s=n,this.#E=s,this.#y=r,this.#c=o,this.#l=a,this.#d=c,this.#x=l,this.#n=h,this.#_=u,this.#h=d,this.#i=p,this.#k=w,this.#g=g,this.#t=k,this.#w=S,this.#a=_,this.#r=b;let E=Gr(e);this.#o=this.#o&Yn|E|tc,E!==Fe&&E!==Ke&&E!==Gt&&(this.#o|=Kn)}#F=[];#V=!1;#Z(e){this.#V=!1;let t=this.#F.slice();this.#F.length=0,t.forEach(n=>n(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let r=n.slice(0,n.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#F.push(e),this.#V)return;this.#V=!0;let s=this.fullpath();this.#e.readdir(s,{withFileTypes:!0},(r,o)=>{if(r)this.#O(r.code),n.provisional=0;else{for(let a of o)this.#L(a,n);this.#W(n)}this.#Z(n.slice(0,n.provisional))})}#B;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#B)await this.#B;else{let n=()=>{};this.#B=new Promise(s=>n=s);try{for(let s of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#L(s,e);this.#W(e)}catch(s){this.#O(s.code),e.provisional=0}this.#B=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let n of this.#e.readdirSync(t,{withFileTypes:!0}))this.#L(n,e);this.#W(e)}catch(n){this.#O(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&nc)return!1;let e=De&this.#o;return e===Fe||e===Ke||e===Gt}shouldWalk(e,t){return(this.#o&Ke)===Ke&&!(this.#o&nc)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#N)return this.#N;if(!((Hi|Vi|Be)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#N=this.resolve(e)}catch{this.#z()}}realpathSync(){if(this.#N)return this.#N;if(!((Hi|Vi|Be)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#N=this.resolve(e)}catch{this.#z()}}[dc](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),n=[],s=this;for(;s&&s.parent;)t.add(s),s.#p=n.join(this.sep),s.#A=n.join("/"),s=s.parent,n.push("..");for(s=e;s&&s.parent&&!t.has(s);)s.#p=void 0,s.#A=void 0,s=s.parent}},Ji=class i extends _e{sep="\\";splitSep=yd;constructor(e,t=Fe,n,s,r,o,a){super(e,t,n,s,r,o,a)}newChild(e,t=Fe,n={}){return new i(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return xn.win32.parse(e).root}getRoot(e){if(e=gd(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new Sn(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(ac,"$1\\"),e===t}},Xi=class i extends _e{splitSep="/";sep="/";constructor(e,t=Fe,n,s,r,o,a){super(e,t,n,s,r,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=Fe,n={}){return new i(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}},Yi=class{root;rootPath;roots;cwd;#e;#n;#i;nocase;#t;constructor(e=process.cwd(),t,n,{nocase:s,childrenCacheSize:r=16*1024,fs:o=Qn}={}){this.#t=oc(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,rc.fileURLToPath)(e));let a=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new Gi,this.#n=new Gi,this.#i=new Jr(r);let c=a.substring(this.rootPath.length).split(n);if(c.length===1&&!c[0]&&c.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let l=this.root,h=c.length-1,u=t.sep,d=this.rootPath,p=!1;for(let w of c){let g=h--;l=l.child(w,{relative:new Array(g).fill("..").join(u),relativePosix:new Array(g).fill("..").join("/"),fullpath:d+=(p?"":u)+w}),p=!0}this.cwd=l}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#i}resolve(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let n=this.#e.get(t);if(n!==void 0)return n;let s=this.cwd.resolve(t).fullpath();return this.#e.set(t,s),s}resolvePosix(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let n=this.#n.get(t);if(n!==void 0)return n;let s=this.cwd.resolve(t).fullpathPosix();return this.#n.set(t,s),s}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,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(e.canReaddir()){let s=await e.readdir();return n?s:s.map(r=>r.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(s=>s.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:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(n?e:e.fullpath());let c=new Set,l=(u,d)=>{c.add(u),u.readdirCB((p,w)=>{if(p)return d(p);let g=w.length;if(!g)return d();let k=()=>{--g===0&&d()};for(let S of w)(!r||r(S))&&a.push(n?S:S.fullpath()),s&&S.isSymbolicLink()?S.realpath().then(_=>_?.isUnknown()?_.lstat():_).then(_=>_?.shouldWalk(c,o)?l(_,k):k()):S.shouldWalk(c,o)?l(S,k):k()},!0)},h=e;return new Promise((u,d)=>{l(h,p=>{if(p)return d(p);u(a)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(n?e:e.fullpath());let c=new Set([e]);for(let l of c){let h=l.readdirSync();for(let u of h){(!r||r(u))&&a.push(n?u:u.fullpath());let d=u;if(u.isSymbolicLink()){if(!(s&&(d=u.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,o)&&c.add(d)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:r,walkFilter:o}=t;(!r||r(e))&&(yield n?e:e.fullpath());let a=new Set([e]);for(let c of a){let l=c.readdirSync();for(let h of l){(!r||r(h))&&(yield n?h:h.fullpath());let u=h;if(h.isSymbolicLink()){if(!(s&&(u=h.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(a,o)&&a.add(u)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:r,walkFilter:o}=t,a=new St({objectMode:!0});(!r||r(e))&&a.write(n?e:e.fullpath());let c=new Set,l=[e],h=0,u=()=>{let d=!1;for(;!d;){let p=l.shift();if(!p){h===0&&a.end();return}h++,c.add(p);let w=(k,S,_=!1)=>{if(k)return a.emit("error",k);if(s&&!_){let b=[];for(let E of S)E.isSymbolicLink()&&b.push(E.realpath().then(O=>O?.isUnknown()?O.lstat():O));if(b.length){Promise.all(b).then(()=>w(null,S,!0));return}}for(let b of S)b&&(!r||r(b))&&(a.write(n?b:b.fullpath())||(d=!0));h--;for(let b of S){let E=b.realpathCached()||b;E.shouldWalk(c,o)&&l.push(E)}d&&!a.flowing?a.once("drain",u):g||u()},g=!0;p.readdirCB(w,!0),g=!1}};return u(),a}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:r,walkFilter:o}=t,a=new St({objectMode:!0}),c=new Set;(!r||r(e))&&a.write(n?e:e.fullpath());let l=[e],h=0,u=()=>{let d=!1;for(;!d;){let p=l.shift();if(!p){h===0&&a.end();return}h++,c.add(p);let w=p.readdirSync();for(let g of w)(!r||r(g))&&(a.write(n?g:g.fullpath())||(d=!0));h--;for(let g of w){let k=g;if(g.isSymbolicLink()){if(!(s&&(k=g.realpathSync())))continue;k.isUnknown()&&k.lstatSync()}k.shouldWalk(c,o)&&l.push(k)}}d&&!a.flowing&&a.once("drain",u)};return u(),a}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[dc](t)}},Sn=class extends Yi{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,xn.win32,"\\",{...t,nocase:n}),this.nocase=n;for(let s=this.cwd;s;s=s.parent)s.nocase=this.nocase}parseRootPath(e){return xn.win32.parse(e).root.toUpperCase()}newRoot(e){return new Ji(this.rootPath,Ke,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},kn=class extends Yi{sep="/";constructor(e=process.cwd(),t={}){let{nocase:n=!1}=t;super(e,xn.posix,"/",{...t,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new Xi(this.rootPath,Ke,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},ti=class extends kn{constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}},qm=process.platform==="win32"?Ji:Xi,pc=process.platform==="win32"?Sn:process.platform==="darwin"?ti:kn;var vd=i=>i.length>=1,bd=i=>i.length>=1,En=class i{#e;#n;#i;length;#t;#r;#_;#w;#c;#h;#a=!0;constructor(e,t,n,s){if(!vd(e))throw new TypeError("empty pattern list");if(!bd(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=t,this.#i=n,this.#t=s,this.#i===0){if(this.isUNC()){let[r,o,a,c,...l]=this.#e,[h,u,d,p,...w]=this.#n;l[0]===""&&(l.shift(),w.shift());let g=[r,o,a,c,""].join("/"),k=[h,u,d,p,""].join("/");this.#e=[g,...l],this.#n=[k,...w],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=this.#e,[a,...c]=this.#n;o[0]===""&&(o.shift(),c.shift());let l=r+"/",h=a+"/";this.#e=[l,...o],this.#n=[h,...c],this.length=this.#e.length}}}pattern(){return this.#e[this.#i]}isString(){return typeof this.#e[this.#i]=="string"}isGlobstar(){return this.#e[this.#i]===se}isRegExp(){return this.#e[this.#i]instanceof RegExp}globString(){return this.#_=this.#_||(this.#i===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#i).join("/"))}hasMore(){return this.length>this.#i+1}rest(){return this.#r!==void 0?this.#r:this.hasMore()?(this.#r=new i(this.#e,this.#n,this.#i+1,this.#t),this.#r.#h=this.#h,this.#r.#c=this.#c,this.#r.#w=this.#w,this.#r):this.#r=null}isUNC(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=this.#t==="win32"&&this.#i===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#w!==void 0?this.#w:this.#w=this.#t==="win32"&&this.#i===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#h!==void 0?this.#h:this.#h=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#i===0?e:""}checkFollowGlobstar(){return!(this.#i===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#i===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var _d=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Cn=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:s,noglobstar:r,platform:o=_d}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:s,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let t=new Pe(e,this.mmopts);for(let n=0;n<t.set.length;n++){let s=t.set[n],r=t.globParts[n];if(!s||!r)throw new Error("invalid pattern object");for(;s[0]==="."&&r[0]===".";)s.shift(),r.shift();let o=new En(s,r,0,this.platform),a=new Pe(o.globString(),this.mmopts),c=r[r.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 t=e.fullpath(),n=`${t}/`,s=e.relative()||".",r=`${s}/`;for(let o of this.relative)if(o.match(s)||o.match(r))return!0;for(let o of this.absolute)if(o.match(t)||o.match(n))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(n))return!0;for(let s of this.absoluteChildren)if(s.match(t))return!0;return!1}};var Xr=class i{store;constructor(e=new Map){this.store=e}copy(){return new i(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let n=e.fullpath(),s=this.store.get(n);s?s.add(t.globString()):this.store.set(n,new Set([t.globString()]))}},Yr=class{store=new Map;add(e,t,n){let s=(t?2:0)|(n?1:0),r=this.store.get(e);this.store.set(e,r===void 0?s:s&r)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},Qr=class{store=new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(s=>s.globString()===t.globString())||n.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},ni=class i{hasWalkedCache;matches=new Yr;subwalks=new Qr;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new Xr}processPatterns(e,t){this.patterns=t;let n=t.map(s=>[e,s]);for(let[s,r]of n){this.hasWalkedCache.storeWalked(s,r);let o=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(o){s=s.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let u=r.rest();if(u)r=u;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let c,l,h=!1;for(;typeof(c=r.pattern())=="string"&&(l=r.rest());)s=s.resolve(c),r=l,h=!0;if(c=r.pattern(),l=r.rest(),h){if(this.hasWalkedCache.hasWalked(s,r))continue;this.hasWalkedCache.storeWalked(s,r)}if(typeof c=="string"){let u=c===".."||c===""||c===".";this.matches.add(s.resolve(c),a,u);continue}else if(c===se){(!s.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(s,r);let u=l?.pattern(),d=l?.rest();if(!l||(u===""||u===".")&&!d)this.matches.add(s,a,u===""||u===".");else if(u===".."){let p=s.parent||s;d?this.hasWalkedCache.hasWalked(p,d)||this.subwalks.add(p,d):this.matches.add(p,a,!0)}}else c instanceof RegExp&&this.subwalks.add(s,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new i(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),s=this.child();for(let r of t)for(let o of n){let a=o.isAbsolute(),c=o.pattern(),l=o.rest();c===se?s.testGlobstar(r,o,l,a):c instanceof RegExp?s.testRegExp(r,c,l,a):s.testString(r,c,l,a)}return s}testGlobstar(e,t,n,s){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,s,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let r=n.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(e,r,n.rest(),s);else if(r===".."){let o=e.parent||e;this.subwalks.add(o,n)}else r instanceof RegExp&&this.testRegExp(e,r,n.rest(),s)}}testRegExp(e,t,n,s){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,s,!1))}testString(e,t,n,s){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,s,!1))}};var xd=(i,e)=>typeof i=="string"?new Cn([i],e):Array.isArray(i)?new Cn(i,e):i,Qi=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#n;#i;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#i=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#n=xd(n.ignore??[],n),!this.includeChildMatches&&typeof this.#n.add!="function")){let s="cannot ignore child matches, ignore lacks add() method.";throw new Error(s)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#n?.ignored?.(e)}#r(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,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=await r.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||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,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=r.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#n?.add){let r=`${e.relativePosix()}/**`;this.#n.add(r)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let s=this.opts.mark&&e.isDirectory()?this.#i:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let r=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(r+s)}else{let r=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#i)?"."+this.#i:"";this.matchEmit(r?o+r+s:"."+s)}}async match(e,t,n){let s=await this.matchCheck(e,n);s&&this.matchFinish(s,t)}matchSync(e,t,n){let s=this.matchCheckSync(e,n);s&&this.matchFinish(s,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new ni(this.opts),n)}walkCB2(e,t,n,s){if(this.#r(e))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,s));return}n.processPatterns(e,t);let r=1,o=()=>{--r===0&&s()};for(let[a,c,l]of n.matches.entries())this.#t(a)||(r++,this.match(a,c,l).then(()=>o()));for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,n,o):a.readdirCB((l,h)=>this.walkCB3(a,h,n,o),!0)}o()}walkCB3(e,t,n,s){n=n.filterEntries(e,t);let r=1,o=()=>{--r===0&&s()};for(let[a,c,l]of n.matches.entries())this.#t(a)||(r++,this.match(a,c,l).then(()=>o()));for(let[a,c]of n.subwalks.entries())r++,this.walkCB2(a,c,n.child(),o);o()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new ni(this.opts),n)}walkCB2Sync(e,t,n,s){if(this.#r(e))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,s));return}n.processPatterns(e,t);let r=1,o=()=>{--r===0&&s()};for(let[a,c,l]of n.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let c=a.readdirSync();this.walkCB3Sync(a,c,n,o)}o()}walkCB3Sync(e,t,n,s){n=n.filterEntries(e,t);let r=1,o=()=>{--r===0&&s()};for(let[a,c,l]of n.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let[a,c]of n.subwalks.entries())r++,this.walkCB2Sync(a,c,n.child(),o);o()}},ii=class extends Qi{matches=new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(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}},si=class extends Qi{results;constructor(e,t,n){super(e,t,n),this.results=new St({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 Sd=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ve=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,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,mc.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=e,this.platform=t.platform||Sd,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=t.platform==="win32"?Sn:t.platform==="darwin"?ti:t.platform?kn:pc;this.scurry=new c(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",s={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(c=>new Pe(c,s)),[o,a]=r.reduce((c,l)=>(c[0].push(...l.set),c[1].push(...l.globParts),c),[[],[]]);this.patterns=o.map((c,l)=>{let h=a[l];if(!h)throw new Error("invalid pattern object");return new En(c,h,0,this.platform)})}async walk(){return[...await new ii(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 ii(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 si(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 si(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 Kr=(i,e={})=>{Array.isArray(i)||(i=[i]);for(let t of i)if(new Pe(t,e).hasMagic())return!0;return!1};function Ki(i,e={}){return new Ve(i,e).streamSync()}function wc(i,e={}){return new Ve(i,e).stream()}function es(i,e={}){return new Ve(i,e).walkSync()}async function gc(i,e={}){return new Ve(i,e).walk()}function ts(i,e={}){return new Ve(i,e).iterateSync()}function vc(i,e={}){return new Ve(i,e).iterate()}var kd=Ki,Ed=Object.assign(wc,{sync:Ki}),Cd=ts,Td=Object.assign(vc,{sync:ts}),Rd=Object.assign(es,{stream:Ki,iterate:ts}),yc=Object.assign(gc,{glob:gc,globSync:es,sync:Rd,globStream:wc,stream:Ed,globStreamSync:Ki,streamSync:kd,globIterate:vc,iterate:Td,globIterateSync:ts,iterateSync:Cd,Glob:Ve,hasMagic:Kr,escape:yn,unescape:qe});yc.glob=yc;var eo={name:"dts-linter",version:"0.4.1",main:"index.js",repository:{type:"git",url:"https://github.com/kylebonnici/dts-linter"},scripts:{compile:"node ./esbuild.js","compile:prod":"node ./esbuild.js --production"},bin:"./dist/dts-linter.js",files:["dist/dts-linter.js","THIRD_PARTY_LICENSES.txt"],keywords:["dts","linter","devicetree","formatting"],author:"Kyle Micallef Bonnici",license:"Apache-2.0",description:"",dependencies:{"devicetree-language-server":"^0.8.1"},devDependencies:{"@types/node":"^24.0.3","devicetree-language-server-types":"^0.0.2-alpha.8",diff:"^8.0.2",esbuild:"^0.25.5",glob:"^11.1.0","license-checker":"^25.0.1","ts-node":"^10.9.2",typescript:"^5.8.3","vscode-jsonrpc":"^8.2.1","vscode-languageserver-types":"^3.17.5",zod:"^3.25.67"}};var bc;(function(i){function e(t){return typeof t=="string"}i.is=e})(bc||(bc={}));var to;(function(i){function e(t){return typeof t=="string"}i.is=e})(to||(to={}));var _c;(function(i){i.MIN_VALUE=-2147483648,i.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&i.MIN_VALUE<=t&&t<=i.MAX_VALUE}i.is=e})(_c||(_c={}));var ns;(function(i){i.MIN_VALUE=0,i.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&i.MIN_VALUE<=t&&t<=i.MAX_VALUE}i.is=e})(ns||(ns={}));var Ze;(function(i){function e(n,s){return n===Number.MAX_VALUE&&(n=ns.MAX_VALUE),s===Number.MAX_VALUE&&(s=ns.MAX_VALUE),{line:n,character:s}}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&m.uinteger(s.line)&&m.uinteger(s.character)}i.is=t})(Ze||(Ze={}));var oe;(function(i){function e(n,s,r,o){if(m.uinteger(n)&&m.uinteger(s)&&m.uinteger(r)&&m.uinteger(o))return{start:Ze.create(n,s),end:Ze.create(r,o)};if(Ze.is(n)&&Ze.is(s))return{start:n,end:s};throw new Error(`Range#create called with invalid arguments[${n}, ${s}, ${r}, ${o}]`)}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&Ze.is(s.start)&&Ze.is(s.end)}i.is=t})(oe||(oe={}));var is;(function(i){function e(n,s){return{uri:n,range:s}}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&oe.is(s.range)&&(m.string(s.uri)||m.undefined(s.uri))}i.is=t})(is||(is={}));var xc;(function(i){function e(n,s,r,o){return{targetUri:n,targetRange:s,targetSelectionRange:r,originSelectionRange:o}}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&oe.is(s.targetRange)&&m.string(s.targetUri)&&oe.is(s.targetSelectionRange)&&(oe.is(s.originSelectionRange)||m.undefined(s.originSelectionRange))}i.is=t})(xc||(xc={}));var no;(function(i){function e(n,s,r,o){return{red:n,green:s,blue:r,alpha:o}}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&m.numberRange(s.red,0,1)&&m.numberRange(s.green,0,1)&&m.numberRange(s.blue,0,1)&&m.numberRange(s.alpha,0,1)}i.is=t})(no||(no={}));var Sc;(function(i){function e(n,s){return{range:n,color:s}}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&oe.is(s.range)&&no.is(s.color)}i.is=t})(Sc||(Sc={}));var kc;(function(i){function e(n,s,r){return{label:n,textEdit:s,additionalTextEdits:r}}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&m.string(s.label)&&(m.undefined(s.textEdit)||Rn.is(s))&&(m.undefined(s.additionalTextEdits)||m.typedArray(s.additionalTextEdits,Rn.is))}i.is=t})(kc||(kc={}));var Ec;(function(i){i.Comment="comment",i.Imports="imports",i.Region="region"})(Ec||(Ec={}));var Cc;(function(i){function e(n,s,r,o,a,c){let l={startLine:n,endLine:s};return m.defined(r)&&(l.startCharacter=r),m.defined(o)&&(l.endCharacter=o),m.defined(a)&&(l.kind=a),m.defined(c)&&(l.collapsedText=c),l}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&m.uinteger(s.startLine)&&m.uinteger(s.startLine)&&(m.undefined(s.startCharacter)||m.uinteger(s.startCharacter))&&(m.undefined(s.endCharacter)||m.uinteger(s.endCharacter))&&(m.undefined(s.kind)||m.string(s.kind))}i.is=t})(Cc||(Cc={}));var io;(function(i){function e(n,s){return{location:n,message:s}}i.create=e;function t(n){let s=n;return m.defined(s)&&is.is(s.location)&&m.string(s.message)}i.is=t})(io||(io={}));var me;(function(i){i.Error=1,i.Warning=2,i.Information=3,i.Hint=4})(me||(me={}));var Tc;(function(i){i.Unnecessary=1,i.Deprecated=2})(Tc||(Tc={}));var Rc;(function(i){function e(t){let n=t;return m.objectLiteral(n)&&m.string(n.href)}i.is=e})(Rc||(Rc={}));var ss;(function(i){function e(n,s,r,o,a,c){let l={range:n,message:s};return m.defined(r)&&(l.severity=r),m.defined(o)&&(l.code=o),m.defined(a)&&(l.source=a),m.defined(c)&&(l.relatedInformation=c),l}i.create=e;function t(n){var s;let r=n;return m.defined(r)&&oe.is(r.range)&&m.string(r.message)&&(m.number(r.severity)||m.undefined(r.severity))&&(m.integer(r.code)||m.string(r.code)||m.undefined(r.code))&&(m.undefined(r.codeDescription)||m.string((s=r.codeDescription)===null||s===void 0?void 0:s.href))&&(m.string(r.source)||m.undefined(r.source))&&(m.undefined(r.relatedInformation)||m.typedArray(r.relatedInformation,io.is))}i.is=t})(ss||(ss={}));var Tn;(function(i){function e(n,s,...r){let o={title:n,command:s};return m.defined(r)&&r.length>0&&(o.arguments=r),o}i.create=e;function t(n){let s=n;return m.defined(s)&&m.string(s.title)&&m.string(s.command)}i.is=t})(Tn||(Tn={}));var Rn;(function(i){function e(r,o){return{range:r,newText:o}}i.replace=e;function t(r,o){return{range:{start:r,end:r},newText:o}}i.insert=t;function n(r){return{range:r,newText:""}}i.del=n;function s(r){let o=r;return m.objectLiteral(o)&&m.string(o.newText)&&oe.is(o.range)}i.is=s})(Rn||(Rn={}));var so;(function(i){function e(n,s,r){let o={label:n};return s!==void 0&&(o.needsConfirmation=s),r!==void 0&&(o.description=r),o}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&m.string(s.label)&&(m.boolean(s.needsConfirmation)||s.needsConfirmation===void 0)&&(m.string(s.description)||s.description===void 0)}i.is=t})(so||(so={}));var On;(function(i){function e(t){let n=t;return m.string(n)}i.is=e})(On||(On={}));var Oc;(function(i){function e(r,o,a){return{range:r,newText:o,annotationId:a}}i.replace=e;function t(r,o,a){return{range:{start:r,end:r},newText:o,annotationId:a}}i.insert=t;function n(r,o){return{range:r,newText:"",annotationId:o}}i.del=n;function s(r){let o=r;return Rn.is(o)&&(so.is(o.annotationId)||On.is(o.annotationId))}i.is=s})(Oc||(Oc={}));var ro;(function(i){function e(n,s){return{textDocument:n,edits:s}}i.create=e;function t(n){let s=n;return m.defined(s)&&uo.is(s.textDocument)&&Array.isArray(s.edits)}i.is=t})(ro||(ro={}));var oo;(function(i){function e(n,s,r){let o={kind:"create",uri:n};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(o.options=s),r!==void 0&&(o.annotationId=r),o}i.create=e;function t(n){let s=n;return s&&s.kind==="create"&&m.string(s.uri)&&(s.options===void 0||(s.options.overwrite===void 0||m.boolean(s.options.overwrite))&&(s.options.ignoreIfExists===void 0||m.boolean(s.options.ignoreIfExists)))&&(s.annotationId===void 0||On.is(s.annotationId))}i.is=t})(oo||(oo={}));var ao;(function(i){function e(n,s,r,o){let a={kind:"rename",oldUri:n,newUri:s};return r!==void 0&&(r.overwrite!==void 0||r.ignoreIfExists!==void 0)&&(a.options=r),o!==void 0&&(a.annotationId=o),a}i.create=e;function t(n){let s=n;return s&&s.kind==="rename"&&m.string(s.oldUri)&&m.string(s.newUri)&&(s.options===void 0||(s.options.overwrite===void 0||m.boolean(s.options.overwrite))&&(s.options.ignoreIfExists===void 0||m.boolean(s.options.ignoreIfExists)))&&(s.annotationId===void 0||On.is(s.annotationId))}i.is=t})(ao||(ao={}));var co;(function(i){function e(n,s,r){let o={kind:"delete",uri:n};return s!==void 0&&(s.recursive!==void 0||s.ignoreIfNotExists!==void 0)&&(o.options=s),r!==void 0&&(o.annotationId=r),o}i.create=e;function t(n){let s=n;return s&&s.kind==="delete"&&m.string(s.uri)&&(s.options===void 0||(s.options.recursive===void 0||m.boolean(s.options.recursive))&&(s.options.ignoreIfNotExists===void 0||m.boolean(s.options.ignoreIfNotExists)))&&(s.annotationId===void 0||On.is(s.annotationId))}i.is=t})(co||(co={}));var lo;(function(i){function e(t){let n=t;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(s=>m.string(s.kind)?oo.is(s)||ao.is(s)||co.is(s):ro.is(s)))}i.is=e})(lo||(lo={}));var Ac;(function(i){function e(n){return{uri:n}}i.create=e;function t(n){let s=n;return m.defined(s)&&m.string(s.uri)}i.is=t})(Ac||(Ac={}));var Nc;(function(i){function e(n,s){return{uri:n,version:s}}i.create=e;function t(n){let s=n;return m.defined(s)&&m.string(s.uri)&&m.integer(s.version)}i.is=t})(Nc||(Nc={}));var uo;(function(i){function e(n,s){return{uri:n,version:s}}i.create=e;function t(n){let s=n;return m.defined(s)&&m.string(s.uri)&&(s.version===null||m.integer(s.version))}i.is=t})(uo||(uo={}));var Pc;(function(i){function e(n,s,r,o){return{uri:n,languageId:s,version:r,text:o}}i.create=e;function t(n){let s=n;return m.defined(s)&&m.string(s.uri)&&m.string(s.languageId)&&m.integer(s.version)&&m.string(s.text)}i.is=t})(Pc||(Pc={}));var ho;(function(i){i.PlainText="plaintext",i.Markdown="markdown";function e(t){let n=t;return n===i.PlainText||n===i.Markdown}i.is=e})(ho||(ho={}));var ri;(function(i){function e(t){let n=t;return m.objectLiteral(t)&&ho.is(n.kind)&&m.string(n.value)}i.is=e})(ri||(ri={}));var Mc;(function(i){i.Text=1,i.Method=2,i.Function=3,i.Constructor=4,i.Field=5,i.Variable=6,i.Class=7,i.Interface=8,i.Module=9,i.Property=10,i.Unit=11,i.Value=12,i.Enum=13,i.Keyword=14,i.Snippet=15,i.Color=16,i.File=17,i.Reference=18,i.Folder=19,i.EnumMember=20,i.Constant=21,i.Struct=22,i.Event=23,i.Operator=24,i.TypeParameter=25})(Mc||(Mc={}));var jc;(function(i){i.PlainText=1,i.Snippet=2})(jc||(jc={}));var Lc;(function(i){i.Deprecated=1})(Lc||(Lc={}));var Ic;(function(i){function e(n,s,r){return{newText:n,insert:s,replace:r}}i.create=e;function t(n){let s=n;return s&&m.string(s.newText)&&oe.is(s.insert)&&oe.is(s.replace)}i.is=t})(Ic||(Ic={}));var $c;(function(i){i.asIs=1,i.adjustIndentation=2})($c||($c={}));var Dc;(function(i){function e(t){let n=t;return n&&(m.string(n.detail)||n.detail===void 0)&&(m.string(n.description)||n.description===void 0)}i.is=e})(Dc||(Dc={}));var Fc;(function(i){function e(t){return{label:t}}i.create=e})(Fc||(Fc={}));var Wc;(function(i){function e(t,n){return{items:t||[],isIncomplete:!!n}}i.create=e})(Wc||(Wc={}));var rs;(function(i){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}i.fromPlainText=e;function t(n){let s=n;return m.string(s)||m.objectLiteral(s)&&m.string(s.language)&&m.string(s.value)}i.is=t})(rs||(rs={}));var zc;(function(i){function e(t){let n=t;return!!n&&m.objectLiteral(n)&&(ri.is(n.contents)||rs.is(n.contents)||m.typedArray(n.contents,rs.is))&&(t.range===void 0||oe.is(t.range))}i.is=e})(zc||(zc={}));var qc;(function(i){function e(t,n){return n?{label:t,documentation:n}:{label:t}}i.create=e})(qc||(qc={}));var Uc;(function(i){function e(t,n,...s){let r={label:t};return m.defined(n)&&(r.documentation=n),m.defined(s)?r.parameters=s:r.parameters=[],r}i.create=e})(Uc||(Uc={}));var Bc;(function(i){i.Text=1,i.Read=2,i.Write=3})(Bc||(Bc={}));var Vc;(function(i){function e(t,n){let s={range:t};return m.number(n)&&(s.kind=n),s}i.create=e})(Vc||(Vc={}));var Zc;(function(i){i.File=1,i.Module=2,i.Namespace=3,i.Package=4,i.Class=5,i.Method=6,i.Property=7,i.Field=8,i.Constructor=9,i.Enum=10,i.Interface=11,i.Function=12,i.Variable=13,i.Constant=14,i.String=15,i.Number=16,i.Boolean=17,i.Array=18,i.Object=19,i.Key=20,i.Null=21,i.EnumMember=22,i.Struct=23,i.Event=24,i.Operator=25,i.TypeParameter=26})(Zc||(Zc={}));var Hc;(function(i){i.Deprecated=1})(Hc||(Hc={}));var Gc;(function(i){function e(t,n,s,r,o){let a={name:t,kind:n,location:{uri:r,range:s}};return o&&(a.containerName=o),a}i.create=e})(Gc||(Gc={}));var Jc;(function(i){function e(t,n,s,r){return r!==void 0?{name:t,kind:n,location:{uri:s,range:r}}:{name:t,kind:n,location:{uri:s}}}i.create=e})(Jc||(Jc={}));var Xc;(function(i){function e(n,s,r,o,a,c){let l={name:n,detail:s,kind:r,range:o,selectionRange:a};return c!==void 0&&(l.children=c),l}i.create=e;function t(n){let s=n;return s&&m.string(s.name)&&m.number(s.kind)&&oe.is(s.range)&&oe.is(s.selectionRange)&&(s.detail===void 0||m.string(s.detail))&&(s.deprecated===void 0||m.boolean(s.deprecated))&&(s.children===void 0||Array.isArray(s.children))&&(s.tags===void 0||Array.isArray(s.tags))}i.is=t})(Xc||(Xc={}));var Yc;(function(i){i.Empty="",i.QuickFix="quickfix",i.Refactor="refactor",i.RefactorExtract="refactor.extract",i.RefactorInline="refactor.inline",i.RefactorRewrite="refactor.rewrite",i.Source="source",i.SourceOrganizeImports="source.organizeImports",i.SourceFixAll="source.fixAll"})(Yc||(Yc={}));var os;(function(i){i.Invoked=1,i.Automatic=2})(os||(os={}));var Qc;(function(i){function e(n,s,r){let o={diagnostics:n};return s!=null&&(o.only=s),r!=null&&(o.triggerKind=r),o}i.create=e;function t(n){let s=n;return m.defined(s)&&m.typedArray(s.diagnostics,ss.is)&&(s.only===void 0||m.typedArray(s.only,m.string))&&(s.triggerKind===void 0||s.triggerKind===os.Invoked||s.triggerKind===os.Automatic)}i.is=t})(Qc||(Qc={}));var Kc;(function(i){function e(n,s,r){let o={title:n},a=!0;return typeof s=="string"?(a=!1,o.kind=s):Tn.is(s)?o.command=s:o.edit=s,a&&r!==void 0&&(o.kind=r),o}i.create=e;function t(n){let s=n;return s&&m.string(s.title)&&(s.diagnostics===void 0||m.typedArray(s.diagnostics,ss.is))&&(s.kind===void 0||m.string(s.kind))&&(s.edit!==void 0||s.command!==void 0)&&(s.command===void 0||Tn.is(s.command))&&(s.isPreferred===void 0||m.boolean(s.isPreferred))&&(s.edit===void 0||lo.is(s.edit))}i.is=t})(Kc||(Kc={}));var el;(function(i){function e(n,s){let r={range:n};return m.defined(s)&&(r.data=s),r}i.create=e;function t(n){let s=n;return m.defined(s)&&oe.is(s.range)&&(m.undefined(s.command)||Tn.is(s.command))}i.is=t})(el||(el={}));var tl;(function(i){function e(n,s){return{tabSize:n,insertSpaces:s}}i.create=e;function t(n){let s=n;return m.defined(s)&&m.uinteger(s.tabSize)&&m.boolean(s.insertSpaces)}i.is=t})(tl||(tl={}));var nl;(function(i){function e(n,s,r){return{range:n,target:s,data:r}}i.create=e;function t(n){let s=n;return m.defined(s)&&oe.is(s.range)&&(m.undefined(s.target)||m.string(s.target))}i.is=t})(nl||(nl={}));var il;(function(i){function e(n,s){return{range:n,parent:s}}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&oe.is(s.range)&&(s.parent===void 0||i.is(s.parent))}i.is=t})(il||(il={}));var sl;(function(i){i.namespace="namespace",i.type="type",i.class="class",i.enum="enum",i.interface="interface",i.struct="struct",i.typeParameter="typeParameter",i.parameter="parameter",i.variable="variable",i.property="property",i.enumMember="enumMember",i.event="event",i.function="function",i.method="method",i.macro="macro",i.keyword="keyword",i.modifier="modifier",i.comment="comment",i.string="string",i.number="number",i.regexp="regexp",i.operator="operator",i.decorator="decorator"})(sl||(sl={}));var rl;(function(i){i.declaration="declaration",i.definition="definition",i.readonly="readonly",i.static="static",i.deprecated="deprecated",i.abstract="abstract",i.async="async",i.modification="modification",i.documentation="documentation",i.defaultLibrary="defaultLibrary"})(rl||(rl={}));var ol;(function(i){function e(t){let n=t;return m.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}i.is=e})(ol||(ol={}));var al;(function(i){function e(n,s){return{range:n,text:s}}i.create=e;function t(n){let s=n;return s!=null&&oe.is(s.range)&&m.string(s.text)}i.is=t})(al||(al={}));var cl;(function(i){function e(n,s,r){return{range:n,variableName:s,caseSensitiveLookup:r}}i.create=e;function t(n){let s=n;return s!=null&&oe.is(s.range)&&m.boolean(s.caseSensitiveLookup)&&(m.string(s.variableName)||s.variableName===void 0)}i.is=t})(cl||(cl={}));var ll;(function(i){function e(n,s){return{range:n,expression:s}}i.create=e;function t(n){let s=n;return s!=null&&oe.is(s.range)&&(m.string(s.expression)||s.expression===void 0)}i.is=t})(ll||(ll={}));var ul;(function(i){function e(n,s){return{frameId:n,stoppedLocation:s}}i.create=e;function t(n){let s=n;return m.defined(s)&&oe.is(n.stoppedLocation)}i.is=t})(ul||(ul={}));var fo;(function(i){i.Type=1,i.Parameter=2;function e(t){return t===1||t===2}i.is=e})(fo||(fo={}));var po;(function(i){function e(n){return{value:n}}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&(s.tooltip===void 0||m.string(s.tooltip)||ri.is(s.tooltip))&&(s.location===void 0||is.is(s.location))&&(s.command===void 0||Tn.is(s.command))}i.is=t})(po||(po={}));var hl;(function(i){function e(n,s,r){let o={position:n,label:s};return r!==void 0&&(o.kind=r),o}i.create=e;function t(n){let s=n;return m.objectLiteral(s)&&Ze.is(s.position)&&(m.string(s.label)||m.typedArray(s.label,po.is))&&(s.kind===void 0||fo.is(s.kind))&&s.textEdits===void 0||m.typedArray(s.textEdits,Rn.is)&&(s.tooltip===void 0||m.string(s.tooltip)||ri.is(s.tooltip))&&(s.paddingLeft===void 0||m.boolean(s.paddingLeft))&&(s.paddingRight===void 0||m.boolean(s.paddingRight))}i.is=t})(hl||(hl={}));var fl;(function(i){function e(t){return{kind:"snippet",value:t}}i.createSnippet=e})(fl||(fl={}));var dl;(function(i){function e(t,n,s,r){return{insertText:t,filterText:n,range:s,command:r}}i.create=e})(dl||(dl={}));var pl;(function(i){function e(t){return{items:t}}i.create=e})(pl||(pl={}));var ml;(function(i){i.Invoked=0,i.Automatic=1})(ml||(ml={}));var gl;(function(i){function e(t,n){return{range:t,text:n}}i.create=e})(gl||(gl={}));var yl;(function(i){function e(t,n){return{triggerKind:t,selectedCompletionInfo:n}}i.create=e})(yl||(yl={}));var wl;(function(i){function e(t){let n=t;return m.objectLiteral(n)&&to.is(n.uri)&&m.string(n.name)}i.is=e})(wl||(wl={}));var vl;(function(i){function e(r,o,a,c){return new mo(r,o,a,c)}i.create=e;function t(r){let o=r;return!!(m.defined(o)&&m.string(o.uri)&&(m.undefined(o.languageId)||m.string(o.languageId))&&m.uinteger(o.lineCount)&&m.func(o.getText)&&m.func(o.positionAt)&&m.func(o.offsetAt))}i.is=t;function n(r,o){let a=r.getText(),c=s(o,(h,u)=>{let d=h.range.start.line-u.range.start.line;return d===0?h.range.start.character-u.range.start.character:d}),l=a.length;for(let h=c.length-1;h>=0;h--){let u=c[h],d=r.offsetAt(u.range.start),p=r.offsetAt(u.range.end);if(p<=l)a=a.substring(0,d)+u.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");l=d}return a}i.applyEdits=n;function s(r,o){if(r.length<=1)return r;let a=r.length/2|0,c=r.slice(0,a),l=r.slice(a);s(c,o),s(l,o);let h=0,u=0,d=0;for(;h<c.length&&u<l.length;)o(c[h],l[u])<=0?r[d++]=c[h++]:r[d++]=l[u++];for(;h<c.length;)r[d++]=c[h++];for(;u<l.length;)r[d++]=l[u++];return r}})(vl||(vl={}));var mo=class{constructor(e,t,n,s){this._uri=e,this._languageId=t,this._version=n,this._content=s,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],t=this._content,n=!0;for(let s=0;s<t.length;s++){n&&(e.push(s),n=!1);let r=t.charAt(s);n=r==="\r"||r===`
51
- `,r==="\r"&&s+1<t.length&&t.charAt(s+1)===`
52
- `&&s++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,s=t.length;if(s===0)return Ze.create(0,e);for(;n<s;){let o=Math.floor((n+s)/2);t[o]>e?s=o:n=o+1}let r=n-1;return Ze.create(r,e-t[r])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line],s=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,s),n)}get lineCount(){return this.getLineOffsets().length}},m;(function(i){let e=Object.prototype.toString;function t(p){return typeof p<"u"}i.defined=t;function n(p){return typeof p>"u"}i.undefined=n;function s(p){return p===!0||p===!1}i.boolean=s;function r(p){return e.call(p)==="[object String]"}i.string=r;function o(p){return e.call(p)==="[object Number]"}i.number=o;function a(p,w,g){return e.call(p)==="[object Number]"&&w<=p&&p<=g}i.numberRange=a;function c(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}i.integer=c;function l(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}i.uinteger=l;function h(p){return e.call(p)==="[object Function]"}i.func=h;function u(p){return p!==null&&typeof p=="object"}i.objectLiteral=u;function d(p,w){return Array.isArray(p)&&p.every(w)}i.typedArray=d})(m||(m={}));var Ad=require.resolve("devicetree-language-server/dist/server.js"),go=class{constructor(e,t,n,s,r){this.poolSize=e;this.cwd=t;this.includesPaths=n;this.bindings=s;this.logLevel=r;this.workers=[];this.queue=[]}async initialize(){let e=[];for(let t=0;t<this.poolSize;t++)e.push(this.createWorker(t));await Promise.all(e)}async createWorker(e){let t=xl.default.spawn(process.execPath,[Ad,"--stdio"],{stdio:["pipe","pipe","pipe"]});t.stderr.on("data",o=>{this.logLevel==="verbose"&&console.error(`LSP Worker ${e} stderr:`,o.toString())});let n=(0,kl.createMessageConnection)(new as.StreamMessageReader(t.stdout),new as.StreamMessageWriter(t.stdin));this.logLevel==="verbose"&&n.onNotification("window/logMessage",o=>{let c={1:"ERROR",2:"WARN",3:"INFO",4:"LOG"}[o.type]||"LOG";ae("info",`[LSP Worker ${e} ${c}] ${o.message}`)}),n.onRequest("workspace/workspaceFolders",()=>[{uri:`file://${this.cwd}`,name:"root"}]),n.listen(),n.sendNotification("workspace/didChangeConfiguration",{settings:{devicetree:{defaultIncludePaths:this.includesPaths,defaultBindingType:"Zephyr",defaultZephyrBindings:this.bindings,cwd:this.cwd,autoChangeContext:!0,allowAdhocContexts:!0,defaultLockRenameEdits:[]}}});let s=[{uri:bl(this.cwd),name:"root"}];await n.sendRequest("initialize",{processId:process.pid,rootUri:bl(this.cwd),capabilities:{},workspaceFolders:s}),await n.sendNotification("initialized");let r={id:e,process:t,connection:n,busy:!1};this.workers.push(r)}async getAvailableWorker(){return new Promise(e=>{let t=this.workers.find(n=>!n.busy);t?(t.busy=!0,e(t)):this.queue.push(()=>{let n=this.workers.find(s=>!s.busy);n&&(n.busy=!0,e(n))})})}releaseWorker(e){e.busy=!1;let t=this.queue.shift();t&&t()}async dispose(){for(let e of this.workers)e.connection.dispose(),e.process.kill();this.workers=[]}};function bl(i){let e=Sl.default.resolve(i);return e=e.replace(/\\/g,"/"),e.startsWith("/")||(e="/"+e),`file://${e}`}function Nd(){let i=process.env;return!!(i.CI&&(i.GITHUB_ACTIONS||i.GITLAB_CI||i.BITBUCKET_BUILD_NUMBER||i.CIRCLECI||i.TRAVIS))}var Pd=Y.object({file:Y.array(Y.string().optional()).optional(),cwd:Y.string().optional(),include:Y.array(Y.string()).optional().default([]),binding:Y.array(Y.string()).optional().default([]),logLevel:Y.enum(["none","verbose"]).optional().default("none"),format:Y.boolean().optional().default(!1),formatFixAll:Y.boolean().optional().default(!1),processIncludes:Y.boolean().optional().default(!1),diagnostics:Y.boolean().optional().default(!1),diagnosticsFull:Y.boolean().optional().default(!1),diagnosticsConfig:Y.string().optional(),showInfoDiagnostics:Y.boolean().optional().default(!1),patchFile:Y.string().optional(),outputFormat:Y.enum(["auto","pretty","annotations","json"]).optional().default("auto"),threads:Y.number().int().min(1).optional().default(1),version:Y.boolean().optional().default(!1),help:Y.boolean().optional().default(!1)}),yo=`Usage: dts-linter [options]
50
+ `);return e?t.pop():t.push(t.pop().slice(0,-1)),t}var Mr=(s,e,t)=>{let n=s instanceof RegExp?Ta(s,t):s,i=e instanceof RegExp?Ta(e,t):e,r=n!==null&&i!=null&&nd(n,i,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+n.length,r[1]),post:t.slice(r[1]+i.length)}},Ta=(s,e)=>{let t=e.match(s);return t?t[0]:null},nd=(s,e,t)=>{let n,i,r,o,a,c=t.indexOf(s),l=t.indexOf(e,c+1),f=c;if(c>=0&&l>0){if(s===e)return[c,l];for(n=[],r=t.length;f>=0&&!a;){if(f===c)n.push(f),c=t.indexOf(s,f+1);else if(n.length===1){let u=n.pop();u!==void 0&&(a=[u,l])}else i=n.pop(),i!==void 0&&i<r&&(r=i,o=l),l=t.indexOf(e,f+1);f=c<l&&c>=0?c:l}n.length&&o!==void 0&&(a=[r,o])}return a};var Oa="\0SLASH"+Math.random()+"\0",Na="\0OPEN"+Math.random()+"\0",Lr="\0CLOSE"+Math.random()+"\0",Aa="\0COMMA"+Math.random()+"\0",Pa="\0PERIOD"+Math.random()+"\0",sd=new RegExp(Oa,"g"),id=new RegExp(Na,"g"),rd=new RegExp(Lr,"g"),od=new RegExp(Aa,"g"),ad=new RegExp(Pa,"g"),cd=/\\\\/g,ld=/\\{/g,ud=/\\}/g,fd=/\\,/g,dd=/\\\./g,hd=1e5;function jr(s){return isNaN(s)?s.charCodeAt(0):parseInt(s,10)}function pd(s){return s.replace(cd,Oa).replace(ld,Na).replace(ud,Lr).replace(fd,Aa).replace(dd,Pa)}function md(s){return s.replace(sd,"\\").replace(id,"{").replace(rd,"}").replace(od,",").replace(ad,".")}function Ma(s){if(!s)return[""];let e=[],t=Mr("{","}",s);if(!t)return s.split(",");let{pre:n,body:i,post:r}=t,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=Ma(r);return r.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function ja(s,e={}){if(!s)return[];let{max:t=hd}=e;return s.slice(0,2)==="{}"&&(s="\\{\\}"+s.slice(2)),qn(pd(s),t,!0).map(md)}function gd(s){return"{"+s+"}"}function yd(s){return/^-?0\d/.test(s)}function wd(s,e){return s<=e}function bd(s,e){return s>=e}function qn(s,e,t){let n=[],i=Mr("{","}",s);if(!i)return[s];let r=i.pre,o=i.post.length?qn(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let c=r+"{"+i.body+"}"+o[a];n.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,f=i.body.indexOf(",")>=0;if(!l&&!f)return i.post.match(/,(?!,).*\}/)?(s=i.pre+"{"+i.body+Lr+i.post,qn(s,e,!0)):[s];let u;if(l)u=i.body.split(/\.\./);else if(u=Ma(i.body),u.length===1&&u[0]!==void 0&&(u=qn(u[0],e,!1).map(gd),u.length===1))return o.map(p=>i.pre+u[0]+p);let h;if(l&&u[0]!==void 0&&u[1]!==void 0){let p=jr(u[0]),w=jr(u[1]),g=Math.max(u[0].length,u[1].length),k=u.length===3&&u[2]!==void 0?Math.max(Math.abs(jr(u[2])),1):1,S=wd;w<p&&(k*=-1,S=bd);let v=u.some(yd);h=[];for(let E=p;S(E,w)&&h.length<e;E+=k){let O;if(c)O=String.fromCharCode(E),O==="\\"&&(O="");else if(O=String(E),v){let H=g-O.length;if(H>0){let Y=new Array(H+1).join("0");E<0?O="-"+Y+O.slice(1):O=Y+O}}h.push(O)}}else{h=[];for(let p=0;p<u.length;p++)h.push.apply(h,qn(u[p],e,!1))}for(let p=0;p<h.length;p++)for(let w=0;w<o.length&&n.length<e;w++){let g=r+h[p]+o[w];(!t||l||g)&&n.push(g)}}return n}var Un=s=>{if(typeof s!="string")throw new TypeError("invalid pattern");if(s.length>65536)throw new TypeError("pattern is too long")};var vd={"[: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]},Vn=s=>s.replace(/[[\]\\-]/g,"\\$&"),_d=s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),La=s=>s.join(""),Ia=(s,e)=>{let t=e;if(s.charAt(t)!=="[")throw new Error("not in a brace expression");let n=[],i=[],r=t+1,o=!1,a=!1,c=!1,l=!1,f=t,u="";e:for(;r<s.length;){let g=s.charAt(r);if((g==="!"||g==="^")&&r===t+1){l=!0,r++;continue}if(g==="]"&&o&&!c){f=r+1;break}if(o=!0,g==="\\"&&!c){c=!0,r++;continue}if(g==="["&&!c){for(let[k,[S,_,v]]of Object.entries(vd))if(s.startsWith(k,r)){if(u)return["$.",!1,s.length-t,!0];r+=k.length,v?i.push(S):n.push(S),a=a||_;continue e}}if(c=!1,u){g>u?n.push(Vn(u)+"-"+Vn(g)):g===u&&n.push(Vn(g)),u="",r++;continue}if(s.startsWith("-]",r+1)){n.push(Vn(g+"-")),r+=2;continue}if(s.startsWith("-",r+1)){u=g,r+=2;continue}n.push(Vn(g)),r++}if(f<r)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,s.length-t,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let g=n[0].length===2?n[0].slice(-1):n[0];return[_d(g),!1,f-t,!1]}let h="["+(l?"^":"")+La(n)+"]",p="["+(l?"":"^")+La(i)+"]";return[n.length&&i.length?"("+h+"|"+p+")":n.length?h:p,a,f-t,!0]};var qe=(s,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?s.replace(/\[([^\/\\])\]/g,"$1"):s.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?s.replace(/\[([^\/\\{}])\]/g,"$1"):s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var Te,xd=new Set(["!","?","+","*","@"]),Ir=s=>xd.has(s),Da=s=>Ir(s.type),Sd=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),kd=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Ed=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),$a=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Cd="(?!(?:^|/)\\.\\.?(?:$|/))",Is="(?!\\.)",Rd=new Set(["[","."]),Td=new Set(["..","."]),Od=new Set("().*{}+?[]^$\\!"),Nd=s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Dr="[^/]",Fa=Dr+"*?",Wa=Dr+"+?",Ad=0,Zt=class{type;#e;#n;#s=!1;#t=[];#r;#_;#w;#c=!1;#f;#a;#l=!1;id=++Ad;get depth(){return(this.#r?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#r?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,t,n={}){this.type=e,e&&(this.#n=!0),this.#r=t,this.#e=this.#r?this.#r.#e:this,this.#f=this.#e===this?n:this.#e.#f,this.#w=this.#e===this?[]:this.#e.#w,e==="!"&&!this.#e.#c&&this.#w.push(this),this.#_=this.#r?this.#r.#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.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#a=this.#t.map(e=>String(e)).join("")}#i(){if(this!==this.#e)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#w.pop();){if(e.type!=="!")continue;let t=e,n=t.#r;for(;n;){for(let i=t.#_+1;!n.type&&i<n.#t.length;i++)for(let r of e.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(n.#t[i])}t=n,n=t.#r}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Te&&t.#r===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#c&&this.#r?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#r?.isStart())return!1;if(this.#_===0)return!0;let e=this.#r;for(let t=0;t<this.#_;t++){let n=e.#t[t];if(!(n instanceof Te&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#r?.type==="!")return!0;if(!this.#r?.isEnd())return!1;if(!this.type)return this.#r?.isEnd();let e=this.#r?this.#r.#t.length:0;return this.#_===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Te(this.type,e);for(let n of this.#t)t.copyIn(n);return t}static#g(e,t,n,i,r){let o=i.maxExtglobRecursion??2,a=!1,c=!1,l=-1,f=!1;if(t.type===null){let g=n,k="";for(;g<e.length;){let S=e.charAt(g++);if(a||S==="\\"){a=!a,k+=S;continue}if(c){g===l+1?(S==="^"||S==="!")&&(f=!0):S==="]"&&!(g===l+2&&f)&&(c=!1),k+=S;continue}else if(S==="["){c=!0,l=g,f=!1,k+=S;continue}if(!i.noext&&Ir(S)&&e.charAt(g)==="("&&r<=o){t.push(k),k="";let v=new Te(S,t);g=Te.#g(e,v,g,i,r+1),t.push(v);continue}k+=S}return t.push(k),g}let u=n+1,h=new Te(null,t),p=[],w="";for(;u<e.length;){let g=e.charAt(u++);if(a||g==="\\"){a=!a,w+=g;continue}if(c){u===l+1?(g==="^"||g==="!")&&(f=!0):g==="]"&&!(u===l+2&&f)&&(c=!1),w+=g;continue}else if(g==="["){c=!0,l=u,f=!1,w+=g;continue}if(!i.noext&&Ir(g)&&e.charAt(u)==="("&&(r<=o||t&&t.#d(g))){let S=t&&t.#d(g)?0:1;h.push(w),w="";let _=new Te(g,h);h.push(_),u=Te.#g(e,_,u,i,r+S);continue}if(g==="|"){h.push(w),w="",p.push(h),h=new Te(null,t);continue}if(g===")")return w===""&&t.#t.length===0&&(t.#l=!0),h.push(w),w="",t.push(...p,h),u;w+=g}return t.type=null,t.#n=void 0,t.#t=[e.substring(n-1)],u}#x(e){return this.#y(e,kd)}#y(e,t=Sd){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#d(n.type,t)}#d(e,t=Ed){return!!t.get(this.type)?.includes(e)}#k(e,t){let n=e.#t[0],i=new Te(null,n,this.options);i.#t.push(""),n.push(i),this.#h(e,t)}#h(e,t){let n=e.#t[0];this.#t.splice(t,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#r=this);this.#a=void 0}#E(e){return!!$a.get(this.type)?.has(e)}#v(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#E(t.type)}#b(e){let t=$a.get(this.type),n=e.#t[0],i=t?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let r of this.#t)typeof r=="object"&&(r.#r=this);this.type=i,this.#a=void 0,this.#l=!1}static fromGlob(e,t={}){let n=new Te(null,void 0,t);return Te.#g(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,i,r]=this.toRegExpSource();if(!(i||this.#n||this.#f.nocase&&!this.#f.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#f.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#f}toRegExpSource(e){let t=e??!!this.#f.dot;if(this.#e===this&&(this.#m(),this.#i()),!Da(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(p=>typeof p!="string"),l=this.#t.map(p=>{let[w,g,k,S]=typeof p=="string"?Te.#p(p,this.#n,c):p.toRegExpSource(e);return this.#n=this.#n||k,this.#s=this.#s||S,w}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Td.has(this.#t[0]))){let w=Rd,g=t&&w.has(l.charAt(0))||l.startsWith("\\.")&&w.has(l.charAt(2))||l.startsWith("\\.\\.")&&w.has(l.charAt(4)),k=!t&&!e&&w.has(l.charAt(0));f=g?Cd:k?Is:""}let u="";return this.isEnd()&&this.#e.#c&&this.#r?.type==="!"&&(u="(?:$|\\/)"),[f+l+u,qe(l),this.#n=!!this.#n,this.#s]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#S(t);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let c=this.toString(),l=this;return l.#t=[c],l.type=null,l.#n=void 0,[c,qe(this.toString()),!1,!1]}let o=!n||e||t||!Is?"":this.#S(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!t?Is:"")+Wa;else{let c=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Is:"")+Fa+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+r+c}return[a,qe(r),this.#n=!!this.#n,this.#s]}#m(){if(Da(this)){let e=0,t=!1;do{t=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#m(),this.#y(i)?(t=!1,this.#h(i,n)):this.#x(i)?(t=!1,this.#k(i,n)):this.#v(i)&&(t=!1,this.#b(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#m();this.#a=void 0}#S(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[n,i,r,o]=t.toRegExpSource(e);return this.#s=this.#s||o,n}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#p(e,t,n=!1){let i=!1,r="",o=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(i){i=!1,r+=(Od.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,r+=n&&/^[*]+$/.test(e)?Wa:Fa,t=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?r+="\\\\":i=!0;continue}if(l==="["){let[f,u,h,p]=Ia(e,c);if(h){r+=f,o=o||u,c+=h-1,t=t||p;continue}}if(l==="?"){r+=Dr,t=!0;continue}r+=Nd(l)}return[r,qe(e),!!t,o]}};Te=Zt;var yn=(s,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?s.replace(/[?*()[\]{}]/g,"[$&]"):s.replace(/[?*()[\]\\{}]/g,"\\$&"):e?s.replace(/[?*()[\]]/g,"[$&]"):s.replace(/[?*()[\]\\]/g,"\\$&");var Se=(s,e,t={})=>(Un(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Pe(e,t).match(s)),Pd=/^\*+([^+@!?\*\[\(]*)$/,Md=s=>e=>!e.startsWith(".")&&e.endsWith(s),jd=s=>e=>e.endsWith(s),Ld=s=>(s=s.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(s)),Id=s=>(s=s.toLowerCase(),e=>e.toLowerCase().endsWith(s)),Dd=/^\*+\.\*+$/,$d=s=>!s.startsWith(".")&&s.includes("."),Fd=s=>s!=="."&&s!==".."&&s.includes("."),Wd=/^\.\*+$/,zd=s=>s!=="."&&s!==".."&&s.startsWith("."),Bd=/^\*+$/,qd=s=>s.length!==0&&!s.startsWith("."),Ud=s=>s.length!==0&&s!=="."&&s!=="..",Vd=/^\?+([^+@!?\*\[\(]*)?$/,Zd=([s,e=""])=>{let t=qa([s]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Hd=([s,e=""])=>{let t=Ua([s]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Gd=([s,e=""])=>{let t=Ua([s]);return e?n=>t(n)&&n.endsWith(e):t},Jd=([s,e=""])=>{let t=qa([s]);return e?n=>t(n)&&n.endsWith(e):t},qa=([s])=>{let e=s.length;return t=>t.length===e&&!t.startsWith(".")},Ua=([s])=>{let e=s.length;return t=>t.length===e&&t!=="."&&t!==".."},Va=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",za={win32:{sep:"\\"},posix:{sep:"/"}},Xd=Va==="win32"?za.win32.sep:za.posix.sep;Se.sep=Xd;var ie=Symbol("globstar **");Se.GLOBSTAR=ie;var Yd="[^/]",Qd=Yd+"*?",Kd="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",eh="(?:(?!(?:\\/|^)\\.).)*?",th=(s,e={})=>t=>Se(t,s,e);Se.filter=th;var $e=(s,e={})=>Object.assign({},s,e),nh=s=>{if(!s||typeof s!="object"||!Object.keys(s).length)return Se;let e=Se;return Object.assign((n,i,r={})=>e(n,i,$e(s,r)),{Minimatch:class extends e.Minimatch{constructor(i,r={}){super(i,$e(s,r))}static defaults(i){return e.defaults($e(s,i)).Minimatch}},AST:class extends e.AST{constructor(i,r,o={}){super(i,r,$e(s,o))}static fromGlob(i,r={}){return e.AST.fromGlob(i,$e(s,r))}},unescape:(n,i={})=>e.unescape(n,$e(s,i)),escape:(n,i={})=>e.escape(n,$e(s,i)),filter:(n,i={})=>e.filter(n,$e(s,i)),defaults:n=>e.defaults($e(s,n)),makeRe:(n,i={})=>e.makeRe(n,$e(s,i)),braceExpand:(n,i={})=>e.braceExpand(n,$e(s,i)),match:(n,i,r={})=>e.match(n,i,$e(s,r)),sep:e.sep,GLOBSTAR:ie})};Se.defaults=nh;var Za=(s,e={})=>(Un(s),e.nobrace||!/\{(?:(?!\{).)*\}/.test(s)?[s]:ja(s,{max:e.braceExpandMax}));Se.braceExpand=Za;var sh=(s,e={})=>new Pe(s,e).makeRe();Se.makeRe=sh;var ih=(s,e,t={})=>{let n=new Pe(e,t);return s=s.filter(i=>n.match(i)),n.options.nonull&&!s.length&&s.push(e),s};Se.match=ih;var Ba=/[?*]|[+@!]\(.*?\)|\[|\]/,rh=s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Pe=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){Un(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Va,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.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 t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=r[0]===""&&r[1]===""&&(r[2]==="?"||!Ba.test(r[2]))&&!Ba.test(r[3]),l=/^[a-z]:/i.test(r[0]);if(c)return[...r.slice(0,4),...r.slice(4).map(f=>this.parse(f))];if(l)return[r[0],...r.slice(1).map(f=>this.parse(f))]}return r.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)e[n][i]==="**"&&(e[n][i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let n=-1;for(;(n=t.indexOf("**",n+1))!==-1;){let i=n;for(;t[i+1]==="**";)i++;i!==n&&t.splice(n,i-n)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((n,i)=>{let r=n[n.length-1];return i==="**"&&r==="**"?n:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(n.pop(),n):(n.push(i),n)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let r=e[i];i===1&&r===""&&e[0]===""||(r==="."||r==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],c=n[i+2],l=n[i+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;t=!0,n.splice(i,1);let f=n.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(t=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(t=!0,n.pop())}let r=0;for(;(r=n.indexOf("..",r+1))!==-1;){let o=n[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let c=r===1&&n[r+1]==="**"?["."]:[];n.splice(r-1,2,...c),n.length===0&&n.push(""),r-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let i=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(i){e[t]=[],e[n]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,n=!1){let i=0,r=0,o=[],a="";for(;i<e.length&&r<t.length;)if(e[i]===t[r])o.push(a==="b"?t[r]:e[i]),i++,r++;else if(n&&e[i]==="**"&&t[r]===e[i+1])o.push(e[i]),i++;else if(n&&t[r]==="**"&&e[i]===t[r+1])o.push(t[r]),r++;else if(e[i]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,r++}else if(t[r]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(t[r]),i++,r++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let i=0,r=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 t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),u=c?3:a?0:void 0,h=f?3:l?0:void 0;if(typeof u=="number"&&typeof h=="number"){let[p,w]=[e[u],t[h]];p.toLowerCase()===w.toLowerCase()&&(t[h]=p,r=h,i=u)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(ie)?this.#e(e,t,n,i,r):this.#s(e,t,n,i,r)}#e(e,t,n,i,r){let o=t.indexOf(ie,r),a=t.lastIndexOf(ie),[c,l,f]=n?[t.slice(r,o),t.slice(o+1),[]]:[t.slice(r,o),t.slice(o+1,a),t.slice(a+1)];if(c.length){let _=e.slice(i,i+c.length);if(!this.#s(_,c,n,0,0))return!1;i+=c.length,r+=c.length}let u=0;if(f.length){if(f.length+i>e.length)return!1;let _=e.length-f.length;if(this.#s(e,f,n,_,0))u=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(_--,!this.#s(e,f,n,_,0)))return!1;u=f.length+1}}if(!l.length){let _=!!u;for(let v=i;v<e.length-u;v++){let E=String(e[v]);if(_=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return n||_}let h=[[[],0]],p=h[0],w=0,g=[0];for(let _ of l)_===ie?(g.push(w),p=[[],0],h.push(p)):(p[0].push(_),w++);let k=h.length-1,S=e.length-u;for(let _ of h)_[1]=S-(g[k--]+_[0].length);return!!this.#n(e,h,i,0,n,0,!!u)}#n(e,t,n,i,r,o,a){let c=t[i];if(!c){for(let u=n;u<e.length;u++){a=!0;let h=e[u];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1}return a}let[l,f]=c;for(;n<=f;){if(this.#s(e.slice(0,n+l.length),l,r,n,0)&&o<this.maxGlobstarRecursion){let p=this.#n(e,t,n+l.length,i+1,r,o+1,a);if(p!==!1)return p}let h=e[n];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;n++}return r||null}#s(e,t,n,i,r){let o,a,c,l;for(o=i,a=r,l=e.length,c=t.length;o<l&&a<c;o++,a++){this.debug("matchOne loop");let f=t[a],u=e[o];if(this.debug(t,f,u),f===!1||f===ie)return!1;let h;if(typeof f=="string"?(h=u===f,this.debug("string match",f,u,h)):(h=f.test(u),this.debug("pattern match",f,u,h)),!h)return!1}if(o===l&&a===c)return!0;if(o===l)return n;if(a===c)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Za(this.pattern,this.options)}parse(e){Un(e);let t=this.options;if(e==="**")return ie;if(e==="")return"";let n,i=null;(n=e.match(Bd))?i=t.dot?Ud:qd:(n=e.match(Pd))?i=(t.nocase?t.dot?Id:Ld:t.dot?jd:Md)(n[1]):(n=e.match(Vd))?i=(t.nocase?t.dot?Hd:Zd:t.dot?Gd:Jd)(n):(n=e.match(Dd))?i=t.dot?Fd:$d:(n=e.match(Wd))&&(i=zd);let r=Zt.fromGlob(e,this.options).toMMPattern();return i&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?Qd:t.dot?Kd:eh,i=new Set(t.nocase?["i"]:[]),r=e.map(c=>{let l=c.map(u=>{if(u instanceof RegExp)for(let h of u.flags.split(""))i.add(h);return typeof u=="string"?rh(u):u===ie?ie:u._src});l.forEach((u,h)=>{let p=l[h+1],w=l[h-1];u!==ie||w===ie||(w===void 0?p!==void 0&&p!==ie?l[h+1]="(?:\\/|"+n+"\\/)?"+p:l[h]=n:p===void 0?l[h-1]=w+"(?:\\/|\\/"+n+")?":p!==ie&&(l[h-1]=w+"(?:\\/|\\/"+n+"\\/)"+p,l[h+1]=ie))});let f=l.filter(u=>u!==ie);if(this.partial&&f.length>=1){let u=[];for(let h=1;h<=f.length;h++)u.push(f.slice(0,h).join("/"));return"(?:"+u.join("|")+")"}return f.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];r="^"+o+r+a+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+a+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...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,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let r=this.set;this.debug(this.pattern,"set",r);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<r.length;a++){let c=r[a],l=i;if(n.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Se.defaults(e).Minimatch}};Se.AST=Zt;Se.Minimatch=Pe;Se.escape=yn;Se.unescape=qe;var gc=require("node:url");var wn=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ga=new Set,$r=typeof process=="object"&&process?process:{},Ja=(s,e,t,n)=>{typeof $r.emitWarning=="function"?$r.emitWarning(s,e,t,n):console.error(`[${t}] ${e}: ${s}`)},Ds=globalThis.AbortController,Ha=globalThis.AbortSignal;if(typeof Ds>"u"){Ha=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},Ds=class{constructor(){e()}signal=new Ha;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let s=$r.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{s&&(s=!1,Ja("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 oh=s=>!Ga.has(s),Jm=Symbol("type"),_t=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),Xa=s=>_t(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?bn:null:null,bn=class extends Array{constructor(e){super(e),this.fill(0)}},Fr=class s{heap;length;static#e=!1;static create(e){let t=Xa(e);if(!t)return[];s.#e=!0;let n=new s(e,t);return s.#e=!1,n}constructor(e,t){if(!s.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Zn=class s{#e;#n;#s;#t;#r;#_;#w;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#f;#a;#l;#i;#g;#x;#y;#d;#k;#h;#E;#v;#b;#m;#S;#p;#N;static unsafeExposeInternals(e){return{starts:e.#v,ttls:e.#b,sizes:e.#E,keyMap:e.#a,keyList:e.#l,valList:e.#i,next:e.#g,prev:e.#x,get head(){return e.#y},get tail(){return e.#d},free:e.#k,isBackgroundFetch:t=>e.#u(t),backgroundFetch:(t,n,i,r)=>e.#L(t,n,i,r),moveToTail:t=>e.#$(t),indexes:t=>e.#T(t),rindexes:t=>e.#O(t),isStale:t=>e.#R(t)}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#f}get size(){return this.#c}get fetchMethod(){return this.#_}get memoMethod(){return this.#w}get dispose(){return this.#s}get onInsert(){return this.#t}get disposeAfter(){return this.#r}constructor(e){let{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:c,dispose:l,onInsert:f,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:p,maxSize:w=0,maxEntrySize:g=0,sizeCalculation:k,fetchMethod:S,memoMethod:_,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:H,ignoreFetchAbort:Y}=e;if(t!==0&&!_t(t))throw new TypeError("max option must be a nonnegative integer");let ge=t?Xa(t):Array;if(!ge)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=w,this.maxEntrySize=g||this.#n,this.sizeCalculation=k,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(_!==void 0&&typeof _!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#w=_,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#_=S,this.#S=!!S,this.#a=new Map,this.#l=new Array(t).fill(void 0),this.#i=new Array(t).fill(void 0),this.#g=new ge(t),this.#x=new ge(t),this.#y=0,this.#d=0,this.#k=Fr.create(t),this.#c=0,this.#f=0,typeof l=="function"&&(this.#s=l),typeof f=="function"&&(this.#t=f),typeof u=="function"?(this.#r=u,this.#h=[]):(this.#r=void 0,this.#h=void 0),this.#m=!!this.#s,this.#N=!!this.#t,this.#p=!!this.#r,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!H,this.ignoreFetchAbort=!!Y,this.maxEntrySize!==0){if(this.#n!==0&&!_t(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!_t(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#W()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=_t(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=n||0,this.ttl){if(!_t(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#o()}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 Oe="LRU_CACHE_UNBOUNDED";oh(Oe)&&(Ga.add(Oe),Ja("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Oe,s))}}getRemainingTTL(e){return this.#a.has(e)?1/0:0}#o(){let e=new bn(this.#e),t=new bn(this.#e);this.#b=e,this.#v=t,this.#A=(r,o,a=wn.now())=>{if(t[r]=o!==0?a:0,e[r]=o,o!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#R(r)&&this.#P(this.#l[r],"expire")},o+1);c.unref&&c.unref()}},this.#M=r=>{t[r]=e[r]!==0?wn.now():0},this.#C=(r,o)=>{if(e[o]){let a=e[o],c=t[o];if(!a||!c)return;r.ttl=a,r.start=c,r.now=n||i();let l=r.now-c;r.remainingTTL=a-l}};let n=0,i=()=>{let r=wn.now();if(this.ttlResolution>0){n=r;let o=setTimeout(()=>n=0,this.ttlResolution);o.unref&&o.unref()}return r};this.getRemainingTTL=r=>{let o=this.#a.get(r);if(o===void 0)return 0;let a=e[o],c=t[o];if(!a||!c)return 1/0;let l=(n||i())-c;return a-l},this.#R=r=>{let o=t[r],a=e[r];return!!a&&!!o&&(n||i())-o>a}}#M=()=>{};#C=()=>{};#A=()=>{};#R=()=>!1;#W(){let e=new bn(this.#e);this.#f=0,this.#E=e,this.#j=t=>{this.#f-=e[t],e[t]=0},this.#z=(t,n,i,r)=>{if(this.#u(n))return 0;if(!_t(i))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(n,t),!_t(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.#I=(t,n,i)=>{if(e[t]=n,this.#n){let r=this.#n-e[t];for(;this.#f>r;)this.#D(!0)}this.#f+=e[t],i&&(i.entrySize=n,i.totalCalculatedSize=this.#f)}}#j=e=>{};#I=(e,t,n)=>{};#z=(e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#d;!(!this.#B(t)||((e||!this.#R(t))&&(yield t),t===this.#y));)t=this.#x[t]}*#O({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#y;!(!this.#B(t)||((e||!this.#R(t))&&(yield t),t===this.#d));)t=this.#g[t]}#B(e){return e!==void 0&&this.#a.get(this.#l[e])===e}*entries(){for(let e of this.#T())this.#i[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#i[e])&&(yield[this.#l[e],this.#i[e]])}*rentries(){for(let e of this.#O())this.#i[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#i[e])&&(yield[this.#l[e],this.#i[e]])}*keys(){for(let e of this.#T()){let t=this.#l[e];t!==void 0&&!this.#u(this.#i[e])&&(yield t)}}*rkeys(){for(let e of this.#O()){let t=this.#l[e];t!==void 0&&!this.#u(this.#i[e])&&(yield t)}}*values(){for(let e of this.#T())this.#i[e]!==void 0&&!this.#u(this.#i[e])&&(yield this.#i[e])}*rvalues(){for(let e of this.#O())this.#i[e]!==void 0&&!this.#u(this.#i[e])&&(yield this.#i[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#T()){let i=this.#i[n],r=this.#u(i)?i.__staleWhileFetching:i;if(r!==void 0&&e(r,this.#l[n],this))return this.get(this.#l[n],t)}}forEach(e,t=this){for(let n of this.#T()){let i=this.#i[n],r=this.#u(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#l[n],this)}}rforEach(e,t=this){for(let n of this.#O()){let i=this.#i[n],r=this.#u(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#l[n],this)}}purgeStale(){let e=!1;for(let t of this.#O({allowStale:!0}))this.#R(t)&&(this.#P(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#a.get(e);if(t===void 0)return;let n=this.#i[t],i=this.#u(n)?n.__staleWhileFetching:n;if(i===void 0)return;let r={value:i};if(this.#b&&this.#v){let o=this.#b[t],a=this.#v[t];if(o&&a){let c=o-(wn.now()-a);r.ttl=c,r.start=Date.now()}}return this.#E&&(r.size=this.#E[t]),r}dump(){let e=[];for(let t of this.#T({allowStale:!0})){let n=this.#l[t],i=this.#i[t],r=this.#u(i)?i.__staleWhileFetching:i;if(r===void 0||n===void 0)continue;let o={value:r};if(this.#b&&this.#v){o.ttl=this.#b[t];let a=wn.now()-this.#v[t];o.start=Math.floor(Date.now()-a)}this.#E&&(o.size=this.#E[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let i=Date.now()-n.start;n.start=wn.now()-i}this.set(t,n.value,n)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,{noUpdateTTL:l=this.noUpdateTTL}=n,f=this.#z(e,t,n.size||0,a);if(this.maxEntrySize&&f>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#P(e,"set"),this;let u=this.#c===0?void 0:this.#a.get(e);if(u===void 0)u=this.#c===0?this.#d:this.#k.length!==0?this.#k.pop():this.#c===this.#e?this.#D(!1):this.#c,this.#l[u]=e,this.#i[u]=t,this.#a.set(e,u),this.#g[this.#d]=u,this.#x[u]=this.#d,this.#d=u,this.#c++,this.#I(u,f,c),c&&(c.set="add"),l=!1,this.#N&&this.#t?.(t,e,"add");else{this.#$(u);let h=this.#i[u];if(t!==h){if(this.#S&&this.#u(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!o&&(this.#m&&this.#s?.(p,e,"set"),this.#p&&this.#h?.push([p,e,"set"]))}else o||(this.#m&&this.#s?.(h,e,"set"),this.#p&&this.#h?.push([h,e,"set"]));if(this.#j(u),this.#I(u,f,c),this.#i[u]=t,c){c.set="replace";let p=h&&this.#u(h)?h.__staleWhileFetching:h;p!==void 0&&(c.oldValue=p)}}else c&&(c.set="update");this.#N&&this.onInsert?.(t,e,t===h?"update":"replace")}if(i!==0&&!this.#b&&this.#o(),this.#b&&(l||this.#A(u,i,r),c&&this.#C(c,u)),!o&&this.#p&&this.#h){let h=this.#h,p;for(;p=h?.shift();)this.#r?.(...p)}return this}pop(){try{for(;this.#c;){let e=this.#i[this.#y];if(this.#D(!0),this.#u(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#p&&this.#h){let e=this.#h,t;for(;t=e?.shift();)this.#r?.(...t)}}}#D(e){let t=this.#y,n=this.#l[t],i=this.#i[t];return this.#S&&this.#u(i)?i.__abortController.abort(new Error("evicted")):(this.#m||this.#p)&&(this.#m&&this.#s?.(i,n,"evict"),this.#p&&this.#h?.push([i,n,"evict"])),this.#j(t),e&&(this.#l[t]=void 0,this.#i[t]=void 0,this.#k.push(t)),this.#c===1?(this.#y=this.#d=0,this.#k.length=0):this.#y=this.#g[t],this.#a.delete(n),this.#c--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,r=this.#a.get(e);if(r!==void 0){let o=this.#i[r];if(this.#u(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#R(r))i&&(i.has="stale",this.#C(i,r));else return n&&this.#M(r),i&&(i.has="hit",this.#C(i,r)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,i=this.#a.get(e);if(i===void 0||!n&&this.#R(i))return;let r=this.#i[i];return this.#u(r)?r.__staleWhileFetching:r}#L(e,t,n,i){let r=t===void 0?void 0:this.#i[t];if(this.#u(r))return r;let o=new Ds,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:n,context:i},l=(g,k=!1)=>{let{aborted:S}=o.signal,_=n.ignoreFetchAbort&&g!==void 0;if(n.status&&(S&&!k?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,_&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),S&&!_&&!k)return u(o.signal.reason);let v=p;return this.#i[t]===p&&(g===void 0?v.__staleWhileFetching?this.#i[t]=v.__staleWhileFetching:this.#P(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,g,c.options))),g},f=g=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=g),u(g)),u=g=>{let{aborted:k}=o.signal,S=k&&n.allowStaleOnFetchAbort,_=S||n.allowStaleOnFetchRejection,v=_||n.noDeleteOnFetchRejection,E=p;if(this.#i[t]===p&&(!v||E.__staleWhileFetching===void 0?this.#P(e,"fetch"):S||(this.#i[t]=E.__staleWhileFetching)),_)return n.status&&E.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),E.__staleWhileFetching;if(E.__returned===E)throw g},h=(g,k)=>{let S=this.#_?.(e,r,c);S&&S instanceof Promise&&S.then(_=>g(_===void 0?void 0:_),k),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(g(void 0),n.allowStaleOnFetchAbort&&(g=_=>l(_,!0)))})};n.status&&(n.status.fetchDispatched=!0);let p=new Promise(h).then(l,f),w=Object.assign(p,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return t===void 0?(this.set(e,w,{...c.options,status:void 0}),t=this.#a.get(e)):this.#i[t]=w,w}#u(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Ds}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:g,forceRefresh:k=!1,status:S,signal:_}=t;if(!this.#S)return S&&(S.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:S});let v={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:f,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:w,ignoreFetchAbort:p,status:S,signal:_},E=this.#a.get(e);if(E===void 0){S&&(S.fetch="miss");let O=this.#L(e,E,v,g);return O.__returned=O}else{let O=this.#i[E];if(this.#u(O)){let Xt=n&&O.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",Xt&&(S.returnedStale=!0)),Xt?O.__staleWhileFetching:O.__returned=O}let H=this.#R(E);if(!k&&!H)return S&&(S.fetch="hit"),this.#$(E),i&&this.#M(E),S&&this.#C(S,E),O;let Y=this.#L(e,E,v,g),Oe=Y.__staleWhileFetching!==void 0&&n;return S&&(S.fetch=H?"stale":"refresh",Oe&&H&&(S.returnedStale=!0)),Oe?Y.__staleWhileFetching:Y.__returned=Y}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let n=this.#w;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:r,...o}=t,a=this.get(e,o);if(!r&&a!==void 0)return a;let c=n(e,a,{options:o,context:i});return this.set(e,c,o),c}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=t,a=this.#a.get(e);if(a!==void 0){let c=this.#i[a],l=this.#u(c);return o&&this.#C(o,a),this.#R(a)?(o&&(o.get="stale"),l?(o&&n&&c.__staleWhileFetching!==void 0&&(o.returnedStale=!0),n?c.__staleWhileFetching:void 0):(r||this.#P(e,"expire"),o&&n&&(o.returnedStale=!0),n?c:void 0)):(o&&(o.get="hit"),l?c.__staleWhileFetching:(this.#$(a),i&&this.#M(a),c))}else o&&(o.get="miss")}#q(e,t){this.#x[t]=e,this.#g[e]=t}#$(e){e!==this.#d&&(e===this.#y?this.#y=this.#g[e]:this.#q(this.#x[e],this.#g[e]),this.#q(this.#d,e),this.#d=e)}delete(e){return this.#P(e,"delete")}#P(e,t){let n=!1;if(this.#c!==0){let i=this.#a.get(e);if(i!==void 0)if(n=!0,this.#c===1)this.#F(t);else{this.#j(i);let r=this.#i[i];if(this.#u(r)?r.__abortController.abort(new Error("deleted")):(this.#m||this.#p)&&(this.#m&&this.#s?.(r,e,t),this.#p&&this.#h?.push([r,e,t])),this.#a.delete(e),this.#l[i]=void 0,this.#i[i]=void 0,i===this.#d)this.#d=this.#x[i];else if(i===this.#y)this.#y=this.#g[i];else{let o=this.#x[i];this.#g[o]=this.#g[i];let a=this.#g[i];this.#x[a]=this.#x[i]}this.#c--,this.#k.push(i)}}if(this.#p&&this.#h?.length){let i=this.#h,r;for(;r=i?.shift();)this.#r?.(...r)}return n}clear(){return this.#F("delete")}#F(e){for(let t of this.#O({allowStale:!0})){let n=this.#i[t];if(this.#u(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#m&&this.#s?.(n,i,e),this.#p&&this.#h?.push([n,i,e])}}if(this.#a.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#v&&(this.#b.fill(0),this.#v.fill(0)),this.#E&&this.#E.fill(0),this.#y=0,this.#d=0,this.#k.length=0,this.#f=0,this.#c=0,this.#p&&this.#h){let t=this.#h,n;for(;n=t?.shift();)this.#r?.(...n)}}};var xn=require("node:path"),oc=require("node:url"),et=require("fs"),gh=dt(require("node:fs"),1),kt=require("node:fs/promises");var Us=require("node:events"),Zr=dt(require("node:stream"),1),tc=require("node:string_decoder"),Ya=typeof process=="object"&&process?process:{stdout:null,stderr:null},ah=s=>!!s&&typeof s=="object"&&(s instanceof St||s instanceof Zr.default||ch(s)||lh(s)),ch=s=>!!s&&typeof s=="object"&&s instanceof Us.EventEmitter&&typeof s.pipe=="function"&&s.pipe!==Zr.default.Writable.prototype.pipe,lh=s=>!!s&&typeof s=="object"&&s instanceof Us.EventEmitter&&typeof s.write=="function"&&typeof s.end=="function",ot=Symbol("EOF"),at=Symbol("maybeEmitEnd"),xt=Symbol("emittedEnd"),$s=Symbol("emittingEnd"),Hn=Symbol("emittedError"),Fs=Symbol("closed"),Qa=Symbol("read"),Ws=Symbol("flush"),Ka=Symbol("flushChunk"),Ue=Symbol("encoding"),vn=Symbol("decoder"),le=Symbol("flowing"),Gn=Symbol("paused"),_n=Symbol("resume"),ue=Symbol("buffer"),ke=Symbol("pipes"),fe=Symbol("bufferLength"),Wr=Symbol("bufferPush"),zs=Symbol("bufferShift"),ve=Symbol("objectMode"),re=Symbol("destroyed"),zr=Symbol("error"),Br=Symbol("emitData"),ec=Symbol("emitEnd"),qr=Symbol("emitEnd2"),Qe=Symbol("async"),Ur=Symbol("abort"),Bs=Symbol("aborted"),Jn=Symbol("signal"),Ht=Symbol("dataListeners"),Me=Symbol("discarded"),Xn=s=>Promise.resolve().then(s),uh=s=>s(),fh=s=>s==="end"||s==="finish"||s==="prefinish",dh=s=>s instanceof ArrayBuffer||!!s&&typeof s=="object"&&s.constructor&&s.constructor.name==="ArrayBuffer"&&s.byteLength>=0,hh=s=>!Buffer.isBuffer(s)&&ArrayBuffer.isView(s),qs=class{src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[_n](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Vr=class extends qs{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},ph=s=>!!s.objectMode,mh=s=>!s.objectMode&&!!s.encoding&&s.encoding!=="buffer",St=class extends Us.EventEmitter{[le]=!1;[Gn]=!1;[ke]=[];[ue]=[];[ve];[Ue];[Qe];[vn];[ot]=!1;[xt]=!1;[$s]=!1;[Fs]=!1;[Hn]=null;[fe]=0;[re]=!1;[Jn];[Bs]=!1;[Ht]=0;[Me]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");ph(t)?(this[ve]=!0,this[Ue]=null):mh(t)?(this[Ue]=t.encoding,this[ve]=!1):(this[ve]=!1,this[Ue]=null),this[Qe]=!!t.async,this[vn]=this[Ue]?new tc.StringDecoder(this[Ue]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[ue]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[ke]});let{signal:n}=t;n&&(this[Jn]=n,n.aborted?this[Ur]():n.addEventListener("abort",()=>this[Ur]()))}get bufferLength(){return this[fe]}get encoding(){return this[Ue]}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[ve]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Qe]}set async(e){this[Qe]=this[Qe]||!!e}[Ur](){this[Bs]=!0,this.emit("abort",this[Jn]?.reason),this.destroy(this[Jn]?.reason)}get aborted(){return this[Bs]}set aborted(e){}write(e,t,n){if(this[Bs])return!1;if(this[ot])throw new Error("write after end");if(this[re])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(n=t,t="utf8"),t||(t="utf8");let i=this[Qe]?Xn:uh;if(!this[ve]&&!Buffer.isBuffer(e)){if(hh(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(dh(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[ve]?(this[le]&&this[fe]!==0&&this[Ws](!0),this[le]?this.emit("data",e):this[Wr](e),this[fe]!==0&&this.emit("readable"),n&&i(n),this[le]):e.length?(typeof e=="string"&&!(t===this[Ue]&&!this[vn]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Ue]&&(e=this[vn].write(e)),this[le]&&this[fe]!==0&&this[Ws](!0),this[le]?this.emit("data",e):this[Wr](e),this[fe]!==0&&this.emit("readable"),n&&i(n),this[le]):(this[fe]!==0&&this.emit("readable"),n&&i(n),this[le])}read(e){if(this[re])return null;if(this[Me]=!1,this[fe]===0||e===0||e&&e>this[fe])return this[at](),null;this[ve]&&(e=null),this[ue].length>1&&!this[ve]&&(this[ue]=[this[Ue]?this[ue].join(""):Buffer.concat(this[ue],this[fe])]);let t=this[Qa](e||null,this[ue][0]);return this[at](),t}[Qa](e,t){if(this[ve])this[zs]();else{let n=t;e===n.length||e===null?this[zs]():typeof n=="string"?(this[ue][0]=n.slice(e),t=n.slice(0,e),this[fe]-=e):(this[ue][0]=n.subarray(e),t=n.subarray(0,e),this[fe]-=e)}return this.emit("data",t),!this[ue].length&&!this[ot]&&this.emit("drain"),t}end(e,t,n){return typeof e=="function"&&(n=e,e=void 0),typeof t=="function"&&(n=t,t="utf8"),e!==void 0&&this.write(e,t),n&&this.once("end",n),this[ot]=!0,this.writable=!1,(this[le]||!this[Gn])&&this[at](),this}[_n](){this[re]||(!this[Ht]&&!this[ke].length&&(this[Me]=!0),this[Gn]=!1,this[le]=!0,this.emit("resume"),this[ue].length?this[Ws]():this[ot]?this[at]():this.emit("drain"))}resume(){return this[_n]()}pause(){this[le]=!1,this[Gn]=!0,this[Me]=!1}get destroyed(){return this[re]}get flowing(){return this[le]}get paused(){return this[Gn]}[Wr](e){this[ve]?this[fe]+=1:this[fe]+=e.length,this[ue].push(e)}[zs](){return this[ve]?this[fe]-=1:this[fe]-=this[ue][0].length,this[ue].shift()}[Ws](e=!1){do;while(this[Ka](this[zs]())&&this[ue].length);!e&&!this[ue].length&&!this[ot]&&this.emit("drain")}[Ka](e){return this.emit("data",e),this[le]}pipe(e,t){if(this[re])return e;this[Me]=!1;let n=this[xt];return t=t||{},e===Ya.stdout||e===Ya.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[ke].push(t.proxyErrors?new Vr(this,e,t):new qs(this,e,t)),this[Qe]?Xn(()=>this[_n]()):this[_n]()),e}unpipe(e){let t=this[ke].find(n=>n.dest===e);t&&(this[ke].length===1?(this[le]&&this[Ht]===0&&(this[le]=!1),this[ke]=[]):this[ke].splice(this[ke].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e==="data")this[Me]=!1,this[Ht]++,!this[ke].length&&!this[le]&&this[_n]();else if(e==="readable"&&this[fe]!==0)super.emit("readable");else if(fh(e)&&this[xt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Hn]){let i=t;this[Qe]?Xn(()=>i.call(this,this[Hn])):i.call(this,this[Hn])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e==="data"&&(this[Ht]=this.listeners("data").length,this[Ht]===0&&!this[Me]&&!this[ke].length&&(this[le]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Ht]=0,!this[Me]&&!this[ke].length&&(this[le]=!1)),t}get emittedEnd(){return this[xt]}[at](){!this[$s]&&!this[xt]&&!this[re]&&this[ue].length===0&&this[ot]&&(this[$s]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Fs]&&this.emit("close"),this[$s]=!1)}emit(e,...t){let n=t[0];if(e!=="error"&&e!=="close"&&e!==re&&this[re])return!1;if(e==="data")return!this[ve]&&!n?!1:this[Qe]?(Xn(()=>this[Br](n)),!0):this[Br](n);if(e==="end")return this[ec]();if(e==="close"){if(this[Fs]=!0,!this[xt]&&!this[re])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[Hn]=n,super.emit(zr,n);let r=!this[Jn]||this.listeners("error").length?super.emit("error",n):!1;return this[at](),r}else if(e==="resume"){let r=super.emit("resume");return this[at](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let i=super.emit(e,...t);return this[at](),i}[Br](e){for(let n of this[ke])n.dest.write(e)===!1&&this.pause();let t=this[Me]?!1:super.emit("data",e);return this[at](),t}[ec](){return this[xt]?!1:(this[xt]=!0,this.readable=!1,this[Qe]?(Xn(()=>this[qr]()),!0):this[qr]())}[qr](){if(this[vn]){let t=this[vn].end();if(t){for(let n of this[ke])n.dest.write(t);this[Me]||super.emit("data",t)}}for(let t of this[ke])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[ve]||(e.dataLength=0);let t=this.promise();return this.on("data",n=>{e.push(n),this[ve]||(e.dataLength+=n.length)}),await t,e}async concat(){if(this[ve])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Ue]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(re,()=>t(new Error("stream destroyed"))),this.on("error",n=>t(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Me]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[ot])return t();let r,o,a=u=>{this.off("data",c),this.off("end",l),this.off(re,f),t(),o(u)},c=u=>{this.off("error",a),this.off("end",l),this.off(re,f),this.pause(),r({value:u,done:!!this[ot]})},l=()=>{this.off("error",a),this.off("data",c),this.off(re,f),t(),r({done:!0,value:void 0})},f=()=>a(new Error("stream destroyed"));return new Promise((u,h)=>{o=h,r=u,this.once(re,f),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Me]=!1;let e=!1,t=()=>(this.pause(),this.off(zr,t),this.off(re,t),this.off("end",t),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}};return this.once("end",t),this.once(zr,t),this.once(re,t),{next:n,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[re])return e?this.emit("error",e):this.emit(re),this;this[re]=!0,this[Me]=!0,this[ue].length=0,this[fe]=0;let t=this;return typeof t.close=="function"&&!this[Fs]&&t.close(),e?this.emit("error",e):this.emit(re),this}static get isStream(){return ah}};var yh=et.realpathSync.native,Qn={lstatSync:et.lstatSync,readdir:et.readdir,readdirSync:et.readdirSync,readlinkSync:et.readlinkSync,realpathSync:yh,promises:{lstat:kt.lstat,readdir:kt.readdir,readlink:kt.readlink,realpath:kt.realpath}},ac=s=>!s||s===Qn||s===gh?Qn:{...Qn,...s,promises:{...Qn.promises,...s.promises||{}}},cc=/^\\\\\?\\([a-z]:)\\?$/i,wh=s=>s.replace(/\//g,"\\").replace(cc,"$1\\"),bh=/[\\\/]/,We=0,lc=1,uc=2,Ke=4,fc=6,dc=8,Gt=10,hc=12,Fe=15,Yn=~Fe,Hr=16,nc=32,Kn=64,Ve=128,Vs=256,Hs=512,sc=Kn|Ve|Hs,vh=1023,Gr=s=>s.isFile()?dc:s.isDirectory()?Ke:s.isSymbolicLink()?Gt:s.isCharacterDevice()?uc:s.isBlockDevice()?fc:s.isSocket()?hc:s.isFIFO()?lc:We,ic=new Map,es=s=>{let e=ic.get(s);if(e)return e;let t=s.normalize("NFKD");return ic.set(s,t),t},rc=new Map,Zs=s=>{let e=rc.get(s);if(e)return e;let t=es(s.toLowerCase());return rc.set(s,t),t},Gs=class extends Zn{constructor(){super({max:256})}},Jr=class extends Zn{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},pc=Symbol("PathScurry setAsCwd"),_e=class{name;root;roots;parent;nocase;isCWD=!1;#e;#n;get dev(){return this.#n}#s;get mode(){return this.#s}#t;get nlink(){return this.#t}#r;get uid(){return this.#r}#_;get gid(){return this.#_}#w;get rdev(){return this.#w}#c;get blksize(){return this.#c}#f;get ino(){return this.#f}#a;get size(){return this.#a}#l;get blocks(){return this.#l}#i;get atimeMs(){return this.#i}#g;get mtimeMs(){return this.#g}#x;get ctimeMs(){return this.#x}#y;get birthtimeMs(){return this.#y}#d;get atime(){return this.#d}#k;get mtime(){return this.#k}#h;get ctime(){return this.#h}#E;get birthtime(){return this.#E}#v;#b;#m;#S;#p;#N;#o;#M;#C;#A;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=We,n,i,r,o,a){this.name=e,this.#v=r?Zs(e):es(e),this.#o=t&vh,this.nocase=r,this.roots=i,this.root=n||this,this.#M=o,this.#m=a.fullpath,this.#p=a.relative,this.#N=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=ac(a.fs)}depth(){return this.#b!==void 0?this.#b:this.parent?this.#b=this.parent.depth()+1:this.#b=0}childrenCache(){return this.#M}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#R(i):this.#R(i)}#R(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#M.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#M.set(this,t),this.#o&=~Hr,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?Zs(e):es(e);for(let c of n)if(c.#v===i)return c;let r=this.parent?this.sep:"",o=this.#m?this.#m+r+e:void 0,a=this.newChild(e,We,{...t,parent:this,fullpath:o});return this.canReaddir()||(a.#o|=Ve),n.push(a),a}relative(){if(this.isCWD)return"";if(this.#p!==void 0)return this.#p;let e=this.name,t=this.parent;if(!t)return this.#p=this.name;let n=t.relative();return n+(!n||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#N!==void 0)return this.#N;let e=this.name,t=this.parent;if(!t)return this.#N=this.fullpathPosix();let n=t.relativePosix();return n+(!n||!t.parent?"":"/")+e}fullpath(){if(this.#m!==void 0)return this.#m;let e=this.name,t=this.parent;if(!t)return this.#m=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#m=i}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep==="/")return this.#S=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#S=`//?/${i}`:this.#S=i}let e=this.parent,t=e.fullpathPosix(),n=t+(!t||!e.parent?"":"/")+this.name;return this.#S=n}isUnknown(){return(this.#o&Fe)===We}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.#o&Fe)===dc}isDirectory(){return(this.#o&Fe)===Ke}isCharacterDevice(){return(this.#o&Fe)===uc}isBlockDevice(){return(this.#o&Fe)===fc}isFIFO(){return(this.#o&Fe)===lc}isSocket(){return(this.#o&Fe)===hc}isSymbolicLink(){return(this.#o&Gt)===Gt}lstatCached(){return this.#o&nc?this:void 0}readlinkCached(){return this.#C}realpathCached(){return this.#A}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#C)return!0;if(!this.parent)return!1;let e=this.#o&Fe;return!(e!==We&&e!==Gt||this.#o&Vs||this.#o&Ve)}calledReaddir(){return!!(this.#o&Hr)}isENOENT(){return!!(this.#o&Ve)}isNamed(e){return this.nocase?this.#v===Zs(e):this.#v===es(e)}async readlink(){let e=this.#C;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(t);if(n)return this.#C=n}catch(t){this.#D(t.code);return}}readlinkSync(){let e=this.#C;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(t);if(n)return this.#C=n}catch(t){this.#D(t.code);return}}#W(e){this.#o|=Hr;for(let t=e.provisional;t<e.length;t++){let n=e[t];n&&n.#j()}}#j(){this.#o&Ve||(this.#o=(this.#o|Ve)&Yn,this.#I())}#I(){let e=this.children();e.provisional=0;for(let t of e)t.#j()}#z(){this.#o|=Hs,this.#T()}#T(){if(this.#o&Kn)return;let e=this.#o;(e&Fe)===Ke&&(e&=Yn),this.#o=e|Kn,this.#I()}#O(e=""){e==="ENOTDIR"||e==="EPERM"?this.#T():e==="ENOENT"?this.#j():this.children().provisional=0}#B(e=""){e==="ENOTDIR"?this.parent.#T():e==="ENOENT"&&this.#j()}#D(e=""){let t=this.#o;t|=Vs,e==="ENOENT"&&(t|=Ve),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Yn),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#T()}#L(e,t){return this.#q(e,t)||this.#u(e,t)}#u(e,t){let n=Gr(e),i=this.newChild(e.name,n,{parent:this}),r=i.#o&Fe;return r!==Ke&&r!==Gt&&r!==We&&(i.#o|=Kn),t.unshift(i),t.provisional++,i}#q(e,t){for(let n=t.provisional;n<t.length;n++){let i=t[n];if((this.nocase?Zs(e.name):es(e.name))===i.#v)return this.#$(e,i,n,t)}}#$(e,t,n,i){let r=t.name;return t.#o=t.#o&Yn|Gr(e),r!==e.name&&(t.name=e.name),n!==i.provisional&&(n===i.length-1?i.pop():i.splice(n,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#o&Ve)===0)try{return this.#P(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#B(e.code)}}lstatSync(){if((this.#o&Ve)===0)try{return this.#P(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#B(e.code)}}#P(e){let{atime:t,atimeMs:n,birthtime:i,birthtimeMs:r,blksize:o,blocks:a,ctime:c,ctimeMs:l,dev:f,gid:u,ino:h,mode:p,mtime:w,mtimeMs:g,nlink:k,rdev:S,size:_,uid:v}=e;this.#d=t,this.#i=n,this.#E=i,this.#y=r,this.#c=o,this.#l=a,this.#h=c,this.#x=l,this.#n=f,this.#_=u,this.#f=h,this.#s=p,this.#k=w,this.#g=g,this.#t=k,this.#w=S,this.#a=_,this.#r=v;let E=Gr(e);this.#o=this.#o&Yn|E|nc,E!==We&&E!==Ke&&E!==Gt&&(this.#o|=Kn)}#F=[];#V=!1;#Z(e){this.#V=!1;let t=this.#F.slice();this.#F.length=0,t.forEach(n=>n(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let r=n.slice(0,n.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#F.push(e),this.#V)return;this.#V=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(r,o)=>{if(r)this.#O(r.code),n.provisional=0;else{for(let a of o)this.#L(a,n);this.#W(n)}this.#Z(n.slice(0,n.provisional))})}#U;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#U)await this.#U;else{let n=()=>{};this.#U=new Promise(i=>n=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#L(i,e);this.#W(e)}catch(i){this.#O(i.code),e.provisional=0}this.#U=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let n of this.#e.readdirSync(t,{withFileTypes:!0}))this.#L(n,e);this.#W(e)}catch(n){this.#O(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&sc)return!1;let e=Fe&this.#o;return e===We||e===Ke||e===Gt}shouldWalk(e,t){return(this.#o&Ke)===Ke&&!(this.#o&sc)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#A)return this.#A;if(!((Hs|Vs|Ve)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#A=this.resolve(e)}catch{this.#z()}}realpathSync(){if(this.#A)return this.#A;if(!((Hs|Vs|Ve)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#A=this.resolve(e)}catch{this.#z()}}[pc](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),n=[],i=this;for(;i&&i.parent;)t.add(i),i.#p=n.join(this.sep),i.#N=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#p=void 0,i.#N=void 0,i=i.parent}},Js=class s extends _e{sep="\\";splitSep=bh;constructor(e,t=We,n,i,r,o,a){super(e,t,n,i,r,o,a)}newChild(e,t=We,n={}){return new s(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return xn.win32.parse(e).root}getRoot(e){if(e=wh(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new Sn(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(cc,"$1\\"),e===t}},Xs=class s extends _e{splitSep="/";sep="/";constructor(e,t=We,n,i,r,o,a){super(e,t,n,i,r,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=We,n={}){return new s(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}},Ys=class{root;rootPath;roots;cwd;#e;#n;#s;nocase;#t;constructor(e=process.cwd(),t,n,{nocase:i,childrenCacheSize:r=16*1024,fs:o=Qn}={}){this.#t=ac(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,oc.fileURLToPath)(e));let a=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new Gs,this.#n=new Gs,this.#s=new Jr(r);let c=a.substring(this.rootPath.length).split(n);if(c.length===1&&!c[0]&&c.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let l=this.root,f=c.length-1,u=t.sep,h=this.rootPath,p=!1;for(let w of c){let g=f--;l=l.child(w,{relative:new Array(g).fill("..").join(u),relativePosix:new Array(g).fill("..").join("/"),fullpath:h+=(p?"":u)+w}),p=!0}this.cwd=l}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#s}resolve(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let n=this.#e.get(t);if(n!==void 0)return n;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let n=this.#n.get(t);if(n!==void 0)return n;let i=this.cwd.resolve(t).fullpathPosix();return this.#n.set(t,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,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(e.canReaddir()){let i=await e.readdir();return n?i:i.map(r=>r.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(n?e:e.fullpath());let c=new Set,l=(u,h)=>{c.add(u),u.readdirCB((p,w)=>{if(p)return h(p);let g=w.length;if(!g)return h();let k=()=>{--g===0&&h()};for(let S of w)(!r||r(S))&&a.push(n?S:S.fullpath()),i&&S.isSymbolicLink()?S.realpath().then(_=>_?.isUnknown()?_.lstat():_).then(_=>_?.shouldWalk(c,o)?l(_,k):k()):S.shouldWalk(c,o)?l(S,k):k()},!0)},f=e;return new Promise((u,h)=>{l(f,p=>{if(p)return h(p);u(a)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(n?e:e.fullpath());let c=new Set([e]);for(let l of c){let f=l.readdirSync();for(let u of f){(!r||r(u))&&a.push(n?u:u.fullpath());let h=u;if(u.isSymbolicLink()){if(!(i&&(h=u.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(c,o)&&c.add(h)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:r,walkFilter:o}=t;(!r||r(e))&&(yield n?e:e.fullpath());let a=new Set([e]);for(let c of a){let l=c.readdirSync();for(let f of l){(!r||r(f))&&(yield n?f:f.fullpath());let u=f;if(f.isSymbolicLink()){if(!(i&&(u=f.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(a,o)&&a.add(u)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new St({objectMode:!0});(!r||r(e))&&a.write(n?e:e.fullpath());let c=new Set,l=[e],f=0,u=()=>{let h=!1;for(;!h;){let p=l.shift();if(!p){f===0&&a.end();return}f++,c.add(p);let w=(k,S,_=!1)=>{if(k)return a.emit("error",k);if(i&&!_){let v=[];for(let E of S)E.isSymbolicLink()&&v.push(E.realpath().then(O=>O?.isUnknown()?O.lstat():O));if(v.length){Promise.all(v).then(()=>w(null,S,!0));return}}for(let v of S)v&&(!r||r(v))&&(a.write(n?v:v.fullpath())||(h=!0));f--;for(let v of S){let E=v.realpathCached()||v;E.shouldWalk(c,o)&&l.push(E)}h&&!a.flowing?a.once("drain",u):g||u()},g=!0;p.readdirCB(w,!0),g=!1}};return u(),a}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof _e||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new St({objectMode:!0}),c=new Set;(!r||r(e))&&a.write(n?e:e.fullpath());let l=[e],f=0,u=()=>{let h=!1;for(;!h;){let p=l.shift();if(!p){f===0&&a.end();return}f++,c.add(p);let w=p.readdirSync();for(let g of w)(!r||r(g))&&(a.write(n?g:g.fullpath())||(h=!0));f--;for(let g of w){let k=g;if(g.isSymbolicLink()){if(!(i&&(k=g.realpathSync())))continue;k.isUnknown()&&k.lstatSync()}k.shouldWalk(c,o)&&l.push(k)}}h&&!a.flowing&&a.once("drain",u)};return u(),a}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[pc](t)}},Sn=class extends Ys{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,xn.win32,"\\",{...t,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return xn.win32.parse(e).root.toUpperCase()}newRoot(e){return new Js(this.rootPath,Ke,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},kn=class extends Ys{sep="/";constructor(e=process.cwd(),t={}){let{nocase:n=!1}=t;super(e,xn.posix,"/",{...t,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new Xs(this.rootPath,Ke,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},ts=class extends kn{constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}},eg=process.platform==="win32"?Js:Xs,mc=process.platform==="win32"?Sn:process.platform==="darwin"?ts:kn;var _h=s=>s.length>=1,xh=s=>s.length>=1,En=class s{#e;#n;#s;length;#t;#r;#_;#w;#c;#f;#a=!0;constructor(e,t,n,i){if(!_h(e))throw new TypeError("empty pattern list");if(!xh(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=t,this.#s=n,this.#t=i,this.#s===0){if(this.isUNC()){let[r,o,a,c,...l]=this.#e,[f,u,h,p,...w]=this.#n;l[0]===""&&(l.shift(),w.shift());let g=[r,o,a,c,""].join("/"),k=[f,u,h,p,""].join("/");this.#e=[g,...l],this.#n=[k,...w],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=this.#e,[a,...c]=this.#n;o[0]===""&&(o.shift(),c.shift());let l=r+"/",f=a+"/";this.#e=[l,...o],this.#n=[f,...c],this.length=this.#e.length}}}pattern(){return this.#e[this.#s]}isString(){return typeof this.#e[this.#s]=="string"}isGlobstar(){return this.#e[this.#s]===ie}isRegExp(){return this.#e[this.#s]instanceof RegExp}globString(){return this.#_=this.#_||(this.#s===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#s).join("/"))}hasMore(){return this.length>this.#s+1}rest(){return this.#r!==void 0?this.#r:this.hasMore()?(this.#r=new s(this.#e,this.#n,this.#s+1,this.#t),this.#r.#f=this.#f,this.#r.#c=this.#c,this.#r.#w=this.#w,this.#r):this.#r=null}isUNC(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=this.#t==="win32"&&this.#s===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#w!==void 0?this.#w:this.#w=this.#t==="win32"&&this.#s===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#f!==void 0?this.#f:this.#f=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#s===0?e:""}checkFollowGlobstar(){return!(this.#s===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#s===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var Sh=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Cn=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:i,noglobstar:r,platform:o=Sh}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let t=new Pe(e,this.mmopts);for(let n=0;n<t.set.length;n++){let i=t.set[n],r=t.globParts[n];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let o=new En(i,r,0,this.platform),a=new Pe(o.globString(),this.mmopts),c=r[r.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 t=e.fullpath(),n=`${t}/`,i=e.relative()||".",r=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(r))return!0;for(let o of this.absolute)if(o.match(t)||o.match(n))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(n))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var Xr=class s{store;constructor(e=new Map){this.store=e}copy(){return new s(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let n=e.fullpath(),i=this.store.get(n);i?i.add(t.globString()):this.store.set(n,new Set([t.globString()]))}},Yr=class{store=new Map;add(e,t,n){let i=(t?2:0)|(n?1:0),r=this.store.get(e);this.store.set(e,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},Qr=class{store=new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(i=>i.globString()===t.globString())||n.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},ns=class s{hasWalkedCache;matches=new Yr;subwalks=new Qr;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new Xr}processPatterns(e,t){this.patterns=t;let n=t.map(i=>[e,i]);for(let[i,r]of n){this.hasWalkedCache.storeWalked(i,r);let o=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let u=r.rest();if(u)r=u;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let c,l,f=!1;for(;typeof(c=r.pattern())=="string"&&(l=r.rest());)i=i.resolve(c),r=l,f=!0;if(c=r.pattern(),l=r.rest(),f){if(this.hasWalkedCache.hasWalked(i,r))continue;this.hasWalkedCache.storeWalked(i,r)}if(typeof c=="string"){let u=c===".."||c===""||c===".";this.matches.add(i.resolve(c),a,u);continue}else if(c===ie){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let u=l?.pattern(),h=l?.rest();if(!l||(u===""||u===".")&&!h)this.matches.add(i,a,u===""||u===".");else if(u===".."){let p=i.parent||i;h?this.hasWalkedCache.hasWalked(p,h)||this.subwalks.add(p,h):this.matches.add(p,a,!0)}}else c instanceof RegExp&&this.subwalks.add(i,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new s(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),i=this.child();for(let r of t)for(let o of n){let a=o.isAbsolute(),c=o.pattern(),l=o.rest();c===ie?i.testGlobstar(r,o,l,a):c instanceof RegExp?i.testRegExp(r,c,l,a):i.testString(r,c,l,a)}return i}testGlobstar(e,t,n,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let r=n.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(e,r,n.rest(),i);else if(r===".."){let o=e.parent||e;this.subwalks.add(o,n)}else r instanceof RegExp&&this.testRegExp(e,r,n.rest(),i)}}testRegExp(e,t,n,i){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}testString(e,t,n,i){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}};var kh=(s,e)=>typeof s=="string"?new Cn([s],e):Array.isArray(s)?new Cn(s,e):s,Qs=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#n;#s;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#s=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#n=kh(n.ignore??[],n),!this.includeChildMatches&&typeof this.#n.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#n?.ignored?.(e)}#r(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,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=await r.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||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,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=r.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#n?.add){let r=`${e.relativePosix()}/**`;this.#n.add(r)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#s:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let r=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#s)?"."+this.#s:"";this.matchEmit(r?o+r+i:"."+i)}}async match(e,t,n){let i=await this.matchCheck(e,n);i&&this.matchFinish(i,t)}matchSync(e,t,n){let i=this.matchCheckSync(e,n);i&&this.matchFinish(i,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new ns(this.opts),n)}walkCB2(e,t,n,i){if(this.#r(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,i));return}n.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||(r++,this.match(a,c,l).then(()=>o()));for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,n,o):a.readdirCB((l,f)=>this.walkCB3(a,f,n,o),!0)}o()}walkCB3(e,t,n,i){n=n.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||(r++,this.match(a,c,l).then(()=>o()));for(let[a,c]of n.subwalks.entries())r++,this.walkCB2(a,c,n.child(),o);o()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new ns(this.opts),n)}walkCB2Sync(e,t,n,i){if(this.#r(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,i));return}n.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let c=a.readdirSync();this.walkCB3Sync(a,c,n,o)}o()}walkCB3Sync(e,t,n,i){n=n.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let[a,c]of n.subwalks.entries())r++,this.walkCB2Sync(a,c,n.child(),o);o()}},ss=class extends Qs{matches=new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(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}},is=class extends Qs{results;constructor(e,t,n){super(e,t,n),this.results=new St({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 Eh=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ze=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,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,gc.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=e,this.platform=t.platform||Eh,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=t.platform==="win32"?Sn:t.platform==="darwin"?ts:t.platform?kn:mc;this.scurry=new c(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(c=>new Pe(c,i)),[o,a]=r.reduce((c,l)=>(c[0].push(...l.set),c[1].push(...l.globParts),c),[[],[]]);this.patterns=o.map((c,l)=>{let f=a[l];if(!f)throw new Error("invalid pattern object");return new En(c,f,0,this.platform)})}async walk(){return[...await new ss(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 ss(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 is(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 is(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 Kr=(s,e={})=>{Array.isArray(s)||(s=[s]);for(let t of s)if(new Pe(t,e).hasMagic())return!0;return!1};function Ks(s,e={}){return new Ze(s,e).streamSync()}function bc(s,e={}){return new Ze(s,e).stream()}function ei(s,e={}){return new Ze(s,e).walkSync()}async function yc(s,e={}){return new Ze(s,e).walk()}function ti(s,e={}){return new Ze(s,e).iterateSync()}function vc(s,e={}){return new Ze(s,e).iterate()}var Ch=Ks,Rh=Object.assign(bc,{sync:Ks}),Th=ti,Oh=Object.assign(vc,{sync:ti}),Nh=Object.assign(ei,{stream:Ks,iterate:ti}),wc=Object.assign(yc,{glob:yc,globSync:ei,sync:Nh,globStream:bc,stream:Rh,globStreamSync:Ks,streamSync:Ch,globIterate:vc,iterate:Oh,globIterateSync:ti,iterateSync:Th,Glob:Ze,hasMagic:Kr,escape:yn,unescape:qe});wc.glob=wc;var eo={name:"dts-linter",version:"0.5.1",main:"index.js",repository:{type:"git",url:"https://github.com/kylebonnici/dts-linter"},scripts:{compile:"node ./esbuild.js","compile:prod":"node ./esbuild.js --production"},bin:"./dist/dts-linter.js",files:["dist/dts-linter.js","THIRD_PARTY_LICENSES.txt"],keywords:["dts","linter","devicetree","formatting"],author:"Kyle Micallef Bonnici",license:"Apache-2.0",description:"",dependencies:{"devicetree-language-server":"^0.9.4"},devDependencies:{"@types/node":"^24.0.3","devicetree-language-server-types":"^0.0.2-alpha.37",diff:"^8.0.2",esbuild:"^0.25.5",glob:"^11.1.0","license-checker":"^25.0.1","ts-node":"^10.9.2",typescript:"^5.8.3","vscode-jsonrpc":"^8.2.1","vscode-languageserver-types":"^3.17.5",zod:"^3.25.67"}};var _c;(function(s){function e(t){return typeof t=="string"}s.is=e})(_c||(_c={}));var to;(function(s){function e(t){return typeof t=="string"}s.is=e})(to||(to={}));var xc;(function(s){s.MIN_VALUE=-2147483648,s.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&s.MIN_VALUE<=t&&t<=s.MAX_VALUE}s.is=e})(xc||(xc={}));var ni;(function(s){s.MIN_VALUE=0,s.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&s.MIN_VALUE<=t&&t<=s.MAX_VALUE}s.is=e})(ni||(ni={}));var He;(function(s){function e(n,i){return n===Number.MAX_VALUE&&(n=ni.MAX_VALUE),i===Number.MAX_VALUE&&(i=ni.MAX_VALUE),{line:n,character:i}}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&m.uinteger(i.line)&&m.uinteger(i.character)}s.is=t})(He||(He={}));var oe;(function(s){function e(n,i,r,o){if(m.uinteger(n)&&m.uinteger(i)&&m.uinteger(r)&&m.uinteger(o))return{start:He.create(n,i),end:He.create(r,o)};if(He.is(n)&&He.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${r}, ${o}]`)}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&He.is(i.start)&&He.is(i.end)}s.is=t})(oe||(oe={}));var si;(function(s){function e(n,i){return{uri:n,range:i}}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&oe.is(i.range)&&(m.string(i.uri)||m.undefined(i.uri))}s.is=t})(si||(si={}));var Sc;(function(s){function e(n,i,r,o){return{targetUri:n,targetRange:i,targetSelectionRange:r,originSelectionRange:o}}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&oe.is(i.targetRange)&&m.string(i.targetUri)&&oe.is(i.targetSelectionRange)&&(oe.is(i.originSelectionRange)||m.undefined(i.originSelectionRange))}s.is=t})(Sc||(Sc={}));var no;(function(s){function e(n,i,r,o){return{red:n,green:i,blue:r,alpha:o}}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&m.numberRange(i.red,0,1)&&m.numberRange(i.green,0,1)&&m.numberRange(i.blue,0,1)&&m.numberRange(i.alpha,0,1)}s.is=t})(no||(no={}));var kc;(function(s){function e(n,i){return{range:n,color:i}}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&oe.is(i.range)&&no.is(i.color)}s.is=t})(kc||(kc={}));var Ec;(function(s){function e(n,i,r){return{label:n,textEdit:i,additionalTextEdits:r}}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&m.string(i.label)&&(m.undefined(i.textEdit)||Tn.is(i))&&(m.undefined(i.additionalTextEdits)||m.typedArray(i.additionalTextEdits,Tn.is))}s.is=t})(Ec||(Ec={}));var Cc;(function(s){s.Comment="comment",s.Imports="imports",s.Region="region"})(Cc||(Cc={}));var Rc;(function(s){function e(n,i,r,o,a,c){let l={startLine:n,endLine:i};return m.defined(r)&&(l.startCharacter=r),m.defined(o)&&(l.endCharacter=o),m.defined(a)&&(l.kind=a),m.defined(c)&&(l.collapsedText=c),l}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&m.uinteger(i.startLine)&&m.uinteger(i.startLine)&&(m.undefined(i.startCharacter)||m.uinteger(i.startCharacter))&&(m.undefined(i.endCharacter)||m.uinteger(i.endCharacter))&&(m.undefined(i.kind)||m.string(i.kind))}s.is=t})(Rc||(Rc={}));var so;(function(s){function e(n,i){return{location:n,message:i}}s.create=e;function t(n){let i=n;return m.defined(i)&&si.is(i.location)&&m.string(i.message)}s.is=t})(so||(so={}));var me;(function(s){s.Error=1,s.Warning=2,s.Information=3,s.Hint=4})(me||(me={}));var Tc;(function(s){s.Unnecessary=1,s.Deprecated=2})(Tc||(Tc={}));var Oc;(function(s){function e(t){let n=t;return m.objectLiteral(n)&&m.string(n.href)}s.is=e})(Oc||(Oc={}));var ii;(function(s){function e(n,i,r,o,a,c){let l={range:n,message:i};return m.defined(r)&&(l.severity=r),m.defined(o)&&(l.code=o),m.defined(a)&&(l.source=a),m.defined(c)&&(l.relatedInformation=c),l}s.create=e;function t(n){var i;let r=n;return m.defined(r)&&oe.is(r.range)&&m.string(r.message)&&(m.number(r.severity)||m.undefined(r.severity))&&(m.integer(r.code)||m.string(r.code)||m.undefined(r.code))&&(m.undefined(r.codeDescription)||m.string((i=r.codeDescription)===null||i===void 0?void 0:i.href))&&(m.string(r.source)||m.undefined(r.source))&&(m.undefined(r.relatedInformation)||m.typedArray(r.relatedInformation,so.is))}s.is=t})(ii||(ii={}));var Rn;(function(s){function e(n,i,...r){let o={title:n,command:i};return m.defined(r)&&r.length>0&&(o.arguments=r),o}s.create=e;function t(n){let i=n;return m.defined(i)&&m.string(i.title)&&m.string(i.command)}s.is=t})(Rn||(Rn={}));var Tn;(function(s){function e(r,o){return{range:r,newText:o}}s.replace=e;function t(r,o){return{range:{start:r,end:r},newText:o}}s.insert=t;function n(r){return{range:r,newText:""}}s.del=n;function i(r){let o=r;return m.objectLiteral(o)&&m.string(o.newText)&&oe.is(o.range)}s.is=i})(Tn||(Tn={}));var io;(function(s){function e(n,i,r){let o={label:n};return i!==void 0&&(o.needsConfirmation=i),r!==void 0&&(o.description=r),o}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&m.string(i.label)&&(m.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(m.string(i.description)||i.description===void 0)}s.is=t})(io||(io={}));var On;(function(s){function e(t){let n=t;return m.string(n)}s.is=e})(On||(On={}));var Nc;(function(s){function e(r,o,a){return{range:r,newText:o,annotationId:a}}s.replace=e;function t(r,o,a){return{range:{start:r,end:r},newText:o,annotationId:a}}s.insert=t;function n(r,o){return{range:r,newText:"",annotationId:o}}s.del=n;function i(r){let o=r;return Tn.is(o)&&(io.is(o.annotationId)||On.is(o.annotationId))}s.is=i})(Nc||(Nc={}));var ro;(function(s){function e(n,i){return{textDocument:n,edits:i}}s.create=e;function t(n){let i=n;return m.defined(i)&&uo.is(i.textDocument)&&Array.isArray(i.edits)}s.is=t})(ro||(ro={}));var oo;(function(s){function e(n,i,r){let o={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),r!==void 0&&(o.annotationId=r),o}s.create=e;function t(n){let i=n;return i&&i.kind==="create"&&m.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||m.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||m.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||On.is(i.annotationId))}s.is=t})(oo||(oo={}));var ao;(function(s){function e(n,i,r,o){let a={kind:"rename",oldUri:n,newUri:i};return r!==void 0&&(r.overwrite!==void 0||r.ignoreIfExists!==void 0)&&(a.options=r),o!==void 0&&(a.annotationId=o),a}s.create=e;function t(n){let i=n;return i&&i.kind==="rename"&&m.string(i.oldUri)&&m.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||m.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||m.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||On.is(i.annotationId))}s.is=t})(ao||(ao={}));var co;(function(s){function e(n,i,r){let o={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),r!==void 0&&(o.annotationId=r),o}s.create=e;function t(n){let i=n;return i&&i.kind==="delete"&&m.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||m.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||m.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||On.is(i.annotationId))}s.is=t})(co||(co={}));var lo;(function(s){function e(t){let n=t;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>m.string(i.kind)?oo.is(i)||ao.is(i)||co.is(i):ro.is(i)))}s.is=e})(lo||(lo={}));var Ac;(function(s){function e(n){return{uri:n}}s.create=e;function t(n){let i=n;return m.defined(i)&&m.string(i.uri)}s.is=t})(Ac||(Ac={}));var Pc;(function(s){function e(n,i){return{uri:n,version:i}}s.create=e;function t(n){let i=n;return m.defined(i)&&m.string(i.uri)&&m.integer(i.version)}s.is=t})(Pc||(Pc={}));var uo;(function(s){function e(n,i){return{uri:n,version:i}}s.create=e;function t(n){let i=n;return m.defined(i)&&m.string(i.uri)&&(i.version===null||m.integer(i.version))}s.is=t})(uo||(uo={}));var Mc;(function(s){function e(n,i,r,o){return{uri:n,languageId:i,version:r,text:o}}s.create=e;function t(n){let i=n;return m.defined(i)&&m.string(i.uri)&&m.string(i.languageId)&&m.integer(i.version)&&m.string(i.text)}s.is=t})(Mc||(Mc={}));var fo;(function(s){s.PlainText="plaintext",s.Markdown="markdown";function e(t){let n=t;return n===s.PlainText||n===s.Markdown}s.is=e})(fo||(fo={}));var rs;(function(s){function e(t){let n=t;return m.objectLiteral(t)&&fo.is(n.kind)&&m.string(n.value)}s.is=e})(rs||(rs={}));var jc;(function(s){s.Text=1,s.Method=2,s.Function=3,s.Constructor=4,s.Field=5,s.Variable=6,s.Class=7,s.Interface=8,s.Module=9,s.Property=10,s.Unit=11,s.Value=12,s.Enum=13,s.Keyword=14,s.Snippet=15,s.Color=16,s.File=17,s.Reference=18,s.Folder=19,s.EnumMember=20,s.Constant=21,s.Struct=22,s.Event=23,s.Operator=24,s.TypeParameter=25})(jc||(jc={}));var Lc;(function(s){s.PlainText=1,s.Snippet=2})(Lc||(Lc={}));var Ic;(function(s){s.Deprecated=1})(Ic||(Ic={}));var Dc;(function(s){function e(n,i,r){return{newText:n,insert:i,replace:r}}s.create=e;function t(n){let i=n;return i&&m.string(i.newText)&&oe.is(i.insert)&&oe.is(i.replace)}s.is=t})(Dc||(Dc={}));var $c;(function(s){s.asIs=1,s.adjustIndentation=2})($c||($c={}));var Fc;(function(s){function e(t){let n=t;return n&&(m.string(n.detail)||n.detail===void 0)&&(m.string(n.description)||n.description===void 0)}s.is=e})(Fc||(Fc={}));var Wc;(function(s){function e(t){return{label:t}}s.create=e})(Wc||(Wc={}));var zc;(function(s){function e(t,n){return{items:t||[],isIncomplete:!!n}}s.create=e})(zc||(zc={}));var ri;(function(s){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s.fromPlainText=e;function t(n){let i=n;return m.string(i)||m.objectLiteral(i)&&m.string(i.language)&&m.string(i.value)}s.is=t})(ri||(ri={}));var Bc;(function(s){function e(t){let n=t;return!!n&&m.objectLiteral(n)&&(rs.is(n.contents)||ri.is(n.contents)||m.typedArray(n.contents,ri.is))&&(t.range===void 0||oe.is(t.range))}s.is=e})(Bc||(Bc={}));var qc;(function(s){function e(t,n){return n?{label:t,documentation:n}:{label:t}}s.create=e})(qc||(qc={}));var Uc;(function(s){function e(t,n,...i){let r={label:t};return m.defined(n)&&(r.documentation=n),m.defined(i)?r.parameters=i:r.parameters=[],r}s.create=e})(Uc||(Uc={}));var Vc;(function(s){s.Text=1,s.Read=2,s.Write=3})(Vc||(Vc={}));var Zc;(function(s){function e(t,n){let i={range:t};return m.number(n)&&(i.kind=n),i}s.create=e})(Zc||(Zc={}));var Hc;(function(s){s.File=1,s.Module=2,s.Namespace=3,s.Package=4,s.Class=5,s.Method=6,s.Property=7,s.Field=8,s.Constructor=9,s.Enum=10,s.Interface=11,s.Function=12,s.Variable=13,s.Constant=14,s.String=15,s.Number=16,s.Boolean=17,s.Array=18,s.Object=19,s.Key=20,s.Null=21,s.EnumMember=22,s.Struct=23,s.Event=24,s.Operator=25,s.TypeParameter=26})(Hc||(Hc={}));var Gc;(function(s){s.Deprecated=1})(Gc||(Gc={}));var Jc;(function(s){function e(t,n,i,r,o){let a={name:t,kind:n,location:{uri:r,range:i}};return o&&(a.containerName=o),a}s.create=e})(Jc||(Jc={}));var Xc;(function(s){function e(t,n,i,r){return r!==void 0?{name:t,kind:n,location:{uri:i,range:r}}:{name:t,kind:n,location:{uri:i}}}s.create=e})(Xc||(Xc={}));var Yc;(function(s){function e(n,i,r,o,a,c){let l={name:n,detail:i,kind:r,range:o,selectionRange:a};return c!==void 0&&(l.children=c),l}s.create=e;function t(n){let i=n;return i&&m.string(i.name)&&m.number(i.kind)&&oe.is(i.range)&&oe.is(i.selectionRange)&&(i.detail===void 0||m.string(i.detail))&&(i.deprecated===void 0||m.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}s.is=t})(Yc||(Yc={}));var Qc;(function(s){s.Empty="",s.QuickFix="quickfix",s.Refactor="refactor",s.RefactorExtract="refactor.extract",s.RefactorInline="refactor.inline",s.RefactorRewrite="refactor.rewrite",s.Source="source",s.SourceOrganizeImports="source.organizeImports",s.SourceFixAll="source.fixAll"})(Qc||(Qc={}));var oi;(function(s){s.Invoked=1,s.Automatic=2})(oi||(oi={}));var Kc;(function(s){function e(n,i,r){let o={diagnostics:n};return i!=null&&(o.only=i),r!=null&&(o.triggerKind=r),o}s.create=e;function t(n){let i=n;return m.defined(i)&&m.typedArray(i.diagnostics,ii.is)&&(i.only===void 0||m.typedArray(i.only,m.string))&&(i.triggerKind===void 0||i.triggerKind===oi.Invoked||i.triggerKind===oi.Automatic)}s.is=t})(Kc||(Kc={}));var el;(function(s){function e(n,i,r){let o={title:n},a=!0;return typeof i=="string"?(a=!1,o.kind=i):Rn.is(i)?o.command=i:o.edit=i,a&&r!==void 0&&(o.kind=r),o}s.create=e;function t(n){let i=n;return i&&m.string(i.title)&&(i.diagnostics===void 0||m.typedArray(i.diagnostics,ii.is))&&(i.kind===void 0||m.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Rn.is(i.command))&&(i.isPreferred===void 0||m.boolean(i.isPreferred))&&(i.edit===void 0||lo.is(i.edit))}s.is=t})(el||(el={}));var tl;(function(s){function e(n,i){let r={range:n};return m.defined(i)&&(r.data=i),r}s.create=e;function t(n){let i=n;return m.defined(i)&&oe.is(i.range)&&(m.undefined(i.command)||Rn.is(i.command))}s.is=t})(tl||(tl={}));var nl;(function(s){function e(n,i){return{tabSize:n,insertSpaces:i}}s.create=e;function t(n){let i=n;return m.defined(i)&&m.uinteger(i.tabSize)&&m.boolean(i.insertSpaces)}s.is=t})(nl||(nl={}));var sl;(function(s){function e(n,i,r){return{range:n,target:i,data:r}}s.create=e;function t(n){let i=n;return m.defined(i)&&oe.is(i.range)&&(m.undefined(i.target)||m.string(i.target))}s.is=t})(sl||(sl={}));var il;(function(s){function e(n,i){return{range:n,parent:i}}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&oe.is(i.range)&&(i.parent===void 0||s.is(i.parent))}s.is=t})(il||(il={}));var rl;(function(s){s.namespace="namespace",s.type="type",s.class="class",s.enum="enum",s.interface="interface",s.struct="struct",s.typeParameter="typeParameter",s.parameter="parameter",s.variable="variable",s.property="property",s.enumMember="enumMember",s.event="event",s.function="function",s.method="method",s.macro="macro",s.keyword="keyword",s.modifier="modifier",s.comment="comment",s.string="string",s.number="number",s.regexp="regexp",s.operator="operator",s.decorator="decorator"})(rl||(rl={}));var ol;(function(s){s.declaration="declaration",s.definition="definition",s.readonly="readonly",s.static="static",s.deprecated="deprecated",s.abstract="abstract",s.async="async",s.modification="modification",s.documentation="documentation",s.defaultLibrary="defaultLibrary"})(ol||(ol={}));var al;(function(s){function e(t){let n=t;return m.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}s.is=e})(al||(al={}));var cl;(function(s){function e(n,i){return{range:n,text:i}}s.create=e;function t(n){let i=n;return i!=null&&oe.is(i.range)&&m.string(i.text)}s.is=t})(cl||(cl={}));var ll;(function(s){function e(n,i,r){return{range:n,variableName:i,caseSensitiveLookup:r}}s.create=e;function t(n){let i=n;return i!=null&&oe.is(i.range)&&m.boolean(i.caseSensitiveLookup)&&(m.string(i.variableName)||i.variableName===void 0)}s.is=t})(ll||(ll={}));var ul;(function(s){function e(n,i){return{range:n,expression:i}}s.create=e;function t(n){let i=n;return i!=null&&oe.is(i.range)&&(m.string(i.expression)||i.expression===void 0)}s.is=t})(ul||(ul={}));var fl;(function(s){function e(n,i){return{frameId:n,stoppedLocation:i}}s.create=e;function t(n){let i=n;return m.defined(i)&&oe.is(n.stoppedLocation)}s.is=t})(fl||(fl={}));var ho;(function(s){s.Type=1,s.Parameter=2;function e(t){return t===1||t===2}s.is=e})(ho||(ho={}));var po;(function(s){function e(n){return{value:n}}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&(i.tooltip===void 0||m.string(i.tooltip)||rs.is(i.tooltip))&&(i.location===void 0||si.is(i.location))&&(i.command===void 0||Rn.is(i.command))}s.is=t})(po||(po={}));var dl;(function(s){function e(n,i,r){let o={position:n,label:i};return r!==void 0&&(o.kind=r),o}s.create=e;function t(n){let i=n;return m.objectLiteral(i)&&He.is(i.position)&&(m.string(i.label)||m.typedArray(i.label,po.is))&&(i.kind===void 0||ho.is(i.kind))&&i.textEdits===void 0||m.typedArray(i.textEdits,Tn.is)&&(i.tooltip===void 0||m.string(i.tooltip)||rs.is(i.tooltip))&&(i.paddingLeft===void 0||m.boolean(i.paddingLeft))&&(i.paddingRight===void 0||m.boolean(i.paddingRight))}s.is=t})(dl||(dl={}));var hl;(function(s){function e(t){return{kind:"snippet",value:t}}s.createSnippet=e})(hl||(hl={}));var pl;(function(s){function e(t,n,i,r){return{insertText:t,filterText:n,range:i,command:r}}s.create=e})(pl||(pl={}));var ml;(function(s){function e(t){return{items:t}}s.create=e})(ml||(ml={}));var gl;(function(s){s.Invoked=0,s.Automatic=1})(gl||(gl={}));var yl;(function(s){function e(t,n){return{range:t,text:n}}s.create=e})(yl||(yl={}));var wl;(function(s){function e(t,n){return{triggerKind:t,selectedCompletionInfo:n}}s.create=e})(wl||(wl={}));var bl;(function(s){function e(t){let n=t;return m.objectLiteral(n)&&to.is(n.uri)&&m.string(n.name)}s.is=e})(bl||(bl={}));var vl;(function(s){function e(r,o,a,c){return new mo(r,o,a,c)}s.create=e;function t(r){let o=r;return!!(m.defined(o)&&m.string(o.uri)&&(m.undefined(o.languageId)||m.string(o.languageId))&&m.uinteger(o.lineCount)&&m.func(o.getText)&&m.func(o.positionAt)&&m.func(o.offsetAt))}s.is=t;function n(r,o){let a=r.getText(),c=i(o,(f,u)=>{let h=f.range.start.line-u.range.start.line;return h===0?f.range.start.character-u.range.start.character:h}),l=a.length;for(let f=c.length-1;f>=0;f--){let u=c[f],h=r.offsetAt(u.range.start),p=r.offsetAt(u.range.end);if(p<=l)a=a.substring(0,h)+u.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");l=h}return a}s.applyEdits=n;function i(r,o){if(r.length<=1)return r;let a=r.length/2|0,c=r.slice(0,a),l=r.slice(a);i(c,o),i(l,o);let f=0,u=0,h=0;for(;f<c.length&&u<l.length;)o(c[f],l[u])<=0?r[h++]=c[f++]:r[h++]=l[u++];for(;f<c.length;)r[h++]=c[f++];for(;u<l.length;)r[h++]=l[u++];return r}})(vl||(vl={}));var mo=class{constructor(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],t=this._content,n=!0;for(let i=0;i<t.length;i++){n&&(e.push(i),n=!1);let r=t.charAt(i);n=r==="\r"||r===`
51
+ `,r==="\r"&&i+1<t.length&&t.charAt(i+1)===`
52
+ `&&i++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,i=t.length;if(i===0)return He.create(0,e);for(;n<i;){let o=Math.floor((n+i)/2);t[o]>e?i=o:n=o+1}let r=n-1;return He.create(r,e-t[r])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line],i=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}},m;(function(s){let e=Object.prototype.toString;function t(p){return typeof p<"u"}s.defined=t;function n(p){return typeof p>"u"}s.undefined=n;function i(p){return p===!0||p===!1}s.boolean=i;function r(p){return e.call(p)==="[object String]"}s.string=r;function o(p){return e.call(p)==="[object Number]"}s.number=o;function a(p,w,g){return e.call(p)==="[object Number]"&&w<=p&&p<=g}s.numberRange=a;function c(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}s.integer=c;function l(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}s.uinteger=l;function f(p){return e.call(p)==="[object Function]"}s.func=f;function u(p){return p!==null&&typeof p=="object"}s.objectLiteral=u;function h(p,w){return Array.isArray(p)&&p.every(w)}s.typedArray=h})(m||(m={}));var Ph=require.resolve("devicetree-language-server/dist/server.js"),go=class{constructor(e,t,n,i,r){this.poolSize=e;this.cwd=t;this.includesPaths=n;this.bindings=i;this.logLevel=r;this.workers=[];this.queue=[]}async initialize(){let e=[];for(let t=0;t<this.poolSize;t++)e.push(this.createWorker(t));await Promise.all(e)}async createWorker(e){let t=El.default.spawn(process.execPath,[Ph,"--stdio"],{stdio:["pipe","pipe","pipe"]});t.stderr.on("data",o=>{this.logLevel==="verbose"&&console.error(`LSP Worker ${e} stderr:`,o.toString())});let n=(0,Rl.createMessageConnection)(new ai.StreamMessageReader(t.stdout),new ai.StreamMessageWriter(t.stdin));this.logLevel==="verbose"&&n.onNotification("window/logMessage",o=>{let c={1:"ERROR",2:"WARN",3:"INFO",4:"LOG"}[o.type]||"LOG";ae("info",`[LSP Worker ${e} ${c}] ${o.message}`)}),n.onRequest("workspace/workspaceFolders",()=>[{uri:`file://${this.cwd}`,name:"root"}]),n.listen(),n.sendNotification("workspace/didChangeConfiguration",{settings:{devicetree:{defaultIncludePaths:this.includesPaths,defaultBindingType:"Zephyr",defaultZephyrBindings:this.bindings,cwd:this.cwd,autoChangeContext:!0,allowAdhocContexts:!0,defaultLockRenameEdits:[]}}});let i=[{uri:_l(this.cwd),name:"root"}];await n.sendRequest("initialize",{processId:process.pid,rootUri:_l(this.cwd),capabilities:{},workspaceFolders:i}),await n.sendNotification("initialized");let r={id:e,process:t,connection:n,busy:!1};this.workers.push(r)}async getAvailableWorker(){return new Promise(e=>{let t=this.workers.find(n=>!n.busy);t?(t.busy=!0,e(t)):this.queue.push(()=>{let n=this.workers.find(i=>!i.busy);n&&(n.busy=!0,e(n))})})}releaseWorker(e){e.busy=!1;let t=this.queue.shift();t&&t()}async dispose(){for(let e of this.workers)e.connection.dispose(),e.process.kill();this.workers=[]}};function _l(s){let e=Cl.default.resolve(s);return e=e.replace(/\\/g,"/"),e.startsWith("/")||(e="/"+e),`file://${e}`}function Mh(){let s=process.env;return!!(s.CI&&(s.GITHUB_ACTIONS||s.GITLAB_CI||s.BITBUCKET_BUILD_NUMBER||s.CIRCLECI||s.TRAVIS))}var jh=W.object({file:W.array(W.string().optional()).optional(),cwd:W.string().optional(),include:W.array(W.string()).optional().default([]),binding:W.array(W.string()).optional().default([]),logLevel:W.enum(["none","verbose"]).optional().default("none"),format:W.boolean().optional().default(!1),formatFixAll:W.boolean().optional().default(!1),disableBaseFormattingRules:W.boolean().optional().default(!1),disableIndentExpressions:W.boolean().optional().default(!1),disableRemoveDuplicateProperties:W.boolean().optional().default(!1),disableRemoveEmptyReferences:W.boolean().optional().default(!1),enableRemoveEmptyNodes:W.boolean().optional().default(!1),enableRemoveEmptyRoots:W.boolean().optional().default(!1),enableSortNodesAndProperties:W.boolean().optional().default(!1),sortNodesNodesBy:W.enum(["none","name","address"]).optional().default("none"),enableSortPropertiesAlphabetically:W.boolean().optional().default(!1),processIncludes:W.boolean().optional().default(!1),diagnostics:W.boolean().optional().default(!1),diagnosticsFull:W.boolean().optional().default(!1),diagnosticsConfig:W.string().optional(),showInfoDiagnostics:W.boolean().optional().default(!1),patchFile:W.string().optional(),outputFormat:W.enum(["auto","pretty","annotations","json"]).optional().default("auto"),wordWrapColumn:W.number().int().min(1).optional().default(100),tabSize:W.number().int().min(1).optional().default(8),insertSpaces:W.boolean().optional().default(!1),filetypes:W.array(W.string()).optional(),threads:W.number().int().min(1).optional().default(1),version:W.boolean().optional().default(!1),help:W.boolean().optional().default(!1)}),yo=`Usage: dts-linter [options]
53
53
 
54
54
  Options:
55
55
  --file List of input files (can be repeated).
56
+ --filetypes <ext,...> Comma-separated list of file extensions to select when --file is not set (default: dts,dtsi,overlay).
56
57
  --cwd <path> Set the current working directory.
57
58
  --include Paths (absolute or relative to CWD) to resolve includes (default: []).
58
59
  --binding Zephyr binding root directories (default: []).
59
60
  --logLevel <none|verbose> Set the logging verbosity (default: none).
60
61
  --format Format the files specified in --file (default: false).
61
62
  --formatFixAll Apply formatting changes directly to the files (default: false).
63
+ --disableBaseFormattingRules Disable base formatting rules (default: false).
64
+ --disableIndentExpressions Disable indentation for expressions when formatting (default: false).
65
+ --disableRemoveDuplicateProperties Disable removal of duplicate properties in the same scope when formatting (default: false).
66
+ --disableRemoveEmptyReferences Disable removal of empty references when formatting (default: false).
67
+ --enableRemoveEmptyNodes Enable removal of empty nodes when formatting (default: false).
68
+ --enableRemoveEmptyRoots Enable removal of empty root nodes when formatting (default: false).
69
+ --enableSortNodesAndProperties Enable sorting of nodes and properties when formatting (default: false).
70
+ --sortNodesNodesBy <none|name|type> When sorting nodes, sort by name or type (default: none).
71
+ --enableSortPropertiesAlphabetically Enable sorting of properties alphabetically when formatting (default: false).
62
72
  --diagnostics Show basic syntax diagnostics for files (default: false).
63
73
  --diagnosticsFull Show full diagnostics for files (default: false).
64
74
  --diagnosticsConfig <path> Path to diagnostics configuration file.
65
75
  --showInfoDiagnostics Show information diagnostics
76
+ --wordWrapColumn <number> Column at which to wrap long lines when formatting (default: 100).
77
+ --tabSize <number> Number of spaces per indentation level (default: 8).
78
+ --insertSpaces Use spaces instead of tabs for indentation (default: false).
66
79
  --patchFile <path> Write formatting diff output to this file (optional).
67
80
  --outputFormat <auto|pretty|annotations|json> stdout output type.
68
81
  --threads <number> Number of parallel LSP instances to use (default: 1).
@@ -70,17 +83,19 @@ Options:
70
83
  --help Show help information (default: false).
71
84
 
72
85
  Example:
73
- dts-linter --file file1.dts --file file2.dtsi --format --diagnostics --threads 4`,J;try{let{values:i}=(0,El.parseArgs)({options:{file:{type:"string",multiple:!0},cwd:{type:"string"},include:{type:"string",multiple:!0},binding:{type:"string",multiple:!0},logLevel:{type:"string"},format:{type:"boolean"},formatFixAll:{type:"boolean"},diagnostics:{type:"boolean"},diagnosticsFull:{type:"boolean"},diagnosticsConfig:{type:"string"},showInfoDiagnostics:{type:"boolean"},patchFile:{type:"string"},outputFormat:{type:"string"},threads:{type:"string"},version:{type:"boolean"},help:{type:"boolean"}},strict:!0}),e={...i,threads:i.threads?parseInt(i.threads,10):void 0},t=Pd.safeParse(e);t.success||(console.log(yo),process.exit(1)),J=t.data}catch{console.log(yo),process.exit(1)}J.help&&(console.log("Invalid arguments"),console.log(yo),process.exit(0));J.version&&(console.log(`${eo.name} version ${eo.version}`),process.exit(0));var Md=J.include,jd=J.binding,Ld=J.logLevel,Cl=J.formatFixAll,Tl=J.format||Cl,cs=J.diagnosticsFull,Id=J.diagnostics||cs,$d=J.showInfoDiagnostics,He=J.outputFormat,wo=J.patchFile,Dd=J.threads,Fd=J.diagnosticsConfig;Fd&&J.file&&(console.log("Cannot use --diagnosticsConfig with --file option."),process.exit(0));var lt=Nd()&&He==="auto"||He==="annotations",Wd=()=>lt?"::group::":"",zd=()=>lt?"::endgroup::":"",qd=i=>lt?`file=${(0,ne.relative)(ee,i)}`:(0,ne.relative)(ee,i),Ud=(i,e)=>lt?`line=${i}${e?`,col=${e}`:""}`:`line: ${i} ${e?`col=${e}`:""}`,Bd=(i,e)=>lt?`endLine=${i}${e?`,endColumn=${e}`:""}`:`endLine: ${i} ${e?`endColumn=${e}`:""}`,Vd=lt?",":" ",Zd=i=>{switch(i){case"error":return"::error";case"warn":return"::warning";case"info":return"::notice"}},Hd=(i,e,t,n,s,r)=>{let o=[t?`file=${t}`:null,s?`line=${s.line}`:null,s?.col?`col=${s.col}`:null,r?`endLine=${r.line}`:null,r?.col?`endColumn=${r.col}`:null,n?`title=${n}`:null].filter(a=>!!a);console.log(`${Zd(i)} ${o.join(",")}::${e}`)},ae=(i,e,t,n,s,r,o,a)=>{if(He==="json"){Rl.issues.push({level:i,message:e.trim(),file:t?(0,ne.relative)(ee,t.trim()):void 0,title:n?.trim(),startLine:s?.line,startCol:s?.col,endLine:r?.line,endCol:r?.col});return}if(lt){Hd(i,e,t?(0,ne.relative)(ee,t):void 0,n,s,r);return}if(i==="info"){console.log(`\u2705 ${o??""}${a??""} ${e}`);return}console.log(`${i==="error"?"\u274C":"\u26A0\uFE0F"} ${o??""}${a??""} ${[t?.trim()?qd(t):t,s?Ud(s.line,s.col):void 0,r?Bd(r.line,r.col):void 0,e].filter(c=>!!c).join(Vd)}`)},ee=J.cwd??process.cwd(),Rl={cwd:ee,issues:[]};if(!J.diagnosticsConfig&&!J.file){let i=cs?"**/*.{dts}":"**/*.{dts,dtsi,overlay}";ae("info",`Searching for '${i}' in ${ee}`),J.file=es(i,{cwd:J.cwd,nodir:!0})}var ai=[];if(J.diagnosticsConfig){let i=ct.default.readFileSync((0,ne.resolve)(ee,J.diagnosticsConfig),"utf8");try{let e=JSON.parse(i);ai.push(...e.map(t=>({...t,mainFile:(0,ne.resolve)(ee,t.mainFile),includePaths:t.includePaths?.map(n=>(0,ne.resolve)(ee,n)),bindingPaths:t.bindingPaths?.map(n=>(0,ne.resolve)(ee,n)),overlayRuns:t.overlayRuns?.map(n=>n.map(s=>(0,ne.resolve)(ee,s)))})))}catch(e){console.log(`Failed to parse diagnostics config file: ${e}`),process.exit(1)}}else J.file&&ai.push(...J.file.filter(i=>!!i).map(i=>({mainFile:(0,ne.resolve)(ee,i)})));var oi=new Map,Jt=[],An=[],Ct=new Map,Et=new Set,_l=new Set;Xd().catch(i=>{console.error("Error validating files:",i),process.exit(1)});var Ol=(i=me.Hint)=>{switch(i){case me.Error:return"error";case me.Warning:return"warn";case me.Information:return"info";case me.Hint:return"hint"}};async function Gd(i,e,t,n){await i.connection.sendRequest("devicetree/setActive",{id:n.id});let s=a=>a===e.dtsFile,r=(a,c)=>a?`[${t}/${Nl}]`:`[${c}/${o.length-1}]`.padEnd((o.length-1).toString().length*2+3," "),o=[...vo(n.mainDtsPath),...n.overlays.flatMap(vo)].filter(a=>!a.endsWith(".h")&&(0,ct.existsSync)(a));await Promise.all(o.map(async(a,c)=>{let l=s(a);if(e.dtsFile.endsWith(".dts")||!cs){let h=await Qd(i.connection,a,l,r(l,c),e);h?.length&&(Ct.has(a)||Ct.set(a,[]),Ct.get(a)?.push({maxSeverity:h.reduce((u,d)=>(d.severity??me.Hint)<u?d.severity??me.Hint:u,me.Hint),context:n,message:h.map(u=>`[${Ol(u.severity)}] ${u.message}: ${JSON.stringify(u.range.start)}-${JSON.stringify(u.range.end)}`).join(`
74
- `)}))}else bo.add(a),ae("warn","Check can only be done on full context!",a,void 0,void 0,void 0,`${l?"":" "}`,r(l,c));Et.add(a)})),i.connection.sendRequest("devicetree/removeContext",{id:n.id,name:e.ctxName}),await Kd(i.connection,n.id)}async function Jd(i,e,t){let n=ct.default.readFileSync(e.mainFile,"utf8"),s=[e.mainFile],r;if(Id){let c=[];e.onlyRunWithOverlays||c.push({ctxName:`dts-linter:${e.mainFile}-no-overlays`,dtsFile:e.mainFile,includePaths:e.includePaths,zephyrBindings:e.bindingPaths,cwd:ee}),(e.overlayRuns??[]).forEach((h,u)=>{c.push({ctxName:`dts-linter:${e.mainFile}-overlay-run-${u}`,dtsFile:e.mainFile,overlays:h,includePaths:e.includePaths,zephyrBindings:e.bindingPaths,cwd:ee})});let l=await Promise.all(c.map(h=>i.connection.sendRequest("devicetree/requestContext",h)));await c.reduce((h,u,d)=>h.finally(()=>Gd(i,u,Al(ai.slice(0,t))+d+1,l[d])),Promise.resolve())}let o=c=>c===e.mainFile,a=(c,l)=>c?`[${t}/${Nl}]`:`[${l}/${s.length-1}]`.padEnd((s.length-1).toString().length*2+3," ");Tl&&await Promise.all(s.map(async(c,l)=>{let h=o(c),u=a(h,l);try{await Yd(i.connection,c,h,u,h?n:ct.default.readFileSync(c,"utf8"),r)}catch(d){if(Jt.push({file:c,context:r}),He==="json")d?.data?.map(p=>{ae("error",p.message,c,"Syntax error.",{line:p.range.start.line+1,col:p.range.start.character},{line:p.range.end.line+1,col:p.range.end.character})});else{let p=d?.data?.map(w=>`[${Ol(w.severity)}] ${w.message}: ${JSON.stringify(w.range.start)}-${JSON.stringify(w.range.end)}`).join(`
86
+ dts-linter --file file1.dts --file file2.dtsi --format --diagnostics --threads 4`,F;try{let{values:s}=(0,Tl.parseArgs)({options:{file:{type:"string",multiple:!0},cwd:{type:"string"},include:{type:"string",multiple:!0},binding:{type:"string",multiple:!0},logLevel:{type:"string"},format:{type:"boolean"},formatFixAll:{type:"boolean"},disableBaseFormattingRules:{type:"boolean"},disableIndentExpressions:{type:"boolean"},disableRemoveDuplicateProperties:{type:"boolean"},disableRemoveEmptyReferences:{type:"boolean"},enableRemoveEmptyNodes:{type:"boolean"},enableRemoveEmptyRoots:{type:"boolean"},enableSortNodesAndProperties:{type:"boolean"},sortNodesNodesBy:{type:"string"},enableSortPropertiesAlphabetically:{type:"boolean"},diagnostics:{type:"boolean"},diagnosticsFull:{type:"boolean"},diagnosticsConfig:{type:"string"},showInfoDiagnostics:{type:"boolean"},wordWrapColumn:{type:"string"},tabSize:{type:"string"},insertSpaces:{type:"boolean"},patchFile:{type:"string"},outputFormat:{type:"string"},filetypes:{type:"string"},threads:{type:"string"},version:{type:"boolean"},help:{type:"boolean"}},strict:!0}),e={...s,wordWrapColumn:s.wordWrapColumn?parseInt(s.wordWrapColumn,10):void 0,tabSize:s.tabSize?parseInt(s.tabSize,10):void 0,threads:s.threads?parseInt(s.threads,10):void 0,filetypes:s.filetypes?s.filetypes.split(",").map(n=>n.trim()).filter(Boolean):void 0},t=jh.safeParse(e);t.success||(console.log(yo),process.exit(1)),F=t.data}catch{console.log(yo),process.exit(1)}F.help&&(console.log("Invalid arguments"),console.log(yo),process.exit(0));F.version&&(console.log(`${eo.name} version ${eo.version}`),process.exit(0));var Lh=F.include,Ih=F.binding,Dh=F.logLevel,Ol=F.formatFixAll,Nl=F.format||Ol,$h=F.disableBaseFormattingRules,Fh=F.disableIndentExpressions,Wh=F.disableRemoveDuplicateProperties,zh=F.disableRemoveEmptyReferences,Bh=F.enableRemoveEmptyNodes,qh=F.enableRemoveEmptyRoots,Uh=F.enableSortNodesAndProperties,xl=F.sortNodesNodesBy,Sl=F.enableSortPropertiesAlphabetically,ci=F.diagnosticsFull,Vh=F.diagnostics||ci,Zh=F.showInfoDiagnostics,je=F.outputFormat,wo=F.patchFile,Hh=F.threads,Gh=F.wordWrapColumn,Jh=F.tabSize,Xh=F.insertSpaces,Yh=F.diagnosticsConfig;F.filetypes&&F.file&&(console.log("Cannot use --filetypes with --file option."),process.exit(1));Yh&&F.file&&(console.log("Cannot use --diagnosticsConfig with --file option."),process.exit(0));var lt=Mh()&&je==="auto"||je==="annotations",Qh=()=>lt?"::group::":"",Kh=()=>lt?"::endgroup::":"",ep=s=>lt?`file=${(0,te.relative)(Q,s)}`:(0,te.relative)(Q,s),tp=(s,e)=>lt?`line=${s}${e?`,col=${e}`:""}`:`line: ${s} ${e?`col=${e}`:""}`,np=(s,e)=>lt?`endLine=${s}${e?`,endColumn=${e}`:""}`:`endLine: ${s} ${e?`endColumn=${e}`:""}`,sp=lt?",":" ",ip=s=>{switch(s){case"error":return"::error";case"warn":return"::warning";case"info":return"::notice"}},rp=(s,e,t,n,i,r)=>{let o=[t?`file=${t}`:null,i?`line=${i.line}`:null,i?.col?`col=${i.col}`:null,r?`endLine=${r.line}`:null,r?.col?`endColumn=${r.col}`:null,n?`title=${n}`:null].filter(a=>!!a);console.log(`${ip(s)} ${o.join(",")}::${e}`)},ae=(s,e,t,n,i,r,o,a)=>{if(je==="json"){Al.issues.push({level:s,message:e.trim(),file:t?(0,te.relative)(Q,t.trim()):void 0,title:n?.trim(),startLine:i?.line,startCol:i?.col,endLine:r?.line,endCol:r?.col});return}if(lt){rp(s,e,t?(0,te.relative)(Q,t):void 0,n,i,r);return}if(s==="info"){console.log(`\u2705 ${o??""}${a??""} ${e}`);return}console.log(`${s==="error"?"\u274C":"\u26A0\uFE0F"} ${o??""}${a??""} ${[t?.trim()?ep(t):t,i?tp(i.line,i.col):void 0,r?np(r.line,r.col):void 0,e].filter(c=>!!c).join(sp)}`)},Q=F.cwd??process.cwd(),Al={cwd:Q,issues:[]};if(!F.diagnosticsConfig&&!F.file){let s=ci?["dts"]:["dts","dtsi","overlay","keymap"],e=F.filetypes??s,t=e.length===1?`**/*.${e[0]}`:`**/*.{${e.join(",")}}`;ae("info",`Searching for '${t}' in ${Q}`),F.file=ei(t,{cwd:F.cwd,nodir:!0})}var as=[];if(F.diagnosticsConfig){let s=ct.default.readFileSync((0,te.resolve)(Q,F.diagnosticsConfig),"utf8");try{let e=JSON.parse(s);as.push(...e.map(t=>({...t,mainFile:(0,te.resolve)(Q,t.mainFile),includePaths:t.includePaths?.map(n=>(0,te.resolve)(Q,n)),bindingPaths:t.bindingPaths?.map(n=>(0,te.resolve)(Q,n)),overlayRuns:t.overlayRuns?.map(n=>n.map(i=>(0,te.resolve)(Q,i)))})))}catch(e){console.log(`Failed to parse diagnostics config file: ${e}`),process.exit(1)}}else F.file&&as.push(...F.file.filter(s=>!!s).map(s=>({mainFile:(0,te.resolve)(Q,s)})));var os=new Map,Jt=[],Nn=[],Ct=new Map,Et=new Set,kl=new Set;cp().catch(s=>{console.error("Error validating files:",s),process.exit(1)});var _o=(s=me.Hint)=>{switch(s){case me.Error:return"error";case me.Warning:return"warn";case me.Information:return"info";case me.Hint:return"hint"}};async function op(s,e,t,n){await s.connection.sendRequest("devicetree/setActive",{id:n.id});let i=a=>a===e.dtsFile,r=(a,c)=>a?`[${t}/${Ml}]`:`[${c}/${o.length-1}]`.padEnd((o.length-1).toString().length*2+3," "),o=[...bo(n.mainDtsPath),...n.overlays.flatMap(bo)].filter(a=>!a.endsWith(".h")&&(0,ct.existsSync)(a));await Promise.all(o.map(async(a,c)=>{let l=i(a);if(e.dtsFile?.endsWith(".dts")||!ci){let f=await up(s.connection,a,l,r(l,c),e);f?.length&&(Ct.has(a)||Ct.set(a,[]),Ct.get(a)?.push({maxSeverity:f.reduce((u,h)=>(h.severity??me.Hint)<u?h.severity??me.Hint:u,me.Hint),context:n,message:f.map(u=>`[${_o(u.severity)}] ${u.message}: ${JSON.stringify(u.range.start)}-${JSON.stringify(u.range.end)}`).join(`
87
+ `)}))}else vo.add(a),ae("warn","Check can only be done on full context!",a,void 0,void 0,void 0,`${l?"":" "}`,r(l,c));Et.add(a)})),s.connection.sendRequest("devicetree/removeContext",{id:n.id,name:e.ctxName}),await fp(s.connection,n.id)}async function ap(s,e,t){let n=ct.default.readFileSync(e.mainFile,"utf8"),i=[e.mainFile],r;if(Vh){let c=[];e.onlyRunWithOverlays||c.push({ctxName:`dts-linter:${e.mainFile}-no-overlays`,dtsFile:e.mainFile,includePaths:e.includePaths,zephyrBindings:e.bindingPaths,cwd:Q}),(e.overlayRuns??[]).forEach((f,u)=>{c.push({ctxName:`dts-linter:${e.mainFile}-overlay-run-${u}`,dtsFile:e.mainFile,overlays:f,includePaths:e.includePaths,zephyrBindings:e.bindingPaths,cwd:Q})});let l=await Promise.all(c.map(f=>s.connection.sendRequest("devicetree/requestContext",f)));await c.reduce((f,u,h)=>f.finally(()=>op(s,u,Pl(as.slice(0,t))+h+1,l[h])),Promise.resolve())}let o=c=>c===e.mainFile,a=(c,l)=>c?`[${t}/${Ml}]`:`[${l}/${i.length-1}]`.padEnd((i.length-1).toString().length*2+3," ");Nl&&await Promise.all(i.map(async(c,l)=>{let f=o(c),u=a(f,l);try{await lp(s.connection,c,f,u,f?n:ct.default.readFileSync(c,"utf8"),r)}catch(h){if(Jt.push({file:c,context:r}),je==="json")h?.data?.map(p=>{ae("error",p.message,c,"Syntax error.",{line:p.range.start.line+1,col:p.range.start.character},{line:p.range.end.line+1,col:p.range.end.character})});else{let p=h?.data?.map(w=>`[${_o(w.severity)}] ${w.message}: ${JSON.stringify(w.range.start)}-${JSON.stringify(w.range.end)}`).join(`
75
88
  `)??"";ae("error",`
76
- ${p}`,c,"Syntax error.",void 0,void 0,u)}}Et.add(c)})),Cl&&s.filter(c=>!_l.has(c)).forEach(c=>{let l=oi.get(c);if(l){let h=Ar(ct.default.readFileSync(c,"utf8"),l);h?(_l.add(c),ct.default.writeFileSync(c,h,"utf8"),An.push({file:c,context:r})):ae("error","Failed to apply changes to file",c)}})}var Al=i=>i.reduce((e,t)=>e+(t.overlayRuns?.length??0)+(t.onlyRunWithOverlays?0:1),0),Nl=Al(ai);async function Xd(){let i=new go(Dd,ee,Md,jd,Ld);await i.initialize();let e=ai.map(async(t,n)=>{let s=await i.getAvailableWorker();await Jd(s,t,n).finally(()=>{i.releaseWorker(s)})});if(await Promise.all(e),wo&&ct.default.writeFileSync(wo,Array.from(oi.values()).join(`
89
+ ${p}`,c,"Syntax error.",void 0,void 0,u)}}Et.add(c)})),Ol&&i.filter(c=>!kl.has(c)).forEach(c=>{let l=os.get(c);if(l){let f=Nr(ct.default.readFileSync(c,"utf8"),l);f?(kl.add(c),ct.default.writeFileSync(c,f,"utf8"),Nn.push({file:c,context:r})):ae("error","Failed to apply changes to file",c)}})}var Pl=s=>s.reduce((e,t)=>e+(t.overlayRuns?.length??0)+(t.onlyRunWithOverlays?0:1),0),Ml=Pl(as);async function cp(){let s=new go(Hh,Q,Lh,Ih,Dh);await s.initialize();let e=as.map(async(t,n)=>{let i=await s.getAvailableWorker();await ap(i,t,n).finally(()=>{s.releaseWorker(i)})});if(await Promise.all(e),wo&&ct.default.writeFileSync(wo,Array.from(os.values()).join(`
77
90
 
78
- `)),await i.dispose(),He==="json")await new Promise(t=>{process.stdout.write(JSON.stringify(Rl,void 0,4),()=>t())});else if(ae("info",`Processed ${Et.size} files`),Tl&&!lt&&(Jt.length-An.length&&ae("error",`${Jt.length-An.length} of ${Et.size} Failed formatting checks`),An.length&&ae("info",`${An.length} of ${Jt.length} formatted in place.`),Jt.length||ae("info","All files passed formatting")),Ct.size){(He==="pretty"||He==="auto")&&(console.log("Diagnostic issues summary"),console.log(Array.from(Ct.entries()).flatMap(([s,r])=>`${Wd()}File: ${(0,ne.relative)(ee,s)}
79
- ${r.flatMap(o=>`Board File: ${(0,ne.relative)(ee,o.context.mainDtsPath.file)}${o.context.overlays.length?`, Overlays: ${o.context.overlays.map(a=>(0,ne.basename)(a.file)).join(" ")}`:""}
91
+ `)),await s.dispose(),je==="json")await new Promise(t=>{process.stdout.write(JSON.stringify(Al,void 0,4),()=>t())});else if(ae("info",`Processed ${Et.size} files`),Nl&&!lt&&(Jt.length-Nn.length&&ae("error",`${Jt.length-Nn.length} of ${Et.size} Failed formatting checks`),Nn.length&&ae("info",`${Nn.length} of ${Jt.length} formatted in place.`),Jt.length||ae("info","All files passed formatting")),Ct.size){(je==="pretty"||je==="auto")&&(console.log("Diagnostic issues summary"),console.log(Array.from(Ct.entries()).flatMap(([i,r])=>`${Qh()}File: ${(0,te.relative)(Q,i)}
92
+ ${r.flatMap(o=>`Board File: ${(0,te.relative)(Q,o.context.mainDtsPath.fsPath)}${o.context.overlays.length?`, Overlays: ${o.context.overlays.map(a=>(0,te.basename)(a.fsPath)).join(" ")}`:""}
80
93
  Issues:
81
94
  ${o.message.replaceAll("[error]","[err]")}`).join(`
82
95
  `)}
83
- ${zd()}`).join(`
84
- `)),ae("error",`${Ct.size} of ${Et.size} file failed diagnostic checks`),bo.size&&ae("warn",`${bo.size} of ${Et.size} Skipped diagnostic checks`));let t=Array.from(Ct).filter(s=>s[1].some(r=>r.maxSeverity<=me.Warning)),n=!!t.length;Pl.size===Et.size&&!n?ae("info","All files passed diagnostic checks"):ae("error",`${t.length} of ${Et.size} Failed diagnostic checks`)}process.exit(Jt.length-An.length||Ct.size?1:0)}var vo=i=>[i.file,...i.includes.flatMap(e=>vo(e))],Yd=async(i,e,t,n,s,r)=>{let o={textDocument:{uri:`file://${e}`},options:{tabSize:8,insertSpaces:!1,trimTrailingWhitespace:!0,insertFinalNewline:!0,trimFinalNewlines:!0},text:s},a=await i.sendRequest("devicetree/formattingText",o),c=t?"":" ";if(a&&a.text!==s){let l=a?.text,h=(0,ne.relative)(ee,e),u=Pr(`a/${h}`,s,l);return ae("error",u,e,"Not correctly formatted.",void 0,void 0,c,n),(He==="json"||He==="annotations")&&a.diagnostics.forEach(d=>{ae("error",d.message,e,void 0,{line:d.range.start.line+1,col:d.range.start.character},{line:d.range.end.line+1,col:d.range.end.character})}),oi.has(e)?oi.get(e)!==u&&wo&&ae("warn","Multiple diffs for the same file. This diff will not be in the generated file!",e,void 0,void 0,void 0,c,n):(Jt.push({file:e,context:r}),oi.set(e,u)),u}else ae("info",`${(0,ne.relative)(ee,e)} is correctly formatted`,void 0,void 0,void 0,void 0,c,n)},Pl=new Set,bo=new Set,Qd=async(i,e,t,n,s)=>{Pl.add(e);let r=(await i.sendRequest("devicetree/diagnosticIssues",{uri:`file://${e}`,full:cs})??[]).filter(a=>a.severity===me.Error||a.severity===me.Warning||a.severity===me.Information&&$d),o=t?"":" ";if(r.length)return r.forEach((a,c)=>{let l=a.severity===me.Error?"error":(a.severity===me.Warning,"warn"),h=He==="json"?`Board File: ${s.dtsFile}${s.overlays?.length?`, Overlays: ${s.overlays.map(p=>(0,ne.relative)(ee,p)).join(" ")}`:""}, Message: ${a.message}`:a.message,u=lt||He==="json"?e:c?" ":t?`${e}${s.overlays?.length?` (Overlays: ${s.overlays.map(p=>(0,ne.relative)(ee,p)).join(" ")})`:""}
96
+ ${Kh()}`).join(`
97
+ `)),ae("error",`${Ct.size} of ${Et.size} file failed diagnostic checks`),vo.size&&ae("warn",`${vo.size} of ${Et.size} Skipped diagnostic checks`));let t=Array.from(Ct).filter(i=>i[1].some(r=>r.maxSeverity<=me.Warning)),n=!!t.length;jl.size===Et.size&&!n?ae("info","All files passed diagnostic checks"):ae("error",`${t.length} of ${Et.size} Failed diagnostic checks`)}process.exit(Jt.length-Nn.length||Ct.size?1:0)}var bo=s=>[s.fsPath,...s.includes.flatMap(e=>bo(e))],lp=async(s,e,t,n,i,r)=>{let o={textDocument:{uri:`file://${e}`},options:{wordWrapColumn:Gh,tabSize:Jh,insertSpaces:Xh,trimTrailingWhitespace:!0,insertFinalNewline:!0,trimFinalNewlines:!0,removeMacroMultiline:!0,wrapLongLines:!0,baseFormattingRules:!$h,indentExpressions:!Fh,removeDuplicateProperties:!Wh,removeEmptyReferences:!zh,removeEmptyNodes:Bh,removeEmptyRoots:qh,sortNodesAndProperties:Uh||xl!=="none"||Sl,sortNodesNodesBy:xl,sortPropertiesAlphabetically:Sl},text:i},a=await s.sendRequest("devicetree/formattingText",o),c=t?"":" ",l=a&&a.text===i;if(a&&(!l||a.diagnostics.length)){let f=a?.text,u=(0,te.relative)(Q,e),h=null;if(l||(h=Pr(`a/${u}`,i,f),ae("error",h,e,"Not correctly formatted.",void 0,void 0,c,n)),(je==="json"||je==="annotations")&&a.diagnostics.forEach(p=>{ae("error",p.message,e,void 0,{line:p.range.start.line+1,col:p.range.start.character},{line:p.range.end.line+1,col:p.range.end.character})}),os.has(e)?os.get(e)!==h&&wo&&ae("warn","Multiple diffs for the same file. This diff will not be in the generated file!",e,void 0,void 0,void 0,c,n):(Jt.push({file:e,context:r}),h&&os.set(e,h)),a.nonActionableDiagnostics.length){let p=`${(0,te.relative)(Q,e)} unable to generate diff to format file.`;je!=="json"&&je!=="annotations"&&(p+=`
98
+ `+a.nonActionableDiagnostics.map(w=>`[${_o(w.severity)}] ${w.message}: ${JSON.stringify(w.range.start)}-${JSON.stringify(w.range.end)}`).join(`
99
+ `)),ae("error",p,void 0,void 0,void 0,void 0,c,n)}}else ae("info",`${(0,te.relative)(Q,e)} is correctly formatted`,void 0,void 0,void 0,void 0,c,n)},jl=new Set,vo=new Set,up=async(s,e,t,n,i)=>{jl.add(e);let r=(await s.sendRequest("devicetree/diagnosticIssues",{uri:`file://${e}`,full:ci})??[]).filter(a=>a.severity===me.Error||a.severity===me.Warning||a.severity===me.Information&&Zh),o=t?"":" ";if(r.length)return r.forEach((a,c)=>{let l=a.severity===me.Error?"error":(a.severity===me.Warning,"warn"),f=je==="json"?`Board File: ${i.dtsFile}${i.overlays?.length?`, Overlays: ${i.overlays.map(p=>(0,te.relative)(Q,p)).join(" ")}`:""}, Message: ${a.message}`:a.message,u=lt||je==="json"?e:c?" ":t?`${e}${i.overlays?.length?` (Overlays: ${i.overlays.map(p=>(0,te.relative)(Q,p)).join(" ")})`:""}
85
100
  ${o} `:`${e}
86
- ${o} `,d=c?"":n;ae(l,h,u,void 0,{line:a.range.start.line+1,col:a.range.start.character},{line:a.range.end.line+1,col:a.range.end.character},o,d)}),r;ae("info",`No diagnostic errors in ${(0,ne.relative)(ee,e)}${s.overlays?.length?` (Overlays: ${s.overlays.map(a=>(0,ne.relative)(ee,a)).join(" ")})`:""}`,void 0,void 0,void 0,void 0,o,n)};function Kd(i,e,t=6e3){return new Promise((n,s)=>{let r=setTimeout(()=>{s(new Error("Timed out waiting for devicetree/contextDeleted")),o.dispose()},t),o=i.onNotification("devicetree/contextDeleted",a=>{a.id===e&&(clearTimeout(r),n(),o.dispose())})})}
101
+ ${o} `,h=c?"":n;ae(l,f,u,void 0,{line:a.range.start.line+1,col:a.range.start.character},{line:a.range.end.line+1,col:a.range.end.character},o,h)}),r;ae("info",`No diagnostic errors in ${(0,te.relative)(Q,e)}${i.overlays?.length?` (Overlays: ${i.overlays.map(a=>(0,te.relative)(Q,a)).join(" ")})`:""}`,void 0,void 0,void 0,void 0,o,n)};function fp(s,e,t=6e3){return new Promise((n,i)=>{let r=setTimeout(()=>{i(new Error("Timed out waiting for devicetree/contextDeleted")),o.dispose()},t),o=s.onNotification("devicetree/contextDeleted",a=>{a.id===e&&(clearTimeout(r),n(),o.dispose())})})}