@bgforge/mls-server 3.16.1 → 3.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/server.js CHANGED
@@ -1,88 +1,88 @@
1
1
  #!/usr/bin/env node
2
2
  var __imu=require("url").pathToFileURL(__filename).href;
3
- "use strict";var sH=Object.create;var $u=Object.defineProperty;var aH=Object.getOwnPropertyDescriptor;var cH=Object.getOwnPropertyNames;var lH=Object.getPrototypeOf,uH=Object.prototype.hasOwnProperty;var dH=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var C=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},fH=(e,t)=>{for(var n in t)$u(e,n,{get:t[n],enumerable:!0})},OP=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of cH(t))!uH.call(e,o)&&o!==n&&$u(e,o,{get:()=>t[o],enumerable:!(r=aH(t,o))||r.enumerable});return e};var B=(e,t,n)=>(n=e!=null?sH(lH(e)):{},OP(t||!e||!e.__esModule?$u(n,"default",{value:e,enumerable:!0}):n,e)),Nh=e=>OP($u({},"__esModule",{value:!0}),e);var ju=C(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.boolean=pH;pr.string=BP;pr.number=hH;pr.error=gH;pr.func=jP;pr.array=WP;pr.stringArray=_H;pr.typedArray=yH;pr.thenable=bH;function pH(e){return e===!0||e===!1}function BP(e){return typeof e=="string"||e instanceof String}function hH(e){return typeof e=="number"||e instanceof Number}function gH(e){return e instanceof Error}function jP(e){return typeof e=="function"}function WP(e){return Array.isArray(e)}function _H(e){return WP(e)&&e.every(t=>BP(t))}function yH(e,t){return Array.isArray(e)&&e.every(t)}function bH(e){return e&&jP(e.then)}});var Ns=C(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.boolean=SH;ni.string=UP;ni.number=wH;ni.error=xH;ni.func=vH;ni.array=HP;ni.stringArray=CH;function SH(e){return e===!0||e===!1}function UP(e){return typeof e=="string"||e instanceof String}function wH(e){return typeof e=="number"||e instanceof Number}function xH(e){return e instanceof Error}function vH(e){return typeof e=="function"}function HP(e){return Array.isArray(e)}function CH(e){return HP(e)&&e.every(t=>UP(t))}});var Qh=C(Z=>{"use strict";var PH=Z&&Z.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),NH=Z&&Z.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),EH=Z&&Z.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&PH(n,t,r[o]);return NH(n,t),n}})();Object.defineProperty(Z,"__esModule",{value:!0});Z.Message=Z.NotificationType9=Z.NotificationType8=Z.NotificationType7=Z.NotificationType6=Z.NotificationType5=Z.NotificationType4=Z.NotificationType3=Z.NotificationType2=Z.NotificationType1=Z.NotificationType0=Z.NotificationType=Z.RequestType9=Z.RequestType8=Z.RequestType7=Z.RequestType6=Z.RequestType5=Z.RequestType4=Z.RequestType3=Z.RequestType2=Z.RequestType1=Z.RequestType=Z.RequestType0=Z.AbstractMessageSignature=Z.ParameterStructures=Z.ResponseError=Z.ErrorCodes=void 0;var Io=EH(Ns()),Rh;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(Rh||(Z.ErrorCodes=Rh={}));var Th=class e extends Error{code;data;constructor(t,n,r){super(n),this.code=Io.number(t)?t:Rh.UnknownErrorCode,this.data=r,Object.setPrototypeOf(this,e.prototype)}toJson(){let t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),t}};Z.ResponseError=Th;var Ni=class e{kind;static auto=new e("auto");static byPosition=new e("byPosition");static byName=new e("byName");constructor(t){this.kind=t}static is(t){return t===e.auto||t===e.byName||t===e.byPosition}toString(){return this.kind}};Z.ParameterStructures=Ni;var Qe=class{method;numberOfParams;constructor(t,n){this.method=t,this.numberOfParams=n}get parameterStructures(){return Ni.auto}};Z.AbstractMessageSignature=Qe;var Ah=class extends Qe{_;constructor(t){super(t,0)}};Z.RequestType0=Ah;var Ih=class extends Qe{_parameterStructures;_;constructor(t,n=Ni.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Z.RequestType=Ih;var Dh=class extends Qe{_parameterStructures;_;constructor(t,n=Ni.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Z.RequestType1=Dh;var kh=class extends Qe{_;constructor(t){super(t,2)}};Z.RequestType2=kh;var Fh=class extends Qe{_;constructor(t){super(t,3)}};Z.RequestType3=Fh;var Lh=class extends Qe{_;constructor(t){super(t,4)}};Z.RequestType4=Lh;var Oh=class extends Qe{_;constructor(t){super(t,5)}};Z.RequestType5=Oh;var Mh=class extends Qe{_;constructor(t){super(t,6)}};Z.RequestType6=Mh;var $h=class extends Qe{_;constructor(t){super(t,7)}};Z.RequestType7=$h;var qh=class extends Qe{_;constructor(t){super(t,8)}};Z.RequestType8=qh;var Bh=class extends Qe{_;constructor(t){super(t,9)}};Z.RequestType9=Bh;var jh=class extends Qe{_parameterStructures;_;constructor(t,n=Ni.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Z.NotificationType=jh;var Wh=class extends Qe{_;constructor(t){super(t,0)}};Z.NotificationType0=Wh;var Uh=class extends Qe{_parameterStructures;_;constructor(t,n=Ni.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Z.NotificationType1=Uh;var Hh=class extends Qe{_;constructor(t){super(t,2)}};Z.NotificationType2=Hh;var Vh=class extends Qe{_;constructor(t){super(t,3)}};Z.NotificationType3=Vh;var Gh=class extends Qe{_;constructor(t){super(t,4)}};Z.NotificationType4=Gh;var zh=class extends Qe{_;constructor(t){super(t,5)}};Z.NotificationType5=zh;var Kh=class extends Qe{_;constructor(t){super(t,6)}};Z.NotificationType6=Kh;var Yh=class extends Qe{_;constructor(t){super(t,7)}};Z.NotificationType7=Yh;var Xh=class extends Qe{_;constructor(t){super(t,8)}};Z.NotificationType8=Xh;var Jh=class extends Qe{_;constructor(t){super(t,9)}};Z.NotificationType9=Jh;var VP;(function(e){function t(o){let s=o;return s&&Io.string(s.method)&&(Io.string(s.id)||Io.number(s.id))}e.isRequest=t;function n(o){let s=o;return s&&Io.string(s.method)&&o.id===void 0}e.isNotification=n;function r(o){let s=o;return s&&(s.result!==void 0||!!s.error)&&(Io.string(s.id)||Io.number(s.id)||s.id===null)}e.isResponse=r})(VP||(Z.Message=VP={}))});var eg=C(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.LRUCache=Ei.LinkedMap=Ei.Touch=void 0;var rn;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(rn||(Ei.Touch=rn={}));var Wu=class{[Symbol.toStringTag]="LinkedMap";_map;_head;_tail;_size;_state;constructor(){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}before(t){let n=this._map.get(t);return n?n.previous?.value:void 0}after(t){let n=this._map.get(t);return n?n.next?.value:void 0}has(t){return this._map.has(t)}get(t,n=rn.None){let r=this._map.get(t);if(r)return n!==rn.None&&this.touch(r,n),r.value}set(t,n,r=rn.None){let o=this._map.get(t);if(o)o.value=n,r!==rn.None&&this.touch(o,r);else{switch(o={key:t,value:n,next:void 0,previous:void 0},r){case rn.None:this.addItemLast(o);break;case rn.First:this.addItemFirst(o);break;case rn.Last:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(t,o),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){let n=this._map.get(t);if(n)return this._map.delete(t),this.removeItem(n),this._size--,n.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,n){let r=this._state,o=this._head;for(;o;){if(n?t.bind(n)(o.value,o.key,this):t(o.value,o.key,this),this._state!==r)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let t=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:n.key,done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return r}values(){let t=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:n.value,done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return r}entries(){let t=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:[n.key,n.value],done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return r}[Symbol.iterator](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let n=this._head,r=this.size;for(;n&&r>t;)this._map.delete(n.key),n=n.next,r--;this._head=n,this._size=r,n&&(n.previous=void 0),this._state++}addItemFirst(t){if(!this._head&&!this._tail)this._tail=t;else if(this._head)t.next=this._head,this._head.previous=t;else throw new Error("Invalid list");this._head=t,this._state++}addItemLast(t){if(!this._head&&!this._tail)this._head=t;else if(this._tail)t.previous=this._tail,this._tail.next=t;else throw new Error("Invalid list");this._tail=t,this._state++}removeItem(t){if(t===this._head&&t===this._tail)this._head=void 0,this._tail=void 0;else if(t===this._head){if(!t.next)throw new Error("Invalid list");t.next.previous=void 0,this._head=t.next}else if(t===this._tail){if(!t.previous)throw new Error("Invalid list");t.previous.next=void 0,this._tail=t.previous}else{let n=t.next,r=t.previous;if(!n||!r)throw new Error("Invalid list");n.previous=r,r.next=n}t.next=void 0,t.previous=void 0,this._state++}touch(t,n){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(n!==rn.First&&n!==rn.Last)){if(n===rn.First){if(t===this._head)return;let r=t.next,o=t.previous;t===this._tail?(o.next=void 0,this._tail=o):(r.previous=o,o.next=r),t.previous=void 0,t.next=this._head,this._head.previous=t,this._head=t,this._state++}else if(n===rn.Last){if(t===this._tail)return;let r=t.next,o=t.previous;t===this._head?(r.previous=void 0,this._head=r):(r.previous=o,o.next=r),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){let t=[];return this.forEach((n,r)=>{t.push([r,n])}),t}fromJSON(t){this.clear();for(let[n,r]of t)this.set(n,r)}};Ei.LinkedMap=Wu;var Zh=class extends Wu{_limit;_ratio;constructor(t,n=1){super(),this._limit=t,this._ratio=Math.min(Math.max(0,n),1)}get limit(){return this._limit}set limit(t){this._limit=t,this.checkTrim()}get ratio(){return this._ratio}set ratio(t){this._ratio=Math.min(Math.max(0,t),1),this.checkTrim()}get(t,n=rn.AsNew){return super.get(t,n)}peek(t){return super.get(t,rn.None)}set(t,n){return super.set(t,n,rn.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Ei.LRUCache=Zh});var zP=C(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.Disposable=void 0;var GP;(function(e){function t(n){return{dispose:n}}e.create=t})(GP||(Uu.Disposable=GP={}))});var Ri=C(rg=>{"use strict";Object.defineProperty(rg,"__esModule",{value:!0});var tg;function ng(){if(tg===void 0)throw new Error("No runtime abstraction layer installed");return tg}(function(e){function t(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");tg=n}e.install=t})(ng||(ng={}));rg.default=ng});var Es=C(Ti=>{"use strict";var RH=Ti&&Ti.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.Emitter=Ti.Event=void 0;var TH=RH(Ri()),KP;(function(e){let t={dispose(){}};e.None=function(){return t}})(KP||(Ti.Event=KP={}));var ig=class{_callbacks;_contexts;add(t,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(t),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(t,n)})}remove(t,n=null){if(!this._callbacks)return;let r=!1;for(let o=0,s=this._callbacks.length;o<s;o++)if(this._callbacks[o]===t)if(this._contexts[o]===n){this._callbacks.splice(o,1),this._contexts.splice(o,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...t){if(!this._callbacks)return[];let n=[],r=this._callbacks.slice(0),o=this._contexts.slice(0);for(let s=0,a=r.length;s<a;s++)try{n.push(r[s].apply(o[s],t))}catch(c){(0,TH.default)().console.error(c)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},og=class e{_options;static _noop=function(){};_event;_callbacks;constructor(t){this._options=t}get event(){return this._event||(this._event=(t,n,r)=>{this._callbacks||(this._callbacks=new ig),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,n);let o={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,n),o.dispose=e._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(o),o}),this._event}fire(t){this._callbacks&&this._callbacks.invoke.call(this._callbacks,t)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};Ti.Emitter=og});var Gu=C(Pn=>{"use strict";var AH=Pn&&Pn.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),IH=Pn&&Pn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),DH=Pn&&Pn.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&AH(n,t,r[o]);return IH(n,t),n}})(),kH=Pn&&Pn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Pn,"__esModule",{value:!0});Pn.CancellationTokenSource=Pn.CancellationToken=void 0;var FH=kH(Ri()),LH=DH(Ns()),sg=Es(),Hu;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:sg.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:sg.Event.None});function t(n){let r=n;return r&&(r===e.None||r===e.Cancelled||LH.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}e.is=t})(Hu||(Pn.CancellationToken=Hu={}));var OH=Object.freeze(function(e,t){let n=(0,FH.default)().timer.setTimeout(e.bind(t),0);return{dispose(){n.dispose()}}}),Vu=class{_isCancelled=!1;_emitter;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?OH:(this._emitter||(this._emitter=new sg.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},ag=class{_token;get token(){return this._token||(this._token=new Vu),this._token}cancel(){this._token?this._token.cancel():this._token=Hu.Cancelled}dispose(){this._token?this._token instanceof Vu&&this._token.dispose():this._token=Hu.None}};Pn.CancellationTokenSource=ag});var YP=C(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.SharedArrayReceiverStrategy=Rs.SharedArraySenderStrategy=void 0;var MH=Gu(),bc;(function(e){e.Continue=0,e.Cancelled=1})(bc||(bc={}));var cg=class{buffers;constructor(){this.buffers=new Map}enableCancellation(t){if(t.id===null)return;let n=new SharedArrayBuffer(4),r=new Int32Array(n,0,1);r[0]=bc.Continue,this.buffers.set(t.id,n),t.$cancellationData=n}async sendCancellation(t,n){let r=this.buffers.get(n);if(r===void 0)return;let o=new Int32Array(r,0,1);Atomics.store(o,0,bc.Cancelled)}cleanup(t){this.buffers.delete(t)}dispose(){this.buffers.clear()}};Rs.SharedArraySenderStrategy=cg;var lg=class{data;constructor(t){this.data=new Int32Array(t,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===bc.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},ug=class{token;constructor(t){this.token=new lg(t)}cancel(){}dispose(){}},dg=class{kind="request";createCancellationTokenSource(t){let n=t.$cancellationData;return n===void 0?new MH.CancellationTokenSource:new ug(n)}};Rs.SharedArrayReceiverStrategy=dg});var mg=C(Ts=>{"use strict";var $H=Ts&&Ts.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ts,"__esModule",{value:!0});Ts.Semaphore=void 0;var qH=$H(Ri()),fg=class{_capacity;_active;_waiting;constructor(t=1){if(t<=0)throw new Error("Capacity must be greater than 0");this._capacity=t,this._active=0,this._waiting=[]}lock(t){return new Promise((n,r)=>{this._waiting.push({thunk:t,resolve:n,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,qH.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let t=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("Too many thunks active");try{let n=t.thunk();n instanceof Promise?n.then(r=>{this._active--,t.resolve(r),this.runNext()},r=>{this._active--,t.reject(r),this.runNext()}):(this._active--,t.resolve(n),this.runNext())}catch(n){this._active--,t.reject(n),this.runNext()}}};Ts.Semaphore=fg});var JP=C(on=>{"use strict";var BH=on&&on.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),jH=on&&on.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),WH=on&&on.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&BH(n,t,r[o]);return jH(n,t),n}})(),UH=on&&on.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(on,"__esModule",{value:!0});on.ReadableStreamMessageReader=on.AbstractMessageReader=on.MessageReader=void 0;var hg=UH(Ri()),As=WH(Ns()),pg=Es(),HH=mg(),XP;(function(e){function t(n){let r=n;return r&&As.func(r.listen)&&As.func(r.dispose)&&As.func(r.onError)&&As.func(r.onClose)&&As.func(r.onPartialMessage)}e.is=t})(XP||(on.MessageReader=XP={}));var zu=class{errorEmitter;closeEmitter;partialMessageEmitter;constructor(){this.errorEmitter=new pg.Emitter,this.closeEmitter=new pg.Emitter,this.partialMessageEmitter=new pg.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose(),this.partialMessageEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t){this.errorEmitter.fire(this.asError(t))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(t){this.partialMessageEmitter.fire(t)}asError(t){return t instanceof Error?t:new Error(`Reader received error. Reason: ${As.string(t.message)?t.message:"unknown"}`)}};on.AbstractMessageReader=zu;var gg;(function(e){function t(n){let r,o,s,a=new Map,c,l=new Map;if(n===void 0||typeof n=="string")r=n??"utf-8";else{if(r=n.charset??"utf-8",n.contentDecoder!==void 0&&(s=n.contentDecoder,a.set(s.name,s)),n.contentDecoders!==void 0)for(let u of n.contentDecoders)a.set(u.name,u);if(n.contentTypeDecoder!==void 0&&(c=n.contentTypeDecoder,l.set(c.name,c)),n.contentTypeDecoders!==void 0)for(let u of n.contentTypeDecoders)l.set(u.name,u)}return c===void 0&&(c=(0,hg.default)().applicationJson.decoder,l.set(c.name,c)),{charset:r,contentDecoder:s,contentDecoders:a,contentTypeDecoder:c,contentTypeDecoders:l}}e.fromOptions=t})(gg||(gg={}));var _g=class extends zu{readable;options;callback;nextMessageLength;messageToken;buffer;partialMessageTimer;_partialMessageTimeout;readSemaphore;constructor(t,n){super(),this.readable=t,this.options=gg.fromOptions(n),this.buffer=(0,hg.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new HH.Semaphore(1)}set partialMessageTimeout(t){this._partialMessageTimeout=t}get partialMessageTimeout(){return this._partialMessageTimeout}listen(t){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=t;let n=this.readable.onData(r=>{this.onData(r)});return this.readable.onError(r=>this.fireError(r)),this.readable.onClose(()=>this.fireClose()),n}onData(t){try{for(this.buffer.append(t);;){if(this.nextMessageLength===-1){let r=this.buffer.tryReadHeaders(!0);if(!r)return;let o=r.get("content-length");if(!o){this.fireError(new Error(`Header must provide a Content-Length property.
4
- ${JSON.stringify(Object.fromEntries(r))}`));return}let s=parseInt(o);if(isNaN(s)){this.fireError(new Error(`Content-Length value must be a number. Got ${o}`));return}this.nextMessageLength=s}let n=this.buffer.tryReadBody(this.nextMessageLength);if(n===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let r=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(n):n,o=await this.options.contentTypeDecoder.decode(r,this.options);this.callback(o)}).catch(r=>{this.fireError(r)})}}catch(n){this.fireError(n)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,hg.default)().timer.setTimeout((t,n)=>{this.partialMessageTimer=void 0,t===this.messageToken&&(this.firePartialMessage({messageToken:t,waitingTime:n}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};on.ReadableStreamMessageReader=_g});var nN=C(sn=>{"use strict";var VH=sn&&sn.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),GH=sn&&sn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),zH=sn&&sn.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&VH(n,t,r[o]);return GH(n,t),n}})(),KH=sn&&sn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sn,"__esModule",{value:!0});sn.WriteableStreamMessageWriter=sn.AbstractMessageWriter=sn.MessageWriter=void 0;var QP=KH(Ri()),Sc=zH(Ns()),YH=mg(),ZP=Es(),XH="Content-Length: ",eN=`\r
5
- `,tN;(function(e){function t(n){let r=n;return r&&Sc.func(r.dispose)&&Sc.func(r.onClose)&&Sc.func(r.onError)&&Sc.func(r.write)}e.is=t})(tN||(sn.MessageWriter=tN={}));var Ku=class{errorEmitter;closeEmitter;constructor(){this.errorEmitter=new ZP.Emitter,this.closeEmitter=new ZP.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t,n,r){this.errorEmitter.fire([this.asError(t),n,r])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(t){return t instanceof Error?t:new Error(`Writer received error. Reason: ${Sc.string(t.message)?t.message:"unknown"}`)}};sn.AbstractMessageWriter=Ku;var yg;(function(e){function t(n){return n===void 0||typeof n=="string"?{charset:n??"utf-8",contentTypeEncoder:(0,QP.default)().applicationJson.encoder}:{charset:n.charset??"utf-8",contentEncoder:n.contentEncoder,contentTypeEncoder:n.contentTypeEncoder??(0,QP.default)().applicationJson.encoder}}e.fromOptions=t})(yg||(yg={}));var bg=class extends Ku{writable;options;errorCount;writeSemaphore;constructor(t,n){super(),this.writable=t,this.options=yg.fromOptions(n),this.errorCount=0,this.writeSemaphore=new YH.Semaphore(1),this.writable.onError(r=>this.fireError(r)),this.writable.onClose(()=>this.fireClose())}async write(t){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(t,this.options).then(r=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(r):r).then(r=>{let o=[];return o.push(XH,r.byteLength.toString(),eN),o.push(eN),this.doWrite(t,o,r)},r=>{throw this.fireError(r),r}))}async doWrite(t,n,r){try{return await this.writable.write(n.join(""),"ascii"),this.writable.write(r)}catch(o){return this.handleError(o,t),Promise.reject(o)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){this.writable.end()}};sn.WriteableStreamMessageWriter=bg});var rN=C(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.AbstractMessageBuffer=void 0;var JH=13,QH=10,ZH=`\r
6
- `,Sg=class{_encoding;_chunks;_totalLength;constructor(t="utf-8"){this._encoding=t,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(t){let n=typeof t=="string"?this.fromString(t,this._encoding):t;this._chunks.push(n),this._totalLength+=n.byteLength}tryReadHeaders(t=!1){if(this._chunks.length===0)return;let n=0,r=0,o=0,s=0;e:for(;r<this._chunks.length;){let u=this._chunks[r];for(o=0;o<u.length;){switch(u[o]){case JH:switch(n){case 0:n=1;break;case 2:n=3;break;default:n=0}break;case QH:switch(n){case 1:n=2;break;case 3:n=4,o++;break e;default:n=0}break;default:n=0}o++}s+=u.byteLength,r++}if(n!==4)return;let a=this._read(s+o),c=new Map,l=this.toString(a,"ascii").split(ZH);if(l.length<2)return c;for(let u=0;u<l.length-2;u++){let d=l[u],f=d.indexOf(":");if(f===-1)throw new Error(`Message header must separate key and value using ':'
7
- ${d}`);let m=d.substr(0,f),p=d.substr(f+1).trim();c.set(t?m.toLowerCase():m,p)}return c}tryReadBody(t){if(!(this._totalLength<t))return this._read(t)}get numberOfBytes(){return this._totalLength}_read(t){if(t===0)return this.emptyBuffer();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let s=this._chunks[0];return this._chunks.shift(),this._totalLength-=t,this.asNative(s)}if(this._chunks[0].byteLength>t){let s=this._chunks[0],a=this.asNative(s,t);return this._chunks[0]=s.slice(t),this._totalLength-=t,a}let n=this.allocNative(t),r=0,o=0;for(;t>0;){let s=this._chunks[o];if(s.byteLength>t){let a=s.slice(0,t);n.set(a,r),r+=t,this._chunks[o]=s.slice(t),this._totalLength-=t,t-=t}else n.set(s,r),r+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,t-=s.byteLength}return n}};Yu.AbstractMessageBuffer=Sg});var aN=C(oe=>{"use strict";var eV=oe&&oe.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),tV=oe&&oe.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),nV=oe&&oe.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&eV(n,t,r[o]);return tV(n,t),n}})(),rV=oe&&oe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(oe,"__esModule",{value:!0});oe.ConnectionOptions=oe.MessageStrategy=oe.CancellationStrategy=oe.CancellationSenderStrategy=oe.CancellationReceiverStrategy=oe.RequestCancellationReceiverStrategy=oe.IdCancellationReceiverStrategy=oe.ConnectionStrategy=oe.ConnectionError=oe.ConnectionErrors=oe.LogTraceNotification=oe.SetTraceNotification=oe.TraceFormat=oe.TraceValues=oe.TraceValue=oe.Trace=oe.NullLogger=oe.ProgressType=oe.ProgressToken=void 0;oe.createMessageConnection=iV;var iN=rV(Ri()),dt=nV(Ns()),fe=Qh(),oN=eg(),wc=Es(),wg=Gu(),Cc;(function(e){e.type=new fe.NotificationType("$/cancelRequest")})(Cc||(Cc={}));var xg;(function(e){function t(n){return typeof n=="string"||typeof n=="number"}e.is=t})(xg||(oe.ProgressToken=xg={}));var xc;(function(e){e.type=new fe.NotificationType("$/progress")})(xc||(xc={}));var vg=class{__;_pr;constructor(){}};oe.ProgressType=vg;var Cg;(function(e){function t(n){return dt.func(n)}e.is=t})(Cg||(Cg={}));oe.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Oe;(function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Compact=2]="Compact",e[e.Verbose=3]="Verbose"})(Oe||(oe.Trace=Oe={}));var Pg;(function(e){e.Off="off",e.Messages="messages",e.Compact="compact",e.Verbose="verbose"})(Pg||(oe.TraceValue=Pg={}));oe.TraceValues=Pg;(function(e){function t(r){if(!dt.string(r))return e.Off;switch(r=r.toLowerCase(),r){case"off":return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose;default:return e.Off}}e.fromString=t;function n(r){switch(r){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}e.toString=n})(Oe||(oe.Trace=Oe={}));var Hn;(function(e){e.Text="text",e.JSON="json"})(Hn||(oe.TraceFormat=Hn={}));(function(e){function t(n){return dt.string(n)?(n=n.toLowerCase(),n==="json"?e.JSON:e.Text):e.Text}e.fromString=t})(Hn||(oe.TraceFormat=Hn={}));var Ng;(function(e){e.type=new fe.NotificationType("$/setTrace")})(Ng||(oe.SetTraceNotification=Ng={}));var Xu;(function(e){e.type=new fe.NotificationType("$/logTrace")})(Xu||(oe.LogTraceNotification=Xu={}));var vc;(function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"})(vc||(oe.ConnectionErrors=vc={}));var Is=class e extends Error{code;constructor(t,n){super(n),this.code=t,Object.setPrototypeOf(this,e.prototype)}};oe.ConnectionError=Is;var Eg;(function(e){function t(n){let r=n;return r&&dt.func(r.cancelUndispatched)}e.is=t})(Eg||(oe.ConnectionStrategy=Eg={}));var Ju;(function(e){function t(n){let r=n;return r&&(r.kind===void 0||r.kind==="id")&&dt.func(r.createCancellationTokenSource)&&(r.dispose===void 0||dt.func(r.dispose))}e.is=t})(Ju||(oe.IdCancellationReceiverStrategy=Ju={}));var Rg;(function(e){function t(n){let r=n;return r&&r.kind==="request"&&dt.func(r.createCancellationTokenSource)&&(r.dispose===void 0||dt.func(r.dispose))}e.is=t})(Rg||(oe.RequestCancellationReceiverStrategy=Rg={}));var Qu;(function(e){e.Message=Object.freeze({createCancellationTokenSource(n){return new wg.CancellationTokenSource}});function t(n){return Ju.is(n)||Rg.is(n)}e.is=t})(Qu||(oe.CancellationReceiverStrategy=Qu={}));var Zu;(function(e){e.Message=Object.freeze({sendCancellation(n,r){return n.sendNotification(Cc.type,{id:r})},cleanup(n){}});function t(n){let r=n;return r&&dt.func(r.sendCancellation)&&dt.func(r.cleanup)}e.is=t})(Zu||(oe.CancellationSenderStrategy=Zu={}));var ed;(function(e){e.Message=Object.freeze({receiver:Qu.Message,sender:Zu.Message});function t(n){let r=n;return r&&Qu.is(r.receiver)&&Zu.is(r.sender)}e.is=t})(ed||(oe.CancellationStrategy=ed={}));var td;(function(e){function t(n){let r=n;return r&&dt.func(r.handleMessage)}e.is=t})(td||(oe.MessageStrategy=td={}));var sN;(function(e){function t(n){let r=n;return r&&(ed.is(r.cancellationStrategy)||Eg.is(r.connectionStrategy)||td.is(r.messageStrategy)||dt.number(r.maxParallelism))}e.is=t})(sN||(oe.ConnectionOptions=sN={}));var hr;(function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"})(hr||(hr={}));function iV(e,t,n,r){let o=n!==void 0?n:oe.NullLogger,s=0,a=0,c=0,l="2.0",u=r?.maxParallelism??-1,d=0,f,m=new Map,p,g=new Map,h=new Map,y,w=new oN.LinkedMap,_=new Map,b=new Set,S=new Map,N=Oe.Off,R=Hn.Text,$,I=hr.New,U=new wc.Emitter,de=new wc.Emitter,F=new wc.Emitter,Q=new wc.Emitter,pe=new wc.Emitter,ot=r&&r.cancellationStrategy?r.cancellationStrategy:ed.Message;function M(P){}function O(){return I===hr.Listening}function wt(){return I===hr.Closed}function D(){return I===hr.Disposed}function j(){(I===hr.New||I===hr.Listening)&&(I=hr.Closed,de.fire(void 0))}function z(P){U.fire([P,void 0,void 0])}function ie(P){U.fire(P)}e.onClose(j),e.onError(z),t.onClose(j),t.onError(ie);function se(P){if(P===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+P.toString()}function xt(P){return P===null?"res-unknown-"+(++c).toString():"res-"+P.toString()}function vt(){return"not-"+(++a).toString()}function Mt(P,q){fe.Message.isRequest(q)?P.set(se(q.id),q):fe.Message.isResponse(q)?u===-1?P.set(xt(q.id),q):Be(q):P.set(vt(),q)}function ce(){y||w.size===0||u!==-1&&d>=u||(y=(0,iN.default)().timer.setImmediate(async()=>{if(y=void 0,w.size===0||u!==-1&&d>=u)return;let P=w.shift(),q;try{d++;let H=r?.messageStrategy;td.is(H)?q=H.handleMessage(P,vn):q=vn(P)}catch(H){o.error(`Processing message queue failed: ${H.toString()}`)}finally{q instanceof Promise?q.then(()=>{d--,ce()}).catch(H=>{o.error(`Processing message queue failed: ${H.toString()}`)}):d--,ce()}}))}async function vn(P){return fe.Message.isRequest(P)?V(P):fe.Message.isNotification(P)?W(P):fe.Message.isResponse(P)?Be(P):he(P)}let ei=P=>{try{if(fe.Message.isNotification(P)&&P.method===Cc.type.method){let q=P.params.id,H=se(q),te=w.get(H);if(fe.Message.isRequest(te)){let ut=r?.connectionStrategy,He=ut&&ut.cancelUndispatched?ut.cancelUndispatched(te,M):void 0;if(He&&(He.error!==void 0||He.result!==void 0)){w.delete(H),S.delete(q),He.id=te.id,Cn(He,P.method,Date.now()),t.write(He).catch(()=>o.error("Sending response for canceled message failed."));return}}let Le=S.get(q);if(Le!==void 0){Le.cancel(),Ch(P);return}else b.add(q)}Mt(w,P)}finally{ce()}};async function V(P){if(D())return Promise.resolve();function q(jt,nn,ht){let gt={jsonrpc:l,id:P.id};return jt instanceof fe.ResponseError?gt.error=jt.toJson():gt.result=jt===void 0?null:jt,Cn(gt,nn,ht),t.write(gt)}function H(jt,nn,ht){let gt={jsonrpc:l,id:P.id,error:jt.toJson()};return Cn(gt,nn,ht),t.write(gt)}Zn(P);let te=m.get(P.method),Le,ut;te&&(Le=te.type,ut=te.handler);let He=Date.now();if(ut||f){let jt=P.id??String(Date.now()),nn=Ju.is(ot.receiver)?ot.receiver.createCancellationTokenSource(jt):ot.receiver.createCancellationTokenSource(P);P.id!==null&&b.has(P.id)&&nn.cancel(),P.id!==null&&S.set(jt,nn);try{let ht;if(ut)if(P.params===void 0){if(Le!==void 0&&Le.numberOfParams!==0)return H(new fe.ResponseError(fe.ErrorCodes.InvalidParams,`Request ${P.method} defines ${Le.numberOfParams} params but received none.`),P.method,He);ht=ut(nn.token)}else if(Array.isArray(P.params)){if(Le!==void 0&&Le.parameterStructures===fe.ParameterStructures.byName)return H(new fe.ResponseError(fe.ErrorCodes.InvalidParams,`Request ${P.method} defines parameters by name but received parameters by position`),P.method,He);ht=ut(...P.params,nn.token)}else{if(Le!==void 0&&Le.parameterStructures===fe.ParameterStructures.byPosition)return H(new fe.ResponseError(fe.ErrorCodes.InvalidParams,`Request ${P.method} defines parameters by position but received parameters by name`),P.method,He);ht=ut(P.params,nn.token)}else f&&(ht=f(P.method,P.params,nn.token));let gt=await ht;await q(gt,P.method,He)}catch(ht){ht instanceof fe.ResponseError?await q(ht,P.method,He):ht&&dt.string(ht.message)?await H(new fe.ResponseError(fe.ErrorCodes.InternalError,`Request ${P.method} failed with message: ${ht.message}`),P.method,He):await H(new fe.ResponseError(fe.ErrorCodes.InternalError,`Request ${P.method} failed unexpectedly without providing any details.`),P.method,He)}finally{S.delete(jt)}}else await H(new fe.ResponseError(fe.ErrorCodes.MethodNotFound,`Unhandled method ${P.method}`),P.method,He)}function Be(P){if(!D())if(P.id===null)P.error?o.error(`Received response message without id: Error is:
8
- ${JSON.stringify(P.error,void 0,4)}`):o.error("Received response message without id. No further error information provided.");else{let q=P.id,H=_.get(q);if(nH(P,H),H!==void 0){_.delete(q);try{if(P.error){let te=P.error;H.reject(new fe.ResponseError(te.code,te.message,te.data))}else if(P.result!==void 0)H.resolve(P.result);else throw new Error("Should never happen.")}catch(te){te.message?o.error(`Response handler '${H.method}' failed with message: ${te.message}`):o.error(`Response handler '${H.method}' failed unexpectedly.`)}}}}async function W(P){if(D())return;let q,H;if(P.method===Cc.type.method){let te=P.params.id;b.delete(te),Ch(P);return}else{let te=g.get(P.method);te&&(H=te.handler,q=te.type)}if(H||p)try{if(Ch(P),H)if(P.params===void 0)q!==void 0&&q.numberOfParams!==0&&q.parameterStructures!==fe.ParameterStructures.byName&&o.error(`Notification ${P.method} defines ${q.numberOfParams} params but received none.`),await H();else if(Array.isArray(P.params)){let te=P.params;P.method===xc.type.method&&te.length===2&&xg.is(te[0])?await H({token:te[0],value:te[1]}):(q!==void 0&&(q.parameterStructures===fe.ParameterStructures.byName&&o.error(`Notification ${P.method} defines parameters by name but received parameters by position`),q.numberOfParams!==P.params.length&&o.error(`Notification ${P.method} defines ${q.numberOfParams} params but received ${te.length} arguments`)),await H(...te))}else q!==void 0&&q.parameterStructures===fe.ParameterStructures.byPosition&&o.error(`Notification ${P.method} defines parameters by position but received parameters by name`),await H(P.params);else p&&await p(P.method,P.params)}catch(te){te.message?o.error(`Notification handler '${P.method}' failed with message: ${te.message}`):o.error(`Notification handler '${P.method}' failed unexpectedly.`)}else F.fire(P)}function he(P){if(!P){o.error("Received empty message.");return}o.error(`Received message which is neither a response nor a notification message:
9
- ${JSON.stringify(P,null,4)}`);let q=P;if(dt.string(q.id)||dt.number(q.id)){let H=q.id,te=_.get(H);te&&te.reject(new Error("The received response has neither a result nor an error property."))}}function Ae(P){if(P!=null)switch(N){case Oe.Verbose:return JSON.stringify(P,null,4);case Oe.Compact:return JSON.stringify(P);default:return}}function Ct(P){if(!(N===Oe.Off||!$))if(R===Hn.Text){let q;(N===Oe.Verbose||N===Oe.Compact)&&P.params&&(q=`Params: ${Ae(P.params)}`),$.log(`Sending request '${P.method} - (${P.id})'.`,q)}else Ps("send-request",P)}function Ue(P){if(!(N===Oe.Off||!$))if(R===Hn.Text){let q;(N===Oe.Verbose||N===Oe.Compact)&&(P.params?q=`Params: ${Ae(P.params)}`:q="No parameters provided."),$.log(`Sending notification '${P.method}'.`,q)}else Ps("send-notification",P)}function Cn(P,q,H){if(!(N===Oe.Off||!$))if(R===Hn.Text){let te;(N===Oe.Verbose||N===Oe.Compact)&&(P.error&&P.error.data?te=`Error data: ${Ae(P.error.data)}`:P.result?te=`Result: ${Ae(P.result)}`:P.error===void 0&&(te="No result returned.")),$.log(`Sending response '${q} - (${P.id})'. Processing request took ${Date.now()-H}ms`,te)}else Ps("send-response",P)}function Zn(P){if(!(N===Oe.Off||!$))if(R===Hn.Text){let q;(N===Oe.Verbose||N===Oe.Compact)&&P.params&&(q=`Params: ${Ae(P.params)}`),$.log(`Received request '${P.method} - (${P.id})'.`,q)}else Ps("receive-request",P)}function Ch(P){if(!(N===Oe.Off||!$||P.method===Xu.type.method))if(R===Hn.Text){let q;(N===Oe.Verbose||N===Oe.Compact)&&(P.params?q=`Params: ${Ae(P.params)}`:q="No parameters provided."),$.log(`Received notification '${P.method}'.`,q)}else Ps("receive-notification",P)}function nH(P,q){if(!(N===Oe.Off||!$))if(R===Hn.Text){let H;if((N===Oe.Verbose||N===Oe.Compact)&&(P.error&&P.error.data?H=`Error data: ${Ae(P.error.data)}`:P.result?H=`Result: ${Ae(P.result)}`:P.error===void 0&&(H="No result returned.")),q){let te=P.error?` Request failed: ${P.error.message} (${P.error.code}).`:"";$.log(`Received response '${q.method} - (${P.id})' in ${Date.now()-q.timerStart}ms.${te}`,H)}else $.log(`Received response ${P.id} without active response promise.`,H)}else Ps("receive-response",P)}function Ps(P,q){if(!$||N===Oe.Off)return;let H={isLSPMessage:!0,type:P,message:q,timestamp:Date.now()};$.log(H)}function gc(){if(wt())throw new Is(vc.Closed,"Connection is closed.");if(D())throw new Is(vc.Disposed,"Connection is disposed.")}function rH(){if(O())throw new Is(vc.AlreadyListening,"Connection is already listening")}function iH(){if(!O())throw new Error("Call listen() first.")}function _c(P){return P===void 0?null:P}function kP(P){if(P!==null)return P}function FP(P){return P!=null&&!Array.isArray(P)&&typeof P=="object"}function Ph(P,q){switch(P){case fe.ParameterStructures.auto:return FP(q)?kP(q):[_c(q)];case fe.ParameterStructures.byName:if(!FP(q))throw new Error("Received parameters by name but param is not an object literal.");return kP(q);case fe.ParameterStructures.byPosition:return[_c(q)];default:throw new Error(`Unknown parameter structure ${P.toString()}`)}}function LP(P,q){let H,te=P.numberOfParams;switch(te){case 0:H=void 0;break;case 1:H=Ph(P.parameterStructures,q[0]);break;default:H=[];for(let Le=0;Le<q.length&&Le<te;Le++)H.push(_c(q[Le]));if(q.length<te)for(let Le=q.length;Le<te;Le++)H.push(null);break}return H}let To={sendNotification:(P,...q)=>{gc();let H,te;if(dt.string(P)){H=P;let ut=q[0],He=0,jt=fe.ParameterStructures.auto;fe.ParameterStructures.is(ut)&&(He=1,jt=ut);let nn=q.length,ht=nn-He;switch(ht){case 0:te=void 0;break;case 1:te=Ph(jt,q[He]);break;default:if(jt===fe.ParameterStructures.byName)throw new Error(`Received ${ht} parameters for 'by Name' notification parameter structure.`);te=q.slice(He,nn).map(gt=>_c(gt));break}}else{let ut=q;H=P.method,te=LP(P,ut)}let Le={jsonrpc:l,method:H,params:te};return Ue(Le),t.write(Le).catch(ut=>{throw o.error("Sending notification failed."),ut})},onNotification:(P,q)=>{gc();let H;return dt.func(P)?p=P:q&&(dt.string(P)?(H=P,g.set(P,{type:void 0,handler:q})):(H=P.method,g.set(P.method,{type:P,handler:q}))),{dispose:()=>{H!==void 0?g.get(H)?.handler===q&&g.delete(H):p===P&&(p=void 0)}}},onProgress:(P,q,H)=>{if(h.has(q))throw new Error(`Progress handler for token ${q} already registered`);return h.set(q,H),{dispose:()=>{h.get(q)===H&&h.delete(q)}}},sendProgress:(P,q,H)=>To.sendNotification(xc.type,{token:q,value:H}),onUnhandledProgress:Q.event,sendRequest:(P,...q)=>{gc(),iH();function H(gt,mr){let ti=ot.sender.sendCancellation(gt,mr);ti===void 0?o.log(`Received no promise from cancellation strategy when cancelling id ${mr}`):ti.catch(()=>{o.log(`Sending cancellation messages for id ${mr} failed.`)})}let te,Le,ut;if(dt.string(P)){te=P;let gt=q[0],mr=q[q.length-1],ti=0,yc=fe.ParameterStructures.auto;fe.ParameterStructures.is(gt)&&(ti=1,yc=gt);let Ao=q.length;wg.CancellationToken.is(mr)&&(Ao=Ao-1,ut=mr);let Dr=Ao-ti;switch(Dr){case 0:Le=void 0;break;case 1:Le=Ph(yc,q[ti]);break;default:if(yc===fe.ParameterStructures.byName)throw new Error(`Received ${Dr} parameters for 'by Name' request parameter structure.`);Le=q.slice(ti,Ao).map(oH=>_c(oH));break}}else{let gt=q;te=P.method,Le=LP(P,gt);let mr=P.numberOfParams;ut=wg.CancellationToken.is(gt[mr])?gt[mr]:void 0}let He=s++,jt,nn=!1;ut!==void 0&&(ut.isCancellationRequested?nn=!0:jt=ut.onCancellationRequested(()=>{H(To,He)}));let ht={jsonrpc:l,id:He,method:te,params:Le};return Ct(ht),typeof ot.sender.enableCancellation=="function"&&ot.sender.enableCancellation(ht),new Promise(async(gt,mr)=>{let ti=Dr=>{gt(Dr),ot.sender.cleanup(He),jt?.dispose()},yc=Dr=>{mr(Dr),ot.sender.cleanup(He),jt?.dispose()},Ao={method:te,timerStart:Date.now(),resolve:ti,reject:yc};try{_.set(He,Ao),await t.write(ht),nn&&H(To,He)}catch(Dr){throw _.delete(He),Ao.reject(new fe.ResponseError(fe.ErrorCodes.MessageWriteError,Dr.message?Dr.message:"Unknown reason")),o.error("Sending request failed."),Dr}})},onRequest:(P,q)=>{gc();let H=null;return Cg.is(P)?(H=void 0,f=P):dt.string(P)?(H=null,q!==void 0&&(H=P,m.set(P,{handler:q,type:void 0}))):q!==void 0&&(H=P.method,m.set(P.method,{type:P,handler:q})),{dispose:()=>{H!==null&&(H!==void 0?m.get(H)?.handler===q&&m.delete(H):f===P&&(f=void 0))}}},hasPendingResponse:()=>_.size>0,trace:async(P,q,H)=>{let te=!1,Le=Hn.Text;H!==void 0&&(dt.boolean(H)?te=H:(te=H.sendNotification||!1,Le=H.traceFormat||Hn.Text)),N=P,R=Le,N===Oe.Off?$=void 0:$=q,te&&!wt()&&!D()&&await To.sendNotification(Ng.type,{value:Oe.toString(P)})},onError:U.event,onClose:de.event,onUnhandledNotification:F.event,onDispose:pe.event,end:()=>{t.end()},dispose:()=>{if(D())return;I=hr.Disposed,pe.fire(void 0);let P=new fe.ResponseError(fe.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let q of _.values())q.reject(P);_=new Map,S=new Map,b=new Set,w=new oN.LinkedMap,dt.func(t.dispose)&&t.dispose(),dt.func(e.dispose)&&e.dispose()},listen:()=>{gc(),rH(),I=hr.Listening,e.listen(ei)},inspect:()=>{(0,iN.default)().console.log("inspect")}};return To.onNotification(Xu.type,P=>{if(N===Oe.Off||!$)return;let q=N===Oe.Verbose||N===Oe.Compact;$.log(P.message,q?P.verbose:void 0)}),To.onNotification(xc.type,async P=>{let q=h.get(P.token);q?await q(P.value):Q.fire(P)}),To}});var ri=C(k=>{"use strict";var oV=k&&k.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(k,"__esModule",{value:!0});k.ProgressType=k.ProgressToken=k.createMessageConnection=k.NullLogger=k.ConnectionOptions=k.ConnectionStrategy=k.AbstractMessageBuffer=k.WriteableStreamMessageWriter=k.AbstractMessageWriter=k.MessageWriter=k.ReadableStreamMessageReader=k.AbstractMessageReader=k.MessageReader=k.SharedArrayReceiverStrategy=k.SharedArraySenderStrategy=k.CancellationToken=k.CancellationTokenSource=k.Emitter=k.Event=k.Disposable=k.LRUCache=k.Touch=k.LinkedMap=k.ParameterStructures=k.NotificationType9=k.NotificationType8=k.NotificationType7=k.NotificationType6=k.NotificationType5=k.NotificationType4=k.NotificationType3=k.NotificationType2=k.NotificationType1=k.NotificationType0=k.NotificationType=k.ErrorCodes=k.ResponseError=k.RequestType9=k.RequestType8=k.RequestType7=k.RequestType6=k.RequestType5=k.RequestType4=k.RequestType3=k.RequestType2=k.RequestType1=k.RequestType0=k.RequestType=k.Message=k.RAL=void 0;k.MessageStrategy=k.CancellationStrategy=k.CancellationSenderStrategy=k.RequestCancellationReceiverStrategy=k.IdCancellationReceiverStrategy=k.CancellationReceiverStrategy=k.ConnectionError=k.ConnectionErrors=k.LogTraceNotification=k.SetTraceNotification=k.TraceFormat=k.TraceValues=k.TraceValue=k.Trace=void 0;var Xe=Qh();Object.defineProperty(k,"Message",{enumerable:!0,get:function(){return Xe.Message}});Object.defineProperty(k,"RequestType",{enumerable:!0,get:function(){return Xe.RequestType}});Object.defineProperty(k,"RequestType0",{enumerable:!0,get:function(){return Xe.RequestType0}});Object.defineProperty(k,"RequestType1",{enumerable:!0,get:function(){return Xe.RequestType1}});Object.defineProperty(k,"RequestType2",{enumerable:!0,get:function(){return Xe.RequestType2}});Object.defineProperty(k,"RequestType3",{enumerable:!0,get:function(){return Xe.RequestType3}});Object.defineProperty(k,"RequestType4",{enumerable:!0,get:function(){return Xe.RequestType4}});Object.defineProperty(k,"RequestType5",{enumerable:!0,get:function(){return Xe.RequestType5}});Object.defineProperty(k,"RequestType6",{enumerable:!0,get:function(){return Xe.RequestType6}});Object.defineProperty(k,"RequestType7",{enumerable:!0,get:function(){return Xe.RequestType7}});Object.defineProperty(k,"RequestType8",{enumerable:!0,get:function(){return Xe.RequestType8}});Object.defineProperty(k,"RequestType9",{enumerable:!0,get:function(){return Xe.RequestType9}});Object.defineProperty(k,"ResponseError",{enumerable:!0,get:function(){return Xe.ResponseError}});Object.defineProperty(k,"ErrorCodes",{enumerable:!0,get:function(){return Xe.ErrorCodes}});Object.defineProperty(k,"NotificationType",{enumerable:!0,get:function(){return Xe.NotificationType}});Object.defineProperty(k,"NotificationType0",{enumerable:!0,get:function(){return Xe.NotificationType0}});Object.defineProperty(k,"NotificationType1",{enumerable:!0,get:function(){return Xe.NotificationType1}});Object.defineProperty(k,"NotificationType2",{enumerable:!0,get:function(){return Xe.NotificationType2}});Object.defineProperty(k,"NotificationType3",{enumerable:!0,get:function(){return Xe.NotificationType3}});Object.defineProperty(k,"NotificationType4",{enumerable:!0,get:function(){return Xe.NotificationType4}});Object.defineProperty(k,"NotificationType5",{enumerable:!0,get:function(){return Xe.NotificationType5}});Object.defineProperty(k,"NotificationType6",{enumerable:!0,get:function(){return Xe.NotificationType6}});Object.defineProperty(k,"NotificationType7",{enumerable:!0,get:function(){return Xe.NotificationType7}});Object.defineProperty(k,"NotificationType8",{enumerable:!0,get:function(){return Xe.NotificationType8}});Object.defineProperty(k,"NotificationType9",{enumerable:!0,get:function(){return Xe.NotificationType9}});Object.defineProperty(k,"ParameterStructures",{enumerable:!0,get:function(){return Xe.ParameterStructures}});var Tg=eg();Object.defineProperty(k,"LinkedMap",{enumerable:!0,get:function(){return Tg.LinkedMap}});Object.defineProperty(k,"LRUCache",{enumerable:!0,get:function(){return Tg.LRUCache}});Object.defineProperty(k,"Touch",{enumerable:!0,get:function(){return Tg.Touch}});var sV=zP();Object.defineProperty(k,"Disposable",{enumerable:!0,get:function(){return sV.Disposable}});var cN=Es();Object.defineProperty(k,"Event",{enumerable:!0,get:function(){return cN.Event}});Object.defineProperty(k,"Emitter",{enumerable:!0,get:function(){return cN.Emitter}});var lN=Gu();Object.defineProperty(k,"CancellationTokenSource",{enumerable:!0,get:function(){return lN.CancellationTokenSource}});Object.defineProperty(k,"CancellationToken",{enumerable:!0,get:function(){return lN.CancellationToken}});var uN=YP();Object.defineProperty(k,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return uN.SharedArraySenderStrategy}});Object.defineProperty(k,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return uN.SharedArrayReceiverStrategy}});var Ag=JP();Object.defineProperty(k,"MessageReader",{enumerable:!0,get:function(){return Ag.MessageReader}});Object.defineProperty(k,"AbstractMessageReader",{enumerable:!0,get:function(){return Ag.AbstractMessageReader}});Object.defineProperty(k,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Ag.ReadableStreamMessageReader}});var Ig=nN();Object.defineProperty(k,"MessageWriter",{enumerable:!0,get:function(){return Ig.MessageWriter}});Object.defineProperty(k,"AbstractMessageWriter",{enumerable:!0,get:function(){return Ig.AbstractMessageWriter}});Object.defineProperty(k,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Ig.WriteableStreamMessageWriter}});var aV=rN();Object.defineProperty(k,"AbstractMessageBuffer",{enumerable:!0,get:function(){return aV.AbstractMessageBuffer}});var Rt=aN();Object.defineProperty(k,"ConnectionStrategy",{enumerable:!0,get:function(){return Rt.ConnectionStrategy}});Object.defineProperty(k,"ConnectionOptions",{enumerable:!0,get:function(){return Rt.ConnectionOptions}});Object.defineProperty(k,"NullLogger",{enumerable:!0,get:function(){return Rt.NullLogger}});Object.defineProperty(k,"createMessageConnection",{enumerable:!0,get:function(){return Rt.createMessageConnection}});Object.defineProperty(k,"ProgressToken",{enumerable:!0,get:function(){return Rt.ProgressToken}});Object.defineProperty(k,"ProgressType",{enumerable:!0,get:function(){return Rt.ProgressType}});Object.defineProperty(k,"Trace",{enumerable:!0,get:function(){return Rt.Trace}});Object.defineProperty(k,"TraceValue",{enumerable:!0,get:function(){return Rt.TraceValue}});Object.defineProperty(k,"TraceFormat",{enumerable:!0,get:function(){return Rt.TraceFormat}});Object.defineProperty(k,"SetTraceNotification",{enumerable:!0,get:function(){return Rt.SetTraceNotification}});Object.defineProperty(k,"LogTraceNotification",{enumerable:!0,get:function(){return Rt.LogTraceNotification}});Object.defineProperty(k,"ConnectionErrors",{enumerable:!0,get:function(){return Rt.ConnectionErrors}});Object.defineProperty(k,"ConnectionError",{enumerable:!0,get:function(){return Rt.ConnectionError}});Object.defineProperty(k,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Rt.CancellationReceiverStrategy}});Object.defineProperty(k,"IdCancellationReceiverStrategy",{enumerable:!0,get:function(){return Rt.IdCancellationReceiverStrategy}});Object.defineProperty(k,"RequestCancellationReceiverStrategy",{enumerable:!0,get:function(){return Rt.RequestCancellationReceiverStrategy}});Object.defineProperty(k,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Rt.CancellationSenderStrategy}});Object.defineProperty(k,"CancellationStrategy",{enumerable:!0,get:function(){return Rt.CancellationStrategy}});Object.defineProperty(k,"MessageStrategy",{enumerable:!0,get:function(){return Rt.MessageStrategy}});Object.defineProperty(k,"TraceValues",{enumerable:!0,get:function(){return Rt.TraceValues}});var cV=oV(Ri());k.RAL=cV.default});var fd={};fH(fd,{AnnotatedTextEdit:()=>ii,ApplyKind:()=>Zg,ChangeAnnotation:()=>Ai,ChangeAnnotationIdentifier:()=>Wt,CodeAction:()=>h_,CodeActionContext:()=>p_,CodeActionKind:()=>m_,CodeActionTag:()=>cd,CodeActionTriggerKind:()=>Ic,CodeDescription:()=>jg,CodeLens:()=>g_,Color:()=>rd,ColorInformation:()=>Lg,ColorPresentation:()=>Og,Command:()=>Do,CompletionItem:()=>t_,CompletionItemKind:()=>Kg,CompletionItemLabelDetails:()=>e_,CompletionItemTag:()=>Xg,CompletionList:()=>n_,CreateFile:()=>ks,DeleteFile:()=>Ls,Diagnostic:()=>Ec,DiagnosticRelatedInformation:()=>id,DiagnosticSeverity:()=>qg,DiagnosticTag:()=>Bg,DocumentHighlight:()=>a_,DocumentHighlightKind:()=>s_,DocumentLink:()=>y_,DocumentSymbol:()=>f_,DocumentUri:()=>Dg,EOL:()=>lV,FoldingRange:()=>$g,FoldingRangeKind:()=>Mg,FormattingOptions:()=>__,Hover:()=>r_,InlayHint:()=>E_,InlayHintKind:()=>ld,InlayHintLabelPart:()=>ud,InlineCompletionContext:()=>D_,InlineCompletionItem:()=>R_,InlineCompletionList:()=>T_,InlineCompletionTriggerKind:()=>A_,InlineValueContext:()=>N_,InlineValueEvaluatableExpression:()=>P_,InlineValueText:()=>v_,InlineValueVariableLookup:()=>C_,InsertReplaceEdit:()=>Jg,InsertTextFormat:()=>Yg,InsertTextMode:()=>Qg,LanguageKind:()=>Gg,Location:()=>Nc,LocationLink:()=>Fg,MarkedString:()=>Ac,MarkupContent:()=>Ii,MarkupKind:()=>ad,OptionalVersionedTextDocumentIdentifier:()=>Tc,ParameterInformation:()=>i_,Position:()=>er,Range:()=>ft,RenameFile:()=>Fs,SelectedCompletionInfo:()=>I_,SelectionRange:()=>b_,SemanticTokenModifiers:()=>w_,SemanticTokenTypes:()=>S_,SemanticTokens:()=>x_,SignatureInformation:()=>o_,SnippetTextEdit:()=>Wg,StringValue:()=>dd,SymbolInformation:()=>u_,SymbolKind:()=>c_,SymbolTag:()=>l_,TextDocument:()=>F_,TextDocumentEdit:()=>Rc,TextDocumentIdentifier:()=>Hg,TextDocumentItem:()=>zg,TextEdit:()=>kr,URI:()=>nd,VersionedTextDocumentIdentifier:()=>Vg,WorkspaceChange:()=>Ug,WorkspaceEdit:()=>od,WorkspaceFolder:()=>k_,WorkspaceSymbol:()=>d_,integer:()=>kg,uinteger:()=>Pc});var Dg,nd,kg,Pc,er,ft,Nc,Fg,rd,Lg,Og,Mg,$g,id,qg,Bg,jg,Ec,Do,kr,Ai,Wt,ii,Rc,ks,Fs,Ls,od,Ds,Wg,sd,Ug,Hg,Vg,Tc,Gg,zg,ad,Ii,Kg,Yg,Xg,Jg,Qg,Zg,e_,t_,n_,Ac,r_,i_,o_,s_,a_,c_,l_,u_,d_,f_,m_,Ic,p_,cd,h_,g_,__,y_,b_,S_,w_,x_,v_,C_,P_,N_,ld,ud,E_,dd,R_,T_,A_,I_,D_,k_,lV,F_,L_,E,md=dH(()=>{"use strict";(function(e){function t(n){return typeof n=="string"}e.is=t})(Dg||(Dg={}));(function(e){function t(n){return typeof n=="string"}e.is=t})(nd||(nd={}));(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(kg||(kg={}));(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(Pc||(Pc={}));(function(e){function t(r,o){return r===Number.MAX_VALUE&&(r=Pc.MAX_VALUE),o===Number.MAX_VALUE&&(o=Pc.MAX_VALUE),{line:r,character:o}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&E.uinteger(o.line)&&E.uinteger(o.character)}e.is=n})(er||(er={}));(function(e){function t(r,o,s,a){if(E.uinteger(r)&&E.uinteger(o)&&E.uinteger(s)&&E.uinteger(a))return{start:er.create(r,o),end:er.create(s,a)};if(er.is(r)&&er.is(o))return{start:r,end:o};throw new Error(`Range#create called with invalid arguments[${r}, ${o}, ${s}, ${a}]`)}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&er.is(o.start)&&er.is(o.end)}e.is=n})(ft||(ft={}));(function(e){function t(r,o){return{uri:r,range:o}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&ft.is(o.range)&&(E.string(o.uri)||E.undefined(o.uri))}e.is=n})(Nc||(Nc={}));(function(e){function t(r,o,s,a){return{targetUri:r,targetRange:o,targetSelectionRange:s,originSelectionRange:a}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&ft.is(o.targetRange)&&E.string(o.targetUri)&&ft.is(o.targetSelectionRange)&&(ft.is(o.originSelectionRange)||E.undefined(o.originSelectionRange))}e.is=n})(Fg||(Fg={}));(function(e){function t(r,o,s,a){return{red:r,green:o,blue:s,alpha:a}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&E.numberRange(o.red,0,1)&&E.numberRange(o.green,0,1)&&E.numberRange(o.blue,0,1)&&E.numberRange(o.alpha,0,1)}e.is=n})(rd||(rd={}));(function(e){function t(r,o){return{range:r,color:o}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&ft.is(o.range)&&rd.is(o.color)}e.is=n})(Lg||(Lg={}));(function(e){function t(r,o,s){return{label:r,textEdit:o,additionalTextEdits:s}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&E.string(o.label)&&(E.undefined(o.textEdit)||kr.is(o))&&(E.undefined(o.additionalTextEdits)||E.typedArray(o.additionalTextEdits,kr.is))}e.is=n})(Og||(Og={}));(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(Mg||(Mg={}));(function(e){function t(r,o,s,a,c,l){let u={startLine:r,endLine:o};return E.defined(s)&&(u.startCharacter=s),E.defined(a)&&(u.endCharacter=a),E.defined(c)&&(u.kind=c),E.defined(l)&&(u.collapsedText=l),u}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&E.uinteger(o.startLine)&&E.uinteger(o.startLine)&&(E.undefined(o.startCharacter)||E.uinteger(o.startCharacter))&&(E.undefined(o.endCharacter)||E.uinteger(o.endCharacter))&&(E.undefined(o.kind)||E.string(o.kind))}e.is=n})($g||($g={}));(function(e){function t(r,o){return{location:r,message:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&Nc.is(o.location)&&E.string(o.message)}e.is=n})(id||(id={}));(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(qg||(qg={}));(function(e){e.Unnecessary=1,e.Deprecated=2})(Bg||(Bg={}));(function(e){function t(n){let r=n;return E.objectLiteral(r)&&E.string(r.href)}e.is=t})(jg||(jg={}));(function(e){function t(s,a,c,l,u,d){let f={range:s,message:a};return E.defined(c)&&(f.severity=c),E.defined(l)&&(f.code=l),E.defined(u)&&(f.source=u),E.defined(d)&&(f.relatedInformation=d),f}e.create=t;function n(s){var a;let c=s;return E.defined(c)&&ft.is(c.range)&&(E.string(c.message)||Ii.is(c.message))&&(E.number(c.severity)||E.undefined(c.severity))&&(E.integer(c.code)||E.string(c.code)||E.undefined(c.code))&&(E.undefined(c.codeDescription)||E.string((a=c.codeDescription)===null||a===void 0?void 0:a.href))&&(E.string(c.source)||E.undefined(c.source))&&(E.undefined(c.relatedInformation)||E.typedArray(c.relatedInformation,id.is))}e.is=n;function r(s){return E.string(s.message)}e.is3_17=r;function o(s){if(E.string(s.message))return s.message;if(Ii.is(s.message))return s.message.value;throw new Error(`Unknown message type ${typeof s.message}`)}e.getMessageString=o})(Ec||(Ec={}));(function(e){function t(r,o,...s){let a={title:r,command:o};return E.defined(s)&&s.length>0&&(a.arguments=s),a}e.create=t;function n(r){let o=r;return E.defined(o)&&E.string(o.title)&&(o.tooltip===void 0||E.string(o.tooltip))&&E.string(o.command)}e.is=n})(Do||(Do={}));(function(e){function t(s,a){return{range:s,newText:a}}e.replace=t;function n(s,a){return{range:{start:s,end:s},newText:a}}e.insert=n;function r(s){return{range:s,newText:""}}e.del=r;function o(s){let a=s;return E.objectLiteral(a)&&E.string(a.newText)&&ft.is(a.range)}e.is=o})(kr||(kr={}));(function(e){function t(r,o,s){let a={label:r};return o!==void 0&&(a.needsConfirmation=o),s!==void 0&&(a.description=s),a}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&E.string(o.label)&&(E.boolean(o.needsConfirmation)||o.needsConfirmation===void 0)&&(E.string(o.description)||o.description===void 0)}e.is=n})(Ai||(Ai={}));(function(e){function t(n){let r=n;return E.string(r)}e.is=t})(Wt||(Wt={}));(function(e){function t(s,a,c){return{range:s,newText:a,annotationId:c}}e.replace=t;function n(s,a,c){return{range:{start:s,end:s},newText:a,annotationId:c}}e.insert=n;function r(s,a){return{range:s,newText:"",annotationId:a}}e.del=r;function o(s){let a=s;return kr.is(a)&&(Ai.is(a.annotationId)||Wt.is(a.annotationId))}e.is=o})(ii||(ii={}));(function(e){function t(r,o){return{textDocument:r,edits:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&Tc.is(o.textDocument)&&Array.isArray(o.edits)}e.is=n})(Rc||(Rc={}));(function(e){function t(r,o,s){let a={kind:"create",uri:r};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}e.create=t;function n(r){let o=r;return o&&o.kind==="create"&&E.string(o.uri)&&(o.options===void 0||(o.options.overwrite===void 0||E.boolean(o.options.overwrite))&&(o.options.ignoreIfExists===void 0||E.boolean(o.options.ignoreIfExists)))&&(o.annotationId===void 0||Wt.is(o.annotationId))}e.is=n})(ks||(ks={}));(function(e){function t(r,o,s,a){let c={kind:"rename",oldUri:r,newUri:o};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(c.options=s),a!==void 0&&(c.annotationId=a),c}e.create=t;function n(r){let o=r;return o&&o.kind==="rename"&&E.string(o.oldUri)&&E.string(o.newUri)&&(o.options===void 0||(o.options.overwrite===void 0||E.boolean(o.options.overwrite))&&(o.options.ignoreIfExists===void 0||E.boolean(o.options.ignoreIfExists)))&&(o.annotationId===void 0||Wt.is(o.annotationId))}e.is=n})(Fs||(Fs={}));(function(e){function t(r,o,s){let a={kind:"delete",uri:r};return o!==void 0&&(o.recursive!==void 0||o.ignoreIfNotExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}e.create=t;function n(r){let o=r;return o&&o.kind==="delete"&&E.string(o.uri)&&(o.options===void 0||(o.options.recursive===void 0||E.boolean(o.options.recursive))&&(o.options.ignoreIfNotExists===void 0||E.boolean(o.options.ignoreIfNotExists)))&&(o.annotationId===void 0||Wt.is(o.annotationId))}e.is=n})(Ls||(Ls={}));(function(e){function t(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(o=>E.string(o.kind)?ks.is(o)||Fs.is(o)||Ls.is(o):Rc.is(o)))}e.is=t})(od||(od={}));Ds=class{constructor(t,n){this.edits=t,this.changeAnnotations=n}insert(t,n,r){let o,s;if(r===void 0?o=kr.insert(t,n):Wt.is(r)?(s=r,o=ii.insert(t,n,r)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(r),o=ii.insert(t,n,s)),this.edits.push(o),s!==void 0)return s}replace(t,n,r){let o,s;if(r===void 0?o=kr.replace(t,n):Wt.is(r)?(s=r,o=ii.replace(t,n,r)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(r),o=ii.replace(t,n,s)),this.edits.push(o),s!==void 0)return s}delete(t,n){let r,o;if(n===void 0?r=kr.del(t):Wt.is(n)?(o=n,r=ii.del(t,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),r=ii.del(t,o)),this.edits.push(r),o!==void 0)return o}add(t){this.edits.push(t)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(t){if(t===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}};(function(e){function t(n){let r=n;return E.objectLiteral(r)&&ft.is(r.range)&&dd.isSnippet(r.snippet)&&(r.annotationId===void 0||Ai.is(r.annotationId)||Wt.is(r.annotationId))}e.is=t})(Wg||(Wg={}));sd=class{constructor(t){this._annotations=t===void 0?Object.create(null):t,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(t,n){let r;if(Wt.is(t)?r=t:(r=this.nextId(),n=t),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(n===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=n,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},Ug=class{constructor(t){this._textEditChanges=Object.create(null),t!==void 0?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new sd(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach(n=>{if(Rc.is(n)){let r=new Ds(n.edits,this._changeAnnotations);this._textEditChanges[n.textDocument.uri]=r}})):t.changes&&Object.keys(t.changes).forEach(n=>{let r=new Ds(t.changes[n]);this._textEditChanges[n]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(t){if(Tc.is(t)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n={uri:t.uri,version:t.version},r=this._textEditChanges[n.uri];if(!r){let o=[],s={textDocument:n,edits:o};this._workspaceEdit.documentChanges.push(s),r=new Ds(o,this._changeAnnotations),this._textEditChanges[n.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let n=this._textEditChanges[t];if(!n){let r=[];this._workspaceEdit.changes[t]=r,n=new Ds(r),this._textEditChanges[t]=n}return n}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new sd,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;Ai.is(n)||Wt.is(n)?o=n:r=n;let s,a;if(o===void 0?s=ks.create(t,r):(a=Wt.is(o)?o:this._changeAnnotations.manage(o),s=ks.create(t,r,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a}renameFile(t,n,r,o){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let s;Ai.is(r)||Wt.is(r)?s=r:o=r;let a,c;if(s===void 0?a=Fs.create(t,n,o):(c=Wt.is(s)?s:this._changeAnnotations.manage(s),a=Fs.create(t,n,o,c)),this._workspaceEdit.documentChanges.push(a),c!==void 0)return c}deleteFile(t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;Ai.is(n)||Wt.is(n)?o=n:r=n;let s,a;if(o===void 0?s=Ls.create(t,r):(a=Wt.is(o)?o:this._changeAnnotations.manage(o),s=Ls.create(t,r,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a}};(function(e){function t(r){return{uri:r}}e.create=t;function n(r){let o=r;return E.defined(o)&&E.string(o.uri)}e.is=n})(Hg||(Hg={}));(function(e){function t(r,o){return{uri:r,version:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&E.string(o.uri)&&E.integer(o.version)}e.is=n})(Vg||(Vg={}));(function(e){function t(r,o){return{uri:r,version:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&E.string(o.uri)&&(o.version===null||E.integer(o.version))}e.is=n})(Tc||(Tc={}));(function(e){e.ABAP="abap",e.WindowsBat="bat",e.BibTeX="bibtex",e.Clojure="clojure",e.Coffeescript="coffeescript",e.C="c",e.CPP="cpp",e.CSharp="csharp",e.CSS="css",e.D="d",e.Delphi="pascal",e.Diff="diff",e.Dart="dart",e.Dockerfile="dockerfile",e.Elixir="elixir",e.Erlang="erlang",e.FSharp="fsharp",e.GitCommit="git-commit",e.GitRebase="git-rebase",e.Go="go",e.Groovy="groovy",e.Handlebars="handlebars",e.Haskell="haskell",e.HTML="html",e.Ini="ini",e.Java="java",e.JavaScript="javascript",e.JavaScriptReact="javascriptreact",e.JSON="json",e.LaTeX="latex",e.Less="less",e.Lua="lua",e.Makefile="makefile",e.Markdown="markdown",e.ObjectiveC="objective-c",e.ObjectiveCPP="objective-cpp",e.Pascal="pascal",e.Perl="perl",e.Perl6="perl6",e.PHP="php",e.Plaintext="plaintext",e.Powershell="powershell",e.Pug="jade",e.Python="python",e.R="r",e.Razor="razor",e.Ruby="ruby",e.Rust="rust",e.SCSS="scss",e.SASS="sass",e.Scala="scala",e.ShaderLab="shaderlab",e.ShellScript="shellscript",e.SQL="sql",e.Swift="swift",e.TypeScript="typescript",e.TypeScriptReact="typescriptreact",e.TeX="tex",e.VisualBasic="vb",e.XML="xml",e.XSL="xsl",e.YAML="yaml"})(Gg||(Gg={}));(function(e){function t(r,o,s,a){return{uri:r,languageId:o,version:s,text:a}}e.create=t;function n(r){let o=r;return E.defined(o)&&E.string(o.uri)&&E.string(o.languageId)&&E.integer(o.version)&&E.string(o.text)}e.is=n})(zg||(zg={}));(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(n){let r=n;return r===e.PlainText||r===e.Markdown}e.is=t})(ad||(ad={}));(function(e){function t(n){let r=n;return E.objectLiteral(n)&&ad.is(r.kind)&&E.string(r.value)}e.is=t})(Ii||(Ii={}));(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Kg||(Kg={}));(function(e){e.PlainText=1,e.Snippet=2})(Yg||(Yg={}));(function(e){e.Deprecated=1})(Xg||(Xg={}));(function(e){function t(r,o,s){return{newText:r,insert:o,replace:s}}e.create=t;function n(r){let o=r;return o&&E.string(o.newText)&&ft.is(o.insert)&&ft.is(o.replace)}e.is=n})(Jg||(Jg={}));(function(e){e.asIs=1,e.adjustIndentation=2})(Qg||(Qg={}));(function(e){e.Replace=1,e.Merge=2})(Zg||(Zg={}));(function(e){function t(n){let r=n;return r&&(E.string(r.detail)||r.detail===void 0)&&(E.string(r.description)||r.description===void 0)}e.is=t})(e_||(e_={}));(function(e){function t(n){return{label:n}}e.create=t})(t_||(t_={}));(function(e){function t(n,r){return{items:n||[],isIncomplete:!!r}}e.create=t})(n_||(n_={}));(function(e){function t(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function n(r){let o=r;return E.string(o)||E.objectLiteral(o)&&E.string(o.language)&&E.string(o.value)}e.is=n})(Ac||(Ac={}));(function(e){function t(n){let r=n;return!!r&&E.objectLiteral(r)&&(Ii.is(r.contents)||Ac.is(r.contents)||E.typedArray(r.contents,Ac.is))&&(n.range===void 0||ft.is(n.range))}e.is=t})(r_||(r_={}));(function(e){function t(n,r){return r?{label:n,documentation:r}:{label:n}}e.create=t})(i_||(i_={}));(function(e){function t(n,r,...o){let s={label:n};return E.defined(r)&&(s.documentation=r),E.defined(o)?s.parameters=o:s.parameters=[],s}e.create=t})(o_||(o_={}));(function(e){e.Text=1,e.Read=2,e.Write=3})(s_||(s_={}));(function(e){function t(n,r){let o={range:n};return E.number(r)&&(o.kind=r),o}e.create=t})(a_||(a_={}));(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(c_||(c_={}));(function(e){e.Deprecated=1})(l_||(l_={}));(function(e){function t(n,r,o,s,a){let c={name:n,kind:r,location:{uri:s,range:o}};return a&&(c.containerName=a),c}e.create=t})(u_||(u_={}));(function(e){function t(n,r,o,s){return s!==void 0?{name:n,kind:r,location:{uri:o,range:s}}:{name:n,kind:r,location:{uri:o}}}e.create=t})(d_||(d_={}));(function(e){function t(r,o,s,a,c,l){let u={name:r,detail:o,kind:s,range:a,selectionRange:c};return l!==void 0&&(u.children=l),u}e.create=t;function n(r){let o=r;return o&&E.string(o.name)&&E.number(o.kind)&&ft.is(o.range)&&ft.is(o.selectionRange)&&(o.detail===void 0||E.string(o.detail))&&(o.deprecated===void 0||E.boolean(o.deprecated))&&(o.children===void 0||Array.isArray(o.children))&&(o.tags===void 0||Array.isArray(o.tags))}e.is=n})(f_||(f_={}));(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorMove="refactor.move",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll",e.Notebook="notebook"})(m_||(m_={}));(function(e){e.Invoked=1,e.Automatic=2})(Ic||(Ic={}));(function(e){function t(r,o,s){let a={diagnostics:r};return o!=null&&(a.only=o),s!=null&&(a.triggerKind=s),a}e.create=t;function n(r){let o=r;return E.defined(o)&&E.typedArray(o.diagnostics,Ec.is)&&(o.only===void 0||E.typedArray(o.only,E.string))&&(o.triggerKind===void 0||o.triggerKind===Ic.Invoked||o.triggerKind===Ic.Automatic)}e.is=n})(p_||(p_={}));(function(e){e.LLMGenerated=1;function t(n){return E.defined(n)&&n===e.LLMGenerated}e.is=t})(cd||(cd={}));(function(e){function t(r,o,s){let a={title:r},c=!0;return typeof o=="string"?(c=!1,a.kind=o):Do.is(o)?a.command=o:a.edit=o,c&&s!==void 0&&(a.kind=s),a}e.create=t;function n(r){let o=r;return o&&E.string(o.title)&&(o.diagnostics===void 0||E.typedArray(o.diagnostics,Ec.is))&&(o.kind===void 0||E.string(o.kind))&&(o.edit!==void 0||o.command!==void 0)&&(o.command===void 0||Do.is(o.command))&&(o.isPreferred===void 0||E.boolean(o.isPreferred))&&(o.edit===void 0||od.is(o.edit))&&(o.tags===void 0||E.typedArray(o.tags,cd.is))}e.is=n})(h_||(h_={}));(function(e){function t(r,o){let s={range:r};return E.defined(o)&&(s.data=o),s}e.create=t;function n(r){let o=r;return E.defined(o)&&ft.is(o.range)&&(E.undefined(o.command)||Do.is(o.command))}e.is=n})(g_||(g_={}));(function(e){function t(r,o){return{tabSize:r,insertSpaces:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&E.uinteger(o.tabSize)&&E.boolean(o.insertSpaces)}e.is=n})(__||(__={}));(function(e){function t(r,o,s){return{range:r,target:o,data:s}}e.create=t;function n(r){let o=r;return E.defined(o)&&ft.is(o.range)&&(E.undefined(o.target)||E.string(o.target))}e.is=n})(y_||(y_={}));(function(e){function t(r,o){return{range:r,parent:o}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&ft.is(o.range)&&(o.parent===void 0||e.is(o.parent))}e.is=n})(b_||(b_={}));(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator",e.label="label"})(S_||(S_={}));(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(w_||(w_={}));(function(e){function t(n){let r=n;return E.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}e.is=t})(x_||(x_={}));(function(e){function t(r,o){return{range:r,text:o}}e.create=t;function n(r){let o=r;return o!=null&&ft.is(o.range)&&E.string(o.text)}e.is=n})(v_||(v_={}));(function(e){function t(r,o,s){return{range:r,variableName:o,caseSensitiveLookup:s}}e.create=t;function n(r){let o=r;return o!=null&&ft.is(o.range)&&E.boolean(o.caseSensitiveLookup)&&(E.string(o.variableName)||o.variableName===void 0)}e.is=n})(C_||(C_={}));(function(e){function t(r,o){return{range:r,expression:o}}e.create=t;function n(r){let o=r;return o!=null&&ft.is(o.range)&&(E.string(o.expression)||o.expression===void 0)}e.is=n})(P_||(P_={}));(function(e){function t(r,o){return{frameId:r,stoppedLocation:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&ft.is(r.stoppedLocation)}e.is=n})(N_||(N_={}));(function(e){e.Type=1,e.Parameter=2;function t(n){return n===1||n===2}e.is=t})(ld||(ld={}));(function(e){function t(r){return{value:r}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&(o.tooltip===void 0||E.string(o.tooltip)||Ii.is(o.tooltip))&&(o.location===void 0||Nc.is(o.location))&&(o.command===void 0||Do.is(o.command))}e.is=n})(ud||(ud={}));(function(e){function t(r,o,s){let a={position:r,label:o};return s!==void 0&&(a.kind=s),a}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&er.is(o.position)&&(E.string(o.label)||E.typedArray(o.label,ud.is))&&(o.kind===void 0||ld.is(o.kind))&&o.textEdits===void 0||E.typedArray(o.textEdits,kr.is)&&(o.tooltip===void 0||E.string(o.tooltip)||Ii.is(o.tooltip))&&(o.paddingLeft===void 0||E.boolean(o.paddingLeft))&&(o.paddingRight===void 0||E.boolean(o.paddingRight))}e.is=n})(E_||(E_={}));(function(e){function t(r){return{kind:"snippet",value:r}}e.createSnippet=t;function n(r){let o=r;return E.objectLiteral(o)&&o.kind==="snippet"&&E.string(o.value)}e.isSnippet=n})(dd||(dd={}));(function(e){function t(n,r,o,s){return{insertText:n,filterText:r,range:o,command:s}}e.create=t})(R_||(R_={}));(function(e){function t(n){return{items:n}}e.create=t})(T_||(T_={}));(function(e){e.Invoked=1,e.Automatic=2})(A_||(A_={}));(function(e){function t(n,r){return{range:n,text:r}}e.create=t})(I_||(I_={}));(function(e){function t(n,r){return{triggerKind:n,selectedCompletionInfo:r}}e.create=t})(D_||(D_={}));(function(e){function t(n){let r=n;return E.objectLiteral(r)&&nd.is(r.uri)&&E.string(r.name)}e.is=t})(k_||(k_={}));lV=[`
3
+ "use strict";var aH=Object.create;var qu=Object.defineProperty;var cH=Object.getOwnPropertyDescriptor;var lH=Object.getOwnPropertyNames;var uH=Object.getPrototypeOf,dH=Object.prototype.hasOwnProperty;var fH=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var C=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},mH=(e,t)=>{for(var n in t)qu(e,n,{get:t[n],enumerable:!0})},LP=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of lH(t))!dH.call(e,o)&&o!==n&&qu(e,o,{get:()=>t[o],enumerable:!(r=cH(t,o))||r.enumerable});return e};var B=(e,t,n)=>(n=e!=null?aH(uH(e)):{},LP(t||!e||!e.__esModule?qu(n,"default",{value:e,enumerable:!0}):n,e)),Nh=e=>LP(qu({},"__esModule",{value:!0}),e);var Wu=C(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.boolean=hH;pr.string=qP;pr.number=gH;pr.error=_H;pr.func=BP;pr.array=jP;pr.stringArray=yH;pr.typedArray=bH;pr.thenable=SH;function hH(e){return e===!0||e===!1}function qP(e){return typeof e=="string"||e instanceof String}function gH(e){return typeof e=="number"||e instanceof Number}function _H(e){return e instanceof Error}function BP(e){return typeof e=="function"}function jP(e){return Array.isArray(e)}function yH(e){return jP(e)&&e.every(t=>qP(t))}function bH(e,t){return Array.isArray(e)&&e.every(t)}function SH(e){return e&&BP(e.then)}});var Ns=C(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.boolean=wH;ni.string=WP;ni.number=xH;ni.error=vH;ni.func=CH;ni.array=UP;ni.stringArray=PH;function wH(e){return e===!0||e===!1}function WP(e){return typeof e=="string"||e instanceof String}function xH(e){return typeof e=="number"||e instanceof Number}function vH(e){return e instanceof Error}function CH(e){return typeof e=="function"}function UP(e){return Array.isArray(e)}function PH(e){return UP(e)&&e.every(t=>WP(t))}});var Qh=C(Z=>{"use strict";var NH=Z&&Z.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),EH=Z&&Z.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),RH=Z&&Z.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&NH(n,t,r[o]);return EH(n,t),n}})();Object.defineProperty(Z,"__esModule",{value:!0});Z.Message=Z.NotificationType9=Z.NotificationType8=Z.NotificationType7=Z.NotificationType6=Z.NotificationType5=Z.NotificationType4=Z.NotificationType3=Z.NotificationType2=Z.NotificationType1=Z.NotificationType0=Z.NotificationType=Z.RequestType9=Z.RequestType8=Z.RequestType7=Z.RequestType6=Z.RequestType5=Z.RequestType4=Z.RequestType3=Z.RequestType2=Z.RequestType1=Z.RequestType=Z.RequestType0=Z.AbstractMessageSignature=Z.ParameterStructures=Z.ResponseError=Z.ErrorCodes=void 0;var Io=RH(Ns()),Rh;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(Rh||(Z.ErrorCodes=Rh={}));var Th=class e extends Error{code;data;constructor(t,n,r){super(n),this.code=Io.number(t)?t:Rh.UnknownErrorCode,this.data=r,Object.setPrototypeOf(this,e.prototype)}toJson(){let t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),t}};Z.ResponseError=Th;var Ni=class e{kind;static auto=new e("auto");static byPosition=new e("byPosition");static byName=new e("byName");constructor(t){this.kind=t}static is(t){return t===e.auto||t===e.byName||t===e.byPosition}toString(){return this.kind}};Z.ParameterStructures=Ni;var Qe=class{method;numberOfParams;constructor(t,n){this.method=t,this.numberOfParams=n}get parameterStructures(){return Ni.auto}};Z.AbstractMessageSignature=Qe;var Ah=class extends Qe{_;constructor(t){super(t,0)}};Z.RequestType0=Ah;var Ih=class extends Qe{_parameterStructures;_;constructor(t,n=Ni.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Z.RequestType=Ih;var Dh=class extends Qe{_parameterStructures;_;constructor(t,n=Ni.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Z.RequestType1=Dh;var kh=class extends Qe{_;constructor(t){super(t,2)}};Z.RequestType2=kh;var Fh=class extends Qe{_;constructor(t){super(t,3)}};Z.RequestType3=Fh;var Lh=class extends Qe{_;constructor(t){super(t,4)}};Z.RequestType4=Lh;var Oh=class extends Qe{_;constructor(t){super(t,5)}};Z.RequestType5=Oh;var Mh=class extends Qe{_;constructor(t){super(t,6)}};Z.RequestType6=Mh;var $h=class extends Qe{_;constructor(t){super(t,7)}};Z.RequestType7=$h;var qh=class extends Qe{_;constructor(t){super(t,8)}};Z.RequestType8=qh;var Bh=class extends Qe{_;constructor(t){super(t,9)}};Z.RequestType9=Bh;var jh=class extends Qe{_parameterStructures;_;constructor(t,n=Ni.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Z.NotificationType=jh;var Wh=class extends Qe{_;constructor(t){super(t,0)}};Z.NotificationType0=Wh;var Uh=class extends Qe{_parameterStructures;_;constructor(t,n=Ni.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};Z.NotificationType1=Uh;var Hh=class extends Qe{_;constructor(t){super(t,2)}};Z.NotificationType2=Hh;var Vh=class extends Qe{_;constructor(t){super(t,3)}};Z.NotificationType3=Vh;var Gh=class extends Qe{_;constructor(t){super(t,4)}};Z.NotificationType4=Gh;var zh=class extends Qe{_;constructor(t){super(t,5)}};Z.NotificationType5=zh;var Kh=class extends Qe{_;constructor(t){super(t,6)}};Z.NotificationType6=Kh;var Yh=class extends Qe{_;constructor(t){super(t,7)}};Z.NotificationType7=Yh;var Xh=class extends Qe{_;constructor(t){super(t,8)}};Z.NotificationType8=Xh;var Jh=class extends Qe{_;constructor(t){super(t,9)}};Z.NotificationType9=Jh;var HP;(function(e){function t(o){let s=o;return s&&Io.string(s.method)&&(Io.string(s.id)||Io.number(s.id))}e.isRequest=t;function n(o){let s=o;return s&&Io.string(s.method)&&o.id===void 0}e.isNotification=n;function r(o){let s=o;return s&&(s.result!==void 0||!!s.error)&&(Io.string(s.id)||Io.number(s.id)||s.id===null)}e.isResponse=r})(HP||(Z.Message=HP={}))});var eg=C(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.LRUCache=Ei.LinkedMap=Ei.Touch=void 0;var rn;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(rn||(Ei.Touch=rn={}));var Uu=class{[Symbol.toStringTag]="LinkedMap";_map;_head;_tail;_size;_state;constructor(){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}before(t){let n=this._map.get(t);return n?n.previous?.value:void 0}after(t){let n=this._map.get(t);return n?n.next?.value:void 0}has(t){return this._map.has(t)}get(t,n=rn.None){let r=this._map.get(t);if(r)return n!==rn.None&&this.touch(r,n),r.value}set(t,n,r=rn.None){let o=this._map.get(t);if(o)o.value=n,r!==rn.None&&this.touch(o,r);else{switch(o={key:t,value:n,next:void 0,previous:void 0},r){case rn.None:this.addItemLast(o);break;case rn.First:this.addItemFirst(o);break;case rn.Last:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(t,o),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){let n=this._map.get(t);if(n)return this._map.delete(t),this.removeItem(n),this._size--,n.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,n){let r=this._state,o=this._head;for(;o;){if(n?t.bind(n)(o.value,o.key,this):t(o.value,o.key,this),this._state!==r)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let t=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:n.key,done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return r}values(){let t=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:n.value,done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return r}entries(){let t=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:[n.key,n.value],done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return r}[Symbol.iterator](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let n=this._head,r=this.size;for(;n&&r>t;)this._map.delete(n.key),n=n.next,r--;this._head=n,this._size=r,n&&(n.previous=void 0),this._state++}addItemFirst(t){if(!this._head&&!this._tail)this._tail=t;else if(this._head)t.next=this._head,this._head.previous=t;else throw new Error("Invalid list");this._head=t,this._state++}addItemLast(t){if(!this._head&&!this._tail)this._head=t;else if(this._tail)t.previous=this._tail,this._tail.next=t;else throw new Error("Invalid list");this._tail=t,this._state++}removeItem(t){if(t===this._head&&t===this._tail)this._head=void 0,this._tail=void 0;else if(t===this._head){if(!t.next)throw new Error("Invalid list");t.next.previous=void 0,this._head=t.next}else if(t===this._tail){if(!t.previous)throw new Error("Invalid list");t.previous.next=void 0,this._tail=t.previous}else{let n=t.next,r=t.previous;if(!n||!r)throw new Error("Invalid list");n.previous=r,r.next=n}t.next=void 0,t.previous=void 0,this._state++}touch(t,n){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(n!==rn.First&&n!==rn.Last)){if(n===rn.First){if(t===this._head)return;let r=t.next,o=t.previous;t===this._tail?(o.next=void 0,this._tail=o):(r.previous=o,o.next=r),t.previous=void 0,t.next=this._head,this._head.previous=t,this._head=t,this._state++}else if(n===rn.Last){if(t===this._tail)return;let r=t.next,o=t.previous;t===this._head?(r.previous=void 0,this._head=r):(r.previous=o,o.next=r),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){let t=[];return this.forEach((n,r)=>{t.push([r,n])}),t}fromJSON(t){this.clear();for(let[n,r]of t)this.set(n,r)}};Ei.LinkedMap=Uu;var Zh=class extends Uu{_limit;_ratio;constructor(t,n=1){super(),this._limit=t,this._ratio=Math.min(Math.max(0,n),1)}get limit(){return this._limit}set limit(t){this._limit=t,this.checkTrim()}get ratio(){return this._ratio}set ratio(t){this._ratio=Math.min(Math.max(0,t),1),this.checkTrim()}get(t,n=rn.AsNew){return super.get(t,n)}peek(t){return super.get(t,rn.None)}set(t,n){return super.set(t,n,rn.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Ei.LRUCache=Zh});var GP=C(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.Disposable=void 0;var VP;(function(e){function t(n){return{dispose:n}}e.create=t})(VP||(Hu.Disposable=VP={}))});var Ri=C(rg=>{"use strict";Object.defineProperty(rg,"__esModule",{value:!0});var tg;function ng(){if(tg===void 0)throw new Error("No runtime abstraction layer installed");return tg}(function(e){function t(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");tg=n}e.install=t})(ng||(ng={}));rg.default=ng});var Es=C(Ti=>{"use strict";var TH=Ti&&Ti.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.Emitter=Ti.Event=void 0;var AH=TH(Ri()),zP;(function(e){let t={dispose(){}};e.None=function(){return t}})(zP||(Ti.Event=zP={}));var ig=class{_callbacks;_contexts;add(t,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(t),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(t,n)})}remove(t,n=null){if(!this._callbacks)return;let r=!1;for(let o=0,s=this._callbacks.length;o<s;o++)if(this._callbacks[o]===t)if(this._contexts[o]===n){this._callbacks.splice(o,1),this._contexts.splice(o,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...t){if(!this._callbacks)return[];let n=[],r=this._callbacks.slice(0),o=this._contexts.slice(0);for(let s=0,a=r.length;s<a;s++)try{n.push(r[s].apply(o[s],t))}catch(c){(0,AH.default)().console.error(c)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},og=class e{_options;static _noop=function(){};_event;_callbacks;constructor(t){this._options=t}get event(){return this._event||(this._event=(t,n,r)=>{this._callbacks||(this._callbacks=new ig),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,n);let o={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,n),o.dispose=e._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(o),o}),this._event}fire(t){this._callbacks&&this._callbacks.invoke.call(this._callbacks,t)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};Ti.Emitter=og});var zu=C(Pn=>{"use strict";var IH=Pn&&Pn.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),DH=Pn&&Pn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),kH=Pn&&Pn.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&IH(n,t,r[o]);return DH(n,t),n}})(),FH=Pn&&Pn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Pn,"__esModule",{value:!0});Pn.CancellationTokenSource=Pn.CancellationToken=void 0;var LH=FH(Ri()),OH=kH(Ns()),sg=Es(),Vu;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:sg.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:sg.Event.None});function t(n){let r=n;return r&&(r===e.None||r===e.Cancelled||OH.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}e.is=t})(Vu||(Pn.CancellationToken=Vu={}));var MH=Object.freeze(function(e,t){let n=(0,LH.default)().timer.setTimeout(e.bind(t),0);return{dispose(){n.dispose()}}}),Gu=class{_isCancelled=!1;_emitter;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?MH:(this._emitter||(this._emitter=new sg.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},ag=class{_token;get token(){return this._token||(this._token=new Gu),this._token}cancel(){this._token?this._token.cancel():this._token=Vu.Cancelled}dispose(){this._token?this._token instanceof Gu&&this._token.dispose():this._token=Vu.None}};Pn.CancellationTokenSource=ag});var KP=C(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.SharedArrayReceiverStrategy=Rs.SharedArraySenderStrategy=void 0;var $H=zu(),Sc;(function(e){e.Continue=0,e.Cancelled=1})(Sc||(Sc={}));var cg=class{buffers;constructor(){this.buffers=new Map}enableCancellation(t){if(t.id===null)return;let n=new SharedArrayBuffer(4),r=new Int32Array(n,0,1);r[0]=Sc.Continue,this.buffers.set(t.id,n),t.$cancellationData=n}async sendCancellation(t,n){let r=this.buffers.get(n);if(r===void 0)return;let o=new Int32Array(r,0,1);Atomics.store(o,0,Sc.Cancelled)}cleanup(t){this.buffers.delete(t)}dispose(){this.buffers.clear()}};Rs.SharedArraySenderStrategy=cg;var lg=class{data;constructor(t){this.data=new Int32Array(t,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Sc.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},ug=class{token;constructor(t){this.token=new lg(t)}cancel(){}dispose(){}},dg=class{kind="request";createCancellationTokenSource(t){let n=t.$cancellationData;return n===void 0?new $H.CancellationTokenSource:new ug(n)}};Rs.SharedArrayReceiverStrategy=dg});var mg=C(Ts=>{"use strict";var qH=Ts&&Ts.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ts,"__esModule",{value:!0});Ts.Semaphore=void 0;var BH=qH(Ri()),fg=class{_capacity;_active;_waiting;constructor(t=1){if(t<=0)throw new Error("Capacity must be greater than 0");this._capacity=t,this._active=0,this._waiting=[]}lock(t){return new Promise((n,r)=>{this._waiting.push({thunk:t,resolve:n,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,BH.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let t=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("Too many thunks active");try{let n=t.thunk();n instanceof Promise?n.then(r=>{this._active--,t.resolve(r),this.runNext()},r=>{this._active--,t.reject(r),this.runNext()}):(this._active--,t.resolve(n),this.runNext())}catch(n){this._active--,t.reject(n),this.runNext()}}};Ts.Semaphore=fg});var XP=C(on=>{"use strict";var jH=on&&on.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),WH=on&&on.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),UH=on&&on.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&jH(n,t,r[o]);return WH(n,t),n}})(),HH=on&&on.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(on,"__esModule",{value:!0});on.ReadableStreamMessageReader=on.AbstractMessageReader=on.MessageReader=void 0;var hg=HH(Ri()),As=UH(Ns()),pg=Es(),VH=mg(),YP;(function(e){function t(n){let r=n;return r&&As.func(r.listen)&&As.func(r.dispose)&&As.func(r.onError)&&As.func(r.onClose)&&As.func(r.onPartialMessage)}e.is=t})(YP||(on.MessageReader=YP={}));var Ku=class{errorEmitter;closeEmitter;partialMessageEmitter;constructor(){this.errorEmitter=new pg.Emitter,this.closeEmitter=new pg.Emitter,this.partialMessageEmitter=new pg.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose(),this.partialMessageEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t){this.errorEmitter.fire(this.asError(t))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(t){this.partialMessageEmitter.fire(t)}asError(t){return t instanceof Error?t:new Error(`Reader received error. Reason: ${As.string(t.message)?t.message:"unknown"}`)}};on.AbstractMessageReader=Ku;var gg;(function(e){function t(n){let r,o,s,a=new Map,c,l=new Map;if(n===void 0||typeof n=="string")r=n??"utf-8";else{if(r=n.charset??"utf-8",n.contentDecoder!==void 0&&(s=n.contentDecoder,a.set(s.name,s)),n.contentDecoders!==void 0)for(let u of n.contentDecoders)a.set(u.name,u);if(n.contentTypeDecoder!==void 0&&(c=n.contentTypeDecoder,l.set(c.name,c)),n.contentTypeDecoders!==void 0)for(let u of n.contentTypeDecoders)l.set(u.name,u)}return c===void 0&&(c=(0,hg.default)().applicationJson.decoder,l.set(c.name,c)),{charset:r,contentDecoder:s,contentDecoders:a,contentTypeDecoder:c,contentTypeDecoders:l}}e.fromOptions=t})(gg||(gg={}));var _g=class extends Ku{readable;options;callback;nextMessageLength;messageToken;buffer;partialMessageTimer;_partialMessageTimeout;readSemaphore;constructor(t,n){super(),this.readable=t,this.options=gg.fromOptions(n),this.buffer=(0,hg.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new VH.Semaphore(1)}set partialMessageTimeout(t){this._partialMessageTimeout=t}get partialMessageTimeout(){return this._partialMessageTimeout}listen(t){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=t;let n=this.readable.onData(r=>{this.onData(r)});return this.readable.onError(r=>this.fireError(r)),this.readable.onClose(()=>this.fireClose()),n}onData(t){try{for(this.buffer.append(t);;){if(this.nextMessageLength===-1){let r=this.buffer.tryReadHeaders(!0);if(!r)return;let o=r.get("content-length");if(!o){this.fireError(new Error(`Header must provide a Content-Length property.
4
+ ${JSON.stringify(Object.fromEntries(r))}`));return}let s=parseInt(o);if(isNaN(s)){this.fireError(new Error(`Content-Length value must be a number. Got ${o}`));return}this.nextMessageLength=s}let n=this.buffer.tryReadBody(this.nextMessageLength);if(n===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let r=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(n):n,o=await this.options.contentTypeDecoder.decode(r,this.options);this.callback(o)}).catch(r=>{this.fireError(r)})}}catch(n){this.fireError(n)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,hg.default)().timer.setTimeout((t,n)=>{this.partialMessageTimer=void 0,t===this.messageToken&&(this.firePartialMessage({messageToken:t,waitingTime:n}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};on.ReadableStreamMessageReader=_g});var tN=C(sn=>{"use strict";var GH=sn&&sn.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),zH=sn&&sn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),KH=sn&&sn.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&GH(n,t,r[o]);return zH(n,t),n}})(),YH=sn&&sn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sn,"__esModule",{value:!0});sn.WriteableStreamMessageWriter=sn.AbstractMessageWriter=sn.MessageWriter=void 0;var JP=YH(Ri()),wc=KH(Ns()),XH=mg(),QP=Es(),JH="Content-Length: ",ZP=`\r
5
+ `,eN;(function(e){function t(n){let r=n;return r&&wc.func(r.dispose)&&wc.func(r.onClose)&&wc.func(r.onError)&&wc.func(r.write)}e.is=t})(eN||(sn.MessageWriter=eN={}));var Yu=class{errorEmitter;closeEmitter;constructor(){this.errorEmitter=new QP.Emitter,this.closeEmitter=new QP.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t,n,r){this.errorEmitter.fire([this.asError(t),n,r])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(t){return t instanceof Error?t:new Error(`Writer received error. Reason: ${wc.string(t.message)?t.message:"unknown"}`)}};sn.AbstractMessageWriter=Yu;var yg;(function(e){function t(n){return n===void 0||typeof n=="string"?{charset:n??"utf-8",contentTypeEncoder:(0,JP.default)().applicationJson.encoder}:{charset:n.charset??"utf-8",contentEncoder:n.contentEncoder,contentTypeEncoder:n.contentTypeEncoder??(0,JP.default)().applicationJson.encoder}}e.fromOptions=t})(yg||(yg={}));var bg=class extends Yu{writable;options;errorCount;writeSemaphore;constructor(t,n){super(),this.writable=t,this.options=yg.fromOptions(n),this.errorCount=0,this.writeSemaphore=new XH.Semaphore(1),this.writable.onError(r=>this.fireError(r)),this.writable.onClose(()=>this.fireClose())}async write(t){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(t,this.options).then(r=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(r):r).then(r=>{let o=[];return o.push(JH,r.byteLength.toString(),ZP),o.push(ZP),this.doWrite(t,o,r)},r=>{throw this.fireError(r),r}))}async doWrite(t,n,r){try{return await this.writable.write(n.join(""),"ascii"),this.writable.write(r)}catch(o){return this.handleError(o,t),Promise.reject(o)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){this.writable.end()}};sn.WriteableStreamMessageWriter=bg});var nN=C(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.AbstractMessageBuffer=void 0;var QH=13,ZH=10,eV=`\r
6
+ `,Sg=class{_encoding;_chunks;_totalLength;constructor(t="utf-8"){this._encoding=t,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(t){let n=typeof t=="string"?this.fromString(t,this._encoding):t;this._chunks.push(n),this._totalLength+=n.byteLength}tryReadHeaders(t=!1){if(this._chunks.length===0)return;let n=0,r=0,o=0,s=0;e:for(;r<this._chunks.length;){let u=this._chunks[r];for(o=0;o<u.length;){switch(u[o]){case QH:switch(n){case 0:n=1;break;case 2:n=3;break;default:n=0}break;case ZH:switch(n){case 1:n=2;break;case 3:n=4,o++;break e;default:n=0}break;default:n=0}o++}s+=u.byteLength,r++}if(n!==4)return;let a=this._read(s+o),c=new Map,l=this.toString(a,"ascii").split(eV);if(l.length<2)return c;for(let u=0;u<l.length-2;u++){let d=l[u],f=d.indexOf(":");if(f===-1)throw new Error(`Message header must separate key and value using ':'
7
+ ${d}`);let m=d.substr(0,f),p=d.substr(f+1).trim();c.set(t?m.toLowerCase():m,p)}return c}tryReadBody(t){if(!(this._totalLength<t))return this._read(t)}get numberOfBytes(){return this._totalLength}_read(t){if(t===0)return this.emptyBuffer();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let s=this._chunks[0];return this._chunks.shift(),this._totalLength-=t,this.asNative(s)}if(this._chunks[0].byteLength>t){let s=this._chunks[0],a=this.asNative(s,t);return this._chunks[0]=s.slice(t),this._totalLength-=t,a}let n=this.allocNative(t),r=0,o=0;for(;t>0;){let s=this._chunks[o];if(s.byteLength>t){let a=s.slice(0,t);n.set(a,r),r+=t,this._chunks[o]=s.slice(t),this._totalLength-=t,t-=t}else n.set(s,r),r+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,t-=s.byteLength}return n}};Xu.AbstractMessageBuffer=Sg});var sN=C(oe=>{"use strict";var tV=oe&&oe.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),nV=oe&&oe.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),rV=oe&&oe.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&tV(n,t,r[o]);return nV(n,t),n}})(),iV=oe&&oe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(oe,"__esModule",{value:!0});oe.ConnectionOptions=oe.MessageStrategy=oe.CancellationStrategy=oe.CancellationSenderStrategy=oe.CancellationReceiverStrategy=oe.RequestCancellationReceiverStrategy=oe.IdCancellationReceiverStrategy=oe.ConnectionStrategy=oe.ConnectionError=oe.ConnectionErrors=oe.LogTraceNotification=oe.SetTraceNotification=oe.TraceFormat=oe.TraceValues=oe.TraceValue=oe.Trace=oe.NullLogger=oe.ProgressType=oe.ProgressToken=void 0;oe.createMessageConnection=oV;var rN=iV(Ri()),dt=rV(Ns()),fe=Qh(),iN=eg(),xc=Es(),wg=zu(),Pc;(function(e){e.type=new fe.NotificationType("$/cancelRequest")})(Pc||(Pc={}));var xg;(function(e){function t(n){return typeof n=="string"||typeof n=="number"}e.is=t})(xg||(oe.ProgressToken=xg={}));var vc;(function(e){e.type=new fe.NotificationType("$/progress")})(vc||(vc={}));var vg=class{__;_pr;constructor(){}};oe.ProgressType=vg;var Cg;(function(e){function t(n){return dt.func(n)}e.is=t})(Cg||(Cg={}));oe.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Oe;(function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Compact=2]="Compact",e[e.Verbose=3]="Verbose"})(Oe||(oe.Trace=Oe={}));var Pg;(function(e){e.Off="off",e.Messages="messages",e.Compact="compact",e.Verbose="verbose"})(Pg||(oe.TraceValue=Pg={}));oe.TraceValues=Pg;(function(e){function t(r){if(!dt.string(r))return e.Off;switch(r=r.toLowerCase(),r){case"off":return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose;default:return e.Off}}e.fromString=t;function n(r){switch(r){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}e.toString=n})(Oe||(oe.Trace=Oe={}));var Hn;(function(e){e.Text="text",e.JSON="json"})(Hn||(oe.TraceFormat=Hn={}));(function(e){function t(n){return dt.string(n)?(n=n.toLowerCase(),n==="json"?e.JSON:e.Text):e.Text}e.fromString=t})(Hn||(oe.TraceFormat=Hn={}));var Ng;(function(e){e.type=new fe.NotificationType("$/setTrace")})(Ng||(oe.SetTraceNotification=Ng={}));var Ju;(function(e){e.type=new fe.NotificationType("$/logTrace")})(Ju||(oe.LogTraceNotification=Ju={}));var Cc;(function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"})(Cc||(oe.ConnectionErrors=Cc={}));var Is=class e extends Error{code;constructor(t,n){super(n),this.code=t,Object.setPrototypeOf(this,e.prototype)}};oe.ConnectionError=Is;var Eg;(function(e){function t(n){let r=n;return r&&dt.func(r.cancelUndispatched)}e.is=t})(Eg||(oe.ConnectionStrategy=Eg={}));var Qu;(function(e){function t(n){let r=n;return r&&(r.kind===void 0||r.kind==="id")&&dt.func(r.createCancellationTokenSource)&&(r.dispose===void 0||dt.func(r.dispose))}e.is=t})(Qu||(oe.IdCancellationReceiverStrategy=Qu={}));var Rg;(function(e){function t(n){let r=n;return r&&r.kind==="request"&&dt.func(r.createCancellationTokenSource)&&(r.dispose===void 0||dt.func(r.dispose))}e.is=t})(Rg||(oe.RequestCancellationReceiverStrategy=Rg={}));var Zu;(function(e){e.Message=Object.freeze({createCancellationTokenSource(n){return new wg.CancellationTokenSource}});function t(n){return Qu.is(n)||Rg.is(n)}e.is=t})(Zu||(oe.CancellationReceiverStrategy=Zu={}));var ed;(function(e){e.Message=Object.freeze({sendCancellation(n,r){return n.sendNotification(Pc.type,{id:r})},cleanup(n){}});function t(n){let r=n;return r&&dt.func(r.sendCancellation)&&dt.func(r.cleanup)}e.is=t})(ed||(oe.CancellationSenderStrategy=ed={}));var td;(function(e){e.Message=Object.freeze({receiver:Zu.Message,sender:ed.Message});function t(n){let r=n;return r&&Zu.is(r.receiver)&&ed.is(r.sender)}e.is=t})(td||(oe.CancellationStrategy=td={}));var nd;(function(e){function t(n){let r=n;return r&&dt.func(r.handleMessage)}e.is=t})(nd||(oe.MessageStrategy=nd={}));var oN;(function(e){function t(n){let r=n;return r&&(td.is(r.cancellationStrategy)||Eg.is(r.connectionStrategy)||nd.is(r.messageStrategy)||dt.number(r.maxParallelism))}e.is=t})(oN||(oe.ConnectionOptions=oN={}));var hr;(function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"})(hr||(hr={}));function oV(e,t,n,r){let o=n!==void 0?n:oe.NullLogger,s=0,a=0,c=0,l="2.0",u=r?.maxParallelism??-1,d=0,f,m=new Map,p,g=new Map,h=new Map,y,w=new iN.LinkedMap,_=new Map,b=new Set,S=new Map,N=Oe.Off,R=Hn.Text,$,I=hr.New,U=new xc.Emitter,de=new xc.Emitter,F=new xc.Emitter,Q=new xc.Emitter,pe=new xc.Emitter,ot=r&&r.cancellationStrategy?r.cancellationStrategy:td.Message;function M(P){}function O(){return I===hr.Listening}function wt(){return I===hr.Closed}function D(){return I===hr.Disposed}function j(){(I===hr.New||I===hr.Listening)&&(I=hr.Closed,de.fire(void 0))}function z(P){U.fire([P,void 0,void 0])}function ie(P){U.fire(P)}e.onClose(j),e.onError(z),t.onClose(j),t.onError(ie);function se(P){if(P===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+P.toString()}function xt(P){return P===null?"res-unknown-"+(++c).toString():"res-"+P.toString()}function vt(){return"not-"+(++a).toString()}function Mt(P,q){fe.Message.isRequest(q)?P.set(se(q.id),q):fe.Message.isResponse(q)?u===-1?P.set(xt(q.id),q):Be(q):P.set(vt(),q)}function ce(){y||w.size===0||u!==-1&&d>=u||(y=(0,rN.default)().timer.setImmediate(async()=>{if(y=void 0,w.size===0||u!==-1&&d>=u)return;let P=w.shift(),q;try{d++;let H=r?.messageStrategy;nd.is(H)?q=H.handleMessage(P,vn):q=vn(P)}catch(H){o.error(`Processing message queue failed: ${H.toString()}`)}finally{q instanceof Promise?q.then(()=>{d--,ce()}).catch(H=>{o.error(`Processing message queue failed: ${H.toString()}`)}):d--,ce()}}))}async function vn(P){return fe.Message.isRequest(P)?V(P):fe.Message.isNotification(P)?W(P):fe.Message.isResponse(P)?Be(P):he(P)}let ei=P=>{try{if(fe.Message.isNotification(P)&&P.method===Pc.type.method){let q=P.params.id,H=se(q),te=w.get(H);if(fe.Message.isRequest(te)){let ut=r?.connectionStrategy,He=ut&&ut.cancelUndispatched?ut.cancelUndispatched(te,M):void 0;if(He&&(He.error!==void 0||He.result!==void 0)){w.delete(H),S.delete(q),He.id=te.id,Cn(He,P.method,Date.now()),t.write(He).catch(()=>o.error("Sending response for canceled message failed."));return}}let Le=S.get(q);if(Le!==void 0){Le.cancel(),Ch(P);return}else b.add(q)}Mt(w,P)}finally{ce()}};async function V(P){if(D())return Promise.resolve();function q(jt,nn,ht){let gt={jsonrpc:l,id:P.id};return jt instanceof fe.ResponseError?gt.error=jt.toJson():gt.result=jt===void 0?null:jt,Cn(gt,nn,ht),t.write(gt)}function H(jt,nn,ht){let gt={jsonrpc:l,id:P.id,error:jt.toJson()};return Cn(gt,nn,ht),t.write(gt)}Zn(P);let te=m.get(P.method),Le,ut;te&&(Le=te.type,ut=te.handler);let He=Date.now();if(ut||f){let jt=P.id??String(Date.now()),nn=Qu.is(ot.receiver)?ot.receiver.createCancellationTokenSource(jt):ot.receiver.createCancellationTokenSource(P);P.id!==null&&b.has(P.id)&&nn.cancel(),P.id!==null&&S.set(jt,nn);try{let ht;if(ut)if(P.params===void 0){if(Le!==void 0&&Le.numberOfParams!==0)return H(new fe.ResponseError(fe.ErrorCodes.InvalidParams,`Request ${P.method} defines ${Le.numberOfParams} params but received none.`),P.method,He);ht=ut(nn.token)}else if(Array.isArray(P.params)){if(Le!==void 0&&Le.parameterStructures===fe.ParameterStructures.byName)return H(new fe.ResponseError(fe.ErrorCodes.InvalidParams,`Request ${P.method} defines parameters by name but received parameters by position`),P.method,He);ht=ut(...P.params,nn.token)}else{if(Le!==void 0&&Le.parameterStructures===fe.ParameterStructures.byPosition)return H(new fe.ResponseError(fe.ErrorCodes.InvalidParams,`Request ${P.method} defines parameters by position but received parameters by name`),P.method,He);ht=ut(P.params,nn.token)}else f&&(ht=f(P.method,P.params,nn.token));let gt=await ht;await q(gt,P.method,He)}catch(ht){ht instanceof fe.ResponseError?await q(ht,P.method,He):ht&&dt.string(ht.message)?await H(new fe.ResponseError(fe.ErrorCodes.InternalError,`Request ${P.method} failed with message: ${ht.message}`),P.method,He):await H(new fe.ResponseError(fe.ErrorCodes.InternalError,`Request ${P.method} failed unexpectedly without providing any details.`),P.method,He)}finally{S.delete(jt)}}else await H(new fe.ResponseError(fe.ErrorCodes.MethodNotFound,`Unhandled method ${P.method}`),P.method,He)}function Be(P){if(!D())if(P.id===null)P.error?o.error(`Received response message without id: Error is:
8
+ ${JSON.stringify(P.error,void 0,4)}`):o.error("Received response message without id. No further error information provided.");else{let q=P.id,H=_.get(q);if(rH(P,H),H!==void 0){_.delete(q);try{if(P.error){let te=P.error;H.reject(new fe.ResponseError(te.code,te.message,te.data))}else if(P.result!==void 0)H.resolve(P.result);else throw new Error("Should never happen.")}catch(te){te.message?o.error(`Response handler '${H.method}' failed with message: ${te.message}`):o.error(`Response handler '${H.method}' failed unexpectedly.`)}}}}async function W(P){if(D())return;let q,H;if(P.method===Pc.type.method){let te=P.params.id;b.delete(te),Ch(P);return}else{let te=g.get(P.method);te&&(H=te.handler,q=te.type)}if(H||p)try{if(Ch(P),H)if(P.params===void 0)q!==void 0&&q.numberOfParams!==0&&q.parameterStructures!==fe.ParameterStructures.byName&&o.error(`Notification ${P.method} defines ${q.numberOfParams} params but received none.`),await H();else if(Array.isArray(P.params)){let te=P.params;P.method===vc.type.method&&te.length===2&&xg.is(te[0])?await H({token:te[0],value:te[1]}):(q!==void 0&&(q.parameterStructures===fe.ParameterStructures.byName&&o.error(`Notification ${P.method} defines parameters by name but received parameters by position`),q.numberOfParams!==P.params.length&&o.error(`Notification ${P.method} defines ${q.numberOfParams} params but received ${te.length} arguments`)),await H(...te))}else q!==void 0&&q.parameterStructures===fe.ParameterStructures.byPosition&&o.error(`Notification ${P.method} defines parameters by position but received parameters by name`),await H(P.params);else p&&await p(P.method,P.params)}catch(te){te.message?o.error(`Notification handler '${P.method}' failed with message: ${te.message}`):o.error(`Notification handler '${P.method}' failed unexpectedly.`)}else F.fire(P)}function he(P){if(!P){o.error("Received empty message.");return}o.error(`Received message which is neither a response nor a notification message:
9
+ ${JSON.stringify(P,null,4)}`);let q=P;if(dt.string(q.id)||dt.number(q.id)){let H=q.id,te=_.get(H);te&&te.reject(new Error("The received response has neither a result nor an error property."))}}function Ae(P){if(P!=null)switch(N){case Oe.Verbose:return JSON.stringify(P,null,4);case Oe.Compact:return JSON.stringify(P);default:return}}function Ct(P){if(!(N===Oe.Off||!$))if(R===Hn.Text){let q;(N===Oe.Verbose||N===Oe.Compact)&&P.params&&(q=`Params: ${Ae(P.params)}`),$.log(`Sending request '${P.method} - (${P.id})'.`,q)}else Ps("send-request",P)}function Ue(P){if(!(N===Oe.Off||!$))if(R===Hn.Text){let q;(N===Oe.Verbose||N===Oe.Compact)&&(P.params?q=`Params: ${Ae(P.params)}`:q="No parameters provided."),$.log(`Sending notification '${P.method}'.`,q)}else Ps("send-notification",P)}function Cn(P,q,H){if(!(N===Oe.Off||!$))if(R===Hn.Text){let te;(N===Oe.Verbose||N===Oe.Compact)&&(P.error&&P.error.data?te=`Error data: ${Ae(P.error.data)}`:P.result?te=`Result: ${Ae(P.result)}`:P.error===void 0&&(te="No result returned.")),$.log(`Sending response '${q} - (${P.id})'. Processing request took ${Date.now()-H}ms`,te)}else Ps("send-response",P)}function Zn(P){if(!(N===Oe.Off||!$))if(R===Hn.Text){let q;(N===Oe.Verbose||N===Oe.Compact)&&P.params&&(q=`Params: ${Ae(P.params)}`),$.log(`Received request '${P.method} - (${P.id})'.`,q)}else Ps("receive-request",P)}function Ch(P){if(!(N===Oe.Off||!$||P.method===Ju.type.method))if(R===Hn.Text){let q;(N===Oe.Verbose||N===Oe.Compact)&&(P.params?q=`Params: ${Ae(P.params)}`:q="No parameters provided."),$.log(`Received notification '${P.method}'.`,q)}else Ps("receive-notification",P)}function rH(P,q){if(!(N===Oe.Off||!$))if(R===Hn.Text){let H;if((N===Oe.Verbose||N===Oe.Compact)&&(P.error&&P.error.data?H=`Error data: ${Ae(P.error.data)}`:P.result?H=`Result: ${Ae(P.result)}`:P.error===void 0&&(H="No result returned.")),q){let te=P.error?` Request failed: ${P.error.message} (${P.error.code}).`:"";$.log(`Received response '${q.method} - (${P.id})' in ${Date.now()-q.timerStart}ms.${te}`,H)}else $.log(`Received response ${P.id} without active response promise.`,H)}else Ps("receive-response",P)}function Ps(P,q){if(!$||N===Oe.Off)return;let H={isLSPMessage:!0,type:P,message:q,timestamp:Date.now()};$.log(H)}function _c(){if(wt())throw new Is(Cc.Closed,"Connection is closed.");if(D())throw new Is(Cc.Disposed,"Connection is disposed.")}function iH(){if(O())throw new Is(Cc.AlreadyListening,"Connection is already listening")}function oH(){if(!O())throw new Error("Call listen() first.")}function yc(P){return P===void 0?null:P}function DP(P){if(P!==null)return P}function kP(P){return P!=null&&!Array.isArray(P)&&typeof P=="object"}function Ph(P,q){switch(P){case fe.ParameterStructures.auto:return kP(q)?DP(q):[yc(q)];case fe.ParameterStructures.byName:if(!kP(q))throw new Error("Received parameters by name but param is not an object literal.");return DP(q);case fe.ParameterStructures.byPosition:return[yc(q)];default:throw new Error(`Unknown parameter structure ${P.toString()}`)}}function FP(P,q){let H,te=P.numberOfParams;switch(te){case 0:H=void 0;break;case 1:H=Ph(P.parameterStructures,q[0]);break;default:H=[];for(let Le=0;Le<q.length&&Le<te;Le++)H.push(yc(q[Le]));if(q.length<te)for(let Le=q.length;Le<te;Le++)H.push(null);break}return H}let To={sendNotification:(P,...q)=>{_c();let H,te;if(dt.string(P)){H=P;let ut=q[0],He=0,jt=fe.ParameterStructures.auto;fe.ParameterStructures.is(ut)&&(He=1,jt=ut);let nn=q.length,ht=nn-He;switch(ht){case 0:te=void 0;break;case 1:te=Ph(jt,q[He]);break;default:if(jt===fe.ParameterStructures.byName)throw new Error(`Received ${ht} parameters for 'by Name' notification parameter structure.`);te=q.slice(He,nn).map(gt=>yc(gt));break}}else{let ut=q;H=P.method,te=FP(P,ut)}let Le={jsonrpc:l,method:H,params:te};return Ue(Le),t.write(Le).catch(ut=>{throw o.error("Sending notification failed."),ut})},onNotification:(P,q)=>{_c();let H;return dt.func(P)?p=P:q&&(dt.string(P)?(H=P,g.set(P,{type:void 0,handler:q})):(H=P.method,g.set(P.method,{type:P,handler:q}))),{dispose:()=>{H!==void 0?g.get(H)?.handler===q&&g.delete(H):p===P&&(p=void 0)}}},onProgress:(P,q,H)=>{if(h.has(q))throw new Error(`Progress handler for token ${q} already registered`);return h.set(q,H),{dispose:()=>{h.get(q)===H&&h.delete(q)}}},sendProgress:(P,q,H)=>To.sendNotification(vc.type,{token:q,value:H}),onUnhandledProgress:Q.event,sendRequest:(P,...q)=>{_c(),oH();function H(gt,mr){let ti=ot.sender.sendCancellation(gt,mr);ti===void 0?o.log(`Received no promise from cancellation strategy when cancelling id ${mr}`):ti.catch(()=>{o.log(`Sending cancellation messages for id ${mr} failed.`)})}let te,Le,ut;if(dt.string(P)){te=P;let gt=q[0],mr=q[q.length-1],ti=0,bc=fe.ParameterStructures.auto;fe.ParameterStructures.is(gt)&&(ti=1,bc=gt);let Ao=q.length;wg.CancellationToken.is(mr)&&(Ao=Ao-1,ut=mr);let Dr=Ao-ti;switch(Dr){case 0:Le=void 0;break;case 1:Le=Ph(bc,q[ti]);break;default:if(bc===fe.ParameterStructures.byName)throw new Error(`Received ${Dr} parameters for 'by Name' request parameter structure.`);Le=q.slice(ti,Ao).map(sH=>yc(sH));break}}else{let gt=q;te=P.method,Le=FP(P,gt);let mr=P.numberOfParams;ut=wg.CancellationToken.is(gt[mr])?gt[mr]:void 0}let He=s++,jt,nn=!1;ut!==void 0&&(ut.isCancellationRequested?nn=!0:jt=ut.onCancellationRequested(()=>{H(To,He)}));let ht={jsonrpc:l,id:He,method:te,params:Le};return Ct(ht),typeof ot.sender.enableCancellation=="function"&&ot.sender.enableCancellation(ht),new Promise(async(gt,mr)=>{let ti=Dr=>{gt(Dr),ot.sender.cleanup(He),jt?.dispose()},bc=Dr=>{mr(Dr),ot.sender.cleanup(He),jt?.dispose()},Ao={method:te,timerStart:Date.now(),resolve:ti,reject:bc};try{_.set(He,Ao),await t.write(ht),nn&&H(To,He)}catch(Dr){throw _.delete(He),Ao.reject(new fe.ResponseError(fe.ErrorCodes.MessageWriteError,Dr.message?Dr.message:"Unknown reason")),o.error("Sending request failed."),Dr}})},onRequest:(P,q)=>{_c();let H=null;return Cg.is(P)?(H=void 0,f=P):dt.string(P)?(H=null,q!==void 0&&(H=P,m.set(P,{handler:q,type:void 0}))):q!==void 0&&(H=P.method,m.set(P.method,{type:P,handler:q})),{dispose:()=>{H!==null&&(H!==void 0?m.get(H)?.handler===q&&m.delete(H):f===P&&(f=void 0))}}},hasPendingResponse:()=>_.size>0,trace:async(P,q,H)=>{let te=!1,Le=Hn.Text;H!==void 0&&(dt.boolean(H)?te=H:(te=H.sendNotification||!1,Le=H.traceFormat||Hn.Text)),N=P,R=Le,N===Oe.Off?$=void 0:$=q,te&&!wt()&&!D()&&await To.sendNotification(Ng.type,{value:Oe.toString(P)})},onError:U.event,onClose:de.event,onUnhandledNotification:F.event,onDispose:pe.event,end:()=>{t.end()},dispose:()=>{if(D())return;I=hr.Disposed,pe.fire(void 0);let P=new fe.ResponseError(fe.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let q of _.values())q.reject(P);_=new Map,S=new Map,b=new Set,w=new iN.LinkedMap,dt.func(t.dispose)&&t.dispose(),dt.func(e.dispose)&&e.dispose()},listen:()=>{_c(),iH(),I=hr.Listening,e.listen(ei)},inspect:()=>{(0,rN.default)().console.log("inspect")}};return To.onNotification(Ju.type,P=>{if(N===Oe.Off||!$)return;let q=N===Oe.Verbose||N===Oe.Compact;$.log(P.message,q?P.verbose:void 0)}),To.onNotification(vc.type,async P=>{let q=h.get(P.token);q?await q(P.value):Q.fire(P)}),To}});var ri=C(k=>{"use strict";var sV=k&&k.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(k,"__esModule",{value:!0});k.ProgressType=k.ProgressToken=k.createMessageConnection=k.NullLogger=k.ConnectionOptions=k.ConnectionStrategy=k.AbstractMessageBuffer=k.WriteableStreamMessageWriter=k.AbstractMessageWriter=k.MessageWriter=k.ReadableStreamMessageReader=k.AbstractMessageReader=k.MessageReader=k.SharedArrayReceiverStrategy=k.SharedArraySenderStrategy=k.CancellationToken=k.CancellationTokenSource=k.Emitter=k.Event=k.Disposable=k.LRUCache=k.Touch=k.LinkedMap=k.ParameterStructures=k.NotificationType9=k.NotificationType8=k.NotificationType7=k.NotificationType6=k.NotificationType5=k.NotificationType4=k.NotificationType3=k.NotificationType2=k.NotificationType1=k.NotificationType0=k.NotificationType=k.ErrorCodes=k.ResponseError=k.RequestType9=k.RequestType8=k.RequestType7=k.RequestType6=k.RequestType5=k.RequestType4=k.RequestType3=k.RequestType2=k.RequestType1=k.RequestType0=k.RequestType=k.Message=k.RAL=void 0;k.MessageStrategy=k.CancellationStrategy=k.CancellationSenderStrategy=k.RequestCancellationReceiverStrategy=k.IdCancellationReceiverStrategy=k.CancellationReceiverStrategy=k.ConnectionError=k.ConnectionErrors=k.LogTraceNotification=k.SetTraceNotification=k.TraceFormat=k.TraceValues=k.TraceValue=k.Trace=void 0;var Xe=Qh();Object.defineProperty(k,"Message",{enumerable:!0,get:function(){return Xe.Message}});Object.defineProperty(k,"RequestType",{enumerable:!0,get:function(){return Xe.RequestType}});Object.defineProperty(k,"RequestType0",{enumerable:!0,get:function(){return Xe.RequestType0}});Object.defineProperty(k,"RequestType1",{enumerable:!0,get:function(){return Xe.RequestType1}});Object.defineProperty(k,"RequestType2",{enumerable:!0,get:function(){return Xe.RequestType2}});Object.defineProperty(k,"RequestType3",{enumerable:!0,get:function(){return Xe.RequestType3}});Object.defineProperty(k,"RequestType4",{enumerable:!0,get:function(){return Xe.RequestType4}});Object.defineProperty(k,"RequestType5",{enumerable:!0,get:function(){return Xe.RequestType5}});Object.defineProperty(k,"RequestType6",{enumerable:!0,get:function(){return Xe.RequestType6}});Object.defineProperty(k,"RequestType7",{enumerable:!0,get:function(){return Xe.RequestType7}});Object.defineProperty(k,"RequestType8",{enumerable:!0,get:function(){return Xe.RequestType8}});Object.defineProperty(k,"RequestType9",{enumerable:!0,get:function(){return Xe.RequestType9}});Object.defineProperty(k,"ResponseError",{enumerable:!0,get:function(){return Xe.ResponseError}});Object.defineProperty(k,"ErrorCodes",{enumerable:!0,get:function(){return Xe.ErrorCodes}});Object.defineProperty(k,"NotificationType",{enumerable:!0,get:function(){return Xe.NotificationType}});Object.defineProperty(k,"NotificationType0",{enumerable:!0,get:function(){return Xe.NotificationType0}});Object.defineProperty(k,"NotificationType1",{enumerable:!0,get:function(){return Xe.NotificationType1}});Object.defineProperty(k,"NotificationType2",{enumerable:!0,get:function(){return Xe.NotificationType2}});Object.defineProperty(k,"NotificationType3",{enumerable:!0,get:function(){return Xe.NotificationType3}});Object.defineProperty(k,"NotificationType4",{enumerable:!0,get:function(){return Xe.NotificationType4}});Object.defineProperty(k,"NotificationType5",{enumerable:!0,get:function(){return Xe.NotificationType5}});Object.defineProperty(k,"NotificationType6",{enumerable:!0,get:function(){return Xe.NotificationType6}});Object.defineProperty(k,"NotificationType7",{enumerable:!0,get:function(){return Xe.NotificationType7}});Object.defineProperty(k,"NotificationType8",{enumerable:!0,get:function(){return Xe.NotificationType8}});Object.defineProperty(k,"NotificationType9",{enumerable:!0,get:function(){return Xe.NotificationType9}});Object.defineProperty(k,"ParameterStructures",{enumerable:!0,get:function(){return Xe.ParameterStructures}});var Tg=eg();Object.defineProperty(k,"LinkedMap",{enumerable:!0,get:function(){return Tg.LinkedMap}});Object.defineProperty(k,"LRUCache",{enumerable:!0,get:function(){return Tg.LRUCache}});Object.defineProperty(k,"Touch",{enumerable:!0,get:function(){return Tg.Touch}});var aV=GP();Object.defineProperty(k,"Disposable",{enumerable:!0,get:function(){return aV.Disposable}});var aN=Es();Object.defineProperty(k,"Event",{enumerable:!0,get:function(){return aN.Event}});Object.defineProperty(k,"Emitter",{enumerable:!0,get:function(){return aN.Emitter}});var cN=zu();Object.defineProperty(k,"CancellationTokenSource",{enumerable:!0,get:function(){return cN.CancellationTokenSource}});Object.defineProperty(k,"CancellationToken",{enumerable:!0,get:function(){return cN.CancellationToken}});var lN=KP();Object.defineProperty(k,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return lN.SharedArraySenderStrategy}});Object.defineProperty(k,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return lN.SharedArrayReceiverStrategy}});var Ag=XP();Object.defineProperty(k,"MessageReader",{enumerable:!0,get:function(){return Ag.MessageReader}});Object.defineProperty(k,"AbstractMessageReader",{enumerable:!0,get:function(){return Ag.AbstractMessageReader}});Object.defineProperty(k,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Ag.ReadableStreamMessageReader}});var Ig=tN();Object.defineProperty(k,"MessageWriter",{enumerable:!0,get:function(){return Ig.MessageWriter}});Object.defineProperty(k,"AbstractMessageWriter",{enumerable:!0,get:function(){return Ig.AbstractMessageWriter}});Object.defineProperty(k,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Ig.WriteableStreamMessageWriter}});var cV=nN();Object.defineProperty(k,"AbstractMessageBuffer",{enumerable:!0,get:function(){return cV.AbstractMessageBuffer}});var Rt=sN();Object.defineProperty(k,"ConnectionStrategy",{enumerable:!0,get:function(){return Rt.ConnectionStrategy}});Object.defineProperty(k,"ConnectionOptions",{enumerable:!0,get:function(){return Rt.ConnectionOptions}});Object.defineProperty(k,"NullLogger",{enumerable:!0,get:function(){return Rt.NullLogger}});Object.defineProperty(k,"createMessageConnection",{enumerable:!0,get:function(){return Rt.createMessageConnection}});Object.defineProperty(k,"ProgressToken",{enumerable:!0,get:function(){return Rt.ProgressToken}});Object.defineProperty(k,"ProgressType",{enumerable:!0,get:function(){return Rt.ProgressType}});Object.defineProperty(k,"Trace",{enumerable:!0,get:function(){return Rt.Trace}});Object.defineProperty(k,"TraceValue",{enumerable:!0,get:function(){return Rt.TraceValue}});Object.defineProperty(k,"TraceFormat",{enumerable:!0,get:function(){return Rt.TraceFormat}});Object.defineProperty(k,"SetTraceNotification",{enumerable:!0,get:function(){return Rt.SetTraceNotification}});Object.defineProperty(k,"LogTraceNotification",{enumerable:!0,get:function(){return Rt.LogTraceNotification}});Object.defineProperty(k,"ConnectionErrors",{enumerable:!0,get:function(){return Rt.ConnectionErrors}});Object.defineProperty(k,"ConnectionError",{enumerable:!0,get:function(){return Rt.ConnectionError}});Object.defineProperty(k,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Rt.CancellationReceiverStrategy}});Object.defineProperty(k,"IdCancellationReceiverStrategy",{enumerable:!0,get:function(){return Rt.IdCancellationReceiverStrategy}});Object.defineProperty(k,"RequestCancellationReceiverStrategy",{enumerable:!0,get:function(){return Rt.RequestCancellationReceiverStrategy}});Object.defineProperty(k,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Rt.CancellationSenderStrategy}});Object.defineProperty(k,"CancellationStrategy",{enumerable:!0,get:function(){return Rt.CancellationStrategy}});Object.defineProperty(k,"MessageStrategy",{enumerable:!0,get:function(){return Rt.MessageStrategy}});Object.defineProperty(k,"TraceValues",{enumerable:!0,get:function(){return Rt.TraceValues}});var lV=sV(Ri());k.RAL=lV.default});var md={};mH(md,{AnnotatedTextEdit:()=>ii,ApplyKind:()=>Zg,ChangeAnnotation:()=>Ai,ChangeAnnotationIdentifier:()=>Wt,CodeAction:()=>h_,CodeActionContext:()=>p_,CodeActionKind:()=>m_,CodeActionTag:()=>ld,CodeActionTriggerKind:()=>Dc,CodeDescription:()=>jg,CodeLens:()=>g_,Color:()=>id,ColorInformation:()=>Lg,ColorPresentation:()=>Og,Command:()=>Do,CompletionItem:()=>t_,CompletionItemKind:()=>Kg,CompletionItemLabelDetails:()=>e_,CompletionItemTag:()=>Xg,CompletionList:()=>n_,CreateFile:()=>ks,DeleteFile:()=>Ls,Diagnostic:()=>Rc,DiagnosticRelatedInformation:()=>od,DiagnosticSeverity:()=>qg,DiagnosticTag:()=>Bg,DocumentHighlight:()=>a_,DocumentHighlightKind:()=>s_,DocumentLink:()=>y_,DocumentSymbol:()=>f_,DocumentUri:()=>Dg,EOL:()=>uV,FoldingRange:()=>$g,FoldingRangeKind:()=>Mg,FormattingOptions:()=>__,Hover:()=>r_,InlayHint:()=>E_,InlayHintKind:()=>ud,InlayHintLabelPart:()=>dd,InlineCompletionContext:()=>D_,InlineCompletionItem:()=>R_,InlineCompletionList:()=>T_,InlineCompletionTriggerKind:()=>A_,InlineValueContext:()=>N_,InlineValueEvaluatableExpression:()=>P_,InlineValueText:()=>v_,InlineValueVariableLookup:()=>C_,InsertReplaceEdit:()=>Jg,InsertTextFormat:()=>Yg,InsertTextMode:()=>Qg,LanguageKind:()=>Gg,Location:()=>Ec,LocationLink:()=>Fg,MarkedString:()=>Ic,MarkupContent:()=>Ii,MarkupKind:()=>cd,OptionalVersionedTextDocumentIdentifier:()=>Ac,ParameterInformation:()=>i_,Position:()=>er,Range:()=>ft,RenameFile:()=>Fs,SelectedCompletionInfo:()=>I_,SelectionRange:()=>b_,SemanticTokenModifiers:()=>w_,SemanticTokenTypes:()=>S_,SemanticTokens:()=>x_,SignatureInformation:()=>o_,SnippetTextEdit:()=>Wg,StringValue:()=>fd,SymbolInformation:()=>u_,SymbolKind:()=>c_,SymbolTag:()=>l_,TextDocument:()=>F_,TextDocumentEdit:()=>Tc,TextDocumentIdentifier:()=>Hg,TextDocumentItem:()=>zg,TextEdit:()=>kr,URI:()=>rd,VersionedTextDocumentIdentifier:()=>Vg,WorkspaceChange:()=>Ug,WorkspaceEdit:()=>sd,WorkspaceFolder:()=>k_,WorkspaceSymbol:()=>d_,integer:()=>kg,uinteger:()=>Nc});var Dg,rd,kg,Nc,er,ft,Ec,Fg,id,Lg,Og,Mg,$g,od,qg,Bg,jg,Rc,Do,kr,Ai,Wt,ii,Tc,ks,Fs,Ls,sd,Ds,Wg,ad,Ug,Hg,Vg,Ac,Gg,zg,cd,Ii,Kg,Yg,Xg,Jg,Qg,Zg,e_,t_,n_,Ic,r_,i_,o_,s_,a_,c_,l_,u_,d_,f_,m_,Dc,p_,ld,h_,g_,__,y_,b_,S_,w_,x_,v_,C_,P_,N_,ud,dd,E_,fd,R_,T_,A_,I_,D_,k_,uV,F_,L_,E,pd=fH(()=>{"use strict";(function(e){function t(n){return typeof n=="string"}e.is=t})(Dg||(Dg={}));(function(e){function t(n){return typeof n=="string"}e.is=t})(rd||(rd={}));(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(kg||(kg={}));(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(Nc||(Nc={}));(function(e){function t(r,o){return r===Number.MAX_VALUE&&(r=Nc.MAX_VALUE),o===Number.MAX_VALUE&&(o=Nc.MAX_VALUE),{line:r,character:o}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&E.uinteger(o.line)&&E.uinteger(o.character)}e.is=n})(er||(er={}));(function(e){function t(r,o,s,a){if(E.uinteger(r)&&E.uinteger(o)&&E.uinteger(s)&&E.uinteger(a))return{start:er.create(r,o),end:er.create(s,a)};if(er.is(r)&&er.is(o))return{start:r,end:o};throw new Error(`Range#create called with invalid arguments[${r}, ${o}, ${s}, ${a}]`)}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&er.is(o.start)&&er.is(o.end)}e.is=n})(ft||(ft={}));(function(e){function t(r,o){return{uri:r,range:o}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&ft.is(o.range)&&(E.string(o.uri)||E.undefined(o.uri))}e.is=n})(Ec||(Ec={}));(function(e){function t(r,o,s,a){return{targetUri:r,targetRange:o,targetSelectionRange:s,originSelectionRange:a}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&ft.is(o.targetRange)&&E.string(o.targetUri)&&ft.is(o.targetSelectionRange)&&(ft.is(o.originSelectionRange)||E.undefined(o.originSelectionRange))}e.is=n})(Fg||(Fg={}));(function(e){function t(r,o,s,a){return{red:r,green:o,blue:s,alpha:a}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&E.numberRange(o.red,0,1)&&E.numberRange(o.green,0,1)&&E.numberRange(o.blue,0,1)&&E.numberRange(o.alpha,0,1)}e.is=n})(id||(id={}));(function(e){function t(r,o){return{range:r,color:o}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&ft.is(o.range)&&id.is(o.color)}e.is=n})(Lg||(Lg={}));(function(e){function t(r,o,s){return{label:r,textEdit:o,additionalTextEdits:s}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&E.string(o.label)&&(E.undefined(o.textEdit)||kr.is(o))&&(E.undefined(o.additionalTextEdits)||E.typedArray(o.additionalTextEdits,kr.is))}e.is=n})(Og||(Og={}));(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(Mg||(Mg={}));(function(e){function t(r,o,s,a,c,l){let u={startLine:r,endLine:o};return E.defined(s)&&(u.startCharacter=s),E.defined(a)&&(u.endCharacter=a),E.defined(c)&&(u.kind=c),E.defined(l)&&(u.collapsedText=l),u}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&E.uinteger(o.startLine)&&E.uinteger(o.startLine)&&(E.undefined(o.startCharacter)||E.uinteger(o.startCharacter))&&(E.undefined(o.endCharacter)||E.uinteger(o.endCharacter))&&(E.undefined(o.kind)||E.string(o.kind))}e.is=n})($g||($g={}));(function(e){function t(r,o){return{location:r,message:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&Ec.is(o.location)&&E.string(o.message)}e.is=n})(od||(od={}));(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(qg||(qg={}));(function(e){e.Unnecessary=1,e.Deprecated=2})(Bg||(Bg={}));(function(e){function t(n){let r=n;return E.objectLiteral(r)&&E.string(r.href)}e.is=t})(jg||(jg={}));(function(e){function t(s,a,c,l,u,d){let f={range:s,message:a};return E.defined(c)&&(f.severity=c),E.defined(l)&&(f.code=l),E.defined(u)&&(f.source=u),E.defined(d)&&(f.relatedInformation=d),f}e.create=t;function n(s){var a;let c=s;return E.defined(c)&&ft.is(c.range)&&(E.string(c.message)||Ii.is(c.message))&&(E.number(c.severity)||E.undefined(c.severity))&&(E.integer(c.code)||E.string(c.code)||E.undefined(c.code))&&(E.undefined(c.codeDescription)||E.string((a=c.codeDescription)===null||a===void 0?void 0:a.href))&&(E.string(c.source)||E.undefined(c.source))&&(E.undefined(c.relatedInformation)||E.typedArray(c.relatedInformation,od.is))}e.is=n;function r(s){return E.string(s.message)}e.is3_17=r;function o(s){if(E.string(s.message))return s.message;if(Ii.is(s.message))return s.message.value;throw new Error(`Unknown message type ${typeof s.message}`)}e.getMessageString=o})(Rc||(Rc={}));(function(e){function t(r,o,...s){let a={title:r,command:o};return E.defined(s)&&s.length>0&&(a.arguments=s),a}e.create=t;function n(r){let o=r;return E.defined(o)&&E.string(o.title)&&(o.tooltip===void 0||E.string(o.tooltip))&&E.string(o.command)}e.is=n})(Do||(Do={}));(function(e){function t(s,a){return{range:s,newText:a}}e.replace=t;function n(s,a){return{range:{start:s,end:s},newText:a}}e.insert=n;function r(s){return{range:s,newText:""}}e.del=r;function o(s){let a=s;return E.objectLiteral(a)&&E.string(a.newText)&&ft.is(a.range)}e.is=o})(kr||(kr={}));(function(e){function t(r,o,s){let a={label:r};return o!==void 0&&(a.needsConfirmation=o),s!==void 0&&(a.description=s),a}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&E.string(o.label)&&(E.boolean(o.needsConfirmation)||o.needsConfirmation===void 0)&&(E.string(o.description)||o.description===void 0)}e.is=n})(Ai||(Ai={}));(function(e){function t(n){let r=n;return E.string(r)}e.is=t})(Wt||(Wt={}));(function(e){function t(s,a,c){return{range:s,newText:a,annotationId:c}}e.replace=t;function n(s,a,c){return{range:{start:s,end:s},newText:a,annotationId:c}}e.insert=n;function r(s,a){return{range:s,newText:"",annotationId:a}}e.del=r;function o(s){let a=s;return kr.is(a)&&(Ai.is(a.annotationId)||Wt.is(a.annotationId))}e.is=o})(ii||(ii={}));(function(e){function t(r,o){return{textDocument:r,edits:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&Ac.is(o.textDocument)&&Array.isArray(o.edits)}e.is=n})(Tc||(Tc={}));(function(e){function t(r,o,s){let a={kind:"create",uri:r};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}e.create=t;function n(r){let o=r;return o&&o.kind==="create"&&E.string(o.uri)&&(o.options===void 0||(o.options.overwrite===void 0||E.boolean(o.options.overwrite))&&(o.options.ignoreIfExists===void 0||E.boolean(o.options.ignoreIfExists)))&&(o.annotationId===void 0||Wt.is(o.annotationId))}e.is=n})(ks||(ks={}));(function(e){function t(r,o,s,a){let c={kind:"rename",oldUri:r,newUri:o};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(c.options=s),a!==void 0&&(c.annotationId=a),c}e.create=t;function n(r){let o=r;return o&&o.kind==="rename"&&E.string(o.oldUri)&&E.string(o.newUri)&&(o.options===void 0||(o.options.overwrite===void 0||E.boolean(o.options.overwrite))&&(o.options.ignoreIfExists===void 0||E.boolean(o.options.ignoreIfExists)))&&(o.annotationId===void 0||Wt.is(o.annotationId))}e.is=n})(Fs||(Fs={}));(function(e){function t(r,o,s){let a={kind:"delete",uri:r};return o!==void 0&&(o.recursive!==void 0||o.ignoreIfNotExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}e.create=t;function n(r){let o=r;return o&&o.kind==="delete"&&E.string(o.uri)&&(o.options===void 0||(o.options.recursive===void 0||E.boolean(o.options.recursive))&&(o.options.ignoreIfNotExists===void 0||E.boolean(o.options.ignoreIfNotExists)))&&(o.annotationId===void 0||Wt.is(o.annotationId))}e.is=n})(Ls||(Ls={}));(function(e){function t(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(o=>E.string(o.kind)?ks.is(o)||Fs.is(o)||Ls.is(o):Tc.is(o)))}e.is=t})(sd||(sd={}));Ds=class{constructor(t,n){this.edits=t,this.changeAnnotations=n}insert(t,n,r){let o,s;if(r===void 0?o=kr.insert(t,n):Wt.is(r)?(s=r,o=ii.insert(t,n,r)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(r),o=ii.insert(t,n,s)),this.edits.push(o),s!==void 0)return s}replace(t,n,r){let o,s;if(r===void 0?o=kr.replace(t,n):Wt.is(r)?(s=r,o=ii.replace(t,n,r)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(r),o=ii.replace(t,n,s)),this.edits.push(o),s!==void 0)return s}delete(t,n){let r,o;if(n===void 0?r=kr.del(t):Wt.is(n)?(o=n,r=ii.del(t,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),r=ii.del(t,o)),this.edits.push(r),o!==void 0)return o}add(t){this.edits.push(t)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(t){if(t===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}};(function(e){function t(n){let r=n;return E.objectLiteral(r)&&ft.is(r.range)&&fd.isSnippet(r.snippet)&&(r.annotationId===void 0||Ai.is(r.annotationId)||Wt.is(r.annotationId))}e.is=t})(Wg||(Wg={}));ad=class{constructor(t){this._annotations=t===void 0?Object.create(null):t,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(t,n){let r;if(Wt.is(t)?r=t:(r=this.nextId(),n=t),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(n===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=n,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},Ug=class{constructor(t){this._textEditChanges=Object.create(null),t!==void 0?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new ad(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach(n=>{if(Tc.is(n)){let r=new Ds(n.edits,this._changeAnnotations);this._textEditChanges[n.textDocument.uri]=r}})):t.changes&&Object.keys(t.changes).forEach(n=>{let r=new Ds(t.changes[n]);this._textEditChanges[n]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(t){if(Ac.is(t)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n={uri:t.uri,version:t.version},r=this._textEditChanges[n.uri];if(!r){let o=[],s={textDocument:n,edits:o};this._workspaceEdit.documentChanges.push(s),r=new Ds(o,this._changeAnnotations),this._textEditChanges[n.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let n=this._textEditChanges[t];if(!n){let r=[];this._workspaceEdit.changes[t]=r,n=new Ds(r),this._textEditChanges[t]=n}return n}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new ad,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;Ai.is(n)||Wt.is(n)?o=n:r=n;let s,a;if(o===void 0?s=ks.create(t,r):(a=Wt.is(o)?o:this._changeAnnotations.manage(o),s=ks.create(t,r,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a}renameFile(t,n,r,o){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let s;Ai.is(r)||Wt.is(r)?s=r:o=r;let a,c;if(s===void 0?a=Fs.create(t,n,o):(c=Wt.is(s)?s:this._changeAnnotations.manage(s),a=Fs.create(t,n,o,c)),this._workspaceEdit.documentChanges.push(a),c!==void 0)return c}deleteFile(t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;Ai.is(n)||Wt.is(n)?o=n:r=n;let s,a;if(o===void 0?s=Ls.create(t,r):(a=Wt.is(o)?o:this._changeAnnotations.manage(o),s=Ls.create(t,r,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a}};(function(e){function t(r){return{uri:r}}e.create=t;function n(r){let o=r;return E.defined(o)&&E.string(o.uri)}e.is=n})(Hg||(Hg={}));(function(e){function t(r,o){return{uri:r,version:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&E.string(o.uri)&&E.integer(o.version)}e.is=n})(Vg||(Vg={}));(function(e){function t(r,o){return{uri:r,version:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&E.string(o.uri)&&(o.version===null||E.integer(o.version))}e.is=n})(Ac||(Ac={}));(function(e){e.ABAP="abap",e.WindowsBat="bat",e.BibTeX="bibtex",e.Clojure="clojure",e.Coffeescript="coffeescript",e.C="c",e.CPP="cpp",e.CSharp="csharp",e.CSS="css",e.D="d",e.Delphi="pascal",e.Diff="diff",e.Dart="dart",e.Dockerfile="dockerfile",e.Elixir="elixir",e.Erlang="erlang",e.FSharp="fsharp",e.GitCommit="git-commit",e.GitRebase="git-rebase",e.Go="go",e.Groovy="groovy",e.Handlebars="handlebars",e.Haskell="haskell",e.HTML="html",e.Ini="ini",e.Java="java",e.JavaScript="javascript",e.JavaScriptReact="javascriptreact",e.JSON="json",e.LaTeX="latex",e.Less="less",e.Lua="lua",e.Makefile="makefile",e.Markdown="markdown",e.ObjectiveC="objective-c",e.ObjectiveCPP="objective-cpp",e.Pascal="pascal",e.Perl="perl",e.Perl6="perl6",e.PHP="php",e.Plaintext="plaintext",e.Powershell="powershell",e.Pug="jade",e.Python="python",e.R="r",e.Razor="razor",e.Ruby="ruby",e.Rust="rust",e.SCSS="scss",e.SASS="sass",e.Scala="scala",e.ShaderLab="shaderlab",e.ShellScript="shellscript",e.SQL="sql",e.Swift="swift",e.TypeScript="typescript",e.TypeScriptReact="typescriptreact",e.TeX="tex",e.VisualBasic="vb",e.XML="xml",e.XSL="xsl",e.YAML="yaml"})(Gg||(Gg={}));(function(e){function t(r,o,s,a){return{uri:r,languageId:o,version:s,text:a}}e.create=t;function n(r){let o=r;return E.defined(o)&&E.string(o.uri)&&E.string(o.languageId)&&E.integer(o.version)&&E.string(o.text)}e.is=n})(zg||(zg={}));(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(n){let r=n;return r===e.PlainText||r===e.Markdown}e.is=t})(cd||(cd={}));(function(e){function t(n){let r=n;return E.objectLiteral(n)&&cd.is(r.kind)&&E.string(r.value)}e.is=t})(Ii||(Ii={}));(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Kg||(Kg={}));(function(e){e.PlainText=1,e.Snippet=2})(Yg||(Yg={}));(function(e){e.Deprecated=1})(Xg||(Xg={}));(function(e){function t(r,o,s){return{newText:r,insert:o,replace:s}}e.create=t;function n(r){let o=r;return o&&E.string(o.newText)&&ft.is(o.insert)&&ft.is(o.replace)}e.is=n})(Jg||(Jg={}));(function(e){e.asIs=1,e.adjustIndentation=2})(Qg||(Qg={}));(function(e){e.Replace=1,e.Merge=2})(Zg||(Zg={}));(function(e){function t(n){let r=n;return r&&(E.string(r.detail)||r.detail===void 0)&&(E.string(r.description)||r.description===void 0)}e.is=t})(e_||(e_={}));(function(e){function t(n){return{label:n}}e.create=t})(t_||(t_={}));(function(e){function t(n,r){return{items:n||[],isIncomplete:!!r}}e.create=t})(n_||(n_={}));(function(e){function t(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function n(r){let o=r;return E.string(o)||E.objectLiteral(o)&&E.string(o.language)&&E.string(o.value)}e.is=n})(Ic||(Ic={}));(function(e){function t(n){let r=n;return!!r&&E.objectLiteral(r)&&(Ii.is(r.contents)||Ic.is(r.contents)||E.typedArray(r.contents,Ic.is))&&(n.range===void 0||ft.is(n.range))}e.is=t})(r_||(r_={}));(function(e){function t(n,r){return r?{label:n,documentation:r}:{label:n}}e.create=t})(i_||(i_={}));(function(e){function t(n,r,...o){let s={label:n};return E.defined(r)&&(s.documentation=r),E.defined(o)?s.parameters=o:s.parameters=[],s}e.create=t})(o_||(o_={}));(function(e){e.Text=1,e.Read=2,e.Write=3})(s_||(s_={}));(function(e){function t(n,r){let o={range:n};return E.number(r)&&(o.kind=r),o}e.create=t})(a_||(a_={}));(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(c_||(c_={}));(function(e){e.Deprecated=1})(l_||(l_={}));(function(e){function t(n,r,o,s,a){let c={name:n,kind:r,location:{uri:s,range:o}};return a&&(c.containerName=a),c}e.create=t})(u_||(u_={}));(function(e){function t(n,r,o,s){return s!==void 0?{name:n,kind:r,location:{uri:o,range:s}}:{name:n,kind:r,location:{uri:o}}}e.create=t})(d_||(d_={}));(function(e){function t(r,o,s,a,c,l){let u={name:r,detail:o,kind:s,range:a,selectionRange:c};return l!==void 0&&(u.children=l),u}e.create=t;function n(r){let o=r;return o&&E.string(o.name)&&E.number(o.kind)&&ft.is(o.range)&&ft.is(o.selectionRange)&&(o.detail===void 0||E.string(o.detail))&&(o.deprecated===void 0||E.boolean(o.deprecated))&&(o.children===void 0||Array.isArray(o.children))&&(o.tags===void 0||Array.isArray(o.tags))}e.is=n})(f_||(f_={}));(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorMove="refactor.move",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll",e.Notebook="notebook"})(m_||(m_={}));(function(e){e.Invoked=1,e.Automatic=2})(Dc||(Dc={}));(function(e){function t(r,o,s){let a={diagnostics:r};return o!=null&&(a.only=o),s!=null&&(a.triggerKind=s),a}e.create=t;function n(r){let o=r;return E.defined(o)&&E.typedArray(o.diagnostics,Rc.is)&&(o.only===void 0||E.typedArray(o.only,E.string))&&(o.triggerKind===void 0||o.triggerKind===Dc.Invoked||o.triggerKind===Dc.Automatic)}e.is=n})(p_||(p_={}));(function(e){e.LLMGenerated=1;function t(n){return E.defined(n)&&n===e.LLMGenerated}e.is=t})(ld||(ld={}));(function(e){function t(r,o,s){let a={title:r},c=!0;return typeof o=="string"?(c=!1,a.kind=o):Do.is(o)?a.command=o:a.edit=o,c&&s!==void 0&&(a.kind=s),a}e.create=t;function n(r){let o=r;return o&&E.string(o.title)&&(o.diagnostics===void 0||E.typedArray(o.diagnostics,Rc.is))&&(o.kind===void 0||E.string(o.kind))&&(o.edit!==void 0||o.command!==void 0)&&(o.command===void 0||Do.is(o.command))&&(o.isPreferred===void 0||E.boolean(o.isPreferred))&&(o.edit===void 0||sd.is(o.edit))&&(o.tags===void 0||E.typedArray(o.tags,ld.is))}e.is=n})(h_||(h_={}));(function(e){function t(r,o){let s={range:r};return E.defined(o)&&(s.data=o),s}e.create=t;function n(r){let o=r;return E.defined(o)&&ft.is(o.range)&&(E.undefined(o.command)||Do.is(o.command))}e.is=n})(g_||(g_={}));(function(e){function t(r,o){return{tabSize:r,insertSpaces:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&E.uinteger(o.tabSize)&&E.boolean(o.insertSpaces)}e.is=n})(__||(__={}));(function(e){function t(r,o,s){return{range:r,target:o,data:s}}e.create=t;function n(r){let o=r;return E.defined(o)&&ft.is(o.range)&&(E.undefined(o.target)||E.string(o.target))}e.is=n})(y_||(y_={}));(function(e){function t(r,o){return{range:r,parent:o}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&ft.is(o.range)&&(o.parent===void 0||e.is(o.parent))}e.is=n})(b_||(b_={}));(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator",e.label="label"})(S_||(S_={}));(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(w_||(w_={}));(function(e){function t(n){let r=n;return E.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}e.is=t})(x_||(x_={}));(function(e){function t(r,o){return{range:r,text:o}}e.create=t;function n(r){let o=r;return o!=null&&ft.is(o.range)&&E.string(o.text)}e.is=n})(v_||(v_={}));(function(e){function t(r,o,s){return{range:r,variableName:o,caseSensitiveLookup:s}}e.create=t;function n(r){let o=r;return o!=null&&ft.is(o.range)&&E.boolean(o.caseSensitiveLookup)&&(E.string(o.variableName)||o.variableName===void 0)}e.is=n})(C_||(C_={}));(function(e){function t(r,o){return{range:r,expression:o}}e.create=t;function n(r){let o=r;return o!=null&&ft.is(o.range)&&(E.string(o.expression)||o.expression===void 0)}e.is=n})(P_||(P_={}));(function(e){function t(r,o){return{frameId:r,stoppedLocation:o}}e.create=t;function n(r){let o=r;return E.defined(o)&&ft.is(r.stoppedLocation)}e.is=n})(N_||(N_={}));(function(e){e.Type=1,e.Parameter=2;function t(n){return n===1||n===2}e.is=t})(ud||(ud={}));(function(e){function t(r){return{value:r}}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&(o.tooltip===void 0||E.string(o.tooltip)||Ii.is(o.tooltip))&&(o.location===void 0||Ec.is(o.location))&&(o.command===void 0||Do.is(o.command))}e.is=n})(dd||(dd={}));(function(e){function t(r,o,s){let a={position:r,label:o};return s!==void 0&&(a.kind=s),a}e.create=t;function n(r){let o=r;return E.objectLiteral(o)&&er.is(o.position)&&(E.string(o.label)||E.typedArray(o.label,dd.is))&&(o.kind===void 0||ud.is(o.kind))&&o.textEdits===void 0||E.typedArray(o.textEdits,kr.is)&&(o.tooltip===void 0||E.string(o.tooltip)||Ii.is(o.tooltip))&&(o.paddingLeft===void 0||E.boolean(o.paddingLeft))&&(o.paddingRight===void 0||E.boolean(o.paddingRight))}e.is=n})(E_||(E_={}));(function(e){function t(r){return{kind:"snippet",value:r}}e.createSnippet=t;function n(r){let o=r;return E.objectLiteral(o)&&o.kind==="snippet"&&E.string(o.value)}e.isSnippet=n})(fd||(fd={}));(function(e){function t(n,r,o,s){return{insertText:n,filterText:r,range:o,command:s}}e.create=t})(R_||(R_={}));(function(e){function t(n){return{items:n}}e.create=t})(T_||(T_={}));(function(e){e.Invoked=1,e.Automatic=2})(A_||(A_={}));(function(e){function t(n,r){return{range:n,text:r}}e.create=t})(I_||(I_={}));(function(e){function t(n,r){return{triggerKind:n,selectedCompletionInfo:r}}e.create=t})(D_||(D_={}));(function(e){function t(n){let r=n;return E.objectLiteral(r)&&rd.is(r.uri)&&E.string(r.name)}e.is=t})(k_||(k_={}));uV=[`
10
10
  `,`\r
11
11
  `,"\r"];(function(e){function t(s,a,c,l){return new L_(s,a,c,l)}e.create=t;function n(s){let a=s;return!!(E.defined(a)&&E.string(a.uri)&&(E.undefined(a.languageId)||E.string(a.languageId))&&E.uinteger(a.lineCount)&&E.func(a.getText)&&E.func(a.positionAt)&&E.func(a.offsetAt))}e.is=n;function r(s,a){let c=s.getText(),l=o(a,(d,f)=>{let m=d.range.start.line-f.range.start.line;return m===0?d.range.start.character-f.range.start.character:m}),u=c.length;for(let d=l.length-1;d>=0;d--){let f=l[d],m=s.offsetAt(f.range.start),p=s.offsetAt(f.range.end);if(p<=u)c=c.substring(0,m)+f.newText+c.substring(p,c.length);else throw new Error("Overlapping edit");u=m}return c}e.applyEdits=r;function o(s,a){if(s.length<=1)return s;let c=s.length/2|0,l=s.slice(0,c),u=s.slice(c);o(l,a),o(u,a);let d=0,f=0,m=0;for(;d<l.length&&f<u.length;)a(l[d],u[f])<=0?s[m++]=l[d++]:s[m++]=u[f++];for(;d<l.length;)s[m++]=l[d++];for(;f<u.length;)s[m++]=u[f++];return s}})(F_||(F_={}));L_=class{constructor(t,n,r,o){this._uri=t,this._languageId=n,this._version=r,this._content=o,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let n=this.offsetAt(t.start),r=this.offsetAt(t.end);return this._content.substring(n,r)}return this._content}update(t,n){this._content=t.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let t=[],n=this._content,r=!0;for(let o=0;o<n.length;o++){r&&(t.push(o),r=!1);let s=n.charAt(o);r=s==="\r"||s===`
12
12
  `,s==="\r"&&o+1<n.length&&n.charAt(o+1)===`
13
- `&&o++}r&&n.length>0&&t.push(n.length),this._lineOffsets=t}return this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),r=0,o=n.length;if(o===0)return er.create(0,t);for(;r<o;){let a=Math.floor((r+o)/2);n[a]>t?o=a:r=a+1}let s=r-1;return er.create(s,t-n[s])}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line],o=t.line+1<n.length?n[t.line+1]:this._content.length;return Math.max(Math.min(r+t.character,o),r)}get lineCount(){return this.getLineOffsets().length}};(function(e){let t=Object.prototype.toString;function n(p){return typeof p<"u"}e.defined=n;function r(p){return typeof p>"u"}e.undefined=r;function o(p){return p===!0||p===!1}e.boolean=o;function s(p){return t.call(p)==="[object String]"}e.string=s;function a(p){return t.call(p)==="[object Number]"}e.number=a;function c(p,g,h){return t.call(p)==="[object Number]"&&g<=p&&p<=h}e.numberRange=c;function l(p){return t.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}e.integer=l;function u(p){return t.call(p)==="[object Number]"&&0<=p&&p<=2147483647}e.uinteger=u;function d(p){return t.call(p)==="[object Function]"}e.func=d;function f(p){return p!==null&&typeof p=="object"}e.objectLiteral=f;function m(p,g){return Array.isArray(p)&&p.every(g)}e.typedArray=m})(E||(E={}))});var Ze=C(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.CM=an.ProtocolNotificationType=an.ProtocolNotificationType0=an.ProtocolRequestType=an.ProtocolRequestType0=an.RegistrationType=an.MessageDirection=void 0;var Os=ri(),dN;(function(e){e.clientToServer="clientToServer",e.serverToClient="serverToClient",e.both="both"})(dN||(an.MessageDirection=dN={}));var O_=class{____;method;constructor(t){this.method=t}};an.RegistrationType=O_;var M_=class extends Os.RequestType0{__;___;____;_pr;constructor(t){super(t)}};an.ProtocolRequestType0=M_;var $_=class extends Os.RequestType{__;___;____;_pr;constructor(t){super(t,Os.ParameterStructures.byName)}};an.ProtocolRequestType=$_;var q_=class extends Os.NotificationType0{___;____;constructor(t){super(t)}};an.ProtocolNotificationType0=q_;var B_=class extends Os.NotificationType{___;____;constructor(t){super(t,Os.ParameterStructures.byName)}};an.ProtocolNotificationType=B_;var fN;(function(e){function t(n,r){return{client:n,server:r}}e.create=t})(fN||(an.CM=fN={}))});var pd=C(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.boolean=uV;gr.string=mN;gr.number=dV;gr.error=fV;gr.func=mV;gr.array=pN;gr.stringArray=pV;gr.typedArray=hV;gr.objectLiteral=gV;function uV(e){return e===!0||e===!1}function mN(e){return typeof e=="string"||e instanceof String}function dV(e){return typeof e=="number"||e instanceof Number}function fV(e){return e instanceof Error}function mV(e){return typeof e=="function"}function pN(e){return Array.isArray(e)}function pV(e){return pN(e)&&e.every(t=>mN(t))}function hV(e,t){return Array.isArray(e)&&e.every(t)}function gV(e){return e!==null&&typeof e=="object"}});var gN=C(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});hd.ImplementationRequest=void 0;var j_=Ze(),hN;(function(e){e.method="textDocument/implementation",e.messageDirection=j_.MessageDirection.clientToServer,e.type=new j_.ProtocolRequestType(e.method),e.capabilities=j_.CM.create("textDocument.implementation","implementationProvider")})(hN||(hd.ImplementationRequest=hN={}))});var yN=C(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});gd.TypeDefinitionRequest=void 0;var W_=Ze(),_N;(function(e){e.method="textDocument/typeDefinition",e.messageDirection=W_.MessageDirection.clientToServer,e.type=new W_.ProtocolRequestType(e.method),e.capabilities=W_.CM.create("textDocument.typeDefinition","typeDefinitionProvider")})(_N||(gd.TypeDefinitionRequest=_N={}))});var wN=C($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.DidChangeWorkspaceFoldersNotification=$s.WorkspaceFoldersRequest=void 0;var Ms=Ze(),bN;(function(e){e.method="workspace/workspaceFolders",e.messageDirection=Ms.MessageDirection.serverToClient,e.type=new Ms.ProtocolRequestType0(e.method),e.capabilities=Ms.CM.create("workspace.workspaceFolders","workspace.workspaceFolders")})(bN||($s.WorkspaceFoldersRequest=bN={}));var SN;(function(e){e.method="workspace/didChangeWorkspaceFolders",e.messageDirection=Ms.MessageDirection.clientToServer,e.type=new Ms.ProtocolNotificationType(e.method),e.capabilities=Ms.CM.create(void 0,"workspace.workspaceFolders.changeNotifications")})(SN||($s.DidChangeWorkspaceFoldersNotification=SN={}))});var vN=C(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.ConfigurationRequest=void 0;var U_=Ze(),xN;(function(e){e.method="workspace/configuration",e.messageDirection=U_.MessageDirection.serverToClient,e.type=new U_.ProtocolRequestType(e.method),e.capabilities=U_.CM.create("workspace.configuration",void 0)})(xN||(_d.ConfigurationRequest=xN={}))});var NN=C(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.ColorPresentationRequest=Bs.DocumentColorRequest=void 0;var qs=Ze(),CN;(function(e){e.method="textDocument/documentColor",e.messageDirection=qs.MessageDirection.clientToServer,e.type=new qs.ProtocolRequestType(e.method),e.capabilities=qs.CM.create("textDocument.colorProvider","colorProvider")})(CN||(Bs.DocumentColorRequest=CN={}));var PN;(function(e){e.method="textDocument/colorPresentation",e.messageDirection=qs.MessageDirection.clientToServer,e.type=new qs.ProtocolRequestType(e.method),e.capabilities=qs.CM.create("textDocument.colorProvider","colorProvider")})(PN||(Bs.ColorPresentationRequest=PN={}))});var TN=C(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.FoldingRangeRefreshRequest=Ws.FoldingRangeRequest=void 0;var js=Ze(),EN;(function(e){e.method="textDocument/foldingRange",e.messageDirection=js.MessageDirection.clientToServer,e.type=new js.ProtocolRequestType(e.method),e.capabilities=js.CM.create("textDocument.foldingRange","foldingRangeProvider")})(EN||(Ws.FoldingRangeRequest=EN={}));var RN;(function(e){e.method="workspace/foldingRange/refresh",e.messageDirection=js.MessageDirection.serverToClient,e.type=new js.ProtocolRequestType0(e.method),e.capabilities=js.CM.create("workspace.foldingRange.refreshSupport",void 0)})(RN||(Ws.FoldingRangeRefreshRequest=RN={}))});var IN=C(yd=>{"use strict";Object.defineProperty(yd,"__esModule",{value:!0});yd.DeclarationRequest=void 0;var H_=Ze(),AN;(function(e){e.method="textDocument/declaration",e.messageDirection=H_.MessageDirection.clientToServer,e.type=new H_.ProtocolRequestType(e.method),e.capabilities=H_.CM.create("textDocument.declaration","declarationProvider")})(AN||(yd.DeclarationRequest=AN={}))});var kN=C(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});bd.SelectionRangeRequest=void 0;var V_=Ze(),DN;(function(e){e.method="textDocument/selectionRange",e.messageDirection=V_.MessageDirection.clientToServer,e.type=new V_.ProtocolRequestType(e.method),e.capabilities=V_.CM.create("textDocument.selectionRange","selectionRangeProvider")})(DN||(bd.SelectionRangeRequest=DN={}))});var MN=C(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.WorkDoneProgressCancelNotification=Di.WorkDoneProgressCreateRequest=Di.WorkDoneProgress=void 0;var _V=ri(),Dc=Ze(),FN;(function(e){e.type=new _V.ProgressType;function t(n){return n===e.type}e.is=t})(FN||(Di.WorkDoneProgress=FN={}));var LN;(function(e){e.method="window/workDoneProgress/create",e.messageDirection=Dc.MessageDirection.serverToClient,e.type=new Dc.ProtocolRequestType(e.method),e.capabilities=Dc.CM.create("window.workDoneProgress",void 0)})(LN||(Di.WorkDoneProgressCreateRequest=LN={}));var ON;(function(e){e.method="window/workDoneProgress/cancel",e.messageDirection=Dc.MessageDirection.clientToServer,e.type=new Dc.ProtocolNotificationType(e.method)})(ON||(Di.WorkDoneProgressCancelNotification=ON={}))});var jN=C(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.CallHierarchyOutgoingCallsRequest=ki.CallHierarchyIncomingCallsRequest=ki.CallHierarchyPrepareRequest=void 0;var oi=Ze(),$N;(function(e){e.method="textDocument/prepareCallHierarchy",e.messageDirection=oi.MessageDirection.clientToServer,e.type=new oi.ProtocolRequestType(e.method),e.capabilities=oi.CM.create("textDocument.callHierarchy","callHierarchyProvider")})($N||(ki.CallHierarchyPrepareRequest=$N={}));var qN;(function(e){e.method="callHierarchy/incomingCalls",e.messageDirection=oi.MessageDirection.clientToServer,e.type=new oi.ProtocolRequestType(e.method),e.capabilities=oi.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(qN||(ki.CallHierarchyIncomingCallsRequest=qN={}));var BN;(function(e){e.method="callHierarchy/outgoingCalls",e.messageDirection=oi.MessageDirection.clientToServer,e.type=new oi.ProtocolRequestType(e.method),e.capabilities=oi.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(BN||(ki.CallHierarchyOutgoingCallsRequest=BN={}))});var zN=C(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.SemanticTokensRefreshRequest=Nn.SemanticTokensRangeRequest=Nn.SemanticTokensDeltaRequest=Nn.SemanticTokensRequest=Nn.SemanticTokensRegistrationType=Nn.TokenFormat=void 0;var Vn=Ze(),WN;(function(e){e.Relative="relative"})(WN||(Nn.TokenFormat=WN={}));var kc;(function(e){e.method="textDocument/semanticTokens",e.type=new Vn.RegistrationType(e.method)})(kc||(Nn.SemanticTokensRegistrationType=kc={}));var UN;(function(e){e.method="textDocument/semanticTokens/full",e.messageDirection=Vn.MessageDirection.clientToServer,e.type=new Vn.ProtocolRequestType(e.method),e.registrationMethod=kc.method,e.capabilities=Vn.CM.create("textDocument.semanticTokens","semanticTokensProvider")})(UN||(Nn.SemanticTokensRequest=UN={}));var HN;(function(e){e.method="textDocument/semanticTokens/full/delta",e.messageDirection=Vn.MessageDirection.clientToServer,e.type=new Vn.ProtocolRequestType(e.method),e.registrationMethod=kc.method,e.capabilities=Vn.CM.create("textDocument.semanticTokens.requests.full.delta","semanticTokensProvider.full.delta")})(HN||(Nn.SemanticTokensDeltaRequest=HN={}));var VN;(function(e){e.method="textDocument/semanticTokens/range",e.messageDirection=Vn.MessageDirection.clientToServer,e.type=new Vn.ProtocolRequestType(e.method),e.registrationMethod=kc.method,e.capabilities=Vn.CM.create("textDocument.semanticTokens.requests.range","semanticTokensProvider.range")})(VN||(Nn.SemanticTokensRangeRequest=VN={}));var GN;(function(e){e.method="workspace/semanticTokens/refresh",e.messageDirection=Vn.MessageDirection.serverToClient,e.type=new Vn.ProtocolRequestType0(e.method),e.capabilities=Vn.CM.create("workspace.semanticTokens.refreshSupport",void 0)})(GN||(Nn.SemanticTokensRefreshRequest=GN={}))});var YN=C(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:!0});Sd.ShowDocumentRequest=void 0;var G_=Ze(),KN;(function(e){e.method="window/showDocument",e.messageDirection=G_.MessageDirection.serverToClient,e.type=new G_.ProtocolRequestType(e.method),e.capabilities=G_.CM.create("window.showDocument.support",void 0)})(KN||(Sd.ShowDocumentRequest=KN={}))});var JN=C(wd=>{"use strict";Object.defineProperty(wd,"__esModule",{value:!0});wd.LinkedEditingRangeRequest=void 0;var z_=Ze(),XN;(function(e){e.method="textDocument/linkedEditingRange",e.messageDirection=z_.MessageDirection.clientToServer,e.type=new z_.ProtocolRequestType(e.method),e.capabilities=z_.CM.create("textDocument.linkedEditingRange","linkedEditingRangeProvider")})(XN||(wd.LinkedEditingRangeRequest=XN={}))});var oE=C(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.WillDeleteFilesRequest=cn.DidDeleteFilesNotification=cn.DidRenameFilesNotification=cn.WillRenameFilesRequest=cn.DidCreateFilesNotification=cn.WillCreateFilesRequest=cn.FileOperationPatternKind=void 0;var Ut=Ze(),QN;(function(e){e.file="file",e.folder="folder"})(QN||(cn.FileOperationPatternKind=QN={}));var ZN;(function(e){e.method="workspace/willCreateFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolRequestType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.willCreate","workspace.fileOperations.willCreate")})(ZN||(cn.WillCreateFilesRequest=ZN={}));var eE;(function(e){e.method="workspace/didCreateFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolNotificationType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.didCreate","workspace.fileOperations.didCreate")})(eE||(cn.DidCreateFilesNotification=eE={}));var tE;(function(e){e.method="workspace/willRenameFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolRequestType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.willRename","workspace.fileOperations.willRename")})(tE||(cn.WillRenameFilesRequest=tE={}));var nE;(function(e){e.method="workspace/didRenameFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolNotificationType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.didRename","workspace.fileOperations.didRename")})(nE||(cn.DidRenameFilesNotification=nE={}));var rE;(function(e){e.method="workspace/didDeleteFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolNotificationType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.didDelete","workspace.fileOperations.didDelete")})(rE||(cn.DidDeleteFilesNotification=rE={}));var iE;(function(e){e.method="workspace/willDeleteFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolRequestType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.willDelete","workspace.fileOperations.willDelete")})(iE||(cn.WillDeleteFilesRequest=iE={}))});var lE=C(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.MonikerRequest=Fi.MonikerKind=Fi.UniquenessLevel=void 0;var K_=Ze(),sE;(function(e){e.document="document",e.project="project",e.group="group",e.scheme="scheme",e.global="global"})(sE||(Fi.UniquenessLevel=sE={}));var aE;(function(e){e.$import="import",e.$export="export",e.local="local"})(aE||(Fi.MonikerKind=aE={}));var cE;(function(e){e.method="textDocument/moniker",e.messageDirection=K_.MessageDirection.clientToServer,e.type=new K_.ProtocolRequestType(e.method),e.capabilities=K_.CM.create("textDocument.moniker","monikerProvider")})(cE||(Fi.MonikerRequest=cE={}))});var mE=C(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.TypeHierarchySubtypesRequest=Li.TypeHierarchySupertypesRequest=Li.TypeHierarchyPrepareRequest=void 0;var ko=Ze(),uE;(function(e){e.method="textDocument/prepareTypeHierarchy",e.messageDirection=ko.MessageDirection.clientToServer,e.type=new ko.ProtocolRequestType(e.method),e.capabilities=ko.CM.create("textDocument.typeHierarchy","typeHierarchyProvider")})(uE||(Li.TypeHierarchyPrepareRequest=uE={}));var dE;(function(e){e.method="typeHierarchy/supertypes",e.messageDirection=ko.MessageDirection.clientToServer,e.type=new ko.ProtocolRequestType(e.method)})(dE||(Li.TypeHierarchySupertypesRequest=dE={}));var fE;(function(e){e.method="typeHierarchy/subtypes",e.messageDirection=ko.MessageDirection.clientToServer,e.type=new ko.ProtocolRequestType(e.method)})(fE||(Li.TypeHierarchySubtypesRequest=fE={}))});var gE=C(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.InlineValueRefreshRequest=Hs.InlineValueRequest=void 0;var Us=Ze(),pE;(function(e){e.method="textDocument/inlineValue",e.messageDirection=Us.MessageDirection.clientToServer,e.type=new Us.ProtocolRequestType(e.method),e.capabilities=Us.CM.create("textDocument.inlineValue","inlineValueProvider")})(pE||(Hs.InlineValueRequest=pE={}));var hE;(function(e){e.method="workspace/inlineValue/refresh",e.messageDirection=Us.MessageDirection.serverToClient,e.type=new Us.ProtocolRequestType0(e.method),e.capabilities=Us.CM.create("workspace.inlineValue.refreshSupport",void 0)})(hE||(Hs.InlineValueRefreshRequest=hE={}))});var SE=C(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.InlayHintRefreshRequest=Oi.InlayHintResolveRequest=Oi.InlayHintRequest=void 0;var si=Ze(),_E;(function(e){e.method="textDocument/inlayHint",e.messageDirection=si.MessageDirection.clientToServer,e.type=new si.ProtocolRequestType(e.method),e.capabilities=si.CM.create("textDocument.inlayHint","inlayHintProvider")})(_E||(Oi.InlayHintRequest=_E={}));var yE;(function(e){e.method="inlayHint/resolve",e.messageDirection=si.MessageDirection.clientToServer,e.type=new si.ProtocolRequestType(e.method),e.capabilities=si.CM.create("textDocument.inlayHint.resolveSupport","inlayHintProvider.resolveProvider")})(yE||(Oi.InlayHintResolveRequest=yE={}));var bE;(function(e){e.method="workspace/inlayHint/refresh",e.messageDirection=si.MessageDirection.serverToClient,e.type=new si.ProtocolRequestType0(e.method),e.capabilities=si.CM.create("workspace.inlayHint.refreshSupport",void 0)})(bE||(Oi.InlayHintRefreshRequest=bE={}))});var EE=C(Ht=>{"use strict";var yV=Ht&&Ht.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),bV=Ht&&Ht.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),SV=Ht&&Ht.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&yV(n,t,r[o]);return bV(n,t),n}})();Object.defineProperty(Ht,"__esModule",{value:!0});Ht.DiagnosticRefreshRequest=Ht.WorkspaceDiagnosticRequest=Ht.DocumentDiagnosticRequest=Ht.DocumentDiagnosticReportKind=Ht.DiagnosticServerCancellationData=void 0;var NE=ri(),wV=SV(pd()),ai=Ze(),wE;(function(e){function t(n){let r=n;return r&&wV.boolean(r.retriggerRequest)}e.is=t})(wE||(Ht.DiagnosticServerCancellationData=wE={}));var xE;(function(e){e.Full="full",e.Unchanged="unchanged"})(xE||(Ht.DocumentDiagnosticReportKind=xE={}));var vE;(function(e){e.method="textDocument/diagnostic",e.messageDirection=ai.MessageDirection.clientToServer,e.type=new ai.ProtocolRequestType(e.method),e.partialResult=new NE.ProgressType,e.capabilities=ai.CM.create("textDocument.diagnostic","diagnosticProvider")})(vE||(Ht.DocumentDiagnosticRequest=vE={}));var CE;(function(e){e.method="workspace/diagnostic",e.messageDirection=ai.MessageDirection.clientToServer,e.type=new ai.ProtocolRequestType(e.method),e.partialResult=new NE.ProgressType,e.capabilities=ai.CM.create("workspace.diagnostics","diagnosticProvider.workspaceDiagnostics")})(CE||(Ht.WorkspaceDiagnosticRequest=CE={}));var PE;(function(e){e.method="workspace/diagnostic/refresh",e.messageDirection=ai.MessageDirection.serverToClient,e.type=new ai.ProtocolRequestType0(e.method),e.capabilities=ai.CM.create("workspace.diagnostics.refreshSupport",void 0)})(PE||(Ht.DiagnosticRefreshRequest=PE={}))});var FE=C(Ve=>{"use strict";var xV=Ve&&Ve.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),vV=Ve&&Ve.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),CV=Ve&&Ve.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&xV(n,t,r[o]);return vV(n,t),n}})();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.DidCloseNotebookDocumentNotification=Ve.DidSaveNotebookDocumentNotification=Ve.DidChangeNotebookDocumentNotification=Ve.NotebookCellArrayChange=Ve.DidOpenNotebookDocumentNotification=Ve.NotebookDocumentSyncRegistrationType=Ve.NotebookDocument=Ve.NotebookCell=Ve.ExecutionSummary=Ve.NotebookCellKind=void 0;var Fc=(md(),Nh(fd)),_r=CV(pd()),Fr=Ze(),Y_;(function(e){e.Markup=1,e.Code=2;function t(n){return n===1||n===2}e.is=t})(Y_||(Ve.NotebookCellKind=Y_={}));var X_;(function(e){function t(o,s){let a={executionOrder:o};return(s===!0||s===!1)&&(a.success=s),a}e.create=t;function n(o){let s=o;return _r.objectLiteral(s)&&Fc.uinteger.is(s.executionOrder)&&(s.success===void 0||_r.boolean(s.success))}e.is=n;function r(o,s){return o===s?!0:o==null||s===null||s===void 0?!1:o.executionOrder===s.executionOrder&&o.success===s.success}e.equals=r})(X_||(Ve.ExecutionSummary=X_={}));var xd;(function(e){function t(s,a){return{kind:s,document:a}}e.create=t;function n(s){let a=s;return _r.objectLiteral(a)&&Y_.is(a.kind)&&Fc.DocumentUri.is(a.document)&&(a.metadata===void 0||_r.objectLiteral(a.metadata))}e.is=n;function r(s,a){let c=new Set;return s.document!==a.document&&c.add("document"),s.kind!==a.kind&&c.add("kind"),s.executionSummary!==a.executionSummary&&c.add("executionSummary"),(s.metadata!==void 0||a.metadata!==void 0)&&!o(s.metadata,a.metadata)&&c.add("metadata"),(s.executionSummary!==void 0||a.executionSummary!==void 0)&&!X_.equals(s.executionSummary,a.executionSummary)&&c.add("executionSummary"),c}e.diff=r;function o(s,a){if(s===a)return!0;if(s==null||a===null||a===void 0||typeof s!=typeof a||typeof s!="object")return!1;let c=Array.isArray(s),l=Array.isArray(a);if(c!==l)return!1;if(c&&l){if(s.length!==a.length)return!1;for(let u=0;u<s.length;u++)if(!o(s[u],a[u]))return!1}if(_r.objectLiteral(s)&&_r.objectLiteral(a)){let u=Object.keys(s),d=Object.keys(a);if(u.length!==d.length||(u.sort(),d.sort(),!o(u,d)))return!1;for(let f=0;f<u.length;f++){let m=u[f];if(!o(s[m],a[m]))return!1}}return!0}})(xd||(Ve.NotebookCell=xd={}));var RE;(function(e){function t(r,o,s,a){return{uri:r,notebookType:o,version:s,cells:a}}e.create=t;function n(r){let o=r;return _r.objectLiteral(o)&&_r.string(o.uri)&&Fc.integer.is(o.version)&&_r.typedArray(o.cells,xd.is)}e.is=n})(RE||(Ve.NotebookDocument=RE={}));var Vs;(function(e){e.method="notebookDocument/sync",e.messageDirection=Fr.MessageDirection.clientToServer,e.type=new Fr.RegistrationType(e.method)})(Vs||(Ve.NotebookDocumentSyncRegistrationType=Vs={}));var TE;(function(e){e.method="notebookDocument/didOpen",e.messageDirection=Fr.MessageDirection.clientToServer,e.type=new Fr.ProtocolNotificationType(e.method),e.registrationMethod=Vs.method})(TE||(Ve.DidOpenNotebookDocumentNotification=TE={}));var AE;(function(e){function t(r){let o=r;return _r.objectLiteral(o)&&Fc.uinteger.is(o.start)&&Fc.uinteger.is(o.deleteCount)&&(o.cells===void 0||_r.typedArray(o.cells,xd.is))}e.is=t;function n(r,o,s){let a={start:r,deleteCount:o};return s!==void 0&&(a.cells=s),a}e.create=n})(AE||(Ve.NotebookCellArrayChange=AE={}));var IE;(function(e){e.method="notebookDocument/didChange",e.messageDirection=Fr.MessageDirection.clientToServer,e.type=new Fr.ProtocolNotificationType(e.method),e.registrationMethod=Vs.method})(IE||(Ve.DidChangeNotebookDocumentNotification=IE={}));var DE;(function(e){e.method="notebookDocument/didSave",e.messageDirection=Fr.MessageDirection.clientToServer,e.type=new Fr.ProtocolNotificationType(e.method),e.registrationMethod=Vs.method})(DE||(Ve.DidSaveNotebookDocumentNotification=DE={}));var kE;(function(e){e.method="notebookDocument/didClose",e.messageDirection=Fr.MessageDirection.clientToServer,e.type=new Fr.ProtocolNotificationType(e.method),e.registrationMethod=Vs.method})(kE||(Ve.DidCloseNotebookDocumentNotification=kE={}))});var OE=C(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});vd.InlineCompletionRequest=void 0;var J_=Ze(),LE;(function(e){e.method="textDocument/inlineCompletion",e.messageDirection=J_.MessageDirection.clientToServer,e.type=new J_.ProtocolRequestType(e.method),e.capabilities=J_.CM.create("textDocument.inlineCompletion","inlineCompletionProvider")})(LE||(vd.InlineCompletionRequest=LE={}))});var qE=C(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.TextDocumentContentRefreshRequest=Gs.TextDocumentContentRequest=void 0;var Lc=Ze(),ME;(function(e){e.method="workspace/textDocumentContent",e.messageDirection=Lc.MessageDirection.clientToServer,e.type=new Lc.ProtocolRequestType(e.method),e.capabilities=Lc.CM.create("workspace.textDocumentContent","workspace.textDocumentContent")})(ME||(Gs.TextDocumentContentRequest=ME={}));var $E;(function(e){e.method="workspace/textDocumentContent/refresh",e.messageDirection=Lc.MessageDirection.serverToClient,e.type=new Lc.ProtocolRequestType(e.method)})($E||(Gs.TextDocumentContentRefreshRequest=$E={}))});var ZR=C(v=>{"use strict";var PV=v&&v.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),NV=v&&v.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),EV=v&&v.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&PV(n,t,r[o]);return NV(n,t),n}})();Object.defineProperty(v,"__esModule",{value:!0});v.CodeActionRequest=v.DocumentSymbolRequest=v.DocumentHighlightRequest=v.ReferencesRequest=v.DefinitionRequest=v.SignatureHelpRequest=v.SignatureHelpTriggerKind=v.HoverRequest=v.CompletionResolveRequest=v.CompletionRequest=v.CompletionTriggerKind=v.PublishDiagnosticsNotification=v.WatchKind=v.GlobPattern=v.RelativePattern=v.FileChangeType=v.DidChangeWatchedFilesNotification=v.WillSaveTextDocumentWaitUntilRequest=v.WillSaveTextDocumentNotification=v.TextDocumentSaveReason=v.DidSaveTextDocumentNotification=v.DidCloseTextDocumentNotification=v.DidChangeTextDocumentNotification=v.TextDocumentContentChangeEvent=v.DidOpenTextDocumentNotification=v.TextDocumentSyncKind=v.TelemetryEventNotification=v.LogMessageNotification=v.ShowMessageRequest=v.ShowMessageNotification=v.MessageType=v.DidChangeConfigurationNotification=v.ExitNotification=v.ShutdownRequest=v.InitializedNotification=v.InitializeErrorCodes=v.InitializeRequest=v.WorkDoneProgressOptions=v.TextDocumentRegistrationOptions=v.StaticRegistrationOptions=v.PositionEncodingKind=v.RegularExpressionEngineKind=v.FailureHandlingKind=v.ResourceOperationKind=v.UnregistrationRequest=v.RegistrationRequest=v.DocumentSelector=v.NotebookCellTextDocumentFilter=v.NotebookDocumentFilter=v.TextDocumentFilter=void 0;v.UniquenessLevel=v.WillDeleteFilesRequest=v.DidDeleteFilesNotification=v.WillRenameFilesRequest=v.DidRenameFilesNotification=v.WillCreateFilesRequest=v.DidCreateFilesNotification=v.FileOperationPatternKind=v.LinkedEditingRangeRequest=v.ShowDocumentRequest=v.SemanticTokensRegistrationType=v.SemanticTokensRefreshRequest=v.SemanticTokensRangeRequest=v.SemanticTokensDeltaRequest=v.SemanticTokensRequest=v.TokenFormat=v.CallHierarchyPrepareRequest=v.CallHierarchyOutgoingCallsRequest=v.CallHierarchyIncomingCallsRequest=v.WorkDoneProgressCancelNotification=v.WorkDoneProgressCreateRequest=v.WorkDoneProgress=v.SelectionRangeRequest=v.DeclarationRequest=v.FoldingRangeRefreshRequest=v.FoldingRangeRequest=v.ColorPresentationRequest=v.DocumentColorRequest=v.ConfigurationRequest=v.DidChangeWorkspaceFoldersNotification=v.WorkspaceFoldersRequest=v.TypeDefinitionRequest=v.ImplementationRequest=v.ApplyWorkspaceEditRequest=v.ExecuteCommandRequest=v.PrepareRenameRequest=v.RenameRequest=v.PrepareSupportDefaultBehavior=v.DocumentOnTypeFormattingRequest=v.DocumentRangesFormattingRequest=v.DocumentRangeFormattingRequest=v.DocumentFormattingRequest=v.DocumentLinkResolveRequest=v.DocumentLinkRequest=v.CodeLensRefreshRequest=v.CodeLensResolveRequest=v.CodeLensRequest=v.WorkspaceSymbolResolveRequest=v.WorkspaceSymbolRequest=v.CodeActionResolveRequest=void 0;v.TextDocumentContentRefreshRequest=v.TextDocumentContentRequest=v.InlineCompletionRequest=v.DidCloseNotebookDocumentNotification=v.DidSaveNotebookDocumentNotification=v.DidChangeNotebookDocumentNotification=v.NotebookCellArrayChange=v.DidOpenNotebookDocumentNotification=v.NotebookDocumentSyncRegistrationType=v.NotebookDocument=v.NotebookCell=v.ExecutionSummary=v.NotebookCellKind=v.DiagnosticRefreshRequest=v.WorkspaceDiagnosticRequest=v.DocumentDiagnosticRequest=v.DocumentDiagnosticReportKind=v.DiagnosticServerCancellationData=v.InlayHintRefreshRequest=v.InlayHintResolveRequest=v.InlayHintRequest=v.InlineValueRefreshRequest=v.InlineValueRequest=v.TypeHierarchySupertypesRequest=v.TypeHierarchySubtypesRequest=v.TypeHierarchyPrepareRequest=v.MonikerRequest=v.MonikerKind=void 0;var L=Ze(),BE=(md(),Nh(fd)),Vt=EV(pd()),RV=gN();Object.defineProperty(v,"ImplementationRequest",{enumerable:!0,get:function(){return RV.ImplementationRequest}});var TV=yN();Object.defineProperty(v,"TypeDefinitionRequest",{enumerable:!0,get:function(){return TV.TypeDefinitionRequest}});var KR=wN();Object.defineProperty(v,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return KR.WorkspaceFoldersRequest}});Object.defineProperty(v,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return KR.DidChangeWorkspaceFoldersNotification}});var AV=vN();Object.defineProperty(v,"ConfigurationRequest",{enumerable:!0,get:function(){return AV.ConfigurationRequest}});var YR=NN();Object.defineProperty(v,"DocumentColorRequest",{enumerable:!0,get:function(){return YR.DocumentColorRequest}});Object.defineProperty(v,"ColorPresentationRequest",{enumerable:!0,get:function(){return YR.ColorPresentationRequest}});var XR=TN();Object.defineProperty(v,"FoldingRangeRequest",{enumerable:!0,get:function(){return XR.FoldingRangeRequest}});Object.defineProperty(v,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return XR.FoldingRangeRefreshRequest}});var IV=IN();Object.defineProperty(v,"DeclarationRequest",{enumerable:!0,get:function(){return IV.DeclarationRequest}});var DV=kN();Object.defineProperty(v,"SelectionRangeRequest",{enumerable:!0,get:function(){return DV.SelectionRangeRequest}});var iy=MN();Object.defineProperty(v,"WorkDoneProgress",{enumerable:!0,get:function(){return iy.WorkDoneProgress}});Object.defineProperty(v,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return iy.WorkDoneProgressCreateRequest}});Object.defineProperty(v,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return iy.WorkDoneProgressCancelNotification}});var oy=jN();Object.defineProperty(v,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return oy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(v,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return oy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(v,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return oy.CallHierarchyPrepareRequest}});var zs=zN();Object.defineProperty(v,"TokenFormat",{enumerable:!0,get:function(){return zs.TokenFormat}});Object.defineProperty(v,"SemanticTokensRequest",{enumerable:!0,get:function(){return zs.SemanticTokensRequest}});Object.defineProperty(v,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return zs.SemanticTokensDeltaRequest}});Object.defineProperty(v,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return zs.SemanticTokensRangeRequest}});Object.defineProperty(v,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return zs.SemanticTokensRefreshRequest}});Object.defineProperty(v,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return zs.SemanticTokensRegistrationType}});var kV=YN();Object.defineProperty(v,"ShowDocumentRequest",{enumerable:!0,get:function(){return kV.ShowDocumentRequest}});var FV=JN();Object.defineProperty(v,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return FV.LinkedEditingRangeRequest}});var Fo=oE();Object.defineProperty(v,"FileOperationPatternKind",{enumerable:!0,get:function(){return Fo.FileOperationPatternKind}});Object.defineProperty(v,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Fo.DidCreateFilesNotification}});Object.defineProperty(v,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Fo.WillCreateFilesRequest}});Object.defineProperty(v,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Fo.DidRenameFilesNotification}});Object.defineProperty(v,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Fo.WillRenameFilesRequest}});Object.defineProperty(v,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Fo.DidDeleteFilesNotification}});Object.defineProperty(v,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Fo.WillDeleteFilesRequest}});var sy=lE();Object.defineProperty(v,"UniquenessLevel",{enumerable:!0,get:function(){return sy.UniquenessLevel}});Object.defineProperty(v,"MonikerKind",{enumerable:!0,get:function(){return sy.MonikerKind}});Object.defineProperty(v,"MonikerRequest",{enumerable:!0,get:function(){return sy.MonikerRequest}});var ay=mE();Object.defineProperty(v,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return ay.TypeHierarchyPrepareRequest}});Object.defineProperty(v,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return ay.TypeHierarchySubtypesRequest}});Object.defineProperty(v,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return ay.TypeHierarchySupertypesRequest}});var JR=gE();Object.defineProperty(v,"InlineValueRequest",{enumerable:!0,get:function(){return JR.InlineValueRequest}});Object.defineProperty(v,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return JR.InlineValueRefreshRequest}});var cy=SE();Object.defineProperty(v,"InlayHintRequest",{enumerable:!0,get:function(){return cy.InlayHintRequest}});Object.defineProperty(v,"InlayHintResolveRequest",{enumerable:!0,get:function(){return cy.InlayHintResolveRequest}});Object.defineProperty(v,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return cy.InlayHintRefreshRequest}});var Oc=EE();Object.defineProperty(v,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return Oc.DiagnosticServerCancellationData}});Object.defineProperty(v,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return Oc.DocumentDiagnosticReportKind}});Object.defineProperty(v,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return Oc.DocumentDiagnosticRequest}});Object.defineProperty(v,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return Oc.WorkspaceDiagnosticRequest}});Object.defineProperty(v,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return Oc.DiagnosticRefreshRequest}});var Lr=FE();Object.defineProperty(v,"NotebookCellKind",{enumerable:!0,get:function(){return Lr.NotebookCellKind}});Object.defineProperty(v,"ExecutionSummary",{enumerable:!0,get:function(){return Lr.ExecutionSummary}});Object.defineProperty(v,"NotebookCell",{enumerable:!0,get:function(){return Lr.NotebookCell}});Object.defineProperty(v,"NotebookDocument",{enumerable:!0,get:function(){return Lr.NotebookDocument}});Object.defineProperty(v,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return Lr.NotebookDocumentSyncRegistrationType}});Object.defineProperty(v,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return Lr.DidOpenNotebookDocumentNotification}});Object.defineProperty(v,"NotebookCellArrayChange",{enumerable:!0,get:function(){return Lr.NotebookCellArrayChange}});Object.defineProperty(v,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return Lr.DidChangeNotebookDocumentNotification}});Object.defineProperty(v,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return Lr.DidSaveNotebookDocumentNotification}});Object.defineProperty(v,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return Lr.DidCloseNotebookDocumentNotification}});var LV=OE();Object.defineProperty(v,"InlineCompletionRequest",{enumerable:!0,get:function(){return LV.InlineCompletionRequest}});var QR=qE();Object.defineProperty(v,"TextDocumentContentRequest",{enumerable:!0,get:function(){return QR.TextDocumentContentRequest}});Object.defineProperty(v,"TextDocumentContentRefreshRequest",{enumerable:!0,get:function(){return QR.TextDocumentContentRefreshRequest}});var Q_;(function(e){function t(n){let r=n;return Vt.string(r)||Vt.string(r.language)||Vt.string(r.scheme)||ry.is(r.pattern)}e.is=t})(Q_||(v.TextDocumentFilter=Q_={}));var Z_;(function(e){function t(n){let r=n;return Vt.objectLiteral(r)&&(Vt.string(r.notebookType)||Vt.string(r.scheme)||Vt.string(r.pattern))}e.is=t})(Z_||(v.NotebookDocumentFilter=Z_={}));var ey;(function(e){function t(n){let r=n;return Vt.objectLiteral(r)&&(Vt.string(r.notebook)||Z_.is(r.notebook))&&(r.language===void 0||Vt.string(r.language))}e.is=t})(ey||(v.NotebookCellTextDocumentFilter=ey={}));var ty;(function(e){function t(n){if(!Array.isArray(n))return!1;for(let r of n)if(!Vt.string(r)&&!Q_.is(r)&&!ey.is(r))return!1;return!0}e.is=t})(ty||(v.DocumentSelector=ty={}));var jE;(function(e){e.method="client/registerCapability",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolRequestType(e.method)})(jE||(v.RegistrationRequest=jE={}));var WE;(function(e){e.method="client/unregisterCapability",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolRequestType(e.method)})(WE||(v.UnregistrationRequest=WE={}));var UE;(function(e){e.Create="create",e.Rename="rename",e.Delete="delete"})(UE||(v.ResourceOperationKind=UE={}));var HE;(function(e){e.Abort="abort",e.Transactional="transactional",e.TextOnlyTransactional="textOnlyTransactional",e.Undo="undo"})(HE||(v.FailureHandlingKind=HE={}));var VE;(function(e){e.ES2020="ES2020"})(VE||(v.RegularExpressionEngineKind=VE={}));var GE;(function(e){e.UTF8="utf-8",e.UTF16="utf-16",e.UTF32="utf-32"})(GE||(v.PositionEncodingKind=GE={}));var zE;(function(e){function t(n){let r=n;return r&&Vt.string(r.id)&&r.id.length>0}e.hasId=t})(zE||(v.StaticRegistrationOptions=zE={}));var KE;(function(e){function t(n){let r=n;return r&&(r.documentSelector===null||ty.is(r.documentSelector))}e.is=t})(KE||(v.TextDocumentRegistrationOptions=KE={}));var YE;(function(e){function t(r){let o=r;return Vt.objectLiteral(o)&&(o.workDoneProgress===void 0||Vt.boolean(o.workDoneProgress))}e.is=t;function n(r){let o=r;return o&&Vt.boolean(o.workDoneProgress)}e.hasWorkDoneProgress=n})(YE||(v.WorkDoneProgressOptions=YE={}));var XE;(function(e){e.method="initialize",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method)})(XE||(v.InitializeRequest=XE={}));var JE;(function(e){e.unknownProtocolVersion=1})(JE||(v.InitializeErrorCodes=JE={}));var QE;(function(e){e.method="initialized",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method)})(QE||(v.InitializedNotification=QE={}));var ZE;(function(e){e.method="shutdown",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType0(e.method)})(ZE||(v.ShutdownRequest=ZE={}));var eR;(function(e){e.method="exit",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType0(e.method)})(eR||(v.ExitNotification=eR={}));var tR;(function(e){e.method="workspace/didChangeConfiguration",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("workspace.didChangeConfiguration",void 0)})(tR||(v.DidChangeConfigurationNotification=tR={}));var nR;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4,e.Debug=5})(nR||(v.MessageType=nR={}));var rR;(function(e){e.method="window/showMessage",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("window.showMessage",void 0)})(rR||(v.ShowMessageNotification=rR={}));var iR;(function(e){e.method="window/showMessageRequest",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("window.showMessage",void 0)})(iR||(v.ShowMessageRequest=iR={}));var oR;(function(e){e.method="window/logMessage",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolNotificationType(e.method)})(oR||(v.LogMessageNotification=oR={}));var sR;(function(e){e.method="telemetry/event",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolNotificationType(e.method)})(sR||(v.TelemetryEventNotification=sR={}));var aR;(function(e){e.None=0,e.Full=1,e.Incremental=2})(aR||(v.TextDocumentSyncKind=aR={}));var cR;(function(e){e.method="textDocument/didOpen",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(cR||(v.DidOpenTextDocumentNotification=cR={}));var lR;(function(e){function t(r){let o=r;return o!=null&&typeof o.text=="string"&&o.range!==void 0&&(o.rangeLength===void 0||typeof o.rangeLength=="number")}e.isIncremental=t;function n(r){let o=r;return o!=null&&typeof o.text=="string"&&o.range===void 0&&o.rangeLength===void 0}e.isFull=n})(lR||(v.TextDocumentContentChangeEvent=lR={}));var uR;(function(e){e.method="textDocument/didChange",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.synchronization","textDocumentSync")})(uR||(v.DidChangeTextDocumentNotification=uR={}));var dR;(function(e){e.method="textDocument/didClose",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(dR||(v.DidCloseTextDocumentNotification=dR={}));var fR;(function(e){e.method="textDocument/didSave",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.synchronization.didSave","textDocumentSync.save")})(fR||(v.DidSaveTextDocumentNotification=fR={}));var mR;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(mR||(v.TextDocumentSaveReason=mR={}));var pR;(function(e){e.method="textDocument/willSave",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.synchronization.willSave","textDocumentSync.willSave")})(pR||(v.WillSaveTextDocumentNotification=pR={}));var hR;(function(e){e.method="textDocument/willSaveWaitUntil",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.synchronization.willSaveWaitUntil","textDocumentSync.willSaveWaitUntil")})(hR||(v.WillSaveTextDocumentWaitUntilRequest=hR={}));var gR;(function(e){e.method="workspace/didChangeWatchedFiles",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("workspace.didChangeWatchedFiles",void 0)})(gR||(v.DidChangeWatchedFilesNotification=gR={}));var _R;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(_R||(v.FileChangeType=_R={}));var ny;(function(e){function t(n){let r=n;return Vt.objectLiteral(r)&&(BE.URI.is(r.baseUri)||BE.WorkspaceFolder.is(r.baseUri))&&Vt.string(r.pattern)}e.is=t})(ny||(v.RelativePattern=ny={}));var ry;(function(e){function t(n){let r=n;return Vt.string(r)||ny.is(r)}e.is=t})(ry||(v.GlobPattern=ry={}));var yR;(function(e){e.Create=1,e.Change=2,e.Delete=4})(yR||(v.WatchKind=yR={}));var bR;(function(e){e.method="textDocument/publishDiagnostics",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.publishDiagnostics",void 0)})(bR||(v.PublishDiagnosticsNotification=bR={}));var SR;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.TriggerForIncompleteCompletions=3})(SR||(v.CompletionTriggerKind=SR={}));var wR;(function(e){e.method="textDocument/completion",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.completion","completionProvider")})(wR||(v.CompletionRequest=wR={}));var xR;(function(e){e.method="completionItem/resolve",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.completion.completionItem.resolveSupport","completionProvider.resolveProvider")})(xR||(v.CompletionResolveRequest=xR={}));var vR;(function(e){e.method="textDocument/hover",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.hover","hoverProvider")})(vR||(v.HoverRequest=vR={}));var CR;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(CR||(v.SignatureHelpTriggerKind=CR={}));var PR;(function(e){e.method="textDocument/signatureHelp",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.signatureHelp","signatureHelpProvider")})(PR||(v.SignatureHelpRequest=PR={}));var NR;(function(e){e.method="textDocument/definition",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.definition","definitionProvider")})(NR||(v.DefinitionRequest=NR={}));var ER;(function(e){e.method="textDocument/references",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.references","referencesProvider")})(ER||(v.ReferencesRequest=ER={}));var RR;(function(e){e.method="textDocument/documentHighlight",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.documentHighlight","documentHighlightProvider")})(RR||(v.DocumentHighlightRequest=RR={}));var TR;(function(e){e.method="textDocument/documentSymbol",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.documentSymbol","documentSymbolProvider")})(TR||(v.DocumentSymbolRequest=TR={}));var AR;(function(e){e.method="textDocument/codeAction",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.codeAction","codeActionProvider")})(AR||(v.CodeActionRequest=AR={}));var IR;(function(e){e.method="codeAction/resolve",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.codeAction.resolveSupport","codeActionProvider.resolveProvider")})(IR||(v.CodeActionResolveRequest=IR={}));var DR;(function(e){e.method="workspace/symbol",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("workspace.symbol","workspaceSymbolProvider")})(DR||(v.WorkspaceSymbolRequest=DR={}));var kR;(function(e){e.method="workspaceSymbol/resolve",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("workspace.symbol.resolveSupport","workspaceSymbolProvider.resolveProvider")})(kR||(v.WorkspaceSymbolResolveRequest=kR={}));var FR;(function(e){e.method="textDocument/codeLens",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.codeLens","codeLensProvider")})(FR||(v.CodeLensRequest=FR={}));var LR;(function(e){e.method="codeLens/resolve",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.codeLens.resolveSupport","codeLensProvider.resolveProvider")})(LR||(v.CodeLensResolveRequest=LR={}));var OR;(function(e){e.method="workspace/codeLens/refresh",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolRequestType0(e.method),e.capabilities=L.CM.create("workspace.codeLens",void 0)})(OR||(v.CodeLensRefreshRequest=OR={}));var MR;(function(e){e.method="textDocument/documentLink",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.documentLink","documentLinkProvider")})(MR||(v.DocumentLinkRequest=MR={}));var $R;(function(e){e.method="documentLink/resolve",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.documentLink","documentLinkProvider.resolveProvider")})($R||(v.DocumentLinkResolveRequest=$R={}));var qR;(function(e){e.method="textDocument/formatting",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.formatting","documentFormattingProvider")})(qR||(v.DocumentFormattingRequest=qR={}));var BR;(function(e){e.method="textDocument/rangeFormatting",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.rangeFormatting","documentRangeFormattingProvider")})(BR||(v.DocumentRangeFormattingRequest=BR={}));var jR;(function(e){e.method="textDocument/rangesFormatting",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.rangeFormatting.rangesSupport","documentRangeFormattingProvider.rangesSupport")})(jR||(v.DocumentRangesFormattingRequest=jR={}));var WR;(function(e){e.method="textDocument/onTypeFormatting",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.onTypeFormatting","documentOnTypeFormattingProvider")})(WR||(v.DocumentOnTypeFormattingRequest=WR={}));var UR;(function(e){e.Identifier=1})(UR||(v.PrepareSupportDefaultBehavior=UR={}));var HR;(function(e){e.method="textDocument/rename",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.rename","renameProvider")})(HR||(v.RenameRequest=HR={}));var VR;(function(e){e.method="textDocument/prepareRename",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.rename.prepareSupport","renameProvider.prepareProvider")})(VR||(v.PrepareRenameRequest=VR={}));var GR;(function(e){e.method="workspace/executeCommand",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("workspace.executeCommand","executeCommandProvider")})(GR||(v.ExecuteCommandRequest=GR={}));var zR;(function(e){e.method="workspace/applyEdit",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolRequestType("workspace/applyEdit"),e.capabilities=L.CM.create("workspace.applyEdit",void 0)})(zR||(v.ApplyWorkspaceEditRequest=zR={}))});var tT=C(ly=>{"use strict";Object.defineProperty(ly,"__esModule",{value:!0});ly.createProtocolConnection=OV;var eT=ri();function OV(e,t,n,r){return eT.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,eT.createMessageConnection)(e,t,n,r)}});var _t=C(En=>{"use strict";var MV=En&&En.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Cd=En&&En.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&MV(t,e,n)};Object.defineProperty(En,"__esModule",{value:!0});En.LSPErrorCodes=En.createProtocolConnection=void 0;Cd(ri(),En);Cd((md(),Nh(fd)),En);Cd(Ze(),En);Cd(ZR(),En);var $V=tT();Object.defineProperty(En,"createProtocolConnection",{enumerable:!0,get:function(){return $V.createProtocolConnection}});var nT;(function(e){e.lspReservedErrorRangeStart=-32899,e.RequestFailed=-32803,e.ServerCancelled=-32802,e.ContentModified=-32801,e.RequestCancelled=-32800,e.lspReservedErrorRangeEnd=-32800})(nT||(En.LSPErrorCodes=nT={}))});var dy=C(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.empty=void 0;Mi.v4=rT;Mi.isUUID=iT;Mi.parse=BV;Mi.generateUuid=jV;var Mc=class{_value;constructor(t){this._value=t}asHex(){return this._value}equals(t){return this.asHex()===t.asHex()}},uy=class e extends Mc{static _chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];static _timeHighBits=["8","9","a","b"];static _oneOf(t){return t[Math.floor(t.length*Math.random())]}static _randomHex(){return e._oneOf(e._chars)}constructor(){super([e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),"-",e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),"-","4",e._randomHex(),e._randomHex(),e._randomHex(),"-",e._oneOf(e._timeHighBits),e._randomHex(),e._randomHex(),e._randomHex(),"-",e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex()].join(""))}};Mi.empty=new Mc("00000000-0000-0000-0000-000000000000");function rT(){return new uy}var qV=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function iT(e){return qV.test(e)}function BV(e){if(!iT(e))throw new Error("invalid uuid");return new Mc(e)}function jV(){return rT().asHex()}});var oT=C(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.ProgressFeature=void 0;Ys.attachWorkDone=UV;Ys.attachPartialResult=VV;var $i=_t(),WV=dy(),Ks=class e{_connection;_token;static Instances=new Map;constructor(t,n){this._connection=t,this._token=n,e.Instances.set(this._token,this)}begin(t,n,r,o){let s={kind:"begin",title:t,message:r,cancellable:o};typeof n=="number"&&(s.percentage=Math.round(n)),this._connection.sendProgress($i.WorkDoneProgress.type,this._token,s)}report(t,n){let r={kind:"report"};typeof t=="number"?(r.percentage=Math.round(t),n!==void 0&&(r.message=n)):r.message=t,this._connection.sendProgress($i.WorkDoneProgress.type,this._token,r)}done(){e.Instances.delete(this._token),this._connection.sendProgress($i.WorkDoneProgress.type,this._token,{kind:"end"})}},Pd=class extends Ks{_source;constructor(t,n){super(t,n),this._source=new $i.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},$c=class{constructor(){}begin(){}report(){}done(){}},Nd=class extends $c{_source;constructor(){super(),this._source=new $i.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function UV(e,t){if(t===void 0||t.workDoneToken===void 0)return new $c;let n=t.workDoneToken;return delete t.workDoneToken,new Ks(e,n)}var HV=e=>class extends e{_progressSupported;constructor(){super(),this._progressSupported=!1}initialize(t){super.initialize(t),t?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification($i.WorkDoneProgressCancelNotification.type,n=>{let r=Ks.Instances.get(n.token);(r instanceof Pd||r instanceof Nd)&&r.cancel()}))}attachWorkDoneProgress(t){return t===void 0?new $c:new Ks(this.connection,t)}createWorkDoneProgress(){if(this._progressSupported){let t=(0,WV.generateUuid)();return this.connection.sendRequest($i.WorkDoneProgressCreateRequest.type,{token:t}).then(()=>new Pd(this.connection,t))}else return Promise.resolve(new Nd)}};Ys.ProgressFeature=HV;var fy;(function(e){e.type=new $i.ProgressType})(fy||(fy={}));var my=class{_connection;_token;constructor(t,n){this._connection=t,this._token=n}report(t){this._connection.sendProgress(fy.type,this._token,t)}};function VV(e,t){if(t===void 0||t.partialResultToken===void 0)return;let n=t.partialResultToken;return delete t.partialResultToken,new my(e,n)}});var sT=C(Or=>{"use strict";var GV=Or&&Or.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),zV=Or&&Or.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),KV=Or&&Or.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&GV(n,t,r[o]);return zV(n,t),n}})();Object.defineProperty(Or,"__esModule",{value:!0});Or.ConfigurationFeature=void 0;var YV=_t(),XV=KV(ju()),JV=e=>class extends e{getConfiguration(t){return t?XV.string(t)?this._getConfiguration({section:t}):this._getConfiguration(t):this._getConfiguration({})}_getConfiguration(t){let n={items:Array.isArray(t)?t:[t]};return this.connection.sendRequest(YV.ConfigurationRequest.type,n).then(r=>Array.isArray(r)?Array.isArray(t)?r:r[0]:Array.isArray(t)?[]:null)}};Or.ConfigurationFeature=JV});var aT=C(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.WorkspaceFoldersFeature=void 0;var Ed=_t(),QV=e=>class extends e{_onDidChangeWorkspaceFolders;_unregistration;_notificationIsAutoRegistered;constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(t){super.initialize(t);let n=t.workspace;n&&n.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Ed.Emitter,this.connection.onNotification(Ed.DidChangeWorkspaceFoldersNotification.type,r=>{this._onDidChangeWorkspaceFolders.fire(r.event)}))}fillServerCapabilities(t){super.fillServerCapabilities(t);let n=t.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=n===!0||typeof n=="string"}getWorkspaceFolders(){return this.connection.sendRequest(Ed.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(Ed.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Rd.WorkspaceFoldersFeature=QV});var cT=C(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});Td.CallHierarchyFeature=void 0;var py=_t(),ZV=e=>class extends e{get callHierarchy(){return{onPrepare:t=>this.connection.onRequest(py.CallHierarchyPrepareRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),void 0)),onIncomingCalls:t=>{let n=py.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onOutgoingCalls:t=>{let n=py.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Td.CallHierarchyFeature=ZV});var gy=C(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.SemanticTokensBuilder=qi.SemanticTokensDiff=qi.SemanticTokensFeature=void 0;var Ad=_t(),e2=e=>class extends e{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Ad.SemanticTokensRefreshRequest.type),on:t=>{let n=Ad.SemanticTokensRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onDelta:t=>{let n=Ad.SemanticTokensDeltaRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onRange:t=>{let n=Ad.SemanticTokensRangeRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};qi.SemanticTokensFeature=e2;var Id=class{originalSequence;modifiedSequence;constructor(t,n){this.originalSequence=t,this.modifiedSequence=n}computeDiff(){let t=this.originalSequence.length,n=this.modifiedSequence.length,r=0;for(;r<n&&r<t&&this.originalSequence[r]===this.modifiedSequence[r];)r++;if(r<n&&r<t){let o=t-1,s=n-1;for(;o>=r&&s>=r&&this.originalSequence[o]===this.modifiedSequence[s];)o--,s--;(o<r||s<r)&&(o++,s++);let a=o-r+1,c=this.modifiedSequence.slice(r,s+1);return c.length===1&&c[0]===this.originalSequence[o]?[{start:r,deleteCount:a-1}]:[{start:r,deleteCount:a,data:c}]}else return r<n?[{start:r,deleteCount:0,data:this.modifiedSequence.slice(r)}]:r<t?[{start:r,deleteCount:t-r}]:[]}};qi.SemanticTokensDiff=Id;var hy=class e{_id;_prevLine;_prevChar;_dataIsSortedAndDeltaEncoded;_data;_dataNonDelta;_dataLen;_prevData;constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataNonDelta=[],this._dataLen=0,this._dataIsSortedAndDeltaEncoded=!0}push(t,n,r,o,s){this._dataIsSortedAndDeltaEncoded&&(t<this._prevLine||t===this._prevLine&&n<this._prevChar)&&(this._dataIsSortedAndDeltaEncoded=!1,this._dataNonDelta=e._deltaDecode(this._data));let a=t,c=n;this._dataIsSortedAndDeltaEncoded&&this._dataLen>0&&(a-=this._prevLine,a===0&&(c-=this._prevChar));let l=this._dataIsSortedAndDeltaEncoded?this._data:this._dataNonDelta;l[this._dataLen++]=a,l[this._dataLen++]=c,l[this._dataLen++]=r,l[this._dataLen++]=o,l[this._dataLen++]=s,this._prevLine=t,this._prevChar=n}get id(){return this._id.toString()}static _deltaDecode(t){let n=t.length/5|0,r=0,o=0,s=[];for(let a=0;a<n;a++){let c=5*a,l=t[c],u=t[c+1];l===0?(l=r,u+=o):l+=r;let d=t[c+2],f=t[c+3],m=t[c+4];s[c+0]=l,s[c+1]=u,s[c+2]=d,s[c+3]=f,s[c+4]=m,r=l,o=u}return s}static _sortAndDeltaEncode(t){let n=[],r=t.length/5|0;for(let c=0;c<r;c++)n[c]=c;n.sort((c,l)=>{let u=t[5*c],d=t[5*l];if(u===d){let f=t[5*c+1],m=t[5*l+1];return f-m}return u-d});let o=[],s=0,a=0;for(let c=0;c<r;c++){let l=5*n[c],u=t[l+0],d=t[l+1],f=t[l+2],m=t[l+3],p=t[l+4],g=u-s,h=g===0?d-a:d,y=5*c;o[y+0]=g,o[y+1]=h,o[y+2]=f,o[y+3]=m,o[y+4]=p,s=u,a=d}return o}getFinalDataDelta(){return this._dataIsSortedAndDeltaEncoded?this._data:e._sortAndDeltaEncode(this._dataNonDelta)}previousResult(t){this.id===t&&(this._prevData=this.getFinalDataDelta()),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this.getFinalDataDelta()}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData!==void 0?{resultId:this.id,edits:new Id(this._prevData,this.getFinalDataDelta()).computeDiff()}:this.build()}};qi.SemanticTokensBuilder=hy});var lT=C(Dd=>{"use strict";Object.defineProperty(Dd,"__esModule",{value:!0});Dd.ShowDocumentFeature=void 0;var t2=_t(),n2=e=>class extends e{showDocument(t){return this.connection.sendRequest(t2.ShowDocumentRequest.type,t)}};Dd.ShowDocumentFeature=n2});var uT=C(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});kd.FileOperationsFeature=void 0;var Xs=_t(),r2=e=>class extends e{onDidCreateFiles(t){return this.connection.onNotification(Xs.DidCreateFilesNotification.type,n=>t(n))}onDidRenameFiles(t){return this.connection.onNotification(Xs.DidRenameFilesNotification.type,n=>t(n))}onDidDeleteFiles(t){return this.connection.onNotification(Xs.DidDeleteFilesNotification.type,n=>t(n))}onWillCreateFiles(t){return this.connection.onRequest(Xs.WillCreateFilesRequest.type,(n,r)=>t(n,r))}onWillRenameFiles(t){return this.connection.onRequest(Xs.WillRenameFilesRequest.type,(n,r)=>t(n,r))}onWillDeleteFiles(t){return this.connection.onRequest(Xs.WillDeleteFilesRequest.type,(n,r)=>t(n,r))}};kd.FileOperationsFeature=r2});var dT=C(Fd=>{"use strict";Object.defineProperty(Fd,"__esModule",{value:!0});Fd.LinkedEditingRangeFeature=void 0;var i2=_t(),o2=e=>class extends e{onLinkedEditingRange(t){return this.connection.onRequest(i2.LinkedEditingRangeRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),void 0))}};Fd.LinkedEditingRangeFeature=o2});var fT=C(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.TypeHierarchyFeature=void 0;var _y=_t(),s2=e=>class extends e{get typeHierarchy(){return{onPrepare:t=>this.connection.onRequest(_y.TypeHierarchyPrepareRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),void 0)),onSupertypes:t=>{let n=_y.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onSubtypes:t=>{let n=_y.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Ld.TypeHierarchyFeature=s2});var pT=C(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.InlineValueFeature=void 0;var mT=_t(),a2=e=>class extends e{get inlineValue(){return{refresh:()=>this.connection.sendRequest(mT.InlineValueRefreshRequest.type),on:t=>this.connection.onRequest(mT.InlineValueRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n)))}}};Od.InlineValueFeature=a2});var gT=C(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.FoldingRangeFeature=void 0;var hT=_t(),c2=e=>class extends e{get foldingRange(){return{refresh:()=>this.connection.sendRequest(hT.FoldingRangeRefreshRequest.type),on:t=>{let n=hT.FoldingRangeRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Md.FoldingRangeFeature=c2});var _T=C($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});$d.InlayHintFeature=void 0;var yy=_t(),l2=e=>class extends e{get inlayHint(){return{refresh:()=>this.connection.sendRequest(yy.InlayHintRefreshRequest.type),on:t=>this.connection.onRequest(yy.InlayHintRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n))),resolve:t=>this.connection.onRequest(yy.InlayHintResolveRequest.type,(n,r)=>t(n,r))}}};$d.InlayHintFeature=l2});var yT=C(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.DiagnosticFeature=void 0;var qc=_t(),u2=e=>class extends e{get diagnostics(){return{refresh:()=>this.connection.sendRequest(qc.DiagnosticRefreshRequest.type),on:t=>this.connection.onRequest(qc.DocumentDiagnosticRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(qc.DocumentDiagnosticRequest.partialResult,n))),onWorkspace:t=>this.connection.onRequest(qc.WorkspaceDiagnosticRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(qc.WorkspaceDiagnosticRequest.partialResult,n)))}}};qd.DiagnosticFeature=u2});var Sy=C(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.TextDocuments=void 0;var Lo=_t(),by=class{_configuration;_syncedDocuments;_onDidChangeContent;_onDidOpen;_onDidClose;_onDidSave;_onWillSave;_willSaveWaitUntil;constructor(t){this._configuration=t,this._syncedDocuments=new Map,this._onDidChangeContent=new Lo.Emitter,this._onDidOpen=new Lo.Emitter,this._onDidClose=new Lo.Emitter,this._onDidSave=new Lo.Emitter,this._onWillSave=new Lo.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(t){this._willSaveWaitUntil=t}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(t){return this._syncedDocuments.get(t)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(t){t.__textDocumentSync=Lo.TextDocumentSyncKind.Incremental;let n=[];return n.push(t.onDidOpenTextDocument(r=>{let o=r.textDocument,s=this._configuration.create(o.uri,o.languageId,o.version,o.text);this._syncedDocuments.set(o.uri,s);let a=Object.freeze({document:s});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),n.push(t.onDidChangeTextDocument(r=>{let o=r.textDocument,s=r.contentChanges;if(s.length===0)return;let{version:a}=o;if(a==null)throw new Error(`Received document change event for ${o.uri} without valid version identifier`);let c=this._syncedDocuments.get(o.uri);c!==void 0&&(c=this._configuration.update(c,s,a),this._syncedDocuments.set(o.uri,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),n.push(t.onDidCloseTextDocument(r=>{let o=this._syncedDocuments.get(r.textDocument.uri);o!==void 0&&(this._syncedDocuments.delete(r.textDocument.uri),this._onDidClose.fire(Object.freeze({document:o})))})),n.push(t.onWillSaveTextDocument(r=>{let o=this._syncedDocuments.get(r.textDocument.uri);o!==void 0&&this._onWillSave.fire(Object.freeze({document:o,reason:r.reason}))})),n.push(t.onWillSaveTextDocumentWaitUntil((r,o)=>{let s=this._syncedDocuments.get(r.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:r.reason}),o):[]})),n.push(t.onDidSaveTextDocument(r=>{let o=this._syncedDocuments.get(r.textDocument.uri);o!==void 0&&this._onDidSave.fire(Object.freeze({document:o}))})),Lo.Disposable.create(()=>{n.forEach(r=>r.dispose())})}};Bd.TextDocuments=by});var vy=C(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.NotebookDocuments=Js.NotebookSyncFeature=void 0;var tr=_t(),bT=Sy(),d2=e=>class extends e{get synchronization(){return{onDidOpenNotebookDocument:t=>this.connection.onNotification(tr.DidOpenNotebookDocumentNotification.type,n=>t(n)),onDidChangeNotebookDocument:t=>this.connection.onNotification(tr.DidChangeNotebookDocumentNotification.type,n=>t(n)),onDidSaveNotebookDocument:t=>this.connection.onNotification(tr.DidSaveNotebookDocumentNotification.type,n=>t(n)),onDidCloseNotebookDocument:t=>this.connection.onNotification(tr.DidCloseNotebookDocumentNotification.type,n=>t(n))}}};Js.NotebookSyncFeature=d2;var wy=class e{static NULL_DISPOSE=Object.freeze({dispose:()=>{}});openHandler;changeHandler;closeHandler;onDidOpenTextDocument(t){return this.openHandler=t,tr.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(t){return this.openHandler&&this.openHandler(t)}onDidChangeTextDocument(t){return this.changeHandler=t,tr.Disposable.create(()=>{this.changeHandler=t})}changeTextDocument(t){return this.changeHandler&&this.changeHandler(t)}onDidCloseTextDocument(t){return this.closeHandler=t,tr.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(t){return this.closeHandler&&this.closeHandler(t)}onWillSaveTextDocument(){return e.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return e.NULL_DISPOSE}onDidSaveTextDocument(){return e.NULL_DISPOSE}},xy=class{notebookDocuments;notebookCellMap;_onDidOpen;_onDidSave;_onDidChange;_onDidClose;_cellTextDocuments;constructor(t){t instanceof bT.TextDocuments?this._cellTextDocuments=t:this._cellTextDocuments=new bT.TextDocuments(t),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new tr.Emitter,this._onDidChange=new tr.Emitter,this._onDidSave=new tr.Emitter,this._onDidClose=new tr.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(t){return this._cellTextDocuments.get(t.document)}getNotebookDocument(t){return this.notebookDocuments.get(t)}getNotebookCell(t){let n=this.notebookCellMap.get(t);return n&&n[0]}findNotebookDocumentForCell(t){let n=typeof t=="string"?t:t.document,r=this.notebookCellMap.get(n);return r&&r[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(t){let n=new wy,r=[];return r.push(this.cellTextDocuments.listen(n)),r.push(t.notebooks.synchronization.onDidOpenNotebookDocument(async o=>{this.notebookDocuments.set(o.notebookDocument.uri,o.notebookDocument);for(let s of o.cellTextDocuments)await n.openTextDocument({textDocument:s});this.updateCellMap(o.notebookDocument),this._onDidOpen.fire(o.notebookDocument)})),r.push(t.notebooks.synchronization.onDidChangeNotebookDocument(async o=>{let s=this.notebookDocuments.get(o.notebookDocument.uri);if(s===void 0)return;s.version=o.notebookDocument.version;let a=s.metadata,c=!1,l=o.change;l.metadata!==void 0&&(c=!0,s.metadata=l.metadata);let u=[],d=[],f=[],m=[];if(l.cells!==void 0){let w=l.cells;if(w.structure!==void 0){let _=w.structure.array;if(s.cells.splice(_.start,_.deleteCount,..._.cells!==void 0?_.cells:[]),w.structure.didOpen!==void 0)for(let b of w.structure.didOpen)await n.openTextDocument({textDocument:b}),u.push(b.uri);if(w.structure.didClose)for(let b of w.structure.didClose)await n.closeTextDocument({textDocument:b}),d.push(b.uri)}if(w.data!==void 0){let _=new Map(w.data.map(b=>[b.document,b]));for(let b=0;b<=s.cells.length;b++){let S=_.get(s.cells[b].document);if(S!==void 0){let N=s.cells.splice(b,1,S);if(f.push({old:N[0],new:S}),_.delete(S.document),_.size===0)break}}}if(w.textContent!==void 0)for(let _ of w.textContent)await n.changeTextDocument({textDocument:_.document,contentChanges:_.changes}),m.push(_.document.uri)}this.updateCellMap(s);let p={notebookDocument:s};c&&(p.metadata={old:a,new:s.metadata});let g=[];for(let w of u)g.push(this.getNotebookCell(w));let h=[];for(let w of d)h.push(this.getNotebookCell(w));let y=[];for(let w of m)y.push(this.getNotebookCell(w));(g.length>0||h.length>0||f.length>0||y.length>0)&&(p.cells={added:g,removed:h,changed:{data:f,textContent:y}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),r.push(t.notebooks.synchronization.onDidSaveNotebookDocument(o=>{let s=this.notebookDocuments.get(o.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),r.push(t.notebooks.synchronization.onDidCloseNotebookDocument(async o=>{let s=this.notebookDocuments.get(o.notebookDocument.uri);if(s!==void 0){this._onDidClose.fire(s);for(let a of o.cellTextDocuments)await n.closeTextDocument({textDocument:a});this.notebookDocuments.delete(o.notebookDocument.uri);for(let a of s.cells)this.notebookCellMap.delete(a.document)}})),tr.Disposable.create(()=>{r.forEach(o=>o.dispose())})}updateCellMap(t){for(let n of t.cells)this.notebookCellMap.set(n.document,[n,t])}};Js.NotebookDocuments=xy});var ST=C(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.MonikerFeature=void 0;var f2=_t(),m2=e=>class extends e{get moniker(){return{on:t=>{let n=f2.MonikerRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};jd.MonikerFeature=m2});var wT=C(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.InlineCompletionFeature=void 0;var p2=_t(),h2=e=>class extends e{get inlineCompletion(){return{on:t=>this.connection.onRequest(p2.InlineCompletionRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n)))}}};Wd.InlineCompletionFeature=h2});var vT=C(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.TextDocumentContentFeature=void 0;var xT=_t(),g2=e=>class extends e{get textDocumentContent(){return{refresh:t=>this.connection.sendRequest(xT.TextDocumentContentRefreshRequest.type,{uri:t}),on:t=>this.connection.onRequest(xT.TextDocumentContentRequest.type,(n,r)=>t(n,r))}}};Ud.TextDocumentContentFeature=g2});var Ty=C(Ge=>{"use strict";var _2=Ge&&Ge.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),y2=Ge&&Ge.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),AT=Ge&&Ge.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&_2(n,t,r[o]);return y2(n,t),n}})();Object.defineProperty(Ge,"__esModule",{value:!0});Ge._NotebooksImpl=Ge._LanguagesImpl=Ge.BulkUnregistration=Ge.BulkRegistration=Ge.ErrorMessageTracker=void 0;Ge.combineConsoleFeatures=IT;Ge.combineTelemetryFeatures=DT;Ge.combineTracerFeatures=kT;Ge.combineClientFeatures=FT;Ge.combineWindowFeatures=LT;Ge.combineWorkspaceFeatures=OT;Ge.combineLanguagesFeatures=MT;Ge.combineNotebooksFeatures=$T;Ge.combineFeatures=L2;Ge.createConnection=O2;var G=_t(),nr=AT(ju()),Py=AT(dy()),ue=oT(),b2=sT(),S2=aT(),w2=cT(),x2=gy(),v2=lT(),C2=uT(),P2=dT(),N2=fT(),E2=pT(),R2=gT(),T2=_T(),A2=yT(),I2=vy(),D2=ST(),k2=wT(),F2=vT();function Cy(e){if(e!==null)return e}var Ny=class{_messages;constructor(){this._messages=Object.create(null)}add(t){let n=this._messages[t];n||(n=0),n++,this._messages[t]=n}sendErrors(t){Object.keys(this._messages).forEach(n=>{t.window.showErrorMessage(n)})}};Ge.ErrorMessageTracker=Ny;var Hd=class{_rawConnection;_connection;constructor(){}rawAttach(t){this._rawConnection=t}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(t){}initialize(t){}error(t){this.send(G.MessageType.Error,t)}warn(t){this.send(G.MessageType.Warning,t)}info(t){this.send(G.MessageType.Info,t)}log(t){this.send(G.MessageType.Log,t)}debug(t){this.send(G.MessageType.Debug,t)}send(t,n){this._rawConnection&&this._rawConnection.sendNotification(G.LogMessageNotification.type,{type:t,message:n}).catch(()=>{(0,G.RAL)().console.error("Sending log message failed")})}},Ey=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}showErrorMessage(t,...n){let r={type:G.MessageType.Error,message:t,actions:n};return this.connection.sendRequest(G.ShowMessageRequest.type,r).then(Cy)}showWarningMessage(t,...n){let r={type:G.MessageType.Warning,message:t,actions:n};return this.connection.sendRequest(G.ShowMessageRequest.type,r).then(Cy)}showInformationMessage(t,...n){let r={type:G.MessageType.Info,message:t,actions:n};return this.connection.sendRequest(G.ShowMessageRequest.type,r).then(Cy)}},CT=(0,v2.ShowDocumentFeature)((0,ue.ProgressFeature)(Ey)),PT;(function(e){function t(){return new Vd}e.create=t})(PT||(Ge.BulkRegistration=PT={}));var Vd=class{_registrations=[];_registered=new Set;add(t,n){let r=nr.string(t)?t:t.method;if(this._registered.has(r))throw new Error(`${r} is already added to this registration`);let o=Py.generateUuid();this._registrations.push({id:o,method:r,registerOptions:n||{}}),this._registered.add(r)}asRegistrationParams(){return{registrations:this._registrations}}},NT;(function(e){function t(){return new Bc(void 0,[])}e.create=t})(NT||(Ge.BulkUnregistration=NT={}));var Bc=class{_connection;_unregistrations=new Map;constructor(t,n){this._connection=t,n.forEach(r=>{this._unregistrations.set(r.method,r)})}get isAttached(){return!!this._connection}attach(t){this._connection=t}add(t){this._unregistrations.set(t.method,t)}dispose(){let t=[];for(let r of this._unregistrations.values())t.push(r);let n={unregisterations:t};this._connection.sendRequest(G.UnregistrationRequest.type,n).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(t){let n=nr.string(t)?t:t.method,r=this._unregistrations.get(n);if(!r)return!1;let o={unregisterations:[r]};return this._connection.sendRequest(G.UnregistrationRequest.type,o).then(()=>{this._unregistrations.delete(n)},s=>{this._connection.console.info(`Un-registering request handler for ${r.id} failed.`)}),!0}},Gd=class{_connection;attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}register(t,n,r){return t instanceof Vd?this.registerMany(t):t instanceof Bc?this.registerSingle1(t,n,r):this.registerSingle2(t,n)}registerSingle1(t,n,r){let o=nr.string(n)?n:n.method,s=Py.generateUuid(),a={registrations:[{id:s,method:o,registerOptions:r||{}}]};return t.isAttached||t.attach(this.connection),this.connection.sendRequest(G.RegistrationRequest.type,a).then(c=>(t.add({id:s,method:o}),t),c=>(this.connection.console.info(`Registering request handler for ${o} failed.`),Promise.reject(c)))}registerSingle2(t,n){let r=nr.string(t)?t:t.method,o=Py.generateUuid(),s={registrations:[{id:o,method:r,registerOptions:n||{}}]};return this.connection.sendRequest(G.RegistrationRequest.type,s).then(a=>G.Disposable.create(()=>{this.unregisterSingle(o,r).catch(()=>{this.connection.console.info(`Un-registering capability with id ${o} failed.`)})}),a=>(this.connection.console.info(`Registering request handler for ${r} failed.`),Promise.reject(a)))}unregisterSingle(t,n){let r={unregisterations:[{id:t,method:n}]};return this.connection.sendRequest(G.UnregistrationRequest.type,r).catch(()=>{this.connection.console.info(`Un-registering request handler for ${t} failed.`)})}registerMany(t){let n=t.asRegistrationParams();return this.connection.sendRequest(G.RegistrationRequest.type,n).then(()=>new Bc(this._connection,n.registrations.map(r=>({id:r.id,method:r.method}))),r=>(this.connection.console.info("Bulk registration failed."),Promise.reject(r)))}},Ry=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}applyEdit(t){function n(o){return o&&!!o.edit}let r=n(t)?t:{edit:t};return this.connection.sendRequest(G.ApplyWorkspaceEditRequest.type,r)}},ET=(0,F2.TextDocumentContentFeature)((0,C2.FileOperationsFeature)((0,S2.WorkspaceFoldersFeature)((0,b2.ConfigurationFeature)(Ry)))),zd=class{_trace;_connection;constructor(){this._trace=G.Trace.Off}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}set trace(t){this._trace=t}log(t,n){this._trace!==G.Trace.Off&&this.connection.sendNotification(G.LogTraceNotification.type,{message:t,verbose:this._trace===G.Trace.Verbose?n:void 0}).catch(()=>{})}},Kd=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}logEvent(t){this.connection.sendNotification(G.TelemetryEventNotification.type,t).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},Yd=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}attachWorkDoneProgress(t){return(0,ue.attachWorkDone)(this.connection,t)}attachPartialResultProgress(t,n){return(0,ue.attachPartialResult)(this.connection,n)}};Ge._LanguagesImpl=Yd;var RT=(0,k2.InlineCompletionFeature)((0,R2.FoldingRangeFeature)((0,D2.MonikerFeature)((0,A2.DiagnosticFeature)((0,T2.InlayHintFeature)((0,E2.InlineValueFeature)((0,N2.TypeHierarchyFeature)((0,P2.LinkedEditingRangeFeature)((0,x2.SemanticTokensFeature)((0,w2.CallHierarchyFeature)(Yd)))))))))),Xd=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}attachWorkDoneProgress(t){return(0,ue.attachWorkDone)(this.connection,t)}attachPartialResultProgress(t,n){return(0,ue.attachPartialResult)(this.connection,n)}};Ge._NotebooksImpl=Xd;var TT=(0,I2.NotebookSyncFeature)(Xd);function IT(e,t){return function(n){return t(e(n))}}function DT(e,t){return function(n){return t(e(n))}}function kT(e,t){return function(n){return t(e(n))}}function FT(e,t){return function(n){return t(e(n))}}function LT(e,t){return function(n){return t(e(n))}}function OT(e,t){return function(n){return t(e(n))}}function MT(e,t){return function(n){return t(e(n))}}function $T(e,t){return function(n){return t(e(n))}}function L2(e,t){function n(o,s,a){return o&&s?a(o,s):o||s}return{__brand:"features",console:n(e.console,t.console,IT),tracer:n(e.tracer,t.tracer,kT),telemetry:n(e.telemetry,t.telemetry,DT),client:n(e.client,t.client,FT),window:n(e.window,t.window,LT),workspace:n(e.workspace,t.workspace,OT),languages:n(e.languages,t.languages,MT),notebooks:n(e.notebooks,t.notebooks,$T)}}function O2(e,t,n){let r=n&&n.console?new(n.console(Hd)):new Hd,o=e(r);r.rawAttach(o);let s=n&&n.tracer?new(n.tracer(zd)):new zd,a=n&&n.telemetry?new(n.telemetry(Kd)):new Kd,c=n&&n.client?new(n.client(Gd)):new Gd,l=n&&n.window?new(n.window(CT)):new CT,u=n&&n.workspace?new(n.workspace(ET)):new ET,d=n&&n.languages?new(n.languages(RT)):new RT,f=n&&n.notebooks?new(n.notebooks(TT)):new TT,m=[r,s,a,c,l,u,d,f];function p(_){return _ instanceof Promise?_:nr.thenable(_)?new Promise((b,S)=>{_.then(N=>b(N),N=>S(N))}):Promise.resolve(_)}let g,h,y,w={listen:()=>o.listen(),sendRequest:(_,...b)=>o.sendRequest(nr.string(_)?_:_.method,...b),onRequest:(_,b)=>o.onRequest(_,b),sendNotification:(_,b)=>{let S=nr.string(_)?_:_.method;return o.sendNotification(S,b)},onNotification:(_,b)=>o.onNotification(_,b),onProgress:o.onProgress,sendProgress:o.sendProgress,onInitialize:_=>(h=_,{dispose:()=>{h=void 0}}),onInitialized:_=>o.onNotification(G.InitializedNotification.type,_),onShutdown:_=>(g=_,{dispose:()=>{g=void 0}}),onExit:_=>(y=_,{dispose:()=>{y=void 0}}),get console(){return r},get telemetry(){return a},get tracer(){return s},get client(){return c},get window(){return l},get workspace(){return u},get languages(){return d},get notebooks(){return f},onDidChangeConfiguration:_=>o.onNotification(G.DidChangeConfigurationNotification.type,_),onDidChangeWatchedFiles:_=>o.onNotification(G.DidChangeWatchedFilesNotification.type,_),__textDocumentSync:void 0,onDidOpenTextDocument:_=>o.onNotification(G.DidOpenTextDocumentNotification.type,_),onDidChangeTextDocument:_=>o.onNotification(G.DidChangeTextDocumentNotification.type,_),onDidCloseTextDocument:_=>o.onNotification(G.DidCloseTextDocumentNotification.type,_),onWillSaveTextDocument:_=>o.onNotification(G.WillSaveTextDocumentNotification.type,_),onWillSaveTextDocumentWaitUntil:_=>o.onRequest(G.WillSaveTextDocumentWaitUntilRequest.type,_),onDidSaveTextDocument:_=>o.onNotification(G.DidSaveTextDocumentNotification.type,_),sendDiagnostics:_=>o.sendNotification(G.PublishDiagnosticsNotification.type,_),onHover:_=>o.onRequest(G.HoverRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onCompletion:_=>o.onRequest(G.CompletionRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onCompletionResolve:_=>o.onRequest(G.CompletionResolveRequest.type,_),onSignatureHelp:_=>o.onRequest(G.SignatureHelpRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onDeclaration:_=>o.onRequest(G.DeclarationRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onDefinition:_=>o.onRequest(G.DefinitionRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onTypeDefinition:_=>o.onRequest(G.TypeDefinitionRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onImplementation:_=>o.onRequest(G.ImplementationRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onReferences:_=>o.onRequest(G.ReferencesRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onDocumentHighlight:_=>o.onRequest(G.DocumentHighlightRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onDocumentSymbol:_=>o.onRequest(G.DocumentSymbolRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onWorkspaceSymbol:_=>o.onRequest(G.WorkspaceSymbolRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onWorkspaceSymbolResolve:_=>o.onRequest(G.WorkspaceSymbolResolveRequest.type,_),onCodeAction:_=>o.onRequest(G.CodeActionRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onCodeActionResolve:_=>o.onRequest(G.CodeActionResolveRequest.type,(b,S)=>_(b,S)),onCodeLens:_=>o.onRequest(G.CodeLensRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onCodeLensResolve:_=>o.onRequest(G.CodeLensResolveRequest.type,(b,S)=>_(b,S)),onDocumentFormatting:_=>o.onRequest(G.DocumentFormattingRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onDocumentRangeFormatting:_=>o.onRequest(G.DocumentRangeFormattingRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onDocumentRangesFormatting:_=>o.onRequest(G.DocumentRangesFormattingRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onDocumentOnTypeFormatting:_=>o.onRequest(G.DocumentOnTypeFormattingRequest.type,(b,S)=>_(b,S)),onRenameRequest:_=>o.onRequest(G.RenameRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onPrepareRename:_=>o.onRequest(G.PrepareRenameRequest.type,(b,S)=>_(b,S)),onDocumentLinks:_=>o.onRequest(G.DocumentLinkRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onDocumentLinkResolve:_=>o.onRequest(G.DocumentLinkResolveRequest.type,(b,S)=>_(b,S)),onDocumentColor:_=>o.onRequest(G.DocumentColorRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onColorPresentation:_=>o.onRequest(G.ColorPresentationRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onFoldingRanges:_=>o.onRequest(G.FoldingRangeRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onSelectionRanges:_=>o.onRequest(G.SelectionRangeRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onExecuteCommand:_=>o.onRequest(G.ExecuteCommandRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),dispose:()=>o.dispose()};for(let _ of m)_.attach(w);return o.onRequest(G.InitializeRequest.type,_=>{t.initialize(_),nr.string(_.trace)&&(s.trace=G.Trace.fromString(_.trace));for(let b of m)b.initialize(_.capabilities);if(h){let b=h(_,new G.CancellationTokenSource().token,(0,ue.attachWorkDone)(o,_),void 0);return p(b).then(S=>{if(S instanceof G.ResponseError)return S;let N=S;N||(N={capabilities:{}});let R=N.capabilities;R||(R={},N.capabilities=R),R.textDocumentSync===void 0||R.textDocumentSync===null?R.textDocumentSync=nr.number(w.__textDocumentSync)?w.__textDocumentSync:G.TextDocumentSyncKind.None:!nr.number(R.textDocumentSync)&&!nr.number(R.textDocumentSync.change)&&(R.textDocumentSync.change=nr.number(w.__textDocumentSync)?w.__textDocumentSync:G.TextDocumentSyncKind.None);for(let $ of m)$.fillServerCapabilities(R);return N})}else{let b={capabilities:{textDocumentSync:G.TextDocumentSyncKind.None}};for(let S of m)S.fillServerCapabilities(b.capabilities);return b}}),o.onRequest(G.ShutdownRequest.type,()=>{if(t.shutdownReceived=!0,g)return g(new G.CancellationTokenSource().token)}),o.onNotification(G.ExitNotification.type,()=>{try{if(y)return y()}finally{t.shutdownReceived?t.exit(0):t.exit(1)}}),o.onNotification(G.SetTraceNotification.type,_=>{s.trace=G.Trace.fromString(_.value)}),w}});var qT=C(hn=>{"use strict";var M2=hn&&hn.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),$2=hn&&hn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Fy=hn&&hn.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&M2(n,t,r[o]);return $2(n,t),n}})();Object.defineProperty(hn,"__esModule",{value:!0});hn.FileSystem=void 0;hn.uriToFilePath=B2;hn.resolve=Jd;hn.resolveGlobalNodePath=Dy;hn.resolveGlobalYarnPath=j2;hn.resolveModulePath=W2;var q2=Fy(require("url")),yr=Fy(require("path")),Ay=Fy(require("fs")),Ly=require("child_process");function B2(e){let t=q2.parse(e);if(t.protocol!=="file:"||!t.path)return;let n=t.path.split("/");for(let r=0,o=n.length;r<o;r++)n[r]=decodeURIComponent(n[r]);if(process.platform==="win32"&&n.length>1){let r=n[0],o=n[1];r.length===0&&o.length>1&&o[1]===":"&&n.shift()}return yr.normalize(n.join("/"))}function Iy(){return process.platform==="win32"}function Jd(e,t,n,r){let o="NODE_PATH",s=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((a,c)=>{let l=process.env,u=Object.create(null);Object.keys(l).forEach(d=>u[d]=l[d]),t&&Ay.existsSync(t)&&(u[o]?u[o]=t+yr.delimiter+u[o]:u[o]=t,r&&r(`NODE_PATH value is: ${u[o]}`)),u.ELECTRON_RUN_AS_NODE="1";try{let d=(0,Ly.fork)("",[],{cwd:n,env:u,execArgv:["-e",s]});if(d.pid===void 0){c(new Error(`Starting process to resolve node module ${e} failed`));return}d.on("error",m=>{c(m)}),d.on("message",m=>{m.c==="r"&&(d.send({c:"e"}),m.s?a(m.r):c(new Error(`Failed to resolve module: ${e}`)))});let f={c:"rs",a:e};d.send(f)}catch(d){c(d)}})}function Dy(e){let t="npm",n=Object.create(null);Object.keys(process.env).forEach(s=>n[s]=process.env[s]),n.NO_UPDATE_NOTIFIER="true";let r={encoding:"utf8",env:n};Iy()&&(t="npm.cmd",r.shell=!0);let o=()=>{};try{process.on("SIGPIPE",o);let s=(0,Ly.spawnSync)(t,["config","get","prefix"],r).stdout;if(!s){e&&e("'npm config get prefix' didn't return a value.");return}let a=s.trim();return e&&e(`'npm config get prefix' value is: ${a}`),a.length>0?Iy()?yr.join(a,"node_modules"):yr.join(a,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",o)}}function j2(e){let t="yarn",n={encoding:"utf8"};Iy()&&(t="yarn.cmd",n.shell=!0);let r=()=>{};try{process.on("SIGPIPE",r);let o=(0,Ly.spawnSync)(t,["global","dir","--json"],n),s=o.stdout;if(!s){e&&(e("'yarn global dir' didn't return a value."),o.stderr&&e(o.stderr));return}let a=s.trim().split(/\r?\n/);for(let c of a)try{let l=JSON.parse(c);if(l.type==="log")return yr.join(l.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",r)}}var ky;(function(e){let t;function n(){return t!==void 0||(process.platform==="win32"?t=!1:t=!Ay.existsSync(__filename.toUpperCase())||!Ay.existsSync(__filename.toLowerCase())),t}e.isCaseSensitive=n;function r(o,s){return n()?yr.normalize(s).indexOf(yr.normalize(o))===0:yr.normalize(s).toLowerCase().indexOf(yr.normalize(o).toLowerCase())===0}e.isParent=r})(ky||(hn.FileSystem=ky={}));function W2(e,t,n,r){return n?(yr.isAbsolute(n)||(n=yr.join(e,n)),Jd(t,n,n,r).then(o=>ky.isParent(n,o)?o:Promise.reject(new Error(`Failed to load ${t} from node path location.`))).then(void 0,o=>Jd(t,Dy(r),e,r))):Jd(t,Dy(r),e,r)}});var WT=C(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:!0});var BT=require("util"),ci=ri(),Oy=class e extends ci.AbstractMessageBuffer{static emptyBuffer=Buffer.allocUnsafe(0);constructor(t="utf-8"){super(t)}emptyBuffer(){return e.emptyBuffer}fromString(t,n){return Buffer.from(t,n)}toString(t,n){return t instanceof Buffer?t.toString(n):new BT.TextDecoder(n).decode(t)}asNative(t,n){return n===void 0?t instanceof Buffer?t:Buffer.from(t):t instanceof Buffer?t.slice(0,n):Buffer.from(t,0,n)}allocNative(t){return Buffer.allocUnsafe(t)}},My=class{stream;constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),ci.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),ci.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),ci.Disposable.create(()=>this.stream.off("end",t))}onData(t){return this.stream.on("data",t),ci.Disposable.create(()=>this.stream.off("data",t))}},$y=class{stream;constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),ci.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),ci.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),ci.Disposable.create(()=>this.stream.off("end",t))}write(t,n){return new Promise((r,o)=>{let s=a=>{a==null?r():o(a)};typeof t=="string"?this.stream.write(t,n,s):this.stream.write(t,s)})}end(){this.stream.end()}},jT=Object.freeze({messageBuffer:Object.freeze({create:e=>new Oy(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(n){return Promise.reject(n)}}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new BT.TextDecoder(t.charset).decode(e)))}catch(n){return Promise.reject(n)}}})}),stream:Object.freeze({asReadableStream:e=>new My(e),asWritableStream:e=>new $y(e)}),console,timer:Object.freeze({setTimeout(e,t,...n){let r=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){let n=setImmediate(e,...t);return{dispose:()=>clearImmediate(n)}},setInterval(e,t,...n){let r=setInterval(e,t,...n);return{dispose:()=>clearInterval(r)}}})});function qy(){return jT}(function(e){function t(){ci.RAL.install(jT)}e.install=t})(qy||(qy={}));By.default=qy});var Gy=C(Re=>{"use strict";var HT=Re&&Re.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),U2=Re&&Re.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Vy=Re&&Re.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&HT(n,t,r[o]);return U2(n,t),n}})(),H2=Re&&Re.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&HT(t,e,n)},V2=Re&&Re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Re,"__esModule",{value:!0});Re.StreamMessageWriter=Re.StreamMessageReader=Re.SocketMessageWriter=Re.SocketMessageReader=Re.PortMessageWriter=Re.PortMessageReader=Re.IPCMessageWriter=Re.IPCMessageReader=void 0;Re.generateRandomPipeName=J2;Re.createClientPipeTransport=Q2;Re.createServerPipeTransport=Z2;Re.createClientSocketTransport=eG;Re.createServerSocketTransport=tG;Re.createMessageConnection=iG;var jc=V2(WT());jc.default.install();var G2=Vy(require("path")),z2=Vy(require("os")),K2=Vy(require("fs")),UT=require("crypto"),ef=require("net"),Gn=ri();H2(ri(),Re);var jy=class extends Gn.AbstractMessageReader{process;constructor(t){super(),this.process=t;let n=this.process;n.on("error",r=>this.fireError(r)),n.on("close",()=>this.fireClose())}listen(t){return this.process.on("message",t),Gn.Disposable.create(()=>this.process.off("message",t))}};Re.IPCMessageReader=jy;var Wy=class extends Gn.AbstractMessageWriter{process;errorCount;constructor(t){super(),this.process=t,this.errorCount=0;let n=this.process;n.on("error",r=>this.fireError(r)),n.on("close",()=>this.fireClose)}write(t){try{return typeof this.process.send=="function"&&this.process.send(t,void 0,void 0,n=>{n?(this.errorCount++,this.handleError(n,t)):this.errorCount=0}),Promise.resolve()}catch(n){return this.handleError(n,t),Promise.reject(n)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){}};Re.IPCMessageWriter=Wy;var Uy=class extends Gn.AbstractMessageReader{onData;constructor(t){super(),this.onData=new Gn.Emitter,t.on("close",()=>this.fireClose),t.on("error",n=>this.fireError(n)),t.on("message",n=>{this.onData.fire(n)})}listen(t){return this.onData.event(t)}};Re.PortMessageReader=Uy;var Hy=class extends Gn.AbstractMessageWriter{port;errorCount;constructor(t){super(),this.port=t,this.errorCount=0,t.on("close",()=>this.fireClose()),t.on("error",n=>this.fireError(n))}write(t){try{return this.port.postMessage(t),Promise.resolve()}catch(n){return this.handleError(n,t),Promise.reject(n)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){}};Re.PortMessageWriter=Hy;var Oo=class extends Gn.ReadableStreamMessageReader{constructor(t,n="utf-8"){super((0,jc.default)().stream.asReadableStream(t),n)}};Re.SocketMessageReader=Oo;var Mo=class extends Gn.WriteableStreamMessageWriter{socket;constructor(t,n){super((0,jc.default)().stream.asWritableStream(t),n),this.socket=t}dispose(){super.dispose(),this.socket.destroy()}};Re.SocketMessageWriter=Mo;var Qd=class extends Gn.ReadableStreamMessageReader{constructor(t,n){super((0,jc.default)().stream.asReadableStream(t),n)}};Re.StreamMessageReader=Qd;var Zd=class extends Gn.WriteableStreamMessageWriter{constructor(t,n){super((0,jc.default)().stream.asWritableStream(t),n)}};Re.StreamMessageWriter=Zd;var Y2=process.env.XDG_RUNTIME_DIR,X2=new Map([["linux",107],["darwin",102]]);function J2(){if(process.platform==="win32")return`\\\\.\\pipe\\lsp-${(0,UT.randomBytes)(16).toString("hex")}-sock`;let e=32,t=10,n=K2.realpathSync(Y2??z2.tmpdir()),r=X2.get(process.platform);if(r!==void 0&&(e=Math.min(r-n.length-t,e)),e<16)throw new Error(`Unable to generate a random pipe name with ${e} characters.`);let o=(0,UT.randomBytes)(Math.floor(e/2)).toString("hex");return G2.join(n,`lsp-${o}.sock`)}function Q2(e,t="utf-8"){let n,r=new Promise((o,s)=>{n=o});return new Promise((o,s)=>{let a=(0,ef.createServer)(c=>{a.close(),n([new Oo(c,t),new Mo(c,t)])});a.on("error",s),a.listen(e,()=>{a.removeListener("error",s),o({onConnected:()=>r})})})}function Z2(e,t="utf-8"){let n=(0,ef.createConnection)(e);return[new Oo(n,t),new Mo(n,t)]}function eG(e,t="utf-8"){let n,r=new Promise((o,s)=>{n=o});return new Promise((o,s)=>{let a=(0,ef.createServer)(c=>{a.close(),n([new Oo(c,t),new Mo(c,t)])});a.on("error",s),a.listen(e,"127.0.0.1",()=>{a.removeListener("error",s),o({onConnected:()=>r})})})}function tG(e,t="utf-8"){let n=(0,ef.createConnection)(e,"127.0.0.1");return[new Oo(n,t),new Mo(n,t)]}function nG(e){let t=e;return t.read!==void 0&&t.addListener!==void 0}function rG(e){let t=e;return t.write!==void 0&&t.addListener!==void 0}function iG(e,t,n,r){n||(n=Gn.NullLogger);let o=nG(e)?new Qd(e):e,s=rG(t)?new Zd(t):t;return Gn.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,Gn.createMessageConnection)(o,s,n,r)}});var zy=C(li=>{"use strict";var oG=li&&li.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),VT=li&&li.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&oG(t,e,n)};Object.defineProperty(li,"__esModule",{value:!0});li.createProtocolConnection=aG;var sG=Gy();VT(Gy(),li);VT(_t(),li);function aG(e,t,n,r){return(0,sG.createMessageConnection)(e,t,n,r)}});var KT=C(ln=>{"use strict";var cG=ln&&ln.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),zT=ln&&ln.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&cG(t,e,n)};Object.defineProperty(ln,"__esModule",{value:!0});ln.ProposedFeatures=ln.NotebookDocuments=ln.TextDocuments=ln.SemanticTokensBuilder=void 0;var lG=gy();Object.defineProperty(ln,"SemanticTokensBuilder",{enumerable:!0,get:function(){return lG.SemanticTokensBuilder}});zT(_t(),ln);var uG=Sy();Object.defineProperty(ln,"TextDocuments",{enumerable:!0,get:function(){return uG.TextDocuments}});var dG=vy();Object.defineProperty(ln,"NotebookDocuments",{enumerable:!0,get:function(){return dG.NotebookDocuments}});zT(Ty(),ln);var GT;(function(e){e.all={__brand:"features"}})(GT||(ln.ProposedFeatures=GT={}))});var le=C(gn=>{"use strict";var QT=gn&&gn.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),fG=gn&&gn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ZT=gn&&gn.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&QT(n,t,r[o]);return fG(n,t),n}})(),eA=gn&&gn.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&QT(t,e,n)};Object.defineProperty(gn,"__esModule",{value:!0});gn.Files=void 0;gn.createConnection=gG;var YT=require("node:util"),Ky=ZT(ju()),mG=Ty(),Wc=ZT(qT()),$o=zy();eA(zy(),gn);eA(KT(),gn);var XT;(function(e){e.uriToFilePath=Wc.uriToFilePath,e.resolveGlobalNodePath=Wc.resolveGlobalNodePath,e.resolveGlobalYarnPath=Wc.resolveGlobalYarnPath,e.resolve=Wc.resolve,e.resolveModulePath=Wc.resolveModulePath})(XT||(gn.Files=XT={}));var JT;function tf(){if(JT!==void 0)try{JT.end()}catch{}}var Qs=!1,tA;function pG(){let e="--clientProcessId";function t(n){try{let r=parseInt(n);isNaN(r)||(tA=setInterval(()=>{try{process.kill(r,0)}catch{tf(),process.exit(Qs?0:1)}},3e3))}catch{}}for(let n=2;n<process.argv.length;n++){let r=process.argv[n];if(r===e&&n+1<process.argv.length){t(process.argv[n+1]);return}else{let o=r.split("=");o[0]===e&&t(o[1])}}}pG();var hG={initialize:e=>{let t=e.processId;Ky.number(t)&&tA===void 0&&setInterval(()=>{try{process.kill(t,0)}catch{process.exit(Qs?0:1)}},3e3)},get shutdownReceived(){return Qs},set shutdownReceived(e){Qs=e},exit:e=>{tf(),process.exit(e)}};function gG(e,t,n,r){let o,s,a,c;return e!==void 0&&e.__brand==="features"&&(o=e,e=t,t=n,n=r),$o.ConnectionStrategy.is(e)||$o.ConnectionOptions.is(e)?c=e:(s=e,a=t,c=n),_G(s,a,c,o)}function _G(e,t,n,r){let o=!1;if(!e&&!t&&process.argv.length>2){let c,l,u=process.argv.slice(2);for(let d=0;d<u.length;d++){let f=u[d];if(f==="--node-ipc"){e=new $o.IPCMessageReader(process),t=new $o.IPCMessageWriter(process);break}else if(f==="--stdio"){o=!0,e=process.stdin,t=process.stdout;break}else if(f==="--socket"){c=parseInt(u[d+1]);break}else if(f==="--pipe"){l=u[d+1];break}else{let m=f.split("=");if(m[0]==="--socket"){c=parseInt(m[1]);break}else if(m[0]==="--pipe"){l=m[1];break}}}if(c){let d=(0,$o.createServerSocketTransport)(c);e=d[0],t=d[1]}else if(l){let d=(0,$o.createServerPipeTransport)(l);e=d[0],t=d[1]}}let s="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!e)throw new Error("Connection input stream is not set. "+s);if(!t)throw new Error("Connection output stream is not set. "+s);if(Ky.func(e.read)&&Ky.func(e.on)){let c=e;c.on("end",()=>{tf(),process.exit(Qs?0:1)}),c.on("close",()=>{tf(),process.exit(Qs?0:1)})}let a=c=>{let l=(0,$o.createProtocolConnection)(e,t,c,n);return o&&yG(c),l};return(0,mG.createConnection)(a,hG,r)}function yG(e){function t(r){return r.map(o=>typeof o=="string"?o:(0,YT.inspect)(o)).join(" ")}let n=new Map;console.assert=function(o,...s){if(!o)if(s.length===0)e.error("Assertion failed");else{let[a,...c]=s;e.error(`Assertion failed: ${a} ${t(c)}`)}},console.count=function(o="default"){let s=String(o),a=n.get(s)??0;a+=1,n.set(s,a),e.log(`${s}: ${s}`)},console.countReset=function(o){o===void 0?n.clear():n.delete(String(o))},console.debug=function(...o){e.log(t(o))},console.dir=function(o,s){e.log((0,YT.inspect)(o,s))},console.log=function(...o){e.log(t(o))},console.error=function(...o){e.error(t(o))},console.trace=function(...o){let s=new Error().stack.replace(/(.+\n){2}/,""),a="Trace";o.length!==0&&(a+=`: ${t(o)}`),e.log(`${a}
14
- ${s}`)},console.warn=function(...o){e.warn(t(o))}}});var uI=C(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.splitWhen=la.flatten=void 0;function qG(e){return e.reduce((t,n)=>[].concat(t,n),[])}la.flatten=qG;function BG(e,t){let n=[[]],r=0;for(let o of e)t(o)?(r++,n[r]=[]):n[r].push(o);return n}la.splitWhen=BG});var dI=C(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.isEnoentCodeError=void 0;function jG(e){return e.code==="ENOENT"}hf.isEnoentCodeError=jG});var fI=C(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.createDirentFromStats=void 0;var Sb=class{constructor(t,n){this.name=t,this.isBlockDevice=n.isBlockDevice.bind(n),this.isCharacterDevice=n.isCharacterDevice.bind(n),this.isDirectory=n.isDirectory.bind(n),this.isFIFO=n.isFIFO.bind(n),this.isFile=n.isFile.bind(n),this.isSocket=n.isSocket.bind(n),this.isSymbolicLink=n.isSymbolicLink.bind(n)}};function WG(e,t){return new Sb(e,t)}gf.createDirentFromStats=WG});var gI=C(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.convertPosixPathToPattern=It.convertWindowsPathToPattern=It.convertPathToPattern=It.escapePosixPath=It.escapeWindowsPath=It.escape=It.removeLeadingDotSegment=It.makeAbsolute=It.unixify=void 0;var UG=require("os"),HG=require("path"),mI=UG.platform()==="win32",VG=2,GG=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,zG=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,KG=/^\\\\([.?])/,YG=/\\(?![!()+@[\]{}])/g;function XG(e){return e.replace(/\\/g,"/")}It.unixify=XG;function JG(e,t){return HG.resolve(e,t)}It.makeAbsolute=JG;function QG(e){if(e.charAt(0)==="."){let t=e.charAt(1);if(t==="/"||t==="\\")return e.slice(VG)}return e}It.removeLeadingDotSegment=QG;It.escape=mI?wb:xb;function wb(e){return e.replace(zG,"\\$2")}It.escapeWindowsPath=wb;function xb(e){return e.replace(GG,"\\$2")}It.escapePosixPath=xb;It.convertPathToPattern=mI?pI:hI;function pI(e){return wb(e).replace(KG,"//$1").replace(YG,"/")}It.convertWindowsPathToPattern=pI;function hI(e){return xb(e)}It.convertPosixPathToPattern=hI});var yI=C((ase,_I)=>{_I.exports=function(t){if(typeof t!="string"||t==="")return!1;for(var n;n=/(\\).|([@?!+*]\(.*\))/g.exec(t);){if(n[2])return!0;t=t.slice(n.index+n[0].length)}return!1}});var wI=C((cse,SI)=>{var ZG=yI(),bI={"{":"}","(":")","[":"]"},ez=function(e){if(e[0]==="!")return!0;for(var t=0,n=-2,r=-2,o=-2,s=-2,a=-2;t<e.length;){if(e[t]==="*"||e[t+1]==="?"&&/[\].+)]/.test(e[t])||r!==-1&&e[t]==="["&&e[t+1]!=="]"&&(r<t&&(r=e.indexOf("]",t)),r>t&&(a===-1||a>r||(a=e.indexOf("\\",t),a===-1||a>r)))||o!==-1&&e[t]==="{"&&e[t+1]!=="}"&&(o=e.indexOf("}",t),o>t&&(a=e.indexOf("\\",t),a===-1||a>o))||s!==-1&&e[t]==="("&&e[t+1]==="?"&&/[:!=]/.test(e[t+2])&&e[t+3]!==")"&&(s=e.indexOf(")",t),s>t&&(a=e.indexOf("\\",t),a===-1||a>s))||n!==-1&&e[t]==="("&&e[t+1]!=="|"&&(n<t&&(n=e.indexOf("|",t)),n!==-1&&e[n+1]!==")"&&(s=e.indexOf(")",n),s>n&&(a=e.indexOf("\\",n),a===-1||a>s))))return!0;if(e[t]==="\\"){var c=e[t+1];t+=2;var l=bI[c];if(l){var u=e.indexOf(l,t);u!==-1&&(t=u+1)}if(e[t]==="!")return!0}else t++}return!1},tz=function(e){if(e[0]==="!")return!0;for(var t=0;t<e.length;){if(/[*?{}()[\]]/.test(e[t]))return!0;if(e[t]==="\\"){var n=e[t+1];t+=2;var r=bI[n];if(r){var o=e.indexOf(r,t);o!==-1&&(t=o+1)}if(e[t]==="!")return!0}else t++}return!1};SI.exports=function(t,n){if(typeof t!="string"||t==="")return!1;if(ZG(t))return!0;var r=ez;return n&&n.strict===!1&&(r=tz),r(t)}});var vI=C((lse,xI)=>{"use strict";var nz=wI(),rz=require("path").posix.dirname,iz=require("os").platform()==="win32",vb="/",oz=/\\/g,sz=/[\{\[].*[\}\]]$/,az=/(^|[^\\])([\{\[]|\([^\)]+$)/,cz=/\\([\!\*\?\|\[\]\(\)\{\}])/g;xI.exports=function(t,n){var r=Object.assign({flipBackslashes:!0},n);r.flipBackslashes&&iz&&t.indexOf(vb)<0&&(t=t.replace(oz,vb)),sz.test(t)&&(t+=vb),t+="a";do t=rz(t);while(nz(t)||az.test(t));return t.replace(cz,"$1")}});var _f=C(or=>{"use strict";or.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;or.find=(e,t)=>e.nodes.find(n=>n.type===t);or.exceedsLimit=(e,t,n=1,r)=>r===!1||!or.isInteger(e)||!or.isInteger(t)?!1:(Number(t)-Number(e))/Number(n)>=r;or.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)};or.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;or.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;or.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;or.reduce=e=>e.reduce((t,n)=>(n.type==="text"&&t.push(n.value),n.type==="range"&&(n.type="text"),t),[]);or.flatten=(...e)=>{let t=[],n=r=>{for(let o=0;o<r.length;o++){let s=r[o];if(Array.isArray(s)){n(s);continue}s!==void 0&&t.push(s)}return t};return n(e),t}});var yf=C((dse,PI)=>{"use strict";var CI=_f();PI.exports=(e,t={})=>{let n=(r,o={})=>{let s=t.escapeInvalid&&CI.isInvalidBrace(o),a=r.invalid===!0&&t.escapeInvalid===!0,c="";if(r.value)return(s||a)&&CI.isOpenOrClose(r)?"\\"+r.value:r.value;if(r.value)return r.value;if(r.nodes)for(let l of r.nodes)c+=n(l);return c};return n(e)}});var EI=C((fse,NI)=>{"use strict";NI.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var OI=C((mse,LI)=>{"use strict";var RI=EI(),Ho=(e,t,n)=>{if(RI(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(t===void 0||e===t)return String(e);if(RI(t)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let r={relaxZeros:!0,...n};typeof r.strictZeros=="boolean"&&(r.relaxZeros=r.strictZeros===!1);let o=String(r.relaxZeros),s=String(r.shorthand),a=String(r.capture),c=String(r.wrap),l=e+":"+t+"="+o+s+a+c;if(Ho.cache.hasOwnProperty(l))return Ho.cache[l].result;let u=Math.min(e,t),d=Math.max(e,t);if(Math.abs(u-d)===1){let h=e+"|"+t;return r.capture?`(${h})`:r.wrap===!1?h:`(?:${h})`}let f=FI(e)||FI(t),m={min:e,max:t,a:u,b:d},p=[],g=[];if(f&&(m.isPadded=f,m.maxLen=String(m.max).length),u<0){let h=d<0?Math.abs(d):1;g=TI(h,Math.abs(u),m,r),u=m.a=0}return d>=0&&(p=TI(u,d,m,r)),m.negatives=g,m.positives=p,m.result=lz(g,p,r),r.capture===!0?m.result=`(${m.result})`:r.wrap!==!1&&p.length+g.length>1&&(m.result=`(?:${m.result})`),Ho.cache[l]=m,m.result};function lz(e,t,n){let r=Cb(e,t,"-",!1,n)||[],o=Cb(t,e,"",!1,n)||[],s=Cb(e,t,"-?",!0,n)||[];return r.concat(s).concat(o).join("|")}function uz(e,t){let n=1,r=1,o=II(e,n),s=new Set([t]);for(;e<=o&&o<=t;)s.add(o),n+=1,o=II(e,n);for(o=DI(t+1,r)-1;e<o&&o<=t;)s.add(o),r+=1,o=DI(t+1,r)-1;return s=[...s],s.sort(mz),s}function dz(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=fz(e,t),o=r.length,s="",a=0;for(let c=0;c<o;c++){let[l,u]=r[c];l===u?s+=l:l!=="0"||u!=="9"?s+=pz(l,u,n):a++}return a&&(s+=n.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[a],digits:o}}function TI(e,t,n,r){let o=uz(e,t),s=[],a=e,c;for(let l=0;l<o.length;l++){let u=o[l],d=dz(String(a),String(u),r),f="";if(!n.isPadded&&c&&c.pattern===d.pattern){c.count.length>1&&c.count.pop(),c.count.push(d.count[0]),c.string=c.pattern+kI(c.count),a=u+1;continue}n.isPadded&&(f=hz(u,n,r)),d.string=f+d.pattern+kI(d.count),s.push(d),a=u+1,c=d}return s}function Cb(e,t,n,r,o){let s=[];for(let a of e){let{string:c}=a;!r&&!AI(t,"string",c)&&s.push(n+c),r&&AI(t,"string",c)&&s.push(n+c)}return s}function fz(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}function mz(e,t){return e>t?1:t>e?-1:0}function AI(e,t,n){return e.some(r=>r[t]===n)}function II(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function DI(e,t){return e-e%Math.pow(10,t)}function kI(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function pz(e,t,n){return`[${e}${t-e===1?"":"-"}${t}]`}function FI(e){return/^-?(0+)\d/.test(e)}function hz(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),o=n.relaxZeros!==!1;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}Ho.cache={};Ho.clearCache=()=>Ho.cache={};LI.exports=Ho});var Eb=C((pse,UI)=>{"use strict";var gz=require("util"),$I=OI(),MI=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),_z=e=>t=>e===!0?Number(t):String(t),Pb=e=>typeof e=="number"||typeof e=="string"&&e!=="",tl=e=>Number.isInteger(+e),Nb=e=>{let t=`${e}`,n=-1;if(t[0]==="-"&&(t=t.slice(1)),t==="0")return!1;for(;t[++n]==="0";);return n>0},yz=(e,t,n)=>typeof e=="string"||typeof t=="string"?!0:n.stringify===!0,bz=(e,t,n)=>{if(t>0){let r=e[0]==="-"?"-":"";r&&(e=e.slice(1)),e=r+e.padStart(r?t-1:t,"0")}return n===!1?String(e):e},Sf=(e,t)=>{let n=e[0]==="-"?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},Sz=(e,t,n)=>{e.negatives.sort((c,l)=>c<l?-1:c>l?1:0),e.positives.sort((c,l)=>c<l?-1:c>l?1:0);let r=t.capture?"":"?:",o="",s="",a;return e.positives.length&&(o=e.positives.map(c=>Sf(String(c),n)).join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.map(c=>Sf(String(c),n)).join("|")})`),o&&s?a=`${o}|${s}`:a=o||s,t.wrap?`(${r}${a})`:a},qI=(e,t,n,r)=>{if(n)return $I(e,t,{wrap:!1,...r});let o=String.fromCharCode(e);if(e===t)return o;let s=String.fromCharCode(t);return`[${o}-${s}]`},BI=(e,t,n)=>{if(Array.isArray(e)){let r=n.wrap===!0,o=n.capture?"":"?:";return r?`(${o}${e.join("|")})`:e.join("|")}return $I(e,t,n)},jI=(...e)=>new RangeError("Invalid range arguments: "+gz.inspect(...e)),WI=(e,t,n)=>{if(n.strictRanges===!0)throw jI([e,t]);return[]},wz=(e,t)=>{if(t.strictRanges===!0)throw new TypeError(`Expected step "${e}" to be a number`);return[]},xz=(e,t,n=1,r={})=>{let o=Number(e),s=Number(t);if(!Number.isInteger(o)||!Number.isInteger(s)){if(r.strictRanges===!0)throw jI([e,t]);return[]}o===0&&(o=0),s===0&&(s=0);let a=o>s,c=String(e),l=String(t),u=String(n);n=Math.max(Math.abs(n),1);let d=Nb(c)||Nb(l)||Nb(u),f=d?Math.max(c.length,l.length,u.length):0,m=d===!1&&yz(e,t,r)===!1,p=r.transform||_z(m);if(r.toRegex&&n===1)return qI(Sf(e,f),Sf(t,f),!0,r);let g={negatives:[],positives:[]},h=_=>g[_<0?"negatives":"positives"].push(Math.abs(_)),y=[],w=0;for(;a?o>=s:o<=s;)r.toRegex===!0&&n>1?h(o):y.push(bz(p(o,w),f,m)),o=a?o-n:o+n,w++;return r.toRegex===!0?n>1?Sz(g,r,f):BI(y,null,{wrap:!1,...r}):y},vz=(e,t,n=1,r={})=>{if(!tl(e)&&e.length>1||!tl(t)&&t.length>1)return WI(e,t,r);let o=r.transform||(m=>String.fromCharCode(m)),s=`${e}`.charCodeAt(0),a=`${t}`.charCodeAt(0),c=s>a,l=Math.min(s,a),u=Math.max(s,a);if(r.toRegex&&n===1)return qI(l,u,!1,r);let d=[],f=0;for(;c?s>=a:s<=a;)d.push(o(s,f)),s=c?s-n:s+n,f++;return r.toRegex===!0?BI(d,null,{wrap:!1,options:r}):d},bf=(e,t,n,r={})=>{if(t==null&&Pb(e))return[e];if(!Pb(e)||!Pb(t))return WI(e,t,r);if(typeof n=="function")return bf(e,t,1,{transform:n});if(MI(n))return bf(e,t,0,n);let o={...r};return o.capture===!0&&(o.wrap=!0),n=n||o.step||1,tl(n)?tl(e)&&tl(t)?xz(e,t,n,o):vz(e,t,Math.max(Math.abs(n),1),o):n!=null&&!MI(n)?wz(n,o):bf(e,t,1,n)};UI.exports=bf});var GI=C((hse,VI)=>{"use strict";var Cz=Eb(),HI=_f(),Pz=(e,t={})=>{let n=(r,o={})=>{let s=HI.isInvalidBrace(o),a=r.invalid===!0&&t.escapeInvalid===!0,c=s===!0||a===!0,l=t.escapeInvalid===!0?"\\":"",u="";if(r.isOpen===!0)return l+r.value;if(r.isClose===!0)return console.log("node.isClose",l,r.value),l+r.value;if(r.type==="open")return c?l+r.value:"(";if(r.type==="close")return c?l+r.value:")";if(r.type==="comma")return r.prev.type==="comma"?"":c?r.value:"|";if(r.value)return r.value;if(r.nodes&&r.ranges>0){let d=HI.reduce(r.nodes),f=Cz(...d,{...t,wrap:!1,toRegex:!0,strictZeros:!0});if(f.length!==0)return d.length>1&&f.length>1?`(${f})`:f}if(r.nodes)for(let d of r.nodes)u+=n(d,r);return u};return n(e)};VI.exports=Pz});var YI=C((gse,KI)=>{"use strict";var Nz=Eb(),zI=yf(),ua=_f(),Vo=(e="",t="",n=!1)=>{let r=[];if(e=[].concat(e),t=[].concat(t),!t.length)return e;if(!e.length)return n?ua.flatten(t).map(o=>`{${o}}`):t;for(let o of e)if(Array.isArray(o))for(let s of o)r.push(Vo(s,t,n));else for(let s of t)n===!0&&typeof s=="string"&&(s=`{${s}}`),r.push(Array.isArray(s)?Vo(o,s,n):o+s);return ua.flatten(r)},Ez=(e,t={})=>{let n=t.rangeLimit===void 0?1e3:t.rangeLimit,r=(o,s={})=>{o.queue=[];let a=s,c=s.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,c=a.queue;if(o.invalid||o.dollar){c.push(Vo(c.pop(),zI(o,t)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){c.push(Vo(c.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let f=ua.reduce(o.nodes);if(ua.exceedsLimit(...f,t.step,n))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let m=Nz(...f,t);m.length===0&&(m=zI(o,t)),c.push(Vo(c.pop(),m)),o.nodes=[];return}let l=ua.encloseBrace(o),u=o.queue,d=o;for(;d.type!=="brace"&&d.type!=="root"&&d.parent;)d=d.parent,u=d.queue;for(let f=0;f<o.nodes.length;f++){let m=o.nodes[f];if(m.type==="comma"&&o.type==="brace"){f===1&&u.push(""),u.push("");continue}if(m.type==="close"){c.push(Vo(c.pop(),u,l));continue}if(m.value&&m.type!=="open"){u.push(Vo(u.pop(),m.value));continue}m.nodes&&r(m,o)}return u};return ua.flatten(r(e))};KI.exports=Ez});var JI=C((_se,XI)=>{"use strict";XI.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
15
- `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var nD=C((yse,tD)=>{"use strict";var Rz=yf(),{MAX_LENGTH:QI,CHAR_BACKSLASH:Rb,CHAR_BACKTICK:Tz,CHAR_COMMA:Az,CHAR_DOT:Iz,CHAR_LEFT_PARENTHESES:Dz,CHAR_RIGHT_PARENTHESES:kz,CHAR_LEFT_CURLY_BRACE:Fz,CHAR_RIGHT_CURLY_BRACE:Lz,CHAR_LEFT_SQUARE_BRACKET:ZI,CHAR_RIGHT_SQUARE_BRACKET:eD,CHAR_DOUBLE_QUOTE:Oz,CHAR_SINGLE_QUOTE:Mz,CHAR_NO_BREAK_SPACE:$z,CHAR_ZERO_WIDTH_NOBREAK_SPACE:qz}=JI(),Bz=(e,t={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let n=t||{},r=typeof n.maxLength=="number"?Math.min(QI,n.maxLength):QI;if(e.length>r)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${r})`);let o={type:"root",input:e,nodes:[]},s=[o],a=o,c=o,l=0,u=e.length,d=0,f=0,m,p=()=>e[d++],g=h=>{if(h.type==="text"&&c.type==="dot"&&(c.type="text"),c&&c.type==="text"&&h.type==="text"){c.value+=h.value;return}return a.nodes.push(h),h.parent=a,h.prev=c,c=h,h};for(g({type:"bos"});d<u;)if(a=s[s.length-1],m=p(),!(m===qz||m===$z)){if(m===Rb){g({type:"text",value:(t.keepEscaping?m:"")+p()});continue}if(m===eD){g({type:"text",value:"\\"+m});continue}if(m===ZI){l++;let h;for(;d<u&&(h=p());){if(m+=h,h===ZI){l++;continue}if(h===Rb){m+=p();continue}if(h===eD&&(l--,l===0))break}g({type:"text",value:m});continue}if(m===Dz){a=g({type:"paren",nodes:[]}),s.push(a),g({type:"text",value:m});continue}if(m===kz){if(a.type!=="paren"){g({type:"text",value:m});continue}a=s.pop(),g({type:"text",value:m}),a=s[s.length-1];continue}if(m===Oz||m===Mz||m===Tz){let h=m,y;for(t.keepQuotes!==!0&&(m="");d<u&&(y=p());){if(y===Rb){m+=y+p();continue}if(y===h){t.keepQuotes===!0&&(m+=y);break}m+=y}g({type:"text",value:m});continue}if(m===Fz){f++;let y={type:"brace",open:!0,close:!1,dollar:c.value&&c.value.slice(-1)==="$"||a.dollar===!0,depth:f,commas:0,ranges:0,nodes:[]};a=g(y),s.push(a),g({type:"open",value:m});continue}if(m===Lz){if(a.type!=="brace"){g({type:"text",value:m});continue}let h="close";a=s.pop(),a.close=!0,g({type:h,value:m}),f--,a=s[s.length-1];continue}if(m===Az&&f>0){if(a.ranges>0){a.ranges=0;let h=a.nodes.shift();a.nodes=[h,{type:"text",value:Rz(a)}]}g({type:"comma",value:m}),a.commas++;continue}if(m===Iz&&f>0&&a.commas===0){let h=a.nodes;if(f===0||h.length===0){g({type:"text",value:m});continue}if(c.type==="dot"){if(a.range=[],c.value+=m,c.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,c.type="text";continue}a.ranges++,a.args=[];continue}if(c.type==="range"){h.pop();let y=h[h.length-1];y.value+=c.value+m,c=y,a.ranges--;continue}g({type:"dot",value:m});continue}g({type:"text",value:m})}do if(a=s.pop(),a.type!=="root"){a.nodes.forEach(w=>{w.nodes||(w.type==="open"&&(w.isOpen=!0),w.type==="close"&&(w.isClose=!0),w.nodes||(w.type="text"),w.invalid=!0)});let h=s[s.length-1],y=h.nodes.indexOf(a);h.nodes.splice(y,1,...a.nodes)}while(s.length>0);return g({type:"eos"}),o};tD.exports=Bz});var oD=C((bse,iD)=>{"use strict";var rD=yf(),jz=GI(),Wz=YI(),Uz=nD(),Yn=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let o=Yn.create(r,t);Array.isArray(o)?n.push(...o):n.push(o)}else n=[].concat(Yn.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(n=[...new Set(n)]),n};Yn.parse=(e,t={})=>Uz(e,t);Yn.stringify=(e,t={})=>rD(typeof e=="string"?Yn.parse(e,t):e,t);Yn.compile=(e,t={})=>(typeof e=="string"&&(e=Yn.parse(e,t)),jz(e,t));Yn.expand=(e,t={})=>{typeof e=="string"&&(e=Yn.parse(e,t));let n=Wz(e,t);return t.noempty===!0&&(n=n.filter(Boolean)),t.nodupes===!0&&(n=[...new Set(n)]),n};Yn.create=(e,t={})=>e===""||e.length<3?[e]:t.expand!==!0?Yn.compile(e,t):Yn.expand(e,t);iD.exports=Yn});var nl=C((Sse,uD)=>{"use strict";var Hz=require("path"),Ur="\\\\/",sD=`[^${Ur}]`,Vz=0,ui="\\.",Gz="\\+",zz="\\?",wf="\\/",Kz="(?=.)",aD="[^/]",Tb=`(?:${wf}|$)`,cD=`(?:^|${wf})`,Ab=`${ui}{1,2}${Tb}`,Yz=`(?!${ui})`,Xz=`(?!${cD}${Ab})`,Jz=`(?!${ui}{0,1}${Tb})`,Qz=`(?!${Ab})`,Zz=`[^.${wf}]`,eK=`${aD}*?`,lD={DOT_LITERAL:ui,PLUS_LITERAL:Gz,QMARK_LITERAL:zz,SLASH_LITERAL:wf,ONE_CHAR:Kz,QMARK:aD,END_ANCHOR:Tb,DOTS_SLASH:Ab,NO_DOT:Yz,NO_DOTS:Xz,NO_DOT_SLASH:Jz,NO_DOTS_SLASH:Qz,QMARK_NO_DOT:Zz,STAR:eK,START_ANCHOR:cD},tK={...lD,SLASH_LITERAL:`[${Ur}]`,QMARK:sD,STAR:`${sD}*?`,DOTS_SLASH:`${ui}{1,2}(?:[${Ur}]|$)`,NO_DOT:`(?!${ui})`,NO_DOTS:`(?!(?:^|[${Ur}])${ui}{1,2}(?:[${Ur}]|$))`,NO_DOT_SLASH:`(?!${ui}{0,1}(?:[${Ur}]|$))`,NO_DOTS_SLASH:`(?!${ui}{1,2}(?:[${Ur}]|$))`,QMARK_NO_DOT:`[^.${Ur}]`,START_ANCHOR:`(?:^|[${Ur}])`,END_ANCHOR:`(?:[${Ur}]|$)`},nK={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};uD.exports={DEFAULT_MAX_EXTGLOB_RECURSION:Vz,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:nK,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:Hz.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?tK:lD}}});var rl=C(An=>{"use strict";var rK=require("path"),iK=process.platform==="win32",{REGEX_BACKSLASH:oK,REGEX_REMOVE_BACKSLASH:sK,REGEX_SPECIAL_CHARS:aK,REGEX_SPECIAL_CHARS_GLOBAL:cK}=nl();An.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);An.hasRegexChars=e=>aK.test(e);An.isRegexChar=e=>e.length===1&&An.hasRegexChars(e);An.escapeRegex=e=>e.replace(cK,"\\$1");An.toPosixSlashes=e=>e.replace(oK,"/");An.removeBackslashes=e=>e.replace(sK,t=>t==="\\"?"":t);An.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};An.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:iK===!0||rK.sep==="\\";An.escapeLast=(e,t,n)=>{let r=e.lastIndexOf(t,n);return r===-1?e:e[r-1]==="\\"?An.escapeLast(e,t,r-1):`${e.slice(0,r)}\\${e.slice(r)}`};An.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n};An.wrapOutput=(e,t={},n={})=>{let r=n.contains?"":"^",o=n.contains?"":"$",s=`${r}(?:${e})${o}`;return t.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var yD=C((xse,_D)=>{"use strict";var dD=rl(),{CHAR_ASTERISK:Ib,CHAR_AT:lK,CHAR_BACKWARD_SLASH:il,CHAR_COMMA:uK,CHAR_DOT:Db,CHAR_EXCLAMATION_MARK:kb,CHAR_FORWARD_SLASH:gD,CHAR_LEFT_CURLY_BRACE:Fb,CHAR_LEFT_PARENTHESES:Lb,CHAR_LEFT_SQUARE_BRACKET:dK,CHAR_PLUS:fK,CHAR_QUESTION_MARK:fD,CHAR_RIGHT_CURLY_BRACE:mK,CHAR_RIGHT_PARENTHESES:mD,CHAR_RIGHT_SQUARE_BRACKET:pK}=nl(),pD=e=>e===gD||e===il,hD=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},hK=(e,t)=>{let n=t||{},r=e.length-1,o=n.parts===!0||n.scanToEnd===!0,s=[],a=[],c=[],l=e,u=-1,d=0,f=0,m=!1,p=!1,g=!1,h=!1,y=!1,w=!1,_=!1,b=!1,S=!1,N=!1,R=0,$,I,U={value:"",depth:0,isGlob:!1},de=()=>u>=r,F=()=>l.charCodeAt(u+1),Q=()=>($=I,l.charCodeAt(++u));for(;u<r;){I=Q();let wt;if(I===il){_=U.backslashes=!0,I=Q(),I===Fb&&(w=!0);continue}if(w===!0||I===Fb){for(R++;de()!==!0&&(I=Q());){if(I===il){_=U.backslashes=!0,Q();continue}if(I===Fb){R++;continue}if(w!==!0&&I===Db&&(I=Q())===Db){if(m=U.isBrace=!0,g=U.isGlob=!0,N=!0,o===!0)continue;break}if(w!==!0&&I===uK){if(m=U.isBrace=!0,g=U.isGlob=!0,N=!0,o===!0)continue;break}if(I===mK&&(R--,R===0)){w=!1,m=U.isBrace=!0,N=!0;break}}if(o===!0)continue;break}if(I===gD){if(s.push(u),a.push(U),U={value:"",depth:0,isGlob:!1},N===!0)continue;if($===Db&&u===d+1){d+=2;continue}f=u+1;continue}if(n.noext!==!0&&(I===fK||I===lK||I===Ib||I===fD||I===kb)===!0&&F()===Lb){if(g=U.isGlob=!0,h=U.isExtglob=!0,N=!0,I===kb&&u===d&&(S=!0),o===!0){for(;de()!==!0&&(I=Q());){if(I===il){_=U.backslashes=!0,I=Q();continue}if(I===mD){g=U.isGlob=!0,N=!0;break}}continue}break}if(I===Ib){if($===Ib&&(y=U.isGlobstar=!0),g=U.isGlob=!0,N=!0,o===!0)continue;break}if(I===fD){if(g=U.isGlob=!0,N=!0,o===!0)continue;break}if(I===dK){for(;de()!==!0&&(wt=Q());){if(wt===il){_=U.backslashes=!0,Q();continue}if(wt===pK){p=U.isBracket=!0,g=U.isGlob=!0,N=!0;break}}if(o===!0)continue;break}if(n.nonegate!==!0&&I===kb&&u===d){b=U.negated=!0,d++;continue}if(n.noparen!==!0&&I===Lb){if(g=U.isGlob=!0,o===!0){for(;de()!==!0&&(I=Q());){if(I===Lb){_=U.backslashes=!0,I=Q();continue}if(I===mD){N=!0;break}}continue}break}if(g===!0){if(N=!0,o===!0)continue;break}}n.noext===!0&&(h=!1,g=!1);let pe=l,ot="",M="";d>0&&(ot=l.slice(0,d),l=l.slice(d),f-=d),pe&&g===!0&&f>0?(pe=l.slice(0,f),M=l.slice(f)):g===!0?(pe="",M=l):pe=l,pe&&pe!==""&&pe!=="/"&&pe!==l&&pD(pe.charCodeAt(pe.length-1))&&(pe=pe.slice(0,-1)),n.unescape===!0&&(M&&(M=dD.removeBackslashes(M)),pe&&_===!0&&(pe=dD.removeBackslashes(pe)));let O={prefix:ot,input:e,start:d,base:pe,glob:M,isBrace:m,isBracket:p,isGlob:g,isExtglob:h,isGlobstar:y,negated:b,negatedExtglob:S};if(n.tokens===!0&&(O.maxDepth=0,pD(I)||a.push(U),O.tokens=a),n.parts===!0||n.tokens===!0){let wt;for(let D=0;D<s.length;D++){let j=wt?wt+1:d,z=s[D],ie=e.slice(j,z);n.tokens&&(D===0&&d!==0?(a[D].isPrefix=!0,a[D].value=ot):a[D].value=ie,hD(a[D]),O.maxDepth+=a[D].depth),(D!==0||ie!=="")&&c.push(ie),wt=z}if(wt&&wt+1<e.length){let D=e.slice(wt+1);c.push(D),n.tokens&&(a[a.length-1].value=D,hD(a[a.length-1]),O.maxDepth+=a[a.length-1].depth)}O.slashes=s,O.parts=c}return O};_D.exports=hK});var vD=C((vse,xD)=>{"use strict";var ol=nl(),un=rl(),{MAX_LENGTH:xf,POSIX_REGEX_SOURCE:gK,REGEX_NON_SPECIAL_CHARS:_K,REGEX_SPECIAL_CHARS_BACKREF:yK,REPLACEMENTS:bD}=ol,bK=(e,t)=>{if(typeof t.expandRange=="function")return t.expandRange(...e,t);e.sort();let n=`[${e.join("-")}]`;try{new RegExp(n)}catch{return e.map(o=>un.escapeRegex(o)).join("..")}return n},da=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,SD=e=>{let t=[],n=0,r=0,o=0,s="",a=!1;for(let c of e){if(a===!0){s+=c,a=!1;continue}if(c==="\\"){s+=c,a=!0;continue}if(c==='"'){o=o===1?0:1,s+=c;continue}if(o===0){if(c==="[")n++;else if(c==="]"&&n>0)n--;else if(n===0){if(c==="(")r++;else if(c===")"&&r>0)r--;else if(c==="|"&&r===0){t.push(s),s="";continue}}}s+=c}return t.push(s),t},SK=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n==="\\"){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},wD=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(SK(t))return t.replace(/\\(.)/g,"$1")},wK=e=>{let t=e.map(wD).filter(Boolean);for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){let o=t[n],s=t[r],a=o[0];if(!(!a||o!==a.repeat(o.length)||s!==a.repeat(s.length))&&(o===s||o.startsWith(s)||s.startsWith(o)))return!0}return!1},Ob=(e,t=!0)=>{if(e[0]!=="+"&&e[0]!=="*"||e[1]!=="(")return;let n=0,r=0,o=0,s=!1;for(let a=1;a<e.length;a++){let c=e[a];if(s===!0){s=!1;continue}if(c==="\\"){s=!0;continue}if(c==='"'){o=o===1?0:1;continue}if(o!==1){if(c==="["){n++;continue}if(c==="]"&&n>0){n--;continue}if(!(n>0)){if(c==="("){r++;continue}if(c===")"&&(r--,r===0))return t===!0&&a!==e.length-1?void 0:{type:e[0],body:e.slice(2,a),end:a}}}}},xK=e=>{let t=0,n=[];for(;t<e.length;){let o=Ob(e.slice(t),!1);if(!o||o.type!=="*")return;let s=SD(o.body).map(c=>c.trim());if(s.length!==1)return;let a=wD(s[0]);if(!a||a.length!==1)return;n.push(a),t+=o.end+1}return n.length<1?void 0:`${n.length===1?un.escapeRegex(n[0]):`[${n.map(o=>un.escapeRegex(o)).join("")}]`}*`},vK=e=>{let t=0,n=e.trim(),r=Ob(n);for(;r;)t++,n=r.body.trim(),r=Ob(n);return t},CK=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let n=typeof t.maxExtglobRecursion=="number"?t.maxExtglobRecursion:ol.DEFAULT_MAX_EXTGLOB_RECURSION,r=SD(e).map(o=>o.trim());if(r.length>1&&(r.some(o=>o==="")||r.some(o=>/^[*?]+$/.test(o))||wK(r)))return{risky:!0};for(let o of r){let s=xK(o);if(s)return{risky:!0,safeOutput:s};if(vK(o)>n)return{risky:!0}}return{risky:!1}},Mb=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=bD[e]||e;let n={...t},r=typeof n.maxLength=="number"?Math.min(xf,n.maxLength):xf,o=e.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);let s={type:"bos",value:"",output:n.prepend||""},a=[s],c=n.capture?"":"?:",l=un.isWindows(t),u=ol.globChars(l),d=ol.extglobChars(u),{DOT_LITERAL:f,PLUS_LITERAL:m,SLASH_LITERAL:p,ONE_CHAR:g,DOTS_SLASH:h,NO_DOT:y,NO_DOT_SLASH:w,NO_DOTS_SLASH:_,QMARK:b,QMARK_NO_DOT:S,STAR:N,START_ANCHOR:R}=u,$=V=>`(${c}(?:(?!${R}${V.dot?h:f}).)*?)`,I=n.dot?"":y,U=n.dot?b:S,de=n.bash===!0?$(n):N;n.capture&&(de=`(${de})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let F={input:e,index:-1,start:0,dot:n.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};e=un.removePrefix(e,F),o=e.length;let Q=[],pe=[],ot=[],M=s,O,wt=()=>F.index===o-1,D=F.peek=(V=1)=>e[F.index+V],j=F.advance=()=>e[++F.index]||"",z=()=>e.slice(F.index+1),ie=(V="",Be=0)=>{F.consumed+=V,F.index+=Be},se=V=>{F.output+=V.output!=null?V.output:V.value,ie(V.value)},xt=()=>{let V=1;for(;D()==="!"&&(D(2)!=="("||D(3)==="?");)j(),F.start++,V++;return V%2===0?!1:(F.negated=!0,F.start++,!0)},vt=V=>{F[V]++,ot.push(V)},Mt=V=>{F[V]--,ot.pop()},ce=V=>{if(M.type==="globstar"){let Be=F.braces>0&&(V.type==="comma"||V.type==="brace"),W=V.extglob===!0||Q.length&&(V.type==="pipe"||V.type==="paren");V.type!=="slash"&&V.type!=="paren"&&!Be&&!W&&(F.output=F.output.slice(0,-M.output.length),M.type="star",M.value="*",M.output=de,F.output+=M.output)}if(Q.length&&V.type!=="paren"&&(Q[Q.length-1].inner+=V.value),(V.value||V.output)&&se(V),M&&M.type==="text"&&V.type==="text"){M.value+=V.value,M.output=(M.output||"")+V.value;return}V.prev=M,a.push(V),M=V},vn=(V,Be)=>{let W={...d[Be],conditions:1,inner:""};W.prev=M,W.parens=F.parens,W.output=F.output,W.startIndex=F.index,W.tokensIndex=a.length;let he=(n.capture?"(":"")+W.open;vt("parens"),ce({type:V,value:Be,output:F.output?"":g}),ce({type:"paren",extglob:!0,value:j(),output:he}),Q.push(W)},ei=V=>{let Be=e.slice(V.startIndex,F.index+1),W=e.slice(V.startIndex+2,F.index),he=CK(W,n);if((V.type==="plus"||V.type==="star")&&he.risky){let Ue=he.safeOutput?(V.output?"":g)+(n.capture?`(${he.safeOutput})`:he.safeOutput):void 0,Cn=a[V.tokensIndex];Cn.type="text",Cn.value=Be,Cn.output=Ue||un.escapeRegex(Be);for(let Zn=V.tokensIndex+1;Zn<a.length;Zn++)a[Zn].value="",a[Zn].output="",delete a[Zn].suffix;F.output=V.output+Cn.output,F.backtrack=!0,ce({type:"paren",extglob:!0,value:O,output:""}),Mt("parens");return}let Ae=V.close+(n.capture?")":""),Ct;if(V.type==="negate"){let Ue=de;if(V.inner&&V.inner.length>1&&V.inner.includes("/")&&(Ue=$(n)),(Ue!==de||wt()||/^\)+$/.test(z()))&&(Ae=V.close=`)$))${Ue}`),V.inner.includes("*")&&(Ct=z())&&/^\.[^\\/.]+$/.test(Ct)){let Cn=Mb(Ct,{...t,fastpaths:!1}).output;Ae=V.close=`)${Cn})${Ue})`}V.prev.type==="bos"&&(F.negatedExtglob=!0)}ce({type:"paren",extglob:!0,value:O,output:Ae}),Mt("parens")};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let V=!1,Be=e.replace(yK,(W,he,Ae,Ct,Ue,Cn)=>Ct==="\\"?(V=!0,W):Ct==="?"?he?he+Ct+(Ue?b.repeat(Ue.length):""):Cn===0?U+(Ue?b.repeat(Ue.length):""):b.repeat(Ae.length):Ct==="."?f.repeat(Ae.length):Ct==="*"?he?he+Ct+(Ue?de:""):de:he?W:`\\${W}`);return V===!0&&(n.unescape===!0?Be=Be.replace(/\\/g,""):Be=Be.replace(/\\+/g,W=>W.length%2===0?"\\\\":W?"\\":"")),Be===e&&n.contains===!0?(F.output=e,F):(F.output=un.wrapOutput(Be,F,t),F)}for(;!wt();){if(O=j(),O==="\0")continue;if(O==="\\"){let W=D();if(W==="/"&&n.bash!==!0||W==="."||W===";")continue;if(!W){O+="\\",ce({type:"text",value:O});continue}let he=/^\\+/.exec(z()),Ae=0;if(he&&he[0].length>2&&(Ae=he[0].length,F.index+=Ae,Ae%2!==0&&(O+="\\")),n.unescape===!0?O=j():O+=j(),F.brackets===0){ce({type:"text",value:O});continue}}if(F.brackets>0&&(O!=="]"||M.value==="["||M.value==="[^")){if(n.posix!==!1&&O===":"){let W=M.value.slice(1);if(W.includes("[")&&(M.posix=!0,W.includes(":"))){let he=M.value.lastIndexOf("["),Ae=M.value.slice(0,he),Ct=M.value.slice(he+2),Ue=gK[Ct];if(Ue){M.value=Ae+Ue,F.backtrack=!0,j(),!s.output&&a.indexOf(M)===1&&(s.output=g);continue}}}(O==="["&&D()!==":"||O==="-"&&D()==="]")&&(O=`\\${O}`),O==="]"&&(M.value==="["||M.value==="[^")&&(O=`\\${O}`),n.posix===!0&&O==="!"&&M.value==="["&&(O="^"),M.value+=O,se({value:O});continue}if(F.quotes===1&&O!=='"'){O=un.escapeRegex(O),M.value+=O,se({value:O});continue}if(O==='"'){F.quotes=F.quotes===1?0:1,n.keepQuotes===!0&&ce({type:"text",value:O});continue}if(O==="("){vt("parens"),ce({type:"paren",value:O});continue}if(O===")"){if(F.parens===0&&n.strictBrackets===!0)throw new SyntaxError(da("opening","("));let W=Q[Q.length-1];if(W&&F.parens===W.parens+1){ei(Q.pop());continue}ce({type:"paren",value:O,output:F.parens?")":"\\)"}),Mt("parens");continue}if(O==="["){if(n.nobracket===!0||!z().includes("]")){if(n.nobracket!==!0&&n.strictBrackets===!0)throw new SyntaxError(da("closing","]"));O=`\\${O}`}else vt("brackets");ce({type:"bracket",value:O});continue}if(O==="]"){if(n.nobracket===!0||M&&M.type==="bracket"&&M.value.length===1){ce({type:"text",value:O,output:`\\${O}`});continue}if(F.brackets===0){if(n.strictBrackets===!0)throw new SyntaxError(da("opening","["));ce({type:"text",value:O,output:`\\${O}`});continue}Mt("brackets");let W=M.value.slice(1);if(M.posix!==!0&&W[0]==="^"&&!W.includes("/")&&(O=`/${O}`),M.value+=O,se({value:O}),n.literalBrackets===!1||un.hasRegexChars(W))continue;let he=un.escapeRegex(M.value);if(F.output=F.output.slice(0,-M.value.length),n.literalBrackets===!0){F.output+=he,M.value=he;continue}M.value=`(${c}${he}|${M.value})`,F.output+=M.value;continue}if(O==="{"&&n.nobrace!==!0){vt("braces");let W={type:"brace",value:O,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};pe.push(W),ce(W);continue}if(O==="}"){let W=pe[pe.length-1];if(n.nobrace===!0||!W){ce({type:"text",value:O,output:O});continue}let he=")";if(W.dots===!0){let Ae=a.slice(),Ct=[];for(let Ue=Ae.length-1;Ue>=0&&(a.pop(),Ae[Ue].type!=="brace");Ue--)Ae[Ue].type!=="dots"&&Ct.unshift(Ae[Ue].value);he=bK(Ct,n),F.backtrack=!0}if(W.comma!==!0&&W.dots!==!0){let Ae=F.output.slice(0,W.outputIndex),Ct=F.tokens.slice(W.tokensIndex);W.value=W.output="\\{",O=he="\\}",F.output=Ae;for(let Ue of Ct)F.output+=Ue.output||Ue.value}ce({type:"brace",value:O,output:he}),Mt("braces"),pe.pop();continue}if(O==="|"){Q.length>0&&Q[Q.length-1].conditions++,ce({type:"text",value:O});continue}if(O===","){let W=O,he=pe[pe.length-1];he&&ot[ot.length-1]==="braces"&&(he.comma=!0,W="|"),ce({type:"comma",value:O,output:W});continue}if(O==="/"){if(M.type==="dot"&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",a.pop(),M=s;continue}ce({type:"slash",value:O,output:p});continue}if(O==="."){if(F.braces>0&&M.type==="dot"){M.value==="."&&(M.output=f);let W=pe[pe.length-1];M.type="dots",M.output+=O,M.value+=O,W.dots=!0;continue}if(F.braces+F.parens===0&&M.type!=="bos"&&M.type!=="slash"){ce({type:"text",value:O,output:f});continue}ce({type:"dot",value:O,output:f});continue}if(O==="?"){if(!(M&&M.value==="(")&&n.noextglob!==!0&&D()==="("&&D(2)!=="?"){vn("qmark",O);continue}if(M&&M.type==="paren"){let he=D(),Ae=O;if(he==="<"&&!un.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(M.value==="("&&!/[!=<:]/.test(he)||he==="<"&&!/<([!=]|\w+>)/.test(z()))&&(Ae=`\\${O}`),ce({type:"text",value:O,output:Ae});continue}if(n.dot!==!0&&(M.type==="slash"||M.type==="bos")){ce({type:"qmark",value:O,output:S});continue}ce({type:"qmark",value:O,output:b});continue}if(O==="!"){if(n.noextglob!==!0&&D()==="("&&(D(2)!=="?"||!/[!=<:]/.test(D(3)))){vn("negate",O);continue}if(n.nonegate!==!0&&F.index===0){xt();continue}}if(O==="+"){if(n.noextglob!==!0&&D()==="("&&D(2)!=="?"){vn("plus",O);continue}if(M&&M.value==="("||n.regex===!1){ce({type:"plus",value:O,output:m});continue}if(M&&(M.type==="bracket"||M.type==="paren"||M.type==="brace")||F.parens>0){ce({type:"plus",value:O});continue}ce({type:"plus",value:m});continue}if(O==="@"){if(n.noextglob!==!0&&D()==="("&&D(2)!=="?"){ce({type:"at",extglob:!0,value:O,output:""});continue}ce({type:"text",value:O});continue}if(O!=="*"){(O==="$"||O==="^")&&(O=`\\${O}`);let W=_K.exec(z());W&&(O+=W[0],F.index+=W[0].length),ce({type:"text",value:O});continue}if(M&&(M.type==="globstar"||M.star===!0)){M.type="star",M.star=!0,M.value+=O,M.output=de,F.backtrack=!0,F.globstar=!0,ie(O);continue}let V=z();if(n.noextglob!==!0&&/^\([^?]/.test(V)){vn("star",O);continue}if(M.type==="star"){if(n.noglobstar===!0){ie(O);continue}let W=M.prev,he=W.prev,Ae=W.type==="slash"||W.type==="bos",Ct=he&&(he.type==="star"||he.type==="globstar");if(n.bash===!0&&(!Ae||V[0]&&V[0]!=="/")){ce({type:"star",value:O,output:""});continue}let Ue=F.braces>0&&(W.type==="comma"||W.type==="brace"),Cn=Q.length&&(W.type==="pipe"||W.type==="paren");if(!Ae&&W.type!=="paren"&&!Ue&&!Cn){ce({type:"star",value:O,output:""});continue}for(;V.slice(0,3)==="/**";){let Zn=e[F.index+4];if(Zn&&Zn!=="/")break;V=V.slice(3),ie("/**",3)}if(W.type==="bos"&&wt()){M.type="globstar",M.value+=O,M.output=$(n),F.output=M.output,F.globstar=!0,ie(O);continue}if(W.type==="slash"&&W.prev.type!=="bos"&&!Ct&&wt()){F.output=F.output.slice(0,-(W.output+M.output).length),W.output=`(?:${W.output}`,M.type="globstar",M.output=$(n)+(n.strictSlashes?")":"|$)"),M.value+=O,F.globstar=!0,F.output+=W.output+M.output,ie(O);continue}if(W.type==="slash"&&W.prev.type!=="bos"&&V[0]==="/"){let Zn=V[1]!==void 0?"|$":"";F.output=F.output.slice(0,-(W.output+M.output).length),W.output=`(?:${W.output}`,M.type="globstar",M.output=`${$(n)}${p}|${p}${Zn})`,M.value+=O,F.output+=W.output+M.output,F.globstar=!0,ie(O+j()),ce({type:"slash",value:"/",output:""});continue}if(W.type==="bos"&&V[0]==="/"){M.type="globstar",M.value+=O,M.output=`(?:^|${p}|${$(n)}${p})`,F.output=M.output,F.globstar=!0,ie(O+j()),ce({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-M.output.length),M.type="globstar",M.output=$(n),M.value+=O,F.output+=M.output,F.globstar=!0,ie(O);continue}let Be={type:"star",value:O,output:de};if(n.bash===!0){Be.output=".*?",(M.type==="bos"||M.type==="slash")&&(Be.output=I+Be.output),ce(Be);continue}if(M&&(M.type==="bracket"||M.type==="paren")&&n.regex===!0){Be.output=O,ce(Be);continue}(F.index===F.start||M.type==="slash"||M.type==="dot")&&(M.type==="dot"?(F.output+=w,M.output+=w):n.dot===!0?(F.output+=_,M.output+=_):(F.output+=I,M.output+=I),D()!=="*"&&(F.output+=g,M.output+=g)),ce(Be)}for(;F.brackets>0;){if(n.strictBrackets===!0)throw new SyntaxError(da("closing","]"));F.output=un.escapeLast(F.output,"["),Mt("brackets")}for(;F.parens>0;){if(n.strictBrackets===!0)throw new SyntaxError(da("closing",")"));F.output=un.escapeLast(F.output,"("),Mt("parens")}for(;F.braces>0;){if(n.strictBrackets===!0)throw new SyntaxError(da("closing","}"));F.output=un.escapeLast(F.output,"{"),Mt("braces")}if(n.strictSlashes!==!0&&(M.type==="star"||M.type==="bracket")&&ce({type:"maybe_slash",value:"",output:`${p}?`}),F.backtrack===!0){F.output="";for(let V of F.tokens)F.output+=V.output!=null?V.output:V.value,V.suffix&&(F.output+=V.suffix)}return F};Mb.fastpaths=(e,t)=>{let n={...t},r=typeof n.maxLength=="number"?Math.min(xf,n.maxLength):xf,o=e.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);e=bD[e]||e;let s=un.isWindows(t),{DOT_LITERAL:a,SLASH_LITERAL:c,ONE_CHAR:l,DOTS_SLASH:u,NO_DOT:d,NO_DOTS:f,NO_DOTS_SLASH:m,STAR:p,START_ANCHOR:g}=ol.globChars(s),h=n.dot?f:d,y=n.dot?m:d,w=n.capture?"":"?:",_={negated:!1,prefix:""},b=n.bash===!0?".*?":p;n.capture&&(b=`(${b})`);let S=I=>I.noglobstar===!0?b:`(${w}(?:(?!${g}${I.dot?u:a}).)*?)`,N=I=>{switch(I){case"*":return`${h}${l}${b}`;case".*":return`${a}${l}${b}`;case"*.*":return`${h}${b}${a}${l}${b}`;case"*/*":return`${h}${b}${c}${l}${y}${b}`;case"**":return h+S(n);case"**/*":return`(?:${h}${S(n)}${c})?${y}${l}${b}`;case"**/*.*":return`(?:${h}${S(n)}${c})?${y}${b}${a}${l}${b}`;case"**/.*":return`(?:${h}${S(n)}${c})?${a}${l}${b}`;default:{let U=/^(.*?)\.(\w+)$/.exec(I);if(!U)return;let de=N(U[1]);return de?de+a+U[2]:void 0}}},R=un.removePrefix(e,_),$=N(R);return $&&n.strictSlashes!==!0&&($+=`${c}?`),$};xD.exports=Mb});var PD=C((Cse,CD)=>{"use strict";var PK=require("path"),NK=yD(),$b=vD(),qb=rl(),EK=nl(),RK=e=>e&&typeof e=="object"&&!Array.isArray(e),Pt=(e,t,n=!1)=>{if(Array.isArray(e)){let d=e.map(m=>Pt(m,t,n));return m=>{for(let p of d){let g=p(m);if(g)return g}return!1}}let r=RK(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let o=t||{},s=qb.isWindows(t),a=r?Pt.compileRe(e,t):Pt.makeRe(e,t,!1,!0),c=a.state;delete a.state;let l=()=>!1;if(o.ignore){let d={...t,ignore:null,onMatch:null,onResult:null};l=Pt(o.ignore,d,n)}let u=(d,f=!1)=>{let{isMatch:m,match:p,output:g}=Pt.test(d,a,t,{glob:e,posix:s}),h={glob:e,state:c,regex:a,posix:s,input:d,output:g,match:p,isMatch:m};return typeof o.onResult=="function"&&o.onResult(h),m===!1?(h.isMatch=!1,f?h:!1):l(d)?(typeof o.onIgnore=="function"&&o.onIgnore(h),h.isMatch=!1,f?h:!1):(typeof o.onMatch=="function"&&o.onMatch(h),f?h:!0)};return n&&(u.state=c),u};Pt.test=(e,t,n,{glob:r,posix:o}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let s=n||{},a=s.format||(o?qb.toPosixSlashes:null),c=e===r,l=c&&a?a(e):e;return c===!1&&(l=a?a(e):e,c=l===r),(c===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?c=Pt.matchBase(e,t,n,o):c=t.exec(l)),{isMatch:!!c,match:c,output:l}};Pt.matchBase=(e,t,n,r=qb.isWindows(n))=>(t instanceof RegExp?t:Pt.makeRe(t,n)).test(PK.basename(e));Pt.isMatch=(e,t,n)=>Pt(t,n)(e);Pt.parse=(e,t)=>Array.isArray(e)?e.map(n=>Pt.parse(n,t)):$b(e,{...t,fastpaths:!1});Pt.scan=(e,t)=>NK(e,t);Pt.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let o=t||{},s=o.contains?"":"^",a=o.contains?"":"$",c=`${s}(?:${e.output})${a}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=Pt.toRegex(c,t);return r===!0&&(l.state=e),l};Pt.makeRe=(e,t={},n=!1,r=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(o.output=$b.fastpaths(e,t)),o.output||(o=$b(e,t)),Pt.compileRe(o,t,n,r)};Pt.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(n){if(t&&t.debug===!0)throw n;return/$^/}};Pt.constants=EK;CD.exports=Pt});var ED=C((Pse,ND)=>{"use strict";ND.exports=PD()});var kD=C((Nse,DD)=>{"use strict";var TD=require("util"),AD=oD(),Hr=ED(),Bb=rl(),RD=e=>e===""||e==="./",ID=e=>{let t=e.indexOf("{");return t>-1&&e.indexOf("}",t)>-1},tt=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let r=new Set,o=new Set,s=new Set,a=0,c=d=>{s.add(d.output),n&&n.onResult&&n.onResult(d)};for(let d=0;d<t.length;d++){let f=Hr(String(t[d]),{...n,onResult:c},!0),m=f.state.negated||f.state.negatedExtglob;m&&a++;for(let p of e){let g=f(p,!0);(m?!g.isMatch:g.isMatch)&&(m?r.add(g.output):(r.delete(g.output),o.add(g.output)))}}let u=(a===t.length?[...s]:[...o]).filter(d=>!r.has(d));if(n&&u.length===0){if(n.failglob===!0)throw new Error(`No matches found for "${t.join(", ")}"`);if(n.nonull===!0||n.nullglob===!0)return n.unescape?t.map(d=>d.replace(/\\/g,"")):t}return u};tt.match=tt;tt.matcher=(e,t)=>Hr(e,t);tt.isMatch=(e,t,n)=>Hr(t,n)(e);tt.any=tt.isMatch;tt.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],s=c=>{n.onResult&&n.onResult(c),o.push(c.output)},a=new Set(tt(e,t,{...n,onResult:s}));for(let c of o)a.has(c)||r.add(c);return[...r]};tt.contains=(e,t,n)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${TD.inspect(e)}"`);if(Array.isArray(t))return t.some(r=>tt.contains(e,r,n));if(typeof t=="string"){if(RD(e)||RD(t))return!1;if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t))return!0}return tt.isMatch(e,t,{...n,contains:!0})};tt.matchKeys=(e,t,n)=>{if(!Bb.isObject(e))throw new TypeError("Expected the first argument to be an object");let r=tt(Object.keys(e),t,n),o={};for(let s of r)o[s]=e[s];return o};tt.some=(e,t,n)=>{let r=[].concat(e);for(let o of[].concat(t)){let s=Hr(String(o),n);if(r.some(a=>s(a)))return!0}return!1};tt.every=(e,t,n)=>{let r=[].concat(e);for(let o of[].concat(t)){let s=Hr(String(o),n);if(!r.every(a=>s(a)))return!1}return!0};tt.all=(e,t,n)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${TD.inspect(e)}"`);return[].concat(t).every(r=>Hr(r,n)(e))};tt.capture=(e,t,n)=>{let r=Bb.isWindows(n),s=Hr.makeRe(String(e),{...n,capture:!0}).exec(r?Bb.toPosixSlashes(t):t);if(s)return s.slice(1).map(a=>a===void 0?"":a)};tt.makeRe=(...e)=>Hr.makeRe(...e);tt.scan=(...e)=>Hr.scan(...e);tt.parse=(e,t)=>{let n=[];for(let r of[].concat(e||[]))for(let o of AD(String(r),t))n.push(Hr.parse(o,t));return n};tt.braces=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return t&&t.nobrace===!0||!ID(e)?[e]:AD(e,t)};tt.braceExpand=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return tt.braces(e,{...t,expand:!0})};tt.hasBraces=ID;DD.exports=tt});var UD=C(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.isAbsolute=ae.partitionAbsoluteAndRelative=ae.removeDuplicateSlashes=ae.matchAny=ae.convertPatternsToRe=ae.makeRe=ae.getPatternParts=ae.expandBraceExpansion=ae.expandPatternsWithBraceExpansion=ae.isAffectDepthOfReadingPattern=ae.endsWithSlashGlobStar=ae.hasGlobStar=ae.getBaseDirectory=ae.isPatternRelatedToParentDirectory=ae.getPatternsOutsideCurrentDirectory=ae.getPatternsInsideCurrentDirectory=ae.getPositivePatterns=ae.getNegativePatterns=ae.isPositivePattern=ae.isNegativePattern=ae.convertToNegativePattern=ae.convertToPositivePattern=ae.isDynamicPattern=ae.isStaticPattern=void 0;var FD=require("path"),TK=vI(),jb=kD(),LD="**",AK="\\",IK=/[*?]|^!/,DK=/\[[^[]*]/,kK=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,FK=/[!*+?@]\([^(]*\)/,LK=/,|\.\./,OK=/(?!^)\/{2,}/g;function OD(e,t={}){return!MD(e,t)}ae.isStaticPattern=OD;function MD(e,t={}){return e===""?!1:!!(t.caseSensitiveMatch===!1||e.includes(AK)||IK.test(e)||DK.test(e)||kK.test(e)||t.extglob!==!1&&FK.test(e)||t.braceExpansion!==!1&&MK(e))}ae.isDynamicPattern=MD;function MK(e){let t=e.indexOf("{");if(t===-1)return!1;let n=e.indexOf("}",t+1);if(n===-1)return!1;let r=e.slice(t,n);return LK.test(r)}function $K(e){return vf(e)?e.slice(1):e}ae.convertToPositivePattern=$K;function qK(e){return"!"+e}ae.convertToNegativePattern=qK;function vf(e){return e.startsWith("!")&&e[1]!=="("}ae.isNegativePattern=vf;function $D(e){return!vf(e)}ae.isPositivePattern=$D;function BK(e){return e.filter(vf)}ae.getNegativePatterns=BK;function jK(e){return e.filter($D)}ae.getPositivePatterns=jK;function WK(e){return e.filter(t=>!Wb(t))}ae.getPatternsInsideCurrentDirectory=WK;function UK(e){return e.filter(Wb)}ae.getPatternsOutsideCurrentDirectory=UK;function Wb(e){return e.startsWith("..")||e.startsWith("./..")}ae.isPatternRelatedToParentDirectory=Wb;function HK(e){return TK(e,{flipBackslashes:!1})}ae.getBaseDirectory=HK;function VK(e){return e.includes(LD)}ae.hasGlobStar=VK;function qD(e){return e.endsWith("/"+LD)}ae.endsWithSlashGlobStar=qD;function GK(e){let t=FD.basename(e);return qD(e)||OD(t)}ae.isAffectDepthOfReadingPattern=GK;function zK(e){return e.reduce((t,n)=>t.concat(BD(n)),[])}ae.expandPatternsWithBraceExpansion=zK;function BD(e){let t=jb.braces(e,{expand:!0,nodupes:!0,keepEscaping:!0});return t.sort((n,r)=>n.length-r.length),t.filter(n=>n!=="")}ae.expandBraceExpansion=BD;function KK(e,t){let{parts:n}=jb.scan(e,Object.assign(Object.assign({},t),{parts:!0}));return n.length===0&&(n=[e]),n[0].startsWith("/")&&(n[0]=n[0].slice(1),n.unshift("")),n}ae.getPatternParts=KK;function jD(e,t){return jb.makeRe(e,t)}ae.makeRe=jD;function YK(e,t){return e.map(n=>jD(n,t))}ae.convertPatternsToRe=YK;function XK(e,t){return t.some(n=>n.test(e))}ae.matchAny=XK;function JK(e){return e.replace(OK,"/")}ae.removeDuplicateSlashes=JK;function QK(e){let t=[],n=[];for(let r of e)WD(r)?t.push(r):n.push(r);return[t,n]}ae.partitionAbsoluteAndRelative=QK;function WD(e){return FD.isAbsolute(e)}ae.isAbsolute=WD});var zD=C((Rse,GD)=>{"use strict";var ZK=require("stream"),HD=ZK.PassThrough,e3=Array.prototype.slice;GD.exports=t3;function t3(){let e=[],t=e3.call(arguments),n=!1,r=t[t.length-1];r&&!Array.isArray(r)&&r.pipe==null?t.pop():r={};let o=r.end!==!1,s=r.pipeError===!0;r.objectMode==null&&(r.objectMode=!0),r.highWaterMark==null&&(r.highWaterMark=64*1024);let a=HD(r);function c(){for(let d=0,f=arguments.length;d<f;d++)e.push(VD(arguments[d],r));return l(),this}function l(){if(n)return;n=!0;let d=e.shift();if(!d){process.nextTick(u);return}Array.isArray(d)||(d=[d]);let f=d.length+1;function m(){--f>0||(n=!1,l())}function p(g){function h(){g.removeListener("merge2UnpipeEnd",h),g.removeListener("end",h),s&&g.removeListener("error",y),m()}function y(w){a.emit("error",w)}if(g._readableState.endEmitted)return m();g.on("merge2UnpipeEnd",h),g.on("end",h),s&&g.on("error",y),g.pipe(a,{end:!1}),g.resume()}for(let g=0;g<d.length;g++)p(d[g]);m()}function u(){n=!1,a.emit("queueDrain"),o&&a.end()}return a.setMaxListeners(0),a.add=c,a.on("unpipe",function(d){d.emit("merge2UnpipeEnd")}),t.length&&c.apply(null,t),a}function VD(e,t){if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)e[n]=VD(e[n],t);else{if(!e._readableState&&e.pipe&&(e=e.pipe(HD(t))),!e._readableState||!e.pause||!e.pipe)throw new Error("Only readable stream can be merged.");e.pause()}return e}});var YD=C(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.merge=void 0;var n3=zD();function r3(e){let t=n3(e);return e.forEach(n=>{n.once("error",r=>t.emit("error",r))}),t.once("close",()=>KD(e)),t.once("end",()=>KD(e)),t}Cf.merge=r3;function KD(e){e.forEach(t=>t.emit("close"))}});var XD=C(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.isEmpty=fa.isString=void 0;function i3(e){return typeof e=="string"}fa.isString=i3;function o3(e){return e===""}fa.isEmpty=o3});var di=C(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.string=dn.stream=dn.pattern=dn.path=dn.fs=dn.errno=dn.array=void 0;var s3=uI();dn.array=s3;var a3=dI();dn.errno=a3;var c3=fI();dn.fs=c3;var l3=gI();dn.path=l3;var u3=UD();dn.pattern=u3;var d3=YD();dn.stream=d3;var f3=XD();dn.string=f3});var ek=C(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.convertPatternGroupToTask=fn.convertPatternGroupsToTasks=fn.groupPatternsByBaseDirectory=fn.getNegativePatternsAsPositive=fn.getPositivePatterns=fn.convertPatternsToTasks=fn.generate=void 0;var wr=di();function m3(e,t){let n=JD(e,t),r=JD(t.ignore,t),o=QD(n),s=ZD(n,r),a=o.filter(d=>wr.pattern.isStaticPattern(d,t)),c=o.filter(d=>wr.pattern.isDynamicPattern(d,t)),l=Ub(a,s,!1),u=Ub(c,s,!0);return l.concat(u)}fn.generate=m3;function JD(e,t){let n=e;return t.braceExpansion&&(n=wr.pattern.expandPatternsWithBraceExpansion(n)),t.baseNameMatch&&(n=n.map(r=>r.includes("/")?r:`**/${r}`)),n.map(r=>wr.pattern.removeDuplicateSlashes(r))}function Ub(e,t,n){let r=[],o=wr.pattern.getPatternsOutsideCurrentDirectory(e),s=wr.pattern.getPatternsInsideCurrentDirectory(e),a=Hb(o),c=Hb(s);return r.push(...Vb(a,t,n)),"."in c?r.push(Gb(".",s,t,n)):r.push(...Vb(c,t,n)),r}fn.convertPatternsToTasks=Ub;function QD(e){return wr.pattern.getPositivePatterns(e)}fn.getPositivePatterns=QD;function ZD(e,t){return wr.pattern.getNegativePatterns(e).concat(t).map(wr.pattern.convertToPositivePattern)}fn.getNegativePatternsAsPositive=ZD;function Hb(e){let t={};return e.reduce((n,r)=>{let o=wr.pattern.getBaseDirectory(r);return o in n?n[o].push(r):n[o]=[r],n},t)}fn.groupPatternsByBaseDirectory=Hb;function Vb(e,t,n){return Object.keys(e).map(r=>Gb(r,e[r],t,n))}fn.convertPatternGroupsToTasks=Vb;function Gb(e,t,n,r){return{dynamic:r,positive:t,negative:n,base:e,patterns:[].concat(t,n.map(wr.pattern.convertToNegativePattern))}}fn.convertPatternGroupToTask=Gb});var nk=C(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.read=void 0;function p3(e,t,n){t.fs.lstat(e,(r,o)=>{if(r!==null){tk(n,r);return}if(!o.isSymbolicLink()||!t.followSymbolicLink){zb(n,o);return}t.fs.stat(e,(s,a)=>{if(s!==null){if(t.throwErrorOnBrokenSymbolicLink){tk(n,s);return}zb(n,o);return}t.markSymbolicLink&&(a.isSymbolicLink=()=>!0),zb(n,a)})})}Pf.read=p3;function tk(e,t){e(t)}function zb(e,t){e(null,t)}});var rk=C(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.read=void 0;function h3(e,t){let n=t.fs.lstatSync(e);if(!n.isSymbolicLink()||!t.followSymbolicLink)return n;try{let r=t.fs.statSync(e);return t.markSymbolicLink&&(r.isSymbolicLink=()=>!0),r}catch(r){if(!t.throwErrorOnBrokenSymbolicLink)return n;throw r}}Nf.read=h3});var ik=C(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.createFileSystemAdapter=Ui.FILE_SYSTEM_ADAPTER=void 0;var Ef=require("fs");Ui.FILE_SYSTEM_ADAPTER={lstat:Ef.lstat,stat:Ef.stat,lstatSync:Ef.lstatSync,statSync:Ef.statSync};function g3(e){return e===void 0?Ui.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Ui.FILE_SYSTEM_ADAPTER),e)}Ui.createFileSystemAdapter=g3});var ok=C(Yb=>{"use strict";Object.defineProperty(Yb,"__esModule",{value:!0});var _3=ik(),Kb=class{constructor(t={}){this._options=t,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=_3.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(t,n){return t??n}};Yb.default=Kb});var Go=C(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.statSync=Hi.stat=Hi.Settings=void 0;var sk=nk(),y3=rk(),Xb=ok();Hi.Settings=Xb.default;function b3(e,t,n){if(typeof t=="function"){sk.read(e,Jb(),t);return}sk.read(e,Jb(t),n)}Hi.stat=b3;function S3(e,t){let n=Jb(t);return y3.read(e,n)}Hi.statSync=S3;function Jb(e={}){return e instanceof Xb.default?e:new Xb.default(e)}});var lk=C(($se,ck)=>{var ak;ck.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):e=>(ak||(ak=Promise.resolve())).then(e).catch(t=>setTimeout(()=>{throw t},0))});var dk=C((qse,uk)=>{uk.exports=x3;var w3=lk();function x3(e,t){let n,r,o,s=!0;Array.isArray(e)?(n=[],r=e.length):(o=Object.keys(e),n={},r=o.length);function a(l){function u(){t&&t(l,n),t=null}s?w3(u):u()}function c(l,u,d){n[l]=d,(--r===0||u)&&a(u)}r?o?o.forEach(function(l){e[l](function(u,d){c(l,u,d)})}):e.forEach(function(l,u){l(function(d,f){c(u,d,f)})}):a(null),s=!1}});var Qb=C(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var Rf=process.versions.node.split(".");if(Rf[0]===void 0||Rf[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var fk=Number.parseInt(Rf[0],10),v3=Number.parseInt(Rf[1],10),mk=10,C3=10,P3=fk>mk,N3=fk===mk&&v3>=C3;Tf.IS_SUPPORT_READDIR_WITH_FILE_TYPES=P3||N3});var pk=C(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.createDirentFromStats=void 0;var Zb=class{constructor(t,n){this.name=t,this.isBlockDevice=n.isBlockDevice.bind(n),this.isCharacterDevice=n.isCharacterDevice.bind(n),this.isDirectory=n.isDirectory.bind(n),this.isFIFO=n.isFIFO.bind(n),this.isFile=n.isFile.bind(n),this.isSocket=n.isSocket.bind(n),this.isSymbolicLink=n.isSymbolicLink.bind(n)}};function E3(e,t){return new Zb(e,t)}Af.createDirentFromStats=E3});var eS=C(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.fs=void 0;var R3=pk();If.fs=R3});var tS=C(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.joinPathSegments=void 0;function T3(e,t,n){return e.endsWith(n)?e+t:e+n+t}Df.joinPathSegments=T3});var Sk=C(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.readdir=Vi.readdirWithFileTypes=Vi.read=void 0;var A3=Go(),hk=dk(),I3=Qb(),gk=eS(),_k=tS();function D3(e,t,n){if(!t.stats&&I3.IS_SUPPORT_READDIR_WITH_FILE_TYPES){yk(e,t,n);return}bk(e,t,n)}Vi.read=D3;function yk(e,t,n){t.fs.readdir(e,{withFileTypes:!0},(r,o)=>{if(r!==null){kf(n,r);return}let s=o.map(c=>({dirent:c,name:c.name,path:_k.joinPathSegments(e,c.name,t.pathSegmentSeparator)}));if(!t.followSymbolicLinks){nS(n,s);return}let a=s.map(c=>k3(c,t));hk(a,(c,l)=>{if(c!==null){kf(n,c);return}nS(n,l)})})}Vi.readdirWithFileTypes=yk;function k3(e,t){return n=>{if(!e.dirent.isSymbolicLink()){n(null,e);return}t.fs.stat(e.path,(r,o)=>{if(r!==null){if(t.throwErrorOnBrokenSymbolicLink){n(r);return}n(null,e);return}e.dirent=gk.fs.createDirentFromStats(e.name,o),n(null,e)})}}function bk(e,t,n){t.fs.readdir(e,(r,o)=>{if(r!==null){kf(n,r);return}let s=o.map(a=>{let c=_k.joinPathSegments(e,a,t.pathSegmentSeparator);return l=>{A3.stat(c,t.fsStatSettings,(u,d)=>{if(u!==null){l(u);return}let f={name:a,path:c,dirent:gk.fs.createDirentFromStats(a,d)};t.stats&&(f.stats=d),l(null,f)})}});hk(s,(a,c)=>{if(a!==null){kf(n,a);return}nS(n,c)})})}Vi.readdir=bk;function kf(e,t){e(t)}function nS(e,t){e(null,t)}});var Pk=C(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.readdir=Gi.readdirWithFileTypes=Gi.read=void 0;var F3=Go(),L3=Qb(),wk=eS(),xk=tS();function O3(e,t){return!t.stats&&L3.IS_SUPPORT_READDIR_WITH_FILE_TYPES?vk(e,t):Ck(e,t)}Gi.read=O3;function vk(e,t){return t.fs.readdirSync(e,{withFileTypes:!0}).map(r=>{let o={dirent:r,name:r.name,path:xk.joinPathSegments(e,r.name,t.pathSegmentSeparator)};if(o.dirent.isSymbolicLink()&&t.followSymbolicLinks)try{let s=t.fs.statSync(o.path);o.dirent=wk.fs.createDirentFromStats(o.name,s)}catch(s){if(t.throwErrorOnBrokenSymbolicLink)throw s}return o})}Gi.readdirWithFileTypes=vk;function Ck(e,t){return t.fs.readdirSync(e).map(r=>{let o=xk.joinPathSegments(e,r,t.pathSegmentSeparator),s=F3.statSync(o,t.fsStatSettings),a={name:r,path:o,dirent:wk.fs.createDirentFromStats(r,s)};return t.stats&&(a.stats=s),a})}Gi.readdir=Ck});var Nk=C(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.createFileSystemAdapter=zi.FILE_SYSTEM_ADAPTER=void 0;var ma=require("fs");zi.FILE_SYSTEM_ADAPTER={lstat:ma.lstat,stat:ma.stat,lstatSync:ma.lstatSync,statSync:ma.statSync,readdir:ma.readdir,readdirSync:ma.readdirSync};function M3(e){return e===void 0?zi.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},zi.FILE_SYSTEM_ADAPTER),e)}zi.createFileSystemAdapter=M3});var Ek=C(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});var $3=require("path"),q3=Go(),B3=Nk(),rS=class{constructor(t={}){this._options=t,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=B3.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,$3.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new q3.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(t,n){return t??n}};iS.default=rS});var Ff=C(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.Settings=Ki.scandirSync=Ki.scandir=void 0;var Rk=Sk(),j3=Pk(),oS=Ek();Ki.Settings=oS.default;function W3(e,t,n){if(typeof t=="function"){Rk.read(e,sS(),t);return}Rk.read(e,sS(t),n)}Ki.scandir=W3;function U3(e,t){let n=sS(t);return j3.read(e,n)}Ki.scandirSync=U3;function sS(e={}){return e instanceof oS.default?e:new oS.default(e)}});var Ak=C((Yse,Tk)=>{"use strict";function H3(e){var t=new e,n=t;function r(){var s=t;return s.next?t=s.next:(t=new e,n=t),s.next=null,s}function o(s){n.next=s,n=s}return{get:r,release:o}}Tk.exports=H3});var Dk=C((Xse,aS)=>{"use strict";var V3=Ak();function Ik(e,t,n){if(typeof e=="function"&&(n=t,t=e,e=null),!(n>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var r=V3(G3),o=null,s=null,a=0,c=null,l={push:h,drain:In,saturated:In,pause:d,paused:!1,get concurrency(){return n},set concurrency(R){if(!(R>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(n=R,!l.paused)for(;o&&a<n;)a++,w()},running:u,resume:p,idle:g,length:f,getQueue:m,unshift:y,empty:In,kill:_,killAndDrain:b,error:N,abort:S};return l;function u(){return a}function d(){l.paused=!0}function f(){for(var R=o,$=0;R;)R=R.next,$++;return $}function m(){for(var R=o,$=[];R;)$.push(R.value),R=R.next;return $}function p(){if(l.paused){if(l.paused=!1,o===null){a++,w();return}for(;o&&a<n;)a++,w()}}function g(){return a===0&&l.length()===0}function h(R,$){var I=r.get();I.context=e,I.release=w,I.value=R,I.callback=$||In,I.errorHandler=c,a>=n||l.paused?s?(s.next=I,s=I):(o=I,s=I,l.saturated()):(a++,t.call(e,I.value,I.worked))}function y(R,$){var I=r.get();I.context=e,I.release=w,I.value=R,I.callback=$||In,I.errorHandler=c,a>=n||l.paused?o?(I.next=o,o=I):(o=I,s=I,l.saturated()):(a++,t.call(e,I.value,I.worked))}function w(R){R&&r.release(R);var $=o;$&&a<=n?l.paused?a--:(s===o&&(s=null),o=$.next,$.next=null,t.call(e,$.value,$.worked),s===null&&l.empty()):--a===0&&l.drain()}function _(){o=null,s=null,l.drain=In}function b(){o=null,s=null,l.drain(),l.drain=In}function S(){var R=o;for(o=null,s=null;R;){var $=R.next,I=R.callback,U=R.errorHandler,de=R.value,F=R.context;R.value=null,R.callback=In,R.errorHandler=null,U&&U(new Error("abort"),de),I.call(F,new Error("abort")),R.release(R),R=$}l.drain=In}function N(R){c=R}}function In(){}function G3(){this.value=null,this.callback=In,this.next=null,this.release=In,this.context=null,this.errorHandler=null;var e=this;this.worked=function(n,r){var o=e.callback,s=e.errorHandler,a=e.value;e.value=null,e.callback=In,e.errorHandler&&s(n,a),o.call(e.context,n,r),e.release(e)}}function z3(e,t,n){typeof e=="function"&&(n=t,t=e,e=null);function r(d,f){t.call(this,d).then(function(m){f(null,m)},f)}var o=Ik(e,r,n),s=o.push,a=o.unshift;return o.push=c,o.unshift=l,o.drained=u,o;function c(d){var f=new Promise(function(m,p){s(d,function(g,h){if(g){p(g);return}m(h)})});return f.catch(In),f}function l(d){var f=new Promise(function(m,p){a(d,function(g,h){if(g){p(g);return}m(h)})});return f.catch(In),f}function u(){var d=new Promise(function(f){process.nextTick(function(){if(o.idle())f();else{var m=o.drain;o.drain=function(){typeof m=="function"&&m(),f(),o.drain=m}}})});return d}}aS.exports=Ik;aS.exports.promise=z3});var Lf=C(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.joinPathSegments=Vr.replacePathSegmentSeparator=Vr.isAppliedFilter=Vr.isFatalError=void 0;function K3(e,t){return e.errorFilter===null?!0:!e.errorFilter(t)}Vr.isFatalError=K3;function Y3(e,t){return e===null||e(t)}Vr.isAppliedFilter=Y3;function X3(e,t){return e.split(/[/\\]/).join(t)}Vr.replacePathSegmentSeparator=X3;function J3(e,t,n){return e===""?t:e.endsWith(n)?e+t:e+n+t}Vr.joinPathSegments=J3});var uS=C(lS=>{"use strict";Object.defineProperty(lS,"__esModule",{value:!0});var Q3=Lf(),cS=class{constructor(t,n){this._root=t,this._settings=n,this._root=Q3.replacePathSegmentSeparator(t,n.pathSegmentSeparator)}};lS.default=cS});var mS=C(fS=>{"use strict";Object.defineProperty(fS,"__esModule",{value:!0});var Z3=require("events"),eY=Ff(),tY=Dk(),Of=Lf(),nY=uS(),dS=class extends nY.default{constructor(t,n){super(t,n),this._settings=n,this._scandir=eY.scandir,this._emitter=new Z3.EventEmitter,this._queue=tY(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(t){this._emitter.on("entry",t)}onError(t){this._emitter.once("error",t)}onEnd(t){this._emitter.once("end",t)}_pushToQueue(t,n){let r={directory:t,base:n};this._queue.push(r,o=>{o!==null&&this._handleError(o)})}_worker(t,n){this._scandir(t.directory,this._settings.fsScandirSettings,(r,o)=>{if(r!==null){n(r,void 0);return}for(let s of o)this._handleEntry(s,t.base);n(null,void 0)})}_handleError(t){this._isDestroyed||!Of.isFatalError(this._settings,t)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",t))}_handleEntry(t,n){if(this._isDestroyed||this._isFatalError)return;let r=t.path;n!==void 0&&(t.path=Of.joinPathSegments(n,t.name,this._settings.pathSegmentSeparator)),Of.isAppliedFilter(this._settings.entryFilter,t)&&this._emitEntry(t),t.dirent.isDirectory()&&Of.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(r,n===void 0?void 0:t.path)}_emitEntry(t){this._emitter.emit("entry",t)}};fS.default=dS});var kk=C(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});var rY=mS(),pS=class{constructor(t,n){this._root=t,this._settings=n,this._reader=new rY.default(this._root,this._settings),this._storage=[]}read(t){this._reader.onError(n=>{iY(t,n)}),this._reader.onEntry(n=>{this._storage.push(n)}),this._reader.onEnd(()=>{oY(t,this._storage)}),this._reader.read()}};hS.default=pS;function iY(e,t){e(t)}function oY(e,t){e(null,t)}});var Fk=C(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});var sY=require("stream"),aY=mS(),gS=class{constructor(t,n){this._root=t,this._settings=n,this._reader=new aY.default(this._root,this._settings),this._stream=new sY.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(t=>{this._stream.emit("error",t)}),this._reader.onEntry(t=>{this._stream.push(t)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};_S.default=gS});var Lk=C(bS=>{"use strict";Object.defineProperty(bS,"__esModule",{value:!0});var cY=Ff(),Mf=Lf(),lY=uS(),yS=class extends lY.default{constructor(){super(...arguments),this._scandir=cY.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(t,n){this._queue.add({directory:t,base:n})}_handleQueue(){for(let t of this._queue.values())this._handleDirectory(t.directory,t.base)}_handleDirectory(t,n){try{let r=this._scandir(t,this._settings.fsScandirSettings);for(let o of r)this._handleEntry(o,n)}catch(r){this._handleError(r)}}_handleError(t){if(Mf.isFatalError(this._settings,t))throw t}_handleEntry(t,n){let r=t.path;n!==void 0&&(t.path=Mf.joinPathSegments(n,t.name,this._settings.pathSegmentSeparator)),Mf.isAppliedFilter(this._settings.entryFilter,t)&&this._pushToStorage(t),t.dirent.isDirectory()&&Mf.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(r,n===void 0?void 0:t.path)}_pushToStorage(t){this._storage.push(t)}};bS.default=yS});var Ok=C(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});var uY=Lk(),SS=class{constructor(t,n){this._root=t,this._settings=n,this._reader=new uY.default(this._root,this._settings)}read(){return this._reader.read()}};wS.default=SS});var Mk=C(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});var dY=require("path"),fY=Ff(),xS=class{constructor(t={}){this._options=t,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,dY.sep),this.fsScandirSettings=new fY.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(t,n){return t??n}};vS.default=xS});var qf=C(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.Settings=Gr.walkStream=Gr.walkSync=Gr.walk=void 0;var $k=kk(),mY=Fk(),pY=Ok(),CS=Mk();Gr.Settings=CS.default;function hY(e,t,n){if(typeof t=="function"){new $k.default(e,$f()).read(t);return}new $k.default(e,$f(t)).read(n)}Gr.walk=hY;function gY(e,t){let n=$f(t);return new pY.default(e,n).read()}Gr.walkSync=gY;function _Y(e,t){let n=$f(t);return new mY.default(e,n).read()}Gr.walkStream=_Y;function $f(e={}){return e instanceof CS.default?e:new CS.default(e)}});var Bf=C(NS=>{"use strict";Object.defineProperty(NS,"__esModule",{value:!0});var yY=require("path"),bY=Go(),qk=di(),PS=class{constructor(t){this._settings=t,this._fsStatSettings=new bY.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(t){return yY.resolve(this._settings.cwd,t)}_makeEntry(t,n){let r={name:n,path:n,dirent:qk.fs.createDirentFromStats(n,t)};return this._settings.stats&&(r.stats=t),r}_isFatalError(t){return!qk.errno.isEnoentCodeError(t)&&!this._settings.suppressErrors}};NS.default=PS});var TS=C(RS=>{"use strict";Object.defineProperty(RS,"__esModule",{value:!0});var SY=require("stream"),wY=Go(),xY=qf(),vY=Bf(),ES=class extends vY.default{constructor(){super(...arguments),this._walkStream=xY.walkStream,this._stat=wY.stat}dynamic(t,n){return this._walkStream(t,n)}static(t,n){let r=t.map(this._getFullEntryPath,this),o=new SY.PassThrough({objectMode:!0});o._write=(s,a,c)=>this._getEntry(r[s],t[s],n).then(l=>{l!==null&&n.entryFilter(l)&&o.push(l),s===r.length-1&&o.end(),c()}).catch(c);for(let s=0;s<r.length;s++)o.write(s);return o}_getEntry(t,n,r){return this._getStat(t).then(o=>this._makeEntry(o,n)).catch(o=>{if(r.errorFilter(o))return null;throw o})}_getStat(t){return new Promise((n,r)=>{this._stat(t,this._fsStatSettings,(o,s)=>o===null?n(s):r(o))})}};RS.default=ES});var Bk=C(IS=>{"use strict";Object.defineProperty(IS,"__esModule",{value:!0});var CY=qf(),PY=Bf(),NY=TS(),AS=class extends PY.default{constructor(){super(...arguments),this._walkAsync=CY.walk,this._readerStream=new NY.default(this._settings)}dynamic(t,n){return new Promise((r,o)=>{this._walkAsync(t,n,(s,a)=>{s===null?r(a):o(s)})})}async static(t,n){let r=[],o=this._readerStream.static(t,n);return new Promise((s,a)=>{o.once("error",a),o.on("data",c=>r.push(c)),o.once("end",()=>s(r))})}};IS.default=AS});var jk=C(kS=>{"use strict";Object.defineProperty(kS,"__esModule",{value:!0});var sl=di(),DS=class{constructor(t,n,r){this._patterns=t,this._settings=n,this._micromatchOptions=r,this._storage=[],this._fillStorage()}_fillStorage(){for(let t of this._patterns){let n=this._getPatternSegments(t),r=this._splitSegmentsIntoSections(n);this._storage.push({complete:r.length<=1,pattern:t,segments:n,sections:r})}}_getPatternSegments(t){return sl.pattern.getPatternParts(t,this._micromatchOptions).map(r=>sl.pattern.isDynamicPattern(r,this._settings)?{dynamic:!0,pattern:r,patternRe:sl.pattern.makeRe(r,this._micromatchOptions)}:{dynamic:!1,pattern:r})}_splitSegmentsIntoSections(t){return sl.array.splitWhen(t,n=>n.dynamic&&sl.pattern.hasGlobStar(n.pattern))}};kS.default=DS});var Wk=C(LS=>{"use strict";Object.defineProperty(LS,"__esModule",{value:!0});var EY=jk(),FS=class extends EY.default{match(t){let n=t.split("/"),r=n.length,o=this._storage.filter(s=>!s.complete||s.segments.length>r);for(let s of o){let a=s.sections[0];if(!s.complete&&r>a.length||n.every((l,u)=>{let d=s.segments[u];return!!(d.dynamic&&d.patternRe.test(l)||!d.dynamic&&d.pattern===l)}))return!0}return!1}};LS.default=FS});var Uk=C(MS=>{"use strict";Object.defineProperty(MS,"__esModule",{value:!0});var jf=di(),RY=Wk(),OS=class{constructor(t,n){this._settings=t,this._micromatchOptions=n}getFilter(t,n,r){let o=this._getMatcher(n),s=this._getNegativePatternsRe(r);return a=>this._filter(t,a,o,s)}_getMatcher(t){return new RY.default(t,this._settings,this._micromatchOptions)}_getNegativePatternsRe(t){let n=t.filter(jf.pattern.isAffectDepthOfReadingPattern);return jf.pattern.convertPatternsToRe(n,this._micromatchOptions)}_filter(t,n,r,o){if(this._isSkippedByDeep(t,n.path)||this._isSkippedSymbolicLink(n))return!1;let s=jf.path.removeLeadingDotSegment(n.path);return this._isSkippedByPositivePatterns(s,r)?!1:this._isSkippedByNegativePatterns(s,o)}_isSkippedByDeep(t,n){return this._settings.deep===1/0?!1:this._getEntryLevel(t,n)>=this._settings.deep}_getEntryLevel(t,n){let r=n.split("/").length;if(t==="")return r;let o=t.split("/").length;return r-o}_isSkippedSymbolicLink(t){return!this._settings.followSymbolicLinks&&t.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(t,n){return!this._settings.baseNameMatch&&!n.match(t)}_isSkippedByNegativePatterns(t,n){return!jf.pattern.matchAny(t,n)}};MS.default=OS});var Hk=C(qS=>{"use strict";Object.defineProperty(qS,"__esModule",{value:!0});var Yi=di(),$S=class{constructor(t,n){this._settings=t,this._micromatchOptions=n,this.index=new Map}getFilter(t,n){let[r,o]=Yi.pattern.partitionAbsoluteAndRelative(n),s={positive:{all:Yi.pattern.convertPatternsToRe(t,this._micromatchOptions)},negative:{absolute:Yi.pattern.convertPatternsToRe(r,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:Yi.pattern.convertPatternsToRe(o,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return a=>this._filter(a,s)}_filter(t,n){let r=Yi.path.removeLeadingDotSegment(t.path);if(this._settings.unique&&this._isDuplicateEntry(r)||this._onlyFileFilter(t)||this._onlyDirectoryFilter(t))return!1;let o=this._isMatchToPatternsSet(r,n,t.dirent.isDirectory());return this._settings.unique&&o&&this._createIndexRecord(r),o}_isDuplicateEntry(t){return this.index.has(t)}_createIndexRecord(t){this.index.set(t,void 0)}_onlyFileFilter(t){return this._settings.onlyFiles&&!t.dirent.isFile()}_onlyDirectoryFilter(t){return this._settings.onlyDirectories&&!t.dirent.isDirectory()}_isMatchToPatternsSet(t,n,r){return!(!this._isMatchToPatterns(t,n.positive.all,r)||this._isMatchToPatterns(t,n.negative.relative,r)||this._isMatchToAbsoluteNegative(t,n.negative.absolute,r))}_isMatchToAbsoluteNegative(t,n,r){if(n.length===0)return!1;let o=Yi.path.makeAbsolute(this._settings.cwd,t);return this._isMatchToPatterns(o,n,r)}_isMatchToPatterns(t,n,r){if(n.length===0)return!1;let o=Yi.pattern.matchAny(t,n);return!o&&r?Yi.pattern.matchAny(t+"/",n):o}};qS.default=$S});var Vk=C(jS=>{"use strict";Object.defineProperty(jS,"__esModule",{value:!0});var TY=di(),BS=class{constructor(t){this._settings=t}getFilter(){return t=>this._isNonFatalError(t)}_isNonFatalError(t){return TY.errno.isEnoentCodeError(t)||this._settings.suppressErrors}};jS.default=BS});var zk=C(US=>{"use strict";Object.defineProperty(US,"__esModule",{value:!0});var Gk=di(),WS=class{constructor(t){this._settings=t}getTransformer(){return t=>this._transform(t)}_transform(t){let n=t.path;return this._settings.absolute&&(n=Gk.path.makeAbsolute(this._settings.cwd,n),n=Gk.path.unixify(n)),this._settings.markDirectories&&t.dirent.isDirectory()&&(n+="/"),this._settings.objectMode?Object.assign(Object.assign({},t),{path:n}):n}};US.default=WS});var Wf=C(VS=>{"use strict";Object.defineProperty(VS,"__esModule",{value:!0});var AY=require("path"),IY=Uk(),DY=Hk(),kY=Vk(),FY=zk(),HS=class{constructor(t){this._settings=t,this.errorFilter=new kY.default(this._settings),this.entryFilter=new DY.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new IY.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new FY.default(this._settings)}_getRootDirectory(t){return AY.resolve(this._settings.cwd,t.base)}_getReaderOptions(t){let n=t.base==="."?"":t.base;return{basePath:n,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(n,t.positive,t.negative),entryFilter:this.entryFilter.getFilter(t.positive,t.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};VS.default=HS});var Kk=C(zS=>{"use strict";Object.defineProperty(zS,"__esModule",{value:!0});var LY=Bk(),OY=Wf(),GS=class extends OY.default{constructor(){super(...arguments),this._reader=new LY.default(this._settings)}async read(t){let n=this._getRootDirectory(t),r=this._getReaderOptions(t);return(await this.api(n,t,r)).map(s=>r.transform(s))}api(t,n,r){return n.dynamic?this._reader.dynamic(t,r):this._reader.static(n.patterns,r)}};zS.default=GS});var Yk=C(YS=>{"use strict";Object.defineProperty(YS,"__esModule",{value:!0});var MY=require("stream"),$Y=TS(),qY=Wf(),KS=class extends qY.default{constructor(){super(...arguments),this._reader=new $Y.default(this._settings)}read(t){let n=this._getRootDirectory(t),r=this._getReaderOptions(t),o=this.api(n,t,r),s=new MY.Readable({objectMode:!0,read:()=>{}});return o.once("error",a=>s.emit("error",a)).on("data",a=>s.emit("data",r.transform(a))).once("end",()=>s.emit("end")),s.once("close",()=>o.destroy()),s}api(t,n,r){return n.dynamic?this._reader.dynamic(t,r):this._reader.static(n.patterns,r)}};YS.default=KS});var Xk=C(JS=>{"use strict";Object.defineProperty(JS,"__esModule",{value:!0});var BY=Go(),jY=qf(),WY=Bf(),XS=class extends WY.default{constructor(){super(...arguments),this._walkSync=jY.walkSync,this._statSync=BY.statSync}dynamic(t,n){return this._walkSync(t,n)}static(t,n){let r=[];for(let o of t){let s=this._getFullEntryPath(o),a=this._getEntry(s,o,n);a===null||!n.entryFilter(a)||r.push(a)}return r}_getEntry(t,n,r){try{let o=this._getStat(t);return this._makeEntry(o,n)}catch(o){if(r.errorFilter(o))return null;throw o}}_getStat(t){return this._statSync(t,this._fsStatSettings)}};JS.default=XS});var Jk=C(ZS=>{"use strict";Object.defineProperty(ZS,"__esModule",{value:!0});var UY=Xk(),HY=Wf(),QS=class extends HY.default{constructor(){super(...arguments),this._reader=new UY.default(this._settings)}read(t){let n=this._getRootDirectory(t),r=this._getReaderOptions(t);return this.api(n,t,r).map(r.transform)}api(t,n,r){return n.dynamic?this._reader.dynamic(t,r):this._reader.static(n.patterns,r)}};ZS.default=QS});var Qk=C(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var pa=require("fs"),VY=require("os"),GY=Math.max(VY.cpus().length,1);ha.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:pa.lstat,lstatSync:pa.lstatSync,stat:pa.stat,statSync:pa.statSync,readdir:pa.readdir,readdirSync:pa.readdirSync};var ew=class{constructor(t={}){this._options=t,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,GY),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(t,n){return t===void 0?n:t}_getFileSystemMethods(t={}){return Object.assign(Object.assign({},ha.DEFAULT_FILE_SYSTEM_ADAPTER),t)}};ha.default=ew});var t0=C((wae,e0)=>{"use strict";var Zk=ek(),zY=Kk(),KY=Yk(),YY=Jk(),tw=Qk(),sr=di();async function nw(e,t){xr(e);let n=rw(e,zY.default,t),r=await Promise.all(n);return sr.array.flatten(r)}(function(e){e.glob=e,e.globSync=t,e.globStream=n,e.async=e;function t(u,d){xr(u);let f=rw(u,YY.default,d);return sr.array.flatten(f)}e.sync=t;function n(u,d){xr(u);let f=rw(u,KY.default,d);return sr.stream.merge(f)}e.stream=n;function r(u,d){xr(u);let f=[].concat(u),m=new tw.default(d);return Zk.generate(f,m)}e.generateTasks=r;function o(u,d){xr(u);let f=new tw.default(d);return sr.pattern.isDynamicPattern(u,f)}e.isDynamicPattern=o;function s(u){return xr(u),sr.path.escape(u)}e.escapePath=s;function a(u){return xr(u),sr.path.convertPathToPattern(u)}e.convertPathToPattern=a;let c;(function(u){function d(m){return xr(m),sr.path.escapePosixPath(m)}u.escapePath=d;function f(m){return xr(m),sr.path.convertPosixPathToPattern(m)}u.convertPathToPattern=f})(c=e.posix||(e.posix={}));let l;(function(u){function d(m){return xr(m),sr.path.escapeWindowsPath(m)}u.escapePath=d;function f(m){return xr(m),sr.path.convertWindowsPathToPattern(m)}u.convertPathToPattern=f})(l=e.win32||(e.win32={}))})(nw||(nw={}));function rw(e,t,n){let r=[].concat(e),o=new tw.default(n),s=Zk.generate(r,o),a=new t(o);return s.map(a.read,a)}function xr(e){if(![].concat(e).every(r=>sr.string.isString(r)&&!sr.string.isEmpty(r)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}e0.exports=nw});var Ie=C(Qt=>{"use strict";var sw=Symbol.for("yaml.alias"),p0=Symbol.for("yaml.document"),Jf=Symbol.for("yaml.map"),h0=Symbol.for("yaml.pair"),aw=Symbol.for("yaml.scalar"),Qf=Symbol.for("yaml.seq"),fi=Symbol.for("yaml.node.type"),XY=e=>!!e&&typeof e=="object"&&e[fi]===sw,JY=e=>!!e&&typeof e=="object"&&e[fi]===p0,QY=e=>!!e&&typeof e=="object"&&e[fi]===Jf,ZY=e=>!!e&&typeof e=="object"&&e[fi]===h0,g0=e=>!!e&&typeof e=="object"&&e[fi]===aw,e8=e=>!!e&&typeof e=="object"&&e[fi]===Qf;function _0(e){if(e&&typeof e=="object")switch(e[fi]){case Jf:case Qf:return!0}return!1}function t8(e){if(e&&typeof e=="object")switch(e[fi]){case sw:case Jf:case aw:case Qf:return!0}return!1}var n8=e=>(g0(e)||_0(e))&&!!e.anchor;Qt.ALIAS=sw;Qt.DOC=p0;Qt.MAP=Jf;Qt.NODE_TYPE=fi;Qt.PAIR=h0;Qt.SCALAR=aw;Qt.SEQ=Qf;Qt.hasAnchor=n8;Qt.isAlias=XY;Qt.isCollection=_0;Qt.isDocument=JY;Qt.isMap=QY;Qt.isNode=t8;Qt.isPair=ZY;Qt.isScalar=g0;Qt.isSeq=e8});var cl=C(cw=>{"use strict";var $t=Ie(),Dn=Symbol("break visit"),y0=Symbol("skip children"),zr=Symbol("remove node");function Zf(e,t){let n=b0(t);$t.isDocument(e)?ga(null,e.contents,n,Object.freeze([e]))===zr&&(e.contents=null):ga(null,e,n,Object.freeze([]))}Zf.BREAK=Dn;Zf.SKIP=y0;Zf.REMOVE=zr;function ga(e,t,n,r){let o=S0(e,t,n,r);if($t.isNode(o)||$t.isPair(o))return w0(e,r,o),ga(e,o,n,r);if(typeof o!="symbol"){if($t.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=ga(s,t.items[s],n,r);if(typeof a=="number")s=a-1;else{if(a===Dn)return Dn;a===zr&&(t.items.splice(s,1),s-=1)}}}else if($t.isPair(t)){r=Object.freeze(r.concat(t));let s=ga("key",t.key,n,r);if(s===Dn)return Dn;s===zr&&(t.key=null);let a=ga("value",t.value,n,r);if(a===Dn)return Dn;a===zr&&(t.value=null)}}return o}async function em(e,t){let n=b0(t);$t.isDocument(e)?await _a(null,e.contents,n,Object.freeze([e]))===zr&&(e.contents=null):await _a(null,e,n,Object.freeze([]))}em.BREAK=Dn;em.SKIP=y0;em.REMOVE=zr;async function _a(e,t,n,r){let o=await S0(e,t,n,r);if($t.isNode(o)||$t.isPair(o))return w0(e,r,o),_a(e,o,n,r);if(typeof o!="symbol"){if($t.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=await _a(s,t.items[s],n,r);if(typeof a=="number")s=a-1;else{if(a===Dn)return Dn;a===zr&&(t.items.splice(s,1),s-=1)}}}else if($t.isPair(t)){r=Object.freeze(r.concat(t));let s=await _a("key",t.key,n,r);if(s===Dn)return Dn;s===zr&&(t.key=null);let a=await _a("value",t.value,n,r);if(a===Dn)return Dn;a===zr&&(t.value=null)}}return o}function b0(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function S0(e,t,n,r){if(typeof n=="function")return n(e,t,r);if($t.isMap(t))return n.Map?.(e,t,r);if($t.isSeq(t))return n.Seq?.(e,t,r);if($t.isPair(t))return n.Pair?.(e,t,r);if($t.isScalar(t))return n.Scalar?.(e,t,r);if($t.isAlias(t))return n.Alias?.(e,t,r)}function w0(e,t,n){let r=t[t.length-1];if($t.isCollection(r))r.items[e]=n;else if($t.isPair(r))e==="key"?r.key=n:r.value=n;else if($t.isDocument(r))r.contents=n;else{let o=$t.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${o} parent`)}}cw.visit=Zf;cw.visitAsync=em});var lw=C(v0=>{"use strict";var x0=Ie(),r8=cl(),i8={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},o8=e=>e.replace(/[!,[\]{}]/g,t=>i8[t]),ll=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.trim().split(/[ \t]+/),o=r.shift();switch(o){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,a]=r;return this.tags[s]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let a=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,a),!1}}default:return n(0,`Unknown directive ${o}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}let[,r,o]=t.match(/^(.*!)([^!]*)$/s);o||n(`The ${t} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(o)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+o8(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),o;if(t&&r.length>0&&x0.isNode(t.contents)){let s={};r8.visit(t.contents,(a,c)=>{x0.isNode(c)&&c.tag&&(s[c.tag]=!0)}),o=Object.keys(s)}else o=[];for(let[s,a]of r)s==="!!"&&a==="tag:yaml.org,2002:"||(!t||o.some(c=>c.startsWith(a)))&&n.push(`%TAG ${s} ${a}`);return n.join(`
16
- `)}};ll.defaultYaml={explicit:!1,version:"1.2"};ll.defaultTags={"!!":"tag:yaml.org,2002:"};v0.Directives=ll});var tm=C(ul=>{"use strict";var C0=Ie(),s8=cl();function a8(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function P0(e){let t=new Set;return s8.visit(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function N0(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function c8(e,t){let n=[],r=new Map,o=null;return{onAnchor:s=>{n.push(s),o??(o=P0(e));let a=N0(t,o);return o.add(a),a},setAnchors:()=>{for(let s of n){let a=r.get(s);if(typeof a=="object"&&a.anchor&&(C0.isScalar(a.node)||C0.isCollection(a.node)))a.node.anchor=a.anchor;else{let c=new Error("Failed to resolve repeated object (this should not happen)");throw c.source=s,c}}},sourceObjects:r}}ul.anchorIsValid=a8;ul.anchorNames=P0;ul.createNodeAnchors=c8;ul.findNewAnchor=N0});var uw=C(E0=>{"use strict";function dl(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let o=0,s=r.length;o<s;++o){let a=r[o],c=dl(e,r,String(o),a);c===void 0?delete r[o]:c!==a&&(r[o]=c)}else if(r instanceof Map)for(let o of Array.from(r.keys())){let s=r.get(o),a=dl(e,r,o,s);a===void 0?r.delete(o):a!==s&&r.set(o,a)}else if(r instanceof Set)for(let o of Array.from(r)){let s=dl(e,r,o,o);s===void 0?r.delete(o):s!==o&&(r.delete(o),r.add(s))}else for(let[o,s]of Object.entries(r)){let a=dl(e,r,o,s);a===void 0?delete r[o]:a!==s&&(r[o]=a)}return e.call(t,n,r)}E0.applyReviver=dl});var Qi=C(T0=>{"use strict";var l8=Ie();function R0(e,t,n){if(Array.isArray(e))return e.map((r,o)=>R0(r,String(o),n));if(e&&typeof e.toJSON=="function"){if(!n||!l8.hasAnchor(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let o=e.toJSON(t,n);return n.onCreate&&n.onCreate(o),o}return typeof e=="bigint"&&!n?.keep?Number(e):e}T0.toJS=R0});var nm=C(I0=>{"use strict";var u8=uw(),A0=Ie(),d8=Qi(),dw=class{constructor(t){Object.defineProperty(this,A0.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:o,reviver:s}={}){if(!A0.isDocument(t))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=d8.toJS(this,"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?u8.applyReviver(s,{"":c},"",c):c}};I0.NodeBase=dw});var fl=C(D0=>{"use strict";var f8=tm(),m8=cl(),ya=Ie(),p8=nm(),h8=Qi(),fw=class extends p8.NodeBase{constructor(t){super(ya.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],m8.visit(t,{Node:(s,a)=>{(ya.isAlias(a)||ya.hasAnchor(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let o;for(let s of r){if(s===this)break;s.anchor===this.source&&(o=s)}return o}toJSON(t,n){if(!n)return{source:this.source};let{anchors:r,doc:o,maxAliasCount:s}=n,a=this.resolve(o,n);if(!a){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let c=r.get(a);if(c||(h8.toJS(a,null,n),c=r.get(a)),c?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(s>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=rm(o,a,r)),c.count*c.aliasCount>s)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return c.res}toString(t,n,r){let o=`*${this.source}`;if(t){if(f8.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${o} `}return o}};function rm(e,t,n){if(ya.isAlias(t)){let r=t.resolve(e),o=n&&r&&n.get(r);return o?o.count*o.aliasCount:0}else if(ya.isCollection(t)){let r=0;for(let o of t.items){let s=rm(e,o,n);s>r&&(r=s)}return r}else if(ya.isPair(t)){let r=rm(e,t.key,n),o=rm(e,t.value,n);return Math.max(r,o)}return 1}D0.Alias=fw});var Dt=C(mw=>{"use strict";var g8=Ie(),_8=nm(),y8=Qi(),b8=e=>!e||typeof e!="function"&&typeof e!="object",Zi=class extends _8.NodeBase{constructor(t){super(g8.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:y8.toJS(this.value,t,n)}toString(){return String(this.value)}};Zi.BLOCK_FOLDED="BLOCK_FOLDED";Zi.BLOCK_LITERAL="BLOCK_LITERAL";Zi.PLAIN="PLAIN";Zi.QUOTE_DOUBLE="QUOTE_DOUBLE";Zi.QUOTE_SINGLE="QUOTE_SINGLE";mw.Scalar=Zi;mw.isScalarValue=b8});var ml=C(F0=>{"use strict";var S8=fl(),Yo=Ie(),k0=Dt(),w8="tag:yaml.org,2002:";function x8(e,t,n){if(t){let r=n.filter(s=>s.tag===t),o=r.find(s=>!s.format)??r[0];if(!o)throw new Error(`Tag ${t} not found`);return o}return n.find(r=>r.identify?.(e)&&!r.format)}function v8(e,t,n){if(Yo.isDocument(e)&&(e=e.contents),Yo.isNode(e))return e;if(Yo.isPair(e)){let f=n.schema[Yo.MAP].createNode?.(n.schema,null,n);return f.items.push(e),f}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:o,onTagObj:s,schema:a,sourceObjects:c}=n,l;if(r&&e&&typeof e=="object"){if(l=c.get(e),l)return l.anchor??(l.anchor=o(e)),new S8.Alias(l.anchor);l={anchor:null,node:null},c.set(e,l)}t?.startsWith("!!")&&(t=w8+t.slice(2));let u=x8(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let f=new k0.Scalar(e);return l&&(l.node=f),f}u=e instanceof Map?a[Yo.MAP]:Symbol.iterator in Object(e)?a[Yo.SEQ]:a[Yo.MAP]}s&&(s(u),delete n.onTagObj);let d=u?.createNode?u.createNode(n.schema,e,n):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(n.schema,e,n):new k0.Scalar(e);return t?d.tag=t:u.default||(d.tag=u.tag),l&&(l.node=d),d}F0.createNode=v8});var om=C(im=>{"use strict";var C8=ml(),Kr=Ie(),P8=nm();function pw(e,t,n){let r=n;for(let o=t.length-1;o>=0;--o){let s=t[o];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let a=[];a[s]=r,r=a}else r=new Map([[s,r]])}return C8.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var L0=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,hw=class extends P8.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>Kr.isNode(r)||Kr.isPair(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(L0(t))this.add(n);else{let[r,...o]=t,s=this.get(r,!0);if(Kr.isCollection(s))s.addIn(o,n);else if(s===void 0&&this.schema)this.set(r,pw(this.schema,o,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}deleteIn(t){let[n,...r]=t;if(r.length===0)return this.delete(n);let o=this.get(n,!0);if(Kr.isCollection(o))return o.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){let[r,...o]=t,s=this.get(r,!0);return o.length===0?!n&&Kr.isScalar(s)?s.value:s:Kr.isCollection(s)?s.getIn(o,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Kr.isPair(n))return!1;let r=n.value;return r==null||t&&Kr.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[n,...r]=t;if(r.length===0)return this.has(n);let o=this.get(n,!0);return Kr.isCollection(o)?o.hasIn(r):!1}setIn(t,n){let[r,...o]=t;if(o.length===0)this.set(r,n);else{let s=this.get(r,!0);if(Kr.isCollection(s))s.setIn(o,n);else if(s===void 0&&this.schema)this.set(r,pw(this.schema,o,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}};im.Collection=hw;im.collectionFromPath=pw;im.isEmptyPath=L0});var pl=C(sm=>{"use strict";var N8=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function gw(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var E8=(e,t,n)=>e.endsWith(`
17
- `)?gw(n,t):n.includes(`
13
+ `&&o++}r&&n.length>0&&t.push(n.length),this._lineOffsets=t}return this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),r=0,o=n.length;if(o===0)return er.create(0,t);for(;r<o;){let a=Math.floor((r+o)/2);n[a]>t?o=a:r=a+1}let s=r-1;return er.create(s,t-n[s])}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line],o=t.line+1<n.length?n[t.line+1]:this._content.length;return Math.max(Math.min(r+t.character,o),r)}get lineCount(){return this.getLineOffsets().length}};(function(e){let t=Object.prototype.toString;function n(p){return typeof p<"u"}e.defined=n;function r(p){return typeof p>"u"}e.undefined=r;function o(p){return p===!0||p===!1}e.boolean=o;function s(p){return t.call(p)==="[object String]"}e.string=s;function a(p){return t.call(p)==="[object Number]"}e.number=a;function c(p,g,h){return t.call(p)==="[object Number]"&&g<=p&&p<=h}e.numberRange=c;function l(p){return t.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}e.integer=l;function u(p){return t.call(p)==="[object Number]"&&0<=p&&p<=2147483647}e.uinteger=u;function d(p){return t.call(p)==="[object Function]"}e.func=d;function f(p){return p!==null&&typeof p=="object"}e.objectLiteral=f;function m(p,g){return Array.isArray(p)&&p.every(g)}e.typedArray=m})(E||(E={}))});var Ze=C(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.CM=an.ProtocolNotificationType=an.ProtocolNotificationType0=an.ProtocolRequestType=an.ProtocolRequestType0=an.RegistrationType=an.MessageDirection=void 0;var Os=ri(),uN;(function(e){e.clientToServer="clientToServer",e.serverToClient="serverToClient",e.both="both"})(uN||(an.MessageDirection=uN={}));var O_=class{____;method;constructor(t){this.method=t}};an.RegistrationType=O_;var M_=class extends Os.RequestType0{__;___;____;_pr;constructor(t){super(t)}};an.ProtocolRequestType0=M_;var $_=class extends Os.RequestType{__;___;____;_pr;constructor(t){super(t,Os.ParameterStructures.byName)}};an.ProtocolRequestType=$_;var q_=class extends Os.NotificationType0{___;____;constructor(t){super(t)}};an.ProtocolNotificationType0=q_;var B_=class extends Os.NotificationType{___;____;constructor(t){super(t,Os.ParameterStructures.byName)}};an.ProtocolNotificationType=B_;var dN;(function(e){function t(n,r){return{client:n,server:r}}e.create=t})(dN||(an.CM=dN={}))});var hd=C(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.boolean=dV;gr.string=fN;gr.number=fV;gr.error=mV;gr.func=pV;gr.array=mN;gr.stringArray=hV;gr.typedArray=gV;gr.objectLiteral=_V;function dV(e){return e===!0||e===!1}function fN(e){return typeof e=="string"||e instanceof String}function fV(e){return typeof e=="number"||e instanceof Number}function mV(e){return e instanceof Error}function pV(e){return typeof e=="function"}function mN(e){return Array.isArray(e)}function hV(e){return mN(e)&&e.every(t=>fN(t))}function gV(e,t){return Array.isArray(e)&&e.every(t)}function _V(e){return e!==null&&typeof e=="object"}});var hN=C(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});gd.ImplementationRequest=void 0;var j_=Ze(),pN;(function(e){e.method="textDocument/implementation",e.messageDirection=j_.MessageDirection.clientToServer,e.type=new j_.ProtocolRequestType(e.method),e.capabilities=j_.CM.create("textDocument.implementation","implementationProvider")})(pN||(gd.ImplementationRequest=pN={}))});var _N=C(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.TypeDefinitionRequest=void 0;var W_=Ze(),gN;(function(e){e.method="textDocument/typeDefinition",e.messageDirection=W_.MessageDirection.clientToServer,e.type=new W_.ProtocolRequestType(e.method),e.capabilities=W_.CM.create("textDocument.typeDefinition","typeDefinitionProvider")})(gN||(_d.TypeDefinitionRequest=gN={}))});var SN=C($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.DidChangeWorkspaceFoldersNotification=$s.WorkspaceFoldersRequest=void 0;var Ms=Ze(),yN;(function(e){e.method="workspace/workspaceFolders",e.messageDirection=Ms.MessageDirection.serverToClient,e.type=new Ms.ProtocolRequestType0(e.method),e.capabilities=Ms.CM.create("workspace.workspaceFolders","workspace.workspaceFolders")})(yN||($s.WorkspaceFoldersRequest=yN={}));var bN;(function(e){e.method="workspace/didChangeWorkspaceFolders",e.messageDirection=Ms.MessageDirection.clientToServer,e.type=new Ms.ProtocolNotificationType(e.method),e.capabilities=Ms.CM.create(void 0,"workspace.workspaceFolders.changeNotifications")})(bN||($s.DidChangeWorkspaceFoldersNotification=bN={}))});var xN=C(yd=>{"use strict";Object.defineProperty(yd,"__esModule",{value:!0});yd.ConfigurationRequest=void 0;var U_=Ze(),wN;(function(e){e.method="workspace/configuration",e.messageDirection=U_.MessageDirection.serverToClient,e.type=new U_.ProtocolRequestType(e.method),e.capabilities=U_.CM.create("workspace.configuration",void 0)})(wN||(yd.ConfigurationRequest=wN={}))});var PN=C(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.ColorPresentationRequest=Bs.DocumentColorRequest=void 0;var qs=Ze(),vN;(function(e){e.method="textDocument/documentColor",e.messageDirection=qs.MessageDirection.clientToServer,e.type=new qs.ProtocolRequestType(e.method),e.capabilities=qs.CM.create("textDocument.colorProvider","colorProvider")})(vN||(Bs.DocumentColorRequest=vN={}));var CN;(function(e){e.method="textDocument/colorPresentation",e.messageDirection=qs.MessageDirection.clientToServer,e.type=new qs.ProtocolRequestType(e.method),e.capabilities=qs.CM.create("textDocument.colorProvider","colorProvider")})(CN||(Bs.ColorPresentationRequest=CN={}))});var RN=C(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.FoldingRangeRefreshRequest=Ws.FoldingRangeRequest=void 0;var js=Ze(),NN;(function(e){e.method="textDocument/foldingRange",e.messageDirection=js.MessageDirection.clientToServer,e.type=new js.ProtocolRequestType(e.method),e.capabilities=js.CM.create("textDocument.foldingRange","foldingRangeProvider")})(NN||(Ws.FoldingRangeRequest=NN={}));var EN;(function(e){e.method="workspace/foldingRange/refresh",e.messageDirection=js.MessageDirection.serverToClient,e.type=new js.ProtocolRequestType0(e.method),e.capabilities=js.CM.create("workspace.foldingRange.refreshSupport",void 0)})(EN||(Ws.FoldingRangeRefreshRequest=EN={}))});var AN=C(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});bd.DeclarationRequest=void 0;var H_=Ze(),TN;(function(e){e.method="textDocument/declaration",e.messageDirection=H_.MessageDirection.clientToServer,e.type=new H_.ProtocolRequestType(e.method),e.capabilities=H_.CM.create("textDocument.declaration","declarationProvider")})(TN||(bd.DeclarationRequest=TN={}))});var DN=C(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:!0});Sd.SelectionRangeRequest=void 0;var V_=Ze(),IN;(function(e){e.method="textDocument/selectionRange",e.messageDirection=V_.MessageDirection.clientToServer,e.type=new V_.ProtocolRequestType(e.method),e.capabilities=V_.CM.create("textDocument.selectionRange","selectionRangeProvider")})(IN||(Sd.SelectionRangeRequest=IN={}))});var ON=C(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.WorkDoneProgressCancelNotification=Di.WorkDoneProgressCreateRequest=Di.WorkDoneProgress=void 0;var yV=ri(),kc=Ze(),kN;(function(e){e.type=new yV.ProgressType;function t(n){return n===e.type}e.is=t})(kN||(Di.WorkDoneProgress=kN={}));var FN;(function(e){e.method="window/workDoneProgress/create",e.messageDirection=kc.MessageDirection.serverToClient,e.type=new kc.ProtocolRequestType(e.method),e.capabilities=kc.CM.create("window.workDoneProgress",void 0)})(FN||(Di.WorkDoneProgressCreateRequest=FN={}));var LN;(function(e){e.method="window/workDoneProgress/cancel",e.messageDirection=kc.MessageDirection.clientToServer,e.type=new kc.ProtocolNotificationType(e.method)})(LN||(Di.WorkDoneProgressCancelNotification=LN={}))});var BN=C(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.CallHierarchyOutgoingCallsRequest=ki.CallHierarchyIncomingCallsRequest=ki.CallHierarchyPrepareRequest=void 0;var oi=Ze(),MN;(function(e){e.method="textDocument/prepareCallHierarchy",e.messageDirection=oi.MessageDirection.clientToServer,e.type=new oi.ProtocolRequestType(e.method),e.capabilities=oi.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(MN||(ki.CallHierarchyPrepareRequest=MN={}));var $N;(function(e){e.method="callHierarchy/incomingCalls",e.messageDirection=oi.MessageDirection.clientToServer,e.type=new oi.ProtocolRequestType(e.method),e.capabilities=oi.CM.create("textDocument.callHierarchy","callHierarchyProvider")})($N||(ki.CallHierarchyIncomingCallsRequest=$N={}));var qN;(function(e){e.method="callHierarchy/outgoingCalls",e.messageDirection=oi.MessageDirection.clientToServer,e.type=new oi.ProtocolRequestType(e.method),e.capabilities=oi.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(qN||(ki.CallHierarchyOutgoingCallsRequest=qN={}))});var GN=C(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.SemanticTokensRefreshRequest=Nn.SemanticTokensRangeRequest=Nn.SemanticTokensDeltaRequest=Nn.SemanticTokensRequest=Nn.SemanticTokensRegistrationType=Nn.TokenFormat=void 0;var Vn=Ze(),jN;(function(e){e.Relative="relative"})(jN||(Nn.TokenFormat=jN={}));var Fc;(function(e){e.method="textDocument/semanticTokens",e.type=new Vn.RegistrationType(e.method)})(Fc||(Nn.SemanticTokensRegistrationType=Fc={}));var WN;(function(e){e.method="textDocument/semanticTokens/full",e.messageDirection=Vn.MessageDirection.clientToServer,e.type=new Vn.ProtocolRequestType(e.method),e.registrationMethod=Fc.method,e.capabilities=Vn.CM.create("textDocument.semanticTokens","semanticTokensProvider")})(WN||(Nn.SemanticTokensRequest=WN={}));var UN;(function(e){e.method="textDocument/semanticTokens/full/delta",e.messageDirection=Vn.MessageDirection.clientToServer,e.type=new Vn.ProtocolRequestType(e.method),e.registrationMethod=Fc.method,e.capabilities=Vn.CM.create("textDocument.semanticTokens.requests.full.delta","semanticTokensProvider.full.delta")})(UN||(Nn.SemanticTokensDeltaRequest=UN={}));var HN;(function(e){e.method="textDocument/semanticTokens/range",e.messageDirection=Vn.MessageDirection.clientToServer,e.type=new Vn.ProtocolRequestType(e.method),e.registrationMethod=Fc.method,e.capabilities=Vn.CM.create("textDocument.semanticTokens.requests.range","semanticTokensProvider.range")})(HN||(Nn.SemanticTokensRangeRequest=HN={}));var VN;(function(e){e.method="workspace/semanticTokens/refresh",e.messageDirection=Vn.MessageDirection.serverToClient,e.type=new Vn.ProtocolRequestType0(e.method),e.capabilities=Vn.CM.create("workspace.semanticTokens.refreshSupport",void 0)})(VN||(Nn.SemanticTokensRefreshRequest=VN={}))});var KN=C(wd=>{"use strict";Object.defineProperty(wd,"__esModule",{value:!0});wd.ShowDocumentRequest=void 0;var G_=Ze(),zN;(function(e){e.method="window/showDocument",e.messageDirection=G_.MessageDirection.serverToClient,e.type=new G_.ProtocolRequestType(e.method),e.capabilities=G_.CM.create("window.showDocument.support",void 0)})(zN||(wd.ShowDocumentRequest=zN={}))});var XN=C(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});xd.LinkedEditingRangeRequest=void 0;var z_=Ze(),YN;(function(e){e.method="textDocument/linkedEditingRange",e.messageDirection=z_.MessageDirection.clientToServer,e.type=new z_.ProtocolRequestType(e.method),e.capabilities=z_.CM.create("textDocument.linkedEditingRange","linkedEditingRangeProvider")})(YN||(xd.LinkedEditingRangeRequest=YN={}))});var iE=C(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.WillDeleteFilesRequest=cn.DidDeleteFilesNotification=cn.DidRenameFilesNotification=cn.WillRenameFilesRequest=cn.DidCreateFilesNotification=cn.WillCreateFilesRequest=cn.FileOperationPatternKind=void 0;var Ut=Ze(),JN;(function(e){e.file="file",e.folder="folder"})(JN||(cn.FileOperationPatternKind=JN={}));var QN;(function(e){e.method="workspace/willCreateFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolRequestType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.willCreate","workspace.fileOperations.willCreate")})(QN||(cn.WillCreateFilesRequest=QN={}));var ZN;(function(e){e.method="workspace/didCreateFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolNotificationType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.didCreate","workspace.fileOperations.didCreate")})(ZN||(cn.DidCreateFilesNotification=ZN={}));var eE;(function(e){e.method="workspace/willRenameFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolRequestType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.willRename","workspace.fileOperations.willRename")})(eE||(cn.WillRenameFilesRequest=eE={}));var tE;(function(e){e.method="workspace/didRenameFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolNotificationType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.didRename","workspace.fileOperations.didRename")})(tE||(cn.DidRenameFilesNotification=tE={}));var nE;(function(e){e.method="workspace/didDeleteFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolNotificationType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.didDelete","workspace.fileOperations.didDelete")})(nE||(cn.DidDeleteFilesNotification=nE={}));var rE;(function(e){e.method="workspace/willDeleteFiles",e.messageDirection=Ut.MessageDirection.clientToServer,e.type=new Ut.ProtocolRequestType(e.method),e.capabilities=Ut.CM.create("workspace.fileOperations.willDelete","workspace.fileOperations.willDelete")})(rE||(cn.WillDeleteFilesRequest=rE={}))});var cE=C(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.MonikerRequest=Fi.MonikerKind=Fi.UniquenessLevel=void 0;var K_=Ze(),oE;(function(e){e.document="document",e.project="project",e.group="group",e.scheme="scheme",e.global="global"})(oE||(Fi.UniquenessLevel=oE={}));var sE;(function(e){e.$import="import",e.$export="export",e.local="local"})(sE||(Fi.MonikerKind=sE={}));var aE;(function(e){e.method="textDocument/moniker",e.messageDirection=K_.MessageDirection.clientToServer,e.type=new K_.ProtocolRequestType(e.method),e.capabilities=K_.CM.create("textDocument.moniker","monikerProvider")})(aE||(Fi.MonikerRequest=aE={}))});var fE=C(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.TypeHierarchySubtypesRequest=Li.TypeHierarchySupertypesRequest=Li.TypeHierarchyPrepareRequest=void 0;var ko=Ze(),lE;(function(e){e.method="textDocument/prepareTypeHierarchy",e.messageDirection=ko.MessageDirection.clientToServer,e.type=new ko.ProtocolRequestType(e.method),e.capabilities=ko.CM.create("textDocument.typeHierarchy","typeHierarchyProvider")})(lE||(Li.TypeHierarchyPrepareRequest=lE={}));var uE;(function(e){e.method="typeHierarchy/supertypes",e.messageDirection=ko.MessageDirection.clientToServer,e.type=new ko.ProtocolRequestType(e.method)})(uE||(Li.TypeHierarchySupertypesRequest=uE={}));var dE;(function(e){e.method="typeHierarchy/subtypes",e.messageDirection=ko.MessageDirection.clientToServer,e.type=new ko.ProtocolRequestType(e.method)})(dE||(Li.TypeHierarchySubtypesRequest=dE={}))});var hE=C(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.InlineValueRefreshRequest=Hs.InlineValueRequest=void 0;var Us=Ze(),mE;(function(e){e.method="textDocument/inlineValue",e.messageDirection=Us.MessageDirection.clientToServer,e.type=new Us.ProtocolRequestType(e.method),e.capabilities=Us.CM.create("textDocument.inlineValue","inlineValueProvider")})(mE||(Hs.InlineValueRequest=mE={}));var pE;(function(e){e.method="workspace/inlineValue/refresh",e.messageDirection=Us.MessageDirection.serverToClient,e.type=new Us.ProtocolRequestType0(e.method),e.capabilities=Us.CM.create("workspace.inlineValue.refreshSupport",void 0)})(pE||(Hs.InlineValueRefreshRequest=pE={}))});var bE=C(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.InlayHintRefreshRequest=Oi.InlayHintResolveRequest=Oi.InlayHintRequest=void 0;var si=Ze(),gE;(function(e){e.method="textDocument/inlayHint",e.messageDirection=si.MessageDirection.clientToServer,e.type=new si.ProtocolRequestType(e.method),e.capabilities=si.CM.create("textDocument.inlayHint","inlayHintProvider")})(gE||(Oi.InlayHintRequest=gE={}));var _E;(function(e){e.method="inlayHint/resolve",e.messageDirection=si.MessageDirection.clientToServer,e.type=new si.ProtocolRequestType(e.method),e.capabilities=si.CM.create("textDocument.inlayHint.resolveSupport","inlayHintProvider.resolveProvider")})(_E||(Oi.InlayHintResolveRequest=_E={}));var yE;(function(e){e.method="workspace/inlayHint/refresh",e.messageDirection=si.MessageDirection.serverToClient,e.type=new si.ProtocolRequestType0(e.method),e.capabilities=si.CM.create("workspace.inlayHint.refreshSupport",void 0)})(yE||(Oi.InlayHintRefreshRequest=yE={}))});var NE=C(Ht=>{"use strict";var bV=Ht&&Ht.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),SV=Ht&&Ht.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),wV=Ht&&Ht.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&bV(n,t,r[o]);return SV(n,t),n}})();Object.defineProperty(Ht,"__esModule",{value:!0});Ht.DiagnosticRefreshRequest=Ht.WorkspaceDiagnosticRequest=Ht.DocumentDiagnosticRequest=Ht.DocumentDiagnosticReportKind=Ht.DiagnosticServerCancellationData=void 0;var PE=ri(),xV=wV(hd()),ai=Ze(),SE;(function(e){function t(n){let r=n;return r&&xV.boolean(r.retriggerRequest)}e.is=t})(SE||(Ht.DiagnosticServerCancellationData=SE={}));var wE;(function(e){e.Full="full",e.Unchanged="unchanged"})(wE||(Ht.DocumentDiagnosticReportKind=wE={}));var xE;(function(e){e.method="textDocument/diagnostic",e.messageDirection=ai.MessageDirection.clientToServer,e.type=new ai.ProtocolRequestType(e.method),e.partialResult=new PE.ProgressType,e.capabilities=ai.CM.create("textDocument.diagnostic","diagnosticProvider")})(xE||(Ht.DocumentDiagnosticRequest=xE={}));var vE;(function(e){e.method="workspace/diagnostic",e.messageDirection=ai.MessageDirection.clientToServer,e.type=new ai.ProtocolRequestType(e.method),e.partialResult=new PE.ProgressType,e.capabilities=ai.CM.create("workspace.diagnostics","diagnosticProvider.workspaceDiagnostics")})(vE||(Ht.WorkspaceDiagnosticRequest=vE={}));var CE;(function(e){e.method="workspace/diagnostic/refresh",e.messageDirection=ai.MessageDirection.serverToClient,e.type=new ai.ProtocolRequestType0(e.method),e.capabilities=ai.CM.create("workspace.diagnostics.refreshSupport",void 0)})(CE||(Ht.DiagnosticRefreshRequest=CE={}))});var kE=C(Ve=>{"use strict";var vV=Ve&&Ve.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),CV=Ve&&Ve.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),PV=Ve&&Ve.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&vV(n,t,r[o]);return CV(n,t),n}})();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.DidCloseNotebookDocumentNotification=Ve.DidSaveNotebookDocumentNotification=Ve.DidChangeNotebookDocumentNotification=Ve.NotebookCellArrayChange=Ve.DidOpenNotebookDocumentNotification=Ve.NotebookDocumentSyncRegistrationType=Ve.NotebookDocument=Ve.NotebookCell=Ve.ExecutionSummary=Ve.NotebookCellKind=void 0;var Lc=(pd(),Nh(md)),_r=PV(hd()),Fr=Ze(),Y_;(function(e){e.Markup=1,e.Code=2;function t(n){return n===1||n===2}e.is=t})(Y_||(Ve.NotebookCellKind=Y_={}));var X_;(function(e){function t(o,s){let a={executionOrder:o};return(s===!0||s===!1)&&(a.success=s),a}e.create=t;function n(o){let s=o;return _r.objectLiteral(s)&&Lc.uinteger.is(s.executionOrder)&&(s.success===void 0||_r.boolean(s.success))}e.is=n;function r(o,s){return o===s?!0:o==null||s===null||s===void 0?!1:o.executionOrder===s.executionOrder&&o.success===s.success}e.equals=r})(X_||(Ve.ExecutionSummary=X_={}));var vd;(function(e){function t(s,a){return{kind:s,document:a}}e.create=t;function n(s){let a=s;return _r.objectLiteral(a)&&Y_.is(a.kind)&&Lc.DocumentUri.is(a.document)&&(a.metadata===void 0||_r.objectLiteral(a.metadata))}e.is=n;function r(s,a){let c=new Set;return s.document!==a.document&&c.add("document"),s.kind!==a.kind&&c.add("kind"),s.executionSummary!==a.executionSummary&&c.add("executionSummary"),(s.metadata!==void 0||a.metadata!==void 0)&&!o(s.metadata,a.metadata)&&c.add("metadata"),(s.executionSummary!==void 0||a.executionSummary!==void 0)&&!X_.equals(s.executionSummary,a.executionSummary)&&c.add("executionSummary"),c}e.diff=r;function o(s,a){if(s===a)return!0;if(s==null||a===null||a===void 0||typeof s!=typeof a||typeof s!="object")return!1;let c=Array.isArray(s),l=Array.isArray(a);if(c!==l)return!1;if(c&&l){if(s.length!==a.length)return!1;for(let u=0;u<s.length;u++)if(!o(s[u],a[u]))return!1}if(_r.objectLiteral(s)&&_r.objectLiteral(a)){let u=Object.keys(s),d=Object.keys(a);if(u.length!==d.length||(u.sort(),d.sort(),!o(u,d)))return!1;for(let f=0;f<u.length;f++){let m=u[f];if(!o(s[m],a[m]))return!1}}return!0}})(vd||(Ve.NotebookCell=vd={}));var EE;(function(e){function t(r,o,s,a){return{uri:r,notebookType:o,version:s,cells:a}}e.create=t;function n(r){let o=r;return _r.objectLiteral(o)&&_r.string(o.uri)&&Lc.integer.is(o.version)&&_r.typedArray(o.cells,vd.is)}e.is=n})(EE||(Ve.NotebookDocument=EE={}));var Vs;(function(e){e.method="notebookDocument/sync",e.messageDirection=Fr.MessageDirection.clientToServer,e.type=new Fr.RegistrationType(e.method)})(Vs||(Ve.NotebookDocumentSyncRegistrationType=Vs={}));var RE;(function(e){e.method="notebookDocument/didOpen",e.messageDirection=Fr.MessageDirection.clientToServer,e.type=new Fr.ProtocolNotificationType(e.method),e.registrationMethod=Vs.method})(RE||(Ve.DidOpenNotebookDocumentNotification=RE={}));var TE;(function(e){function t(r){let o=r;return _r.objectLiteral(o)&&Lc.uinteger.is(o.start)&&Lc.uinteger.is(o.deleteCount)&&(o.cells===void 0||_r.typedArray(o.cells,vd.is))}e.is=t;function n(r,o,s){let a={start:r,deleteCount:o};return s!==void 0&&(a.cells=s),a}e.create=n})(TE||(Ve.NotebookCellArrayChange=TE={}));var AE;(function(e){e.method="notebookDocument/didChange",e.messageDirection=Fr.MessageDirection.clientToServer,e.type=new Fr.ProtocolNotificationType(e.method),e.registrationMethod=Vs.method})(AE||(Ve.DidChangeNotebookDocumentNotification=AE={}));var IE;(function(e){e.method="notebookDocument/didSave",e.messageDirection=Fr.MessageDirection.clientToServer,e.type=new Fr.ProtocolNotificationType(e.method),e.registrationMethod=Vs.method})(IE||(Ve.DidSaveNotebookDocumentNotification=IE={}));var DE;(function(e){e.method="notebookDocument/didClose",e.messageDirection=Fr.MessageDirection.clientToServer,e.type=new Fr.ProtocolNotificationType(e.method),e.registrationMethod=Vs.method})(DE||(Ve.DidCloseNotebookDocumentNotification=DE={}))});var LE=C(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd.InlineCompletionRequest=void 0;var J_=Ze(),FE;(function(e){e.method="textDocument/inlineCompletion",e.messageDirection=J_.MessageDirection.clientToServer,e.type=new J_.ProtocolRequestType(e.method),e.capabilities=J_.CM.create("textDocument.inlineCompletion","inlineCompletionProvider")})(FE||(Cd.InlineCompletionRequest=FE={}))});var $E=C(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.TextDocumentContentRefreshRequest=Gs.TextDocumentContentRequest=void 0;var Oc=Ze(),OE;(function(e){e.method="workspace/textDocumentContent",e.messageDirection=Oc.MessageDirection.clientToServer,e.type=new Oc.ProtocolRequestType(e.method),e.capabilities=Oc.CM.create("workspace.textDocumentContent","workspace.textDocumentContent")})(OE||(Gs.TextDocumentContentRequest=OE={}));var ME;(function(e){e.method="workspace/textDocumentContent/refresh",e.messageDirection=Oc.MessageDirection.serverToClient,e.type=new Oc.ProtocolRequestType(e.method)})(ME||(Gs.TextDocumentContentRefreshRequest=ME={}))});var QR=C(v=>{"use strict";var NV=v&&v.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),EV=v&&v.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),RV=v&&v.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&NV(n,t,r[o]);return EV(n,t),n}})();Object.defineProperty(v,"__esModule",{value:!0});v.CodeActionRequest=v.DocumentSymbolRequest=v.DocumentHighlightRequest=v.ReferencesRequest=v.DefinitionRequest=v.SignatureHelpRequest=v.SignatureHelpTriggerKind=v.HoverRequest=v.CompletionResolveRequest=v.CompletionRequest=v.CompletionTriggerKind=v.PublishDiagnosticsNotification=v.WatchKind=v.GlobPattern=v.RelativePattern=v.FileChangeType=v.DidChangeWatchedFilesNotification=v.WillSaveTextDocumentWaitUntilRequest=v.WillSaveTextDocumentNotification=v.TextDocumentSaveReason=v.DidSaveTextDocumentNotification=v.DidCloseTextDocumentNotification=v.DidChangeTextDocumentNotification=v.TextDocumentContentChangeEvent=v.DidOpenTextDocumentNotification=v.TextDocumentSyncKind=v.TelemetryEventNotification=v.LogMessageNotification=v.ShowMessageRequest=v.ShowMessageNotification=v.MessageType=v.DidChangeConfigurationNotification=v.ExitNotification=v.ShutdownRequest=v.InitializedNotification=v.InitializeErrorCodes=v.InitializeRequest=v.WorkDoneProgressOptions=v.TextDocumentRegistrationOptions=v.StaticRegistrationOptions=v.PositionEncodingKind=v.RegularExpressionEngineKind=v.FailureHandlingKind=v.ResourceOperationKind=v.UnregistrationRequest=v.RegistrationRequest=v.DocumentSelector=v.NotebookCellTextDocumentFilter=v.NotebookDocumentFilter=v.TextDocumentFilter=void 0;v.UniquenessLevel=v.WillDeleteFilesRequest=v.DidDeleteFilesNotification=v.WillRenameFilesRequest=v.DidRenameFilesNotification=v.WillCreateFilesRequest=v.DidCreateFilesNotification=v.FileOperationPatternKind=v.LinkedEditingRangeRequest=v.ShowDocumentRequest=v.SemanticTokensRegistrationType=v.SemanticTokensRefreshRequest=v.SemanticTokensRangeRequest=v.SemanticTokensDeltaRequest=v.SemanticTokensRequest=v.TokenFormat=v.CallHierarchyPrepareRequest=v.CallHierarchyOutgoingCallsRequest=v.CallHierarchyIncomingCallsRequest=v.WorkDoneProgressCancelNotification=v.WorkDoneProgressCreateRequest=v.WorkDoneProgress=v.SelectionRangeRequest=v.DeclarationRequest=v.FoldingRangeRefreshRequest=v.FoldingRangeRequest=v.ColorPresentationRequest=v.DocumentColorRequest=v.ConfigurationRequest=v.DidChangeWorkspaceFoldersNotification=v.WorkspaceFoldersRequest=v.TypeDefinitionRequest=v.ImplementationRequest=v.ApplyWorkspaceEditRequest=v.ExecuteCommandRequest=v.PrepareRenameRequest=v.RenameRequest=v.PrepareSupportDefaultBehavior=v.DocumentOnTypeFormattingRequest=v.DocumentRangesFormattingRequest=v.DocumentRangeFormattingRequest=v.DocumentFormattingRequest=v.DocumentLinkResolveRequest=v.DocumentLinkRequest=v.CodeLensRefreshRequest=v.CodeLensResolveRequest=v.CodeLensRequest=v.WorkspaceSymbolResolveRequest=v.WorkspaceSymbolRequest=v.CodeActionResolveRequest=void 0;v.TextDocumentContentRefreshRequest=v.TextDocumentContentRequest=v.InlineCompletionRequest=v.DidCloseNotebookDocumentNotification=v.DidSaveNotebookDocumentNotification=v.DidChangeNotebookDocumentNotification=v.NotebookCellArrayChange=v.DidOpenNotebookDocumentNotification=v.NotebookDocumentSyncRegistrationType=v.NotebookDocument=v.NotebookCell=v.ExecutionSummary=v.NotebookCellKind=v.DiagnosticRefreshRequest=v.WorkspaceDiagnosticRequest=v.DocumentDiagnosticRequest=v.DocumentDiagnosticReportKind=v.DiagnosticServerCancellationData=v.InlayHintRefreshRequest=v.InlayHintResolveRequest=v.InlayHintRequest=v.InlineValueRefreshRequest=v.InlineValueRequest=v.TypeHierarchySupertypesRequest=v.TypeHierarchySubtypesRequest=v.TypeHierarchyPrepareRequest=v.MonikerRequest=v.MonikerKind=void 0;var L=Ze(),qE=(pd(),Nh(md)),Vt=RV(hd()),TV=hN();Object.defineProperty(v,"ImplementationRequest",{enumerable:!0,get:function(){return TV.ImplementationRequest}});var AV=_N();Object.defineProperty(v,"TypeDefinitionRequest",{enumerable:!0,get:function(){return AV.TypeDefinitionRequest}});var zR=SN();Object.defineProperty(v,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return zR.WorkspaceFoldersRequest}});Object.defineProperty(v,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return zR.DidChangeWorkspaceFoldersNotification}});var IV=xN();Object.defineProperty(v,"ConfigurationRequest",{enumerable:!0,get:function(){return IV.ConfigurationRequest}});var KR=PN();Object.defineProperty(v,"DocumentColorRequest",{enumerable:!0,get:function(){return KR.DocumentColorRequest}});Object.defineProperty(v,"ColorPresentationRequest",{enumerable:!0,get:function(){return KR.ColorPresentationRequest}});var YR=RN();Object.defineProperty(v,"FoldingRangeRequest",{enumerable:!0,get:function(){return YR.FoldingRangeRequest}});Object.defineProperty(v,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return YR.FoldingRangeRefreshRequest}});var DV=AN();Object.defineProperty(v,"DeclarationRequest",{enumerable:!0,get:function(){return DV.DeclarationRequest}});var kV=DN();Object.defineProperty(v,"SelectionRangeRequest",{enumerable:!0,get:function(){return kV.SelectionRangeRequest}});var iy=ON();Object.defineProperty(v,"WorkDoneProgress",{enumerable:!0,get:function(){return iy.WorkDoneProgress}});Object.defineProperty(v,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return iy.WorkDoneProgressCreateRequest}});Object.defineProperty(v,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return iy.WorkDoneProgressCancelNotification}});var oy=BN();Object.defineProperty(v,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return oy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(v,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return oy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(v,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return oy.CallHierarchyPrepareRequest}});var zs=GN();Object.defineProperty(v,"TokenFormat",{enumerable:!0,get:function(){return zs.TokenFormat}});Object.defineProperty(v,"SemanticTokensRequest",{enumerable:!0,get:function(){return zs.SemanticTokensRequest}});Object.defineProperty(v,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return zs.SemanticTokensDeltaRequest}});Object.defineProperty(v,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return zs.SemanticTokensRangeRequest}});Object.defineProperty(v,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return zs.SemanticTokensRefreshRequest}});Object.defineProperty(v,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return zs.SemanticTokensRegistrationType}});var FV=KN();Object.defineProperty(v,"ShowDocumentRequest",{enumerable:!0,get:function(){return FV.ShowDocumentRequest}});var LV=XN();Object.defineProperty(v,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return LV.LinkedEditingRangeRequest}});var Fo=iE();Object.defineProperty(v,"FileOperationPatternKind",{enumerable:!0,get:function(){return Fo.FileOperationPatternKind}});Object.defineProperty(v,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Fo.DidCreateFilesNotification}});Object.defineProperty(v,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Fo.WillCreateFilesRequest}});Object.defineProperty(v,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Fo.DidRenameFilesNotification}});Object.defineProperty(v,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Fo.WillRenameFilesRequest}});Object.defineProperty(v,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Fo.DidDeleteFilesNotification}});Object.defineProperty(v,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Fo.WillDeleteFilesRequest}});var sy=cE();Object.defineProperty(v,"UniquenessLevel",{enumerable:!0,get:function(){return sy.UniquenessLevel}});Object.defineProperty(v,"MonikerKind",{enumerable:!0,get:function(){return sy.MonikerKind}});Object.defineProperty(v,"MonikerRequest",{enumerable:!0,get:function(){return sy.MonikerRequest}});var ay=fE();Object.defineProperty(v,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return ay.TypeHierarchyPrepareRequest}});Object.defineProperty(v,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return ay.TypeHierarchySubtypesRequest}});Object.defineProperty(v,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return ay.TypeHierarchySupertypesRequest}});var XR=hE();Object.defineProperty(v,"InlineValueRequest",{enumerable:!0,get:function(){return XR.InlineValueRequest}});Object.defineProperty(v,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return XR.InlineValueRefreshRequest}});var cy=bE();Object.defineProperty(v,"InlayHintRequest",{enumerable:!0,get:function(){return cy.InlayHintRequest}});Object.defineProperty(v,"InlayHintResolveRequest",{enumerable:!0,get:function(){return cy.InlayHintResolveRequest}});Object.defineProperty(v,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return cy.InlayHintRefreshRequest}});var Mc=NE();Object.defineProperty(v,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return Mc.DiagnosticServerCancellationData}});Object.defineProperty(v,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return Mc.DocumentDiagnosticReportKind}});Object.defineProperty(v,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return Mc.DocumentDiagnosticRequest}});Object.defineProperty(v,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return Mc.WorkspaceDiagnosticRequest}});Object.defineProperty(v,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return Mc.DiagnosticRefreshRequest}});var Lr=kE();Object.defineProperty(v,"NotebookCellKind",{enumerable:!0,get:function(){return Lr.NotebookCellKind}});Object.defineProperty(v,"ExecutionSummary",{enumerable:!0,get:function(){return Lr.ExecutionSummary}});Object.defineProperty(v,"NotebookCell",{enumerable:!0,get:function(){return Lr.NotebookCell}});Object.defineProperty(v,"NotebookDocument",{enumerable:!0,get:function(){return Lr.NotebookDocument}});Object.defineProperty(v,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return Lr.NotebookDocumentSyncRegistrationType}});Object.defineProperty(v,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return Lr.DidOpenNotebookDocumentNotification}});Object.defineProperty(v,"NotebookCellArrayChange",{enumerable:!0,get:function(){return Lr.NotebookCellArrayChange}});Object.defineProperty(v,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return Lr.DidChangeNotebookDocumentNotification}});Object.defineProperty(v,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return Lr.DidSaveNotebookDocumentNotification}});Object.defineProperty(v,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return Lr.DidCloseNotebookDocumentNotification}});var OV=LE();Object.defineProperty(v,"InlineCompletionRequest",{enumerable:!0,get:function(){return OV.InlineCompletionRequest}});var JR=$E();Object.defineProperty(v,"TextDocumentContentRequest",{enumerable:!0,get:function(){return JR.TextDocumentContentRequest}});Object.defineProperty(v,"TextDocumentContentRefreshRequest",{enumerable:!0,get:function(){return JR.TextDocumentContentRefreshRequest}});var Q_;(function(e){function t(n){let r=n;return Vt.string(r)||Vt.string(r.language)||Vt.string(r.scheme)||ry.is(r.pattern)}e.is=t})(Q_||(v.TextDocumentFilter=Q_={}));var Z_;(function(e){function t(n){let r=n;return Vt.objectLiteral(r)&&(Vt.string(r.notebookType)||Vt.string(r.scheme)||Vt.string(r.pattern))}e.is=t})(Z_||(v.NotebookDocumentFilter=Z_={}));var ey;(function(e){function t(n){let r=n;return Vt.objectLiteral(r)&&(Vt.string(r.notebook)||Z_.is(r.notebook))&&(r.language===void 0||Vt.string(r.language))}e.is=t})(ey||(v.NotebookCellTextDocumentFilter=ey={}));var ty;(function(e){function t(n){if(!Array.isArray(n))return!1;for(let r of n)if(!Vt.string(r)&&!Q_.is(r)&&!ey.is(r))return!1;return!0}e.is=t})(ty||(v.DocumentSelector=ty={}));var BE;(function(e){e.method="client/registerCapability",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolRequestType(e.method)})(BE||(v.RegistrationRequest=BE={}));var jE;(function(e){e.method="client/unregisterCapability",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolRequestType(e.method)})(jE||(v.UnregistrationRequest=jE={}));var WE;(function(e){e.Create="create",e.Rename="rename",e.Delete="delete"})(WE||(v.ResourceOperationKind=WE={}));var UE;(function(e){e.Abort="abort",e.Transactional="transactional",e.TextOnlyTransactional="textOnlyTransactional",e.Undo="undo"})(UE||(v.FailureHandlingKind=UE={}));var HE;(function(e){e.ES2020="ES2020"})(HE||(v.RegularExpressionEngineKind=HE={}));var VE;(function(e){e.UTF8="utf-8",e.UTF16="utf-16",e.UTF32="utf-32"})(VE||(v.PositionEncodingKind=VE={}));var GE;(function(e){function t(n){let r=n;return r&&Vt.string(r.id)&&r.id.length>0}e.hasId=t})(GE||(v.StaticRegistrationOptions=GE={}));var zE;(function(e){function t(n){let r=n;return r&&(r.documentSelector===null||ty.is(r.documentSelector))}e.is=t})(zE||(v.TextDocumentRegistrationOptions=zE={}));var KE;(function(e){function t(r){let o=r;return Vt.objectLiteral(o)&&(o.workDoneProgress===void 0||Vt.boolean(o.workDoneProgress))}e.is=t;function n(r){let o=r;return o&&Vt.boolean(o.workDoneProgress)}e.hasWorkDoneProgress=n})(KE||(v.WorkDoneProgressOptions=KE={}));var YE;(function(e){e.method="initialize",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method)})(YE||(v.InitializeRequest=YE={}));var XE;(function(e){e.unknownProtocolVersion=1})(XE||(v.InitializeErrorCodes=XE={}));var JE;(function(e){e.method="initialized",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method)})(JE||(v.InitializedNotification=JE={}));var QE;(function(e){e.method="shutdown",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType0(e.method)})(QE||(v.ShutdownRequest=QE={}));var ZE;(function(e){e.method="exit",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType0(e.method)})(ZE||(v.ExitNotification=ZE={}));var eR;(function(e){e.method="workspace/didChangeConfiguration",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("workspace.didChangeConfiguration",void 0)})(eR||(v.DidChangeConfigurationNotification=eR={}));var tR;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4,e.Debug=5})(tR||(v.MessageType=tR={}));var nR;(function(e){e.method="window/showMessage",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("window.showMessage",void 0)})(nR||(v.ShowMessageNotification=nR={}));var rR;(function(e){e.method="window/showMessageRequest",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("window.showMessage",void 0)})(rR||(v.ShowMessageRequest=rR={}));var iR;(function(e){e.method="window/logMessage",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolNotificationType(e.method)})(iR||(v.LogMessageNotification=iR={}));var oR;(function(e){e.method="telemetry/event",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolNotificationType(e.method)})(oR||(v.TelemetryEventNotification=oR={}));var sR;(function(e){e.None=0,e.Full=1,e.Incremental=2})(sR||(v.TextDocumentSyncKind=sR={}));var aR;(function(e){e.method="textDocument/didOpen",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(aR||(v.DidOpenTextDocumentNotification=aR={}));var cR;(function(e){function t(r){let o=r;return o!=null&&typeof o.text=="string"&&o.range!==void 0&&(o.rangeLength===void 0||typeof o.rangeLength=="number")}e.isIncremental=t;function n(r){let o=r;return o!=null&&typeof o.text=="string"&&o.range===void 0&&o.rangeLength===void 0}e.isFull=n})(cR||(v.TextDocumentContentChangeEvent=cR={}));var lR;(function(e){e.method="textDocument/didChange",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.synchronization","textDocumentSync")})(lR||(v.DidChangeTextDocumentNotification=lR={}));var uR;(function(e){e.method="textDocument/didClose",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(uR||(v.DidCloseTextDocumentNotification=uR={}));var dR;(function(e){e.method="textDocument/didSave",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.synchronization.didSave","textDocumentSync.save")})(dR||(v.DidSaveTextDocumentNotification=dR={}));var fR;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(fR||(v.TextDocumentSaveReason=fR={}));var mR;(function(e){e.method="textDocument/willSave",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.synchronization.willSave","textDocumentSync.willSave")})(mR||(v.WillSaveTextDocumentNotification=mR={}));var pR;(function(e){e.method="textDocument/willSaveWaitUntil",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.synchronization.willSaveWaitUntil","textDocumentSync.willSaveWaitUntil")})(pR||(v.WillSaveTextDocumentWaitUntilRequest=pR={}));var hR;(function(e){e.method="workspace/didChangeWatchedFiles",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("workspace.didChangeWatchedFiles",void 0)})(hR||(v.DidChangeWatchedFilesNotification=hR={}));var gR;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(gR||(v.FileChangeType=gR={}));var ny;(function(e){function t(n){let r=n;return Vt.objectLiteral(r)&&(qE.URI.is(r.baseUri)||qE.WorkspaceFolder.is(r.baseUri))&&Vt.string(r.pattern)}e.is=t})(ny||(v.RelativePattern=ny={}));var ry;(function(e){function t(n){let r=n;return Vt.string(r)||ny.is(r)}e.is=t})(ry||(v.GlobPattern=ry={}));var _R;(function(e){e.Create=1,e.Change=2,e.Delete=4})(_R||(v.WatchKind=_R={}));var yR;(function(e){e.method="textDocument/publishDiagnostics",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolNotificationType(e.method),e.capabilities=L.CM.create("textDocument.publishDiagnostics",void 0)})(yR||(v.PublishDiagnosticsNotification=yR={}));var bR;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.TriggerForIncompleteCompletions=3})(bR||(v.CompletionTriggerKind=bR={}));var SR;(function(e){e.method="textDocument/completion",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.completion","completionProvider")})(SR||(v.CompletionRequest=SR={}));var wR;(function(e){e.method="completionItem/resolve",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.completion.completionItem.resolveSupport","completionProvider.resolveProvider")})(wR||(v.CompletionResolveRequest=wR={}));var xR;(function(e){e.method="textDocument/hover",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.hover","hoverProvider")})(xR||(v.HoverRequest=xR={}));var vR;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(vR||(v.SignatureHelpTriggerKind=vR={}));var CR;(function(e){e.method="textDocument/signatureHelp",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.signatureHelp","signatureHelpProvider")})(CR||(v.SignatureHelpRequest=CR={}));var PR;(function(e){e.method="textDocument/definition",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.definition","definitionProvider")})(PR||(v.DefinitionRequest=PR={}));var NR;(function(e){e.method="textDocument/references",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.references","referencesProvider")})(NR||(v.ReferencesRequest=NR={}));var ER;(function(e){e.method="textDocument/documentHighlight",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.documentHighlight","documentHighlightProvider")})(ER||(v.DocumentHighlightRequest=ER={}));var RR;(function(e){e.method="textDocument/documentSymbol",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.documentSymbol","documentSymbolProvider")})(RR||(v.DocumentSymbolRequest=RR={}));var TR;(function(e){e.method="textDocument/codeAction",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.codeAction","codeActionProvider")})(TR||(v.CodeActionRequest=TR={}));var AR;(function(e){e.method="codeAction/resolve",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.codeAction.resolveSupport","codeActionProvider.resolveProvider")})(AR||(v.CodeActionResolveRequest=AR={}));var IR;(function(e){e.method="workspace/symbol",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("workspace.symbol","workspaceSymbolProvider")})(IR||(v.WorkspaceSymbolRequest=IR={}));var DR;(function(e){e.method="workspaceSymbol/resolve",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("workspace.symbol.resolveSupport","workspaceSymbolProvider.resolveProvider")})(DR||(v.WorkspaceSymbolResolveRequest=DR={}));var kR;(function(e){e.method="textDocument/codeLens",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.codeLens","codeLensProvider")})(kR||(v.CodeLensRequest=kR={}));var FR;(function(e){e.method="codeLens/resolve",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.codeLens.resolveSupport","codeLensProvider.resolveProvider")})(FR||(v.CodeLensResolveRequest=FR={}));var LR;(function(e){e.method="workspace/codeLens/refresh",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolRequestType0(e.method),e.capabilities=L.CM.create("workspace.codeLens",void 0)})(LR||(v.CodeLensRefreshRequest=LR={}));var OR;(function(e){e.method="textDocument/documentLink",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.documentLink","documentLinkProvider")})(OR||(v.DocumentLinkRequest=OR={}));var MR;(function(e){e.method="documentLink/resolve",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.documentLink","documentLinkProvider.resolveProvider")})(MR||(v.DocumentLinkResolveRequest=MR={}));var $R;(function(e){e.method="textDocument/formatting",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.formatting","documentFormattingProvider")})($R||(v.DocumentFormattingRequest=$R={}));var qR;(function(e){e.method="textDocument/rangeFormatting",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.rangeFormatting","documentRangeFormattingProvider")})(qR||(v.DocumentRangeFormattingRequest=qR={}));var BR;(function(e){e.method="textDocument/rangesFormatting",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.rangeFormatting.rangesSupport","documentRangeFormattingProvider.rangesSupport")})(BR||(v.DocumentRangesFormattingRequest=BR={}));var jR;(function(e){e.method="textDocument/onTypeFormatting",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.onTypeFormatting","documentOnTypeFormattingProvider")})(jR||(v.DocumentOnTypeFormattingRequest=jR={}));var WR;(function(e){e.Identifier=1})(WR||(v.PrepareSupportDefaultBehavior=WR={}));var UR;(function(e){e.method="textDocument/rename",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.rename","renameProvider")})(UR||(v.RenameRequest=UR={}));var HR;(function(e){e.method="textDocument/prepareRename",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("textDocument.rename.prepareSupport","renameProvider.prepareProvider")})(HR||(v.PrepareRenameRequest=HR={}));var VR;(function(e){e.method="workspace/executeCommand",e.messageDirection=L.MessageDirection.clientToServer,e.type=new L.ProtocolRequestType(e.method),e.capabilities=L.CM.create("workspace.executeCommand","executeCommandProvider")})(VR||(v.ExecuteCommandRequest=VR={}));var GR;(function(e){e.method="workspace/applyEdit",e.messageDirection=L.MessageDirection.serverToClient,e.type=new L.ProtocolRequestType("workspace/applyEdit"),e.capabilities=L.CM.create("workspace.applyEdit",void 0)})(GR||(v.ApplyWorkspaceEditRequest=GR={}))});var eT=C(ly=>{"use strict";Object.defineProperty(ly,"__esModule",{value:!0});ly.createProtocolConnection=MV;var ZR=ri();function MV(e,t,n,r){return ZR.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,ZR.createMessageConnection)(e,t,n,r)}});var _t=C(En=>{"use strict";var $V=En&&En.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Pd=En&&En.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&$V(t,e,n)};Object.defineProperty(En,"__esModule",{value:!0});En.LSPErrorCodes=En.createProtocolConnection=void 0;Pd(ri(),En);Pd((pd(),Nh(md)),En);Pd(Ze(),En);Pd(QR(),En);var qV=eT();Object.defineProperty(En,"createProtocolConnection",{enumerable:!0,get:function(){return qV.createProtocolConnection}});var tT;(function(e){e.lspReservedErrorRangeStart=-32899,e.RequestFailed=-32803,e.ServerCancelled=-32802,e.ContentModified=-32801,e.RequestCancelled=-32800,e.lspReservedErrorRangeEnd=-32800})(tT||(En.LSPErrorCodes=tT={}))});var dy=C(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.empty=void 0;Mi.v4=nT;Mi.isUUID=rT;Mi.parse=jV;Mi.generateUuid=WV;var $c=class{_value;constructor(t){this._value=t}asHex(){return this._value}equals(t){return this.asHex()===t.asHex()}},uy=class e extends $c{static _chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];static _timeHighBits=["8","9","a","b"];static _oneOf(t){return t[Math.floor(t.length*Math.random())]}static _randomHex(){return e._oneOf(e._chars)}constructor(){super([e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),"-",e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),"-","4",e._randomHex(),e._randomHex(),e._randomHex(),"-",e._oneOf(e._timeHighBits),e._randomHex(),e._randomHex(),e._randomHex(),"-",e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex()].join(""))}};Mi.empty=new $c("00000000-0000-0000-0000-000000000000");function nT(){return new uy}var BV=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rT(e){return BV.test(e)}function jV(e){if(!rT(e))throw new Error("invalid uuid");return new $c(e)}function WV(){return nT().asHex()}});var iT=C(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.ProgressFeature=void 0;Ys.attachWorkDone=HV;Ys.attachPartialResult=GV;var $i=_t(),UV=dy(),Ks=class e{_connection;_token;static Instances=new Map;constructor(t,n){this._connection=t,this._token=n,e.Instances.set(this._token,this)}begin(t,n,r,o){let s={kind:"begin",title:t,message:r,cancellable:o};typeof n=="number"&&(s.percentage=Math.round(n)),this._connection.sendProgress($i.WorkDoneProgress.type,this._token,s)}report(t,n){let r={kind:"report"};typeof t=="number"?(r.percentage=Math.round(t),n!==void 0&&(r.message=n)):r.message=t,this._connection.sendProgress($i.WorkDoneProgress.type,this._token,r)}done(){e.Instances.delete(this._token),this._connection.sendProgress($i.WorkDoneProgress.type,this._token,{kind:"end"})}},Nd=class extends Ks{_source;constructor(t,n){super(t,n),this._source=new $i.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},qc=class{constructor(){}begin(){}report(){}done(){}},Ed=class extends qc{_source;constructor(){super(),this._source=new $i.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function HV(e,t){if(t===void 0||t.workDoneToken===void 0)return new qc;let n=t.workDoneToken;return delete t.workDoneToken,new Ks(e,n)}var VV=e=>class extends e{_progressSupported;constructor(){super(),this._progressSupported=!1}initialize(t){super.initialize(t),t?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification($i.WorkDoneProgressCancelNotification.type,n=>{let r=Ks.Instances.get(n.token);(r instanceof Nd||r instanceof Ed)&&r.cancel()}))}attachWorkDoneProgress(t){return t===void 0?new qc:new Ks(this.connection,t)}createWorkDoneProgress(){if(this._progressSupported){let t=(0,UV.generateUuid)();return this.connection.sendRequest($i.WorkDoneProgressCreateRequest.type,{token:t}).then(()=>new Nd(this.connection,t))}else return Promise.resolve(new Ed)}};Ys.ProgressFeature=VV;var fy;(function(e){e.type=new $i.ProgressType})(fy||(fy={}));var my=class{_connection;_token;constructor(t,n){this._connection=t,this._token=n}report(t){this._connection.sendProgress(fy.type,this._token,t)}};function GV(e,t){if(t===void 0||t.partialResultToken===void 0)return;let n=t.partialResultToken;return delete t.partialResultToken,new my(e,n)}});var oT=C(Or=>{"use strict";var zV=Or&&Or.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),KV=Or&&Or.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),YV=Or&&Or.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&zV(n,t,r[o]);return KV(n,t),n}})();Object.defineProperty(Or,"__esModule",{value:!0});Or.ConfigurationFeature=void 0;var XV=_t(),JV=YV(Wu()),QV=e=>class extends e{getConfiguration(t){return t?JV.string(t)?this._getConfiguration({section:t}):this._getConfiguration(t):this._getConfiguration({})}_getConfiguration(t){let n={items:Array.isArray(t)?t:[t]};return this.connection.sendRequest(XV.ConfigurationRequest.type,n).then(r=>Array.isArray(r)?Array.isArray(t)?r:r[0]:Array.isArray(t)?[]:null)}};Or.ConfigurationFeature=QV});var sT=C(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});Td.WorkspaceFoldersFeature=void 0;var Rd=_t(),ZV=e=>class extends e{_onDidChangeWorkspaceFolders;_unregistration;_notificationIsAutoRegistered;constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(t){super.initialize(t);let n=t.workspace;n&&n.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Rd.Emitter,this.connection.onNotification(Rd.DidChangeWorkspaceFoldersNotification.type,r=>{this._onDidChangeWorkspaceFolders.fire(r.event)}))}fillServerCapabilities(t){super.fillServerCapabilities(t);let n=t.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=n===!0||typeof n=="string"}getWorkspaceFolders(){return this.connection.sendRequest(Rd.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(Rd.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Td.WorkspaceFoldersFeature=ZV});var aT=C(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});Ad.CallHierarchyFeature=void 0;var py=_t(),e2=e=>class extends e{get callHierarchy(){return{onPrepare:t=>this.connection.onRequest(py.CallHierarchyPrepareRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),void 0)),onIncomingCalls:t=>{let n=py.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onOutgoingCalls:t=>{let n=py.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Ad.CallHierarchyFeature=e2});var gy=C(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.SemanticTokensBuilder=qi.SemanticTokensDiff=qi.SemanticTokensFeature=void 0;var Id=_t(),t2=e=>class extends e{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Id.SemanticTokensRefreshRequest.type),on:t=>{let n=Id.SemanticTokensRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onDelta:t=>{let n=Id.SemanticTokensDeltaRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onRange:t=>{let n=Id.SemanticTokensRangeRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};qi.SemanticTokensFeature=t2;var Dd=class{originalSequence;modifiedSequence;constructor(t,n){this.originalSequence=t,this.modifiedSequence=n}computeDiff(){let t=this.originalSequence.length,n=this.modifiedSequence.length,r=0;for(;r<n&&r<t&&this.originalSequence[r]===this.modifiedSequence[r];)r++;if(r<n&&r<t){let o=t-1,s=n-1;for(;o>=r&&s>=r&&this.originalSequence[o]===this.modifiedSequence[s];)o--,s--;(o<r||s<r)&&(o++,s++);let a=o-r+1,c=this.modifiedSequence.slice(r,s+1);return c.length===1&&c[0]===this.originalSequence[o]?[{start:r,deleteCount:a-1}]:[{start:r,deleteCount:a,data:c}]}else return r<n?[{start:r,deleteCount:0,data:this.modifiedSequence.slice(r)}]:r<t?[{start:r,deleteCount:t-r}]:[]}};qi.SemanticTokensDiff=Dd;var hy=class e{_id;_prevLine;_prevChar;_dataIsSortedAndDeltaEncoded;_data;_dataNonDelta;_dataLen;_prevData;constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataNonDelta=[],this._dataLen=0,this._dataIsSortedAndDeltaEncoded=!0}push(t,n,r,o,s){this._dataIsSortedAndDeltaEncoded&&(t<this._prevLine||t===this._prevLine&&n<this._prevChar)&&(this._dataIsSortedAndDeltaEncoded=!1,this._dataNonDelta=e._deltaDecode(this._data));let a=t,c=n;this._dataIsSortedAndDeltaEncoded&&this._dataLen>0&&(a-=this._prevLine,a===0&&(c-=this._prevChar));let l=this._dataIsSortedAndDeltaEncoded?this._data:this._dataNonDelta;l[this._dataLen++]=a,l[this._dataLen++]=c,l[this._dataLen++]=r,l[this._dataLen++]=o,l[this._dataLen++]=s,this._prevLine=t,this._prevChar=n}get id(){return this._id.toString()}static _deltaDecode(t){let n=t.length/5|0,r=0,o=0,s=[];for(let a=0;a<n;a++){let c=5*a,l=t[c],u=t[c+1];l===0?(l=r,u+=o):l+=r;let d=t[c+2],f=t[c+3],m=t[c+4];s[c+0]=l,s[c+1]=u,s[c+2]=d,s[c+3]=f,s[c+4]=m,r=l,o=u}return s}static _sortAndDeltaEncode(t){let n=[],r=t.length/5|0;for(let c=0;c<r;c++)n[c]=c;n.sort((c,l)=>{let u=t[5*c],d=t[5*l];if(u===d){let f=t[5*c+1],m=t[5*l+1];return f-m}return u-d});let o=[],s=0,a=0;for(let c=0;c<r;c++){let l=5*n[c],u=t[l+0],d=t[l+1],f=t[l+2],m=t[l+3],p=t[l+4],g=u-s,h=g===0?d-a:d,y=5*c;o[y+0]=g,o[y+1]=h,o[y+2]=f,o[y+3]=m,o[y+4]=p,s=u,a=d}return o}getFinalDataDelta(){return this._dataIsSortedAndDeltaEncoded?this._data:e._sortAndDeltaEncode(this._dataNonDelta)}previousResult(t){this.id===t&&(this._prevData=this.getFinalDataDelta()),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this.getFinalDataDelta()}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData!==void 0?{resultId:this.id,edits:new Dd(this._prevData,this.getFinalDataDelta()).computeDiff()}:this.build()}};qi.SemanticTokensBuilder=hy});var cT=C(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});kd.ShowDocumentFeature=void 0;var n2=_t(),r2=e=>class extends e{showDocument(t){return this.connection.sendRequest(n2.ShowDocumentRequest.type,t)}};kd.ShowDocumentFeature=r2});var lT=C(Fd=>{"use strict";Object.defineProperty(Fd,"__esModule",{value:!0});Fd.FileOperationsFeature=void 0;var Xs=_t(),i2=e=>class extends e{onDidCreateFiles(t){return this.connection.onNotification(Xs.DidCreateFilesNotification.type,n=>t(n))}onDidRenameFiles(t){return this.connection.onNotification(Xs.DidRenameFilesNotification.type,n=>t(n))}onDidDeleteFiles(t){return this.connection.onNotification(Xs.DidDeleteFilesNotification.type,n=>t(n))}onWillCreateFiles(t){return this.connection.onRequest(Xs.WillCreateFilesRequest.type,(n,r)=>t(n,r))}onWillRenameFiles(t){return this.connection.onRequest(Xs.WillRenameFilesRequest.type,(n,r)=>t(n,r))}onWillDeleteFiles(t){return this.connection.onRequest(Xs.WillDeleteFilesRequest.type,(n,r)=>t(n,r))}};Fd.FileOperationsFeature=i2});var uT=C(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.LinkedEditingRangeFeature=void 0;var o2=_t(),s2=e=>class extends e{onLinkedEditingRange(t){return this.connection.onRequest(o2.LinkedEditingRangeRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),void 0))}};Ld.LinkedEditingRangeFeature=s2});var dT=C(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.TypeHierarchyFeature=void 0;var _y=_t(),a2=e=>class extends e{get typeHierarchy(){return{onPrepare:t=>this.connection.onRequest(_y.TypeHierarchyPrepareRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),void 0)),onSupertypes:t=>{let n=_y.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onSubtypes:t=>{let n=_y.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Od.TypeHierarchyFeature=a2});var mT=C(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.InlineValueFeature=void 0;var fT=_t(),c2=e=>class extends e{get inlineValue(){return{refresh:()=>this.connection.sendRequest(fT.InlineValueRefreshRequest.type),on:t=>this.connection.onRequest(fT.InlineValueRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n)))}}};Md.InlineValueFeature=c2});var hT=C($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});$d.FoldingRangeFeature=void 0;var pT=_t(),l2=e=>class extends e{get foldingRange(){return{refresh:()=>this.connection.sendRequest(pT.FoldingRangeRefreshRequest.type),on:t=>{let n=pT.FoldingRangeRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};$d.FoldingRangeFeature=l2});var gT=C(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.InlayHintFeature=void 0;var yy=_t(),u2=e=>class extends e{get inlayHint(){return{refresh:()=>this.connection.sendRequest(yy.InlayHintRefreshRequest.type),on:t=>this.connection.onRequest(yy.InlayHintRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n))),resolve:t=>this.connection.onRequest(yy.InlayHintResolveRequest.type,(n,r)=>t(n,r))}}};qd.InlayHintFeature=u2});var _T=C(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.DiagnosticFeature=void 0;var Bc=_t(),d2=e=>class extends e{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Bc.DiagnosticRefreshRequest.type),on:t=>this.connection.onRequest(Bc.DocumentDiagnosticRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(Bc.DocumentDiagnosticRequest.partialResult,n))),onWorkspace:t=>this.connection.onRequest(Bc.WorkspaceDiagnosticRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(Bc.WorkspaceDiagnosticRequest.partialResult,n)))}}};Bd.DiagnosticFeature=d2});var Sy=C(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.TextDocuments=void 0;var Lo=_t(),by=class{_configuration;_syncedDocuments;_onDidChangeContent;_onDidOpen;_onDidClose;_onDidSave;_onWillSave;_willSaveWaitUntil;constructor(t){this._configuration=t,this._syncedDocuments=new Map,this._onDidChangeContent=new Lo.Emitter,this._onDidOpen=new Lo.Emitter,this._onDidClose=new Lo.Emitter,this._onDidSave=new Lo.Emitter,this._onWillSave=new Lo.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(t){this._willSaveWaitUntil=t}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(t){return this._syncedDocuments.get(t)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(t){t.__textDocumentSync=Lo.TextDocumentSyncKind.Incremental;let n=[];return n.push(t.onDidOpenTextDocument(r=>{let o=r.textDocument,s=this._configuration.create(o.uri,o.languageId,o.version,o.text);this._syncedDocuments.set(o.uri,s);let a=Object.freeze({document:s});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),n.push(t.onDidChangeTextDocument(r=>{let o=r.textDocument,s=r.contentChanges;if(s.length===0)return;let{version:a}=o;if(a==null)throw new Error(`Received document change event for ${o.uri} without valid version identifier`);let c=this._syncedDocuments.get(o.uri);c!==void 0&&(c=this._configuration.update(c,s,a),this._syncedDocuments.set(o.uri,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),n.push(t.onDidCloseTextDocument(r=>{let o=this._syncedDocuments.get(r.textDocument.uri);o!==void 0&&(this._syncedDocuments.delete(r.textDocument.uri),this._onDidClose.fire(Object.freeze({document:o})))})),n.push(t.onWillSaveTextDocument(r=>{let o=this._syncedDocuments.get(r.textDocument.uri);o!==void 0&&this._onWillSave.fire(Object.freeze({document:o,reason:r.reason}))})),n.push(t.onWillSaveTextDocumentWaitUntil((r,o)=>{let s=this._syncedDocuments.get(r.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:r.reason}),o):[]})),n.push(t.onDidSaveTextDocument(r=>{let o=this._syncedDocuments.get(r.textDocument.uri);o!==void 0&&this._onDidSave.fire(Object.freeze({document:o}))})),Lo.Disposable.create(()=>{n.forEach(r=>r.dispose())})}};jd.TextDocuments=by});var vy=C(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.NotebookDocuments=Js.NotebookSyncFeature=void 0;var tr=_t(),yT=Sy(),f2=e=>class extends e{get synchronization(){return{onDidOpenNotebookDocument:t=>this.connection.onNotification(tr.DidOpenNotebookDocumentNotification.type,n=>t(n)),onDidChangeNotebookDocument:t=>this.connection.onNotification(tr.DidChangeNotebookDocumentNotification.type,n=>t(n)),onDidSaveNotebookDocument:t=>this.connection.onNotification(tr.DidSaveNotebookDocumentNotification.type,n=>t(n)),onDidCloseNotebookDocument:t=>this.connection.onNotification(tr.DidCloseNotebookDocumentNotification.type,n=>t(n))}}};Js.NotebookSyncFeature=f2;var wy=class e{static NULL_DISPOSE=Object.freeze({dispose:()=>{}});openHandler;changeHandler;closeHandler;onDidOpenTextDocument(t){return this.openHandler=t,tr.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(t){return this.openHandler&&this.openHandler(t)}onDidChangeTextDocument(t){return this.changeHandler=t,tr.Disposable.create(()=>{this.changeHandler=t})}changeTextDocument(t){return this.changeHandler&&this.changeHandler(t)}onDidCloseTextDocument(t){return this.closeHandler=t,tr.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(t){return this.closeHandler&&this.closeHandler(t)}onWillSaveTextDocument(){return e.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return e.NULL_DISPOSE}onDidSaveTextDocument(){return e.NULL_DISPOSE}},xy=class{notebookDocuments;notebookCellMap;_onDidOpen;_onDidSave;_onDidChange;_onDidClose;_cellTextDocuments;constructor(t){t instanceof yT.TextDocuments?this._cellTextDocuments=t:this._cellTextDocuments=new yT.TextDocuments(t),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new tr.Emitter,this._onDidChange=new tr.Emitter,this._onDidSave=new tr.Emitter,this._onDidClose=new tr.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(t){return this._cellTextDocuments.get(t.document)}getNotebookDocument(t){return this.notebookDocuments.get(t)}getNotebookCell(t){let n=this.notebookCellMap.get(t);return n&&n[0]}findNotebookDocumentForCell(t){let n=typeof t=="string"?t:t.document,r=this.notebookCellMap.get(n);return r&&r[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(t){let n=new wy,r=[];return r.push(this.cellTextDocuments.listen(n)),r.push(t.notebooks.synchronization.onDidOpenNotebookDocument(async o=>{this.notebookDocuments.set(o.notebookDocument.uri,o.notebookDocument);for(let s of o.cellTextDocuments)await n.openTextDocument({textDocument:s});this.updateCellMap(o.notebookDocument),this._onDidOpen.fire(o.notebookDocument)})),r.push(t.notebooks.synchronization.onDidChangeNotebookDocument(async o=>{let s=this.notebookDocuments.get(o.notebookDocument.uri);if(s===void 0)return;s.version=o.notebookDocument.version;let a=s.metadata,c=!1,l=o.change;l.metadata!==void 0&&(c=!0,s.metadata=l.metadata);let u=[],d=[],f=[],m=[];if(l.cells!==void 0){let w=l.cells;if(w.structure!==void 0){let _=w.structure.array;if(s.cells.splice(_.start,_.deleteCount,..._.cells!==void 0?_.cells:[]),w.structure.didOpen!==void 0)for(let b of w.structure.didOpen)await n.openTextDocument({textDocument:b}),u.push(b.uri);if(w.structure.didClose)for(let b of w.structure.didClose)await n.closeTextDocument({textDocument:b}),d.push(b.uri)}if(w.data!==void 0){let _=new Map(w.data.map(b=>[b.document,b]));for(let b=0;b<=s.cells.length;b++){let S=_.get(s.cells[b].document);if(S!==void 0){let N=s.cells.splice(b,1,S);if(f.push({old:N[0],new:S}),_.delete(S.document),_.size===0)break}}}if(w.textContent!==void 0)for(let _ of w.textContent)await n.changeTextDocument({textDocument:_.document,contentChanges:_.changes}),m.push(_.document.uri)}this.updateCellMap(s);let p={notebookDocument:s};c&&(p.metadata={old:a,new:s.metadata});let g=[];for(let w of u)g.push(this.getNotebookCell(w));let h=[];for(let w of d)h.push(this.getNotebookCell(w));let y=[];for(let w of m)y.push(this.getNotebookCell(w));(g.length>0||h.length>0||f.length>0||y.length>0)&&(p.cells={added:g,removed:h,changed:{data:f,textContent:y}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),r.push(t.notebooks.synchronization.onDidSaveNotebookDocument(o=>{let s=this.notebookDocuments.get(o.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),r.push(t.notebooks.synchronization.onDidCloseNotebookDocument(async o=>{let s=this.notebookDocuments.get(o.notebookDocument.uri);if(s!==void 0){this._onDidClose.fire(s);for(let a of o.cellTextDocuments)await n.closeTextDocument({textDocument:a});this.notebookDocuments.delete(o.notebookDocument.uri);for(let a of s.cells)this.notebookCellMap.delete(a.document)}})),tr.Disposable.create(()=>{r.forEach(o=>o.dispose())})}updateCellMap(t){for(let n of t.cells)this.notebookCellMap.set(n.document,[n,t])}};Js.NotebookDocuments=xy});var bT=C(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.MonikerFeature=void 0;var m2=_t(),p2=e=>class extends e{get moniker(){return{on:t=>{let n=m2.MonikerRequest.type;return this.connection.onRequest(n,(r,o)=>t(r,o,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Wd.MonikerFeature=p2});var ST=C(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.InlineCompletionFeature=void 0;var h2=_t(),g2=e=>class extends e{get inlineCompletion(){return{on:t=>this.connection.onRequest(h2.InlineCompletionRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n)))}}};Ud.InlineCompletionFeature=g2});var xT=C(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.TextDocumentContentFeature=void 0;var wT=_t(),_2=e=>class extends e{get textDocumentContent(){return{refresh:t=>this.connection.sendRequest(wT.TextDocumentContentRefreshRequest.type,{uri:t}),on:t=>this.connection.onRequest(wT.TextDocumentContentRequest.type,(n,r)=>t(n,r))}}};Hd.TextDocumentContentFeature=_2});var Ty=C(Ge=>{"use strict";var y2=Ge&&Ge.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),b2=Ge&&Ge.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),TT=Ge&&Ge.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&y2(n,t,r[o]);return b2(n,t),n}})();Object.defineProperty(Ge,"__esModule",{value:!0});Ge._NotebooksImpl=Ge._LanguagesImpl=Ge.BulkUnregistration=Ge.BulkRegistration=Ge.ErrorMessageTracker=void 0;Ge.combineConsoleFeatures=AT;Ge.combineTelemetryFeatures=IT;Ge.combineTracerFeatures=DT;Ge.combineClientFeatures=kT;Ge.combineWindowFeatures=FT;Ge.combineWorkspaceFeatures=LT;Ge.combineLanguagesFeatures=OT;Ge.combineNotebooksFeatures=MT;Ge.combineFeatures=O2;Ge.createConnection=M2;var G=_t(),nr=TT(Wu()),Py=TT(dy()),ue=iT(),S2=oT(),w2=sT(),x2=aT(),v2=gy(),C2=cT(),P2=lT(),N2=uT(),E2=dT(),R2=mT(),T2=hT(),A2=gT(),I2=_T(),D2=vy(),k2=bT(),F2=ST(),L2=xT();function Cy(e){if(e!==null)return e}var Ny=class{_messages;constructor(){this._messages=Object.create(null)}add(t){let n=this._messages[t];n||(n=0),n++,this._messages[t]=n}sendErrors(t){Object.keys(this._messages).forEach(n=>{t.window.showErrorMessage(n)})}};Ge.ErrorMessageTracker=Ny;var Vd=class{_rawConnection;_connection;constructor(){}rawAttach(t){this._rawConnection=t}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(t){}initialize(t){}error(t){this.send(G.MessageType.Error,t)}warn(t){this.send(G.MessageType.Warning,t)}info(t){this.send(G.MessageType.Info,t)}log(t){this.send(G.MessageType.Log,t)}debug(t){this.send(G.MessageType.Debug,t)}send(t,n){this._rawConnection&&this._rawConnection.sendNotification(G.LogMessageNotification.type,{type:t,message:n}).catch(()=>{(0,G.RAL)().console.error("Sending log message failed")})}},Ey=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}showErrorMessage(t,...n){let r={type:G.MessageType.Error,message:t,actions:n};return this.connection.sendRequest(G.ShowMessageRequest.type,r).then(Cy)}showWarningMessage(t,...n){let r={type:G.MessageType.Warning,message:t,actions:n};return this.connection.sendRequest(G.ShowMessageRequest.type,r).then(Cy)}showInformationMessage(t,...n){let r={type:G.MessageType.Info,message:t,actions:n};return this.connection.sendRequest(G.ShowMessageRequest.type,r).then(Cy)}},vT=(0,C2.ShowDocumentFeature)((0,ue.ProgressFeature)(Ey)),CT;(function(e){function t(){return new Gd}e.create=t})(CT||(Ge.BulkRegistration=CT={}));var Gd=class{_registrations=[];_registered=new Set;add(t,n){let r=nr.string(t)?t:t.method;if(this._registered.has(r))throw new Error(`${r} is already added to this registration`);let o=Py.generateUuid();this._registrations.push({id:o,method:r,registerOptions:n||{}}),this._registered.add(r)}asRegistrationParams(){return{registrations:this._registrations}}},PT;(function(e){function t(){return new jc(void 0,[])}e.create=t})(PT||(Ge.BulkUnregistration=PT={}));var jc=class{_connection;_unregistrations=new Map;constructor(t,n){this._connection=t,n.forEach(r=>{this._unregistrations.set(r.method,r)})}get isAttached(){return!!this._connection}attach(t){this._connection=t}add(t){this._unregistrations.set(t.method,t)}dispose(){let t=[];for(let r of this._unregistrations.values())t.push(r);let n={unregisterations:t};this._connection.sendRequest(G.UnregistrationRequest.type,n).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(t){let n=nr.string(t)?t:t.method,r=this._unregistrations.get(n);if(!r)return!1;let o={unregisterations:[r]};return this._connection.sendRequest(G.UnregistrationRequest.type,o).then(()=>{this._unregistrations.delete(n)},s=>{this._connection.console.info(`Un-registering request handler for ${r.id} failed.`)}),!0}},zd=class{_connection;attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}register(t,n,r){return t instanceof Gd?this.registerMany(t):t instanceof jc?this.registerSingle1(t,n,r):this.registerSingle2(t,n)}registerSingle1(t,n,r){let o=nr.string(n)?n:n.method,s=Py.generateUuid(),a={registrations:[{id:s,method:o,registerOptions:r||{}}]};return t.isAttached||t.attach(this.connection),this.connection.sendRequest(G.RegistrationRequest.type,a).then(c=>(t.add({id:s,method:o}),t),c=>(this.connection.console.info(`Registering request handler for ${o} failed.`),Promise.reject(c)))}registerSingle2(t,n){let r=nr.string(t)?t:t.method,o=Py.generateUuid(),s={registrations:[{id:o,method:r,registerOptions:n||{}}]};return this.connection.sendRequest(G.RegistrationRequest.type,s).then(a=>G.Disposable.create(()=>{this.unregisterSingle(o,r).catch(()=>{this.connection.console.info(`Un-registering capability with id ${o} failed.`)})}),a=>(this.connection.console.info(`Registering request handler for ${r} failed.`),Promise.reject(a)))}unregisterSingle(t,n){let r={unregisterations:[{id:t,method:n}]};return this.connection.sendRequest(G.UnregistrationRequest.type,r).catch(()=>{this.connection.console.info(`Un-registering request handler for ${t} failed.`)})}registerMany(t){let n=t.asRegistrationParams();return this.connection.sendRequest(G.RegistrationRequest.type,n).then(()=>new jc(this._connection,n.registrations.map(r=>({id:r.id,method:r.method}))),r=>(this.connection.console.info("Bulk registration failed."),Promise.reject(r)))}},Ry=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}applyEdit(t){function n(o){return o&&!!o.edit}let r=n(t)?t:{edit:t};return this.connection.sendRequest(G.ApplyWorkspaceEditRequest.type,r)}},NT=(0,L2.TextDocumentContentFeature)((0,P2.FileOperationsFeature)((0,w2.WorkspaceFoldersFeature)((0,S2.ConfigurationFeature)(Ry)))),Kd=class{_trace;_connection;constructor(){this._trace=G.Trace.Off}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}set trace(t){this._trace=t}log(t,n){this._trace!==G.Trace.Off&&this.connection.sendNotification(G.LogTraceNotification.type,{message:t,verbose:this._trace===G.Trace.Verbose?n:void 0}).catch(()=>{})}},Yd=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}logEvent(t){this.connection.sendNotification(G.TelemetryEventNotification.type,t).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},Xd=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}attachWorkDoneProgress(t){return(0,ue.attachWorkDone)(this.connection,t)}attachPartialResultProgress(t,n){return(0,ue.attachPartialResult)(this.connection,n)}};Ge._LanguagesImpl=Xd;var ET=(0,F2.InlineCompletionFeature)((0,T2.FoldingRangeFeature)((0,k2.MonikerFeature)((0,I2.DiagnosticFeature)((0,A2.InlayHintFeature)((0,R2.InlineValueFeature)((0,E2.TypeHierarchyFeature)((0,N2.LinkedEditingRangeFeature)((0,v2.SemanticTokensFeature)((0,x2.CallHierarchyFeature)(Xd)))))))))),Jd=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}attachWorkDoneProgress(t){return(0,ue.attachWorkDone)(this.connection,t)}attachPartialResultProgress(t,n){return(0,ue.attachPartialResult)(this.connection,n)}};Ge._NotebooksImpl=Jd;var RT=(0,D2.NotebookSyncFeature)(Jd);function AT(e,t){return function(n){return t(e(n))}}function IT(e,t){return function(n){return t(e(n))}}function DT(e,t){return function(n){return t(e(n))}}function kT(e,t){return function(n){return t(e(n))}}function FT(e,t){return function(n){return t(e(n))}}function LT(e,t){return function(n){return t(e(n))}}function OT(e,t){return function(n){return t(e(n))}}function MT(e,t){return function(n){return t(e(n))}}function O2(e,t){function n(o,s,a){return o&&s?a(o,s):o||s}return{__brand:"features",console:n(e.console,t.console,AT),tracer:n(e.tracer,t.tracer,DT),telemetry:n(e.telemetry,t.telemetry,IT),client:n(e.client,t.client,kT),window:n(e.window,t.window,FT),workspace:n(e.workspace,t.workspace,LT),languages:n(e.languages,t.languages,OT),notebooks:n(e.notebooks,t.notebooks,MT)}}function M2(e,t,n){let r=n&&n.console?new(n.console(Vd)):new Vd,o=e(r);r.rawAttach(o);let s=n&&n.tracer?new(n.tracer(Kd)):new Kd,a=n&&n.telemetry?new(n.telemetry(Yd)):new Yd,c=n&&n.client?new(n.client(zd)):new zd,l=n&&n.window?new(n.window(vT)):new vT,u=n&&n.workspace?new(n.workspace(NT)):new NT,d=n&&n.languages?new(n.languages(ET)):new ET,f=n&&n.notebooks?new(n.notebooks(RT)):new RT,m=[r,s,a,c,l,u,d,f];function p(_){return _ instanceof Promise?_:nr.thenable(_)?new Promise((b,S)=>{_.then(N=>b(N),N=>S(N))}):Promise.resolve(_)}let g,h,y,w={listen:()=>o.listen(),sendRequest:(_,...b)=>o.sendRequest(nr.string(_)?_:_.method,...b),onRequest:(_,b)=>o.onRequest(_,b),sendNotification:(_,b)=>{let S=nr.string(_)?_:_.method;return o.sendNotification(S,b)},onNotification:(_,b)=>o.onNotification(_,b),onProgress:o.onProgress,sendProgress:o.sendProgress,onInitialize:_=>(h=_,{dispose:()=>{h=void 0}}),onInitialized:_=>o.onNotification(G.InitializedNotification.type,_),onShutdown:_=>(g=_,{dispose:()=>{g=void 0}}),onExit:_=>(y=_,{dispose:()=>{y=void 0}}),get console(){return r},get telemetry(){return a},get tracer(){return s},get client(){return c},get window(){return l},get workspace(){return u},get languages(){return d},get notebooks(){return f},onDidChangeConfiguration:_=>o.onNotification(G.DidChangeConfigurationNotification.type,_),onDidChangeWatchedFiles:_=>o.onNotification(G.DidChangeWatchedFilesNotification.type,_),__textDocumentSync:void 0,onDidOpenTextDocument:_=>o.onNotification(G.DidOpenTextDocumentNotification.type,_),onDidChangeTextDocument:_=>o.onNotification(G.DidChangeTextDocumentNotification.type,_),onDidCloseTextDocument:_=>o.onNotification(G.DidCloseTextDocumentNotification.type,_),onWillSaveTextDocument:_=>o.onNotification(G.WillSaveTextDocumentNotification.type,_),onWillSaveTextDocumentWaitUntil:_=>o.onRequest(G.WillSaveTextDocumentWaitUntilRequest.type,_),onDidSaveTextDocument:_=>o.onNotification(G.DidSaveTextDocumentNotification.type,_),sendDiagnostics:_=>o.sendNotification(G.PublishDiagnosticsNotification.type,_),onHover:_=>o.onRequest(G.HoverRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onCompletion:_=>o.onRequest(G.CompletionRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onCompletionResolve:_=>o.onRequest(G.CompletionResolveRequest.type,_),onSignatureHelp:_=>o.onRequest(G.SignatureHelpRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onDeclaration:_=>o.onRequest(G.DeclarationRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onDefinition:_=>o.onRequest(G.DefinitionRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onTypeDefinition:_=>o.onRequest(G.TypeDefinitionRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onImplementation:_=>o.onRequest(G.ImplementationRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onReferences:_=>o.onRequest(G.ReferencesRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onDocumentHighlight:_=>o.onRequest(G.DocumentHighlightRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onDocumentSymbol:_=>o.onRequest(G.DocumentSymbolRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onWorkspaceSymbol:_=>o.onRequest(G.WorkspaceSymbolRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onWorkspaceSymbolResolve:_=>o.onRequest(G.WorkspaceSymbolResolveRequest.type,_),onCodeAction:_=>o.onRequest(G.CodeActionRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onCodeActionResolve:_=>o.onRequest(G.CodeActionResolveRequest.type,(b,S)=>_(b,S)),onCodeLens:_=>o.onRequest(G.CodeLensRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onCodeLensResolve:_=>o.onRequest(G.CodeLensResolveRequest.type,(b,S)=>_(b,S)),onDocumentFormatting:_=>o.onRequest(G.DocumentFormattingRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onDocumentRangeFormatting:_=>o.onRequest(G.DocumentRangeFormattingRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onDocumentRangesFormatting:_=>o.onRequest(G.DocumentRangesFormattingRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onDocumentOnTypeFormatting:_=>o.onRequest(G.DocumentOnTypeFormattingRequest.type,(b,S)=>_(b,S)),onRenameRequest:_=>o.onRequest(G.RenameRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),onPrepareRename:_=>o.onRequest(G.PrepareRenameRequest.type,(b,S)=>_(b,S)),onDocumentLinks:_=>o.onRequest(G.DocumentLinkRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onDocumentLinkResolve:_=>o.onRequest(G.DocumentLinkResolveRequest.type,(b,S)=>_(b,S)),onDocumentColor:_=>o.onRequest(G.DocumentColorRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onColorPresentation:_=>o.onRequest(G.ColorPresentationRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onFoldingRanges:_=>o.onRequest(G.FoldingRangeRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onSelectionRanges:_=>o.onRequest(G.SelectionRangeRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),(0,ue.attachPartialResult)(o,b))),onExecuteCommand:_=>o.onRequest(G.ExecuteCommandRequest.type,(b,S)=>_(b,S,(0,ue.attachWorkDone)(o,b),void 0)),dispose:()=>o.dispose()};for(let _ of m)_.attach(w);return o.onRequest(G.InitializeRequest.type,_=>{t.initialize(_),nr.string(_.trace)&&(s.trace=G.Trace.fromString(_.trace));for(let b of m)b.initialize(_.capabilities);if(h){let b=h(_,new G.CancellationTokenSource().token,(0,ue.attachWorkDone)(o,_),void 0);return p(b).then(S=>{if(S instanceof G.ResponseError)return S;let N=S;N||(N={capabilities:{}});let R=N.capabilities;R||(R={},N.capabilities=R),R.textDocumentSync===void 0||R.textDocumentSync===null?R.textDocumentSync=nr.number(w.__textDocumentSync)?w.__textDocumentSync:G.TextDocumentSyncKind.None:!nr.number(R.textDocumentSync)&&!nr.number(R.textDocumentSync.change)&&(R.textDocumentSync.change=nr.number(w.__textDocumentSync)?w.__textDocumentSync:G.TextDocumentSyncKind.None);for(let $ of m)$.fillServerCapabilities(R);return N})}else{let b={capabilities:{textDocumentSync:G.TextDocumentSyncKind.None}};for(let S of m)S.fillServerCapabilities(b.capabilities);return b}}),o.onRequest(G.ShutdownRequest.type,()=>{if(t.shutdownReceived=!0,g)return g(new G.CancellationTokenSource().token)}),o.onNotification(G.ExitNotification.type,()=>{try{if(y)return y()}finally{t.shutdownReceived?t.exit(0):t.exit(1)}}),o.onNotification(G.SetTraceNotification.type,_=>{s.trace=G.Trace.fromString(_.value)}),w}});var $T=C(hn=>{"use strict";var $2=hn&&hn.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),q2=hn&&hn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Fy=hn&&hn.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&$2(n,t,r[o]);return q2(n,t),n}})();Object.defineProperty(hn,"__esModule",{value:!0});hn.FileSystem=void 0;hn.uriToFilePath=j2;hn.resolve=Qd;hn.resolveGlobalNodePath=Dy;hn.resolveGlobalYarnPath=W2;hn.resolveModulePath=U2;var B2=Fy(require("url")),yr=Fy(require("path")),Ay=Fy(require("fs")),Ly=require("child_process");function j2(e){let t=B2.parse(e);if(t.protocol!=="file:"||!t.path)return;let n=t.path.split("/");for(let r=0,o=n.length;r<o;r++)n[r]=decodeURIComponent(n[r]);if(process.platform==="win32"&&n.length>1){let r=n[0],o=n[1];r.length===0&&o.length>1&&o[1]===":"&&n.shift()}return yr.normalize(n.join("/"))}function Iy(){return process.platform==="win32"}function Qd(e,t,n,r){let o="NODE_PATH",s=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((a,c)=>{let l=process.env,u=Object.create(null);Object.keys(l).forEach(d=>u[d]=l[d]),t&&Ay.existsSync(t)&&(u[o]?u[o]=t+yr.delimiter+u[o]:u[o]=t,r&&r(`NODE_PATH value is: ${u[o]}`)),u.ELECTRON_RUN_AS_NODE="1";try{let d=(0,Ly.fork)("",[],{cwd:n,env:u,execArgv:["-e",s]});if(d.pid===void 0){c(new Error(`Starting process to resolve node module ${e} failed`));return}d.on("error",m=>{c(m)}),d.on("message",m=>{m.c==="r"&&(d.send({c:"e"}),m.s?a(m.r):c(new Error(`Failed to resolve module: ${e}`)))});let f={c:"rs",a:e};d.send(f)}catch(d){c(d)}})}function Dy(e){let t="npm",n=Object.create(null);Object.keys(process.env).forEach(s=>n[s]=process.env[s]),n.NO_UPDATE_NOTIFIER="true";let r={encoding:"utf8",env:n};Iy()&&(t="npm.cmd",r.shell=!0);let o=()=>{};try{process.on("SIGPIPE",o);let s=(0,Ly.spawnSync)(t,["config","get","prefix"],r).stdout;if(!s){e&&e("'npm config get prefix' didn't return a value.");return}let a=s.trim();return e&&e(`'npm config get prefix' value is: ${a}`),a.length>0?Iy()?yr.join(a,"node_modules"):yr.join(a,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",o)}}function W2(e){let t="yarn",n={encoding:"utf8"};Iy()&&(t="yarn.cmd",n.shell=!0);let r=()=>{};try{process.on("SIGPIPE",r);let o=(0,Ly.spawnSync)(t,["global","dir","--json"],n),s=o.stdout;if(!s){e&&(e("'yarn global dir' didn't return a value."),o.stderr&&e(o.stderr));return}let a=s.trim().split(/\r?\n/);for(let c of a)try{let l=JSON.parse(c);if(l.type==="log")return yr.join(l.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",r)}}var ky;(function(e){let t;function n(){return t!==void 0||(process.platform==="win32"?t=!1:t=!Ay.existsSync(__filename.toUpperCase())||!Ay.existsSync(__filename.toLowerCase())),t}e.isCaseSensitive=n;function r(o,s){return n()?yr.normalize(s).indexOf(yr.normalize(o))===0:yr.normalize(s).toLowerCase().indexOf(yr.normalize(o).toLowerCase())===0}e.isParent=r})(ky||(hn.FileSystem=ky={}));function U2(e,t,n,r){return n?(yr.isAbsolute(n)||(n=yr.join(e,n)),Qd(t,n,n,r).then(o=>ky.isParent(n,o)?o:Promise.reject(new Error(`Failed to load ${t} from node path location.`))).then(void 0,o=>Qd(t,Dy(r),e,r))):Qd(t,Dy(r),e,r)}});var jT=C(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:!0});var qT=require("util"),ci=ri(),Oy=class e extends ci.AbstractMessageBuffer{static emptyBuffer=Buffer.allocUnsafe(0);constructor(t="utf-8"){super(t)}emptyBuffer(){return e.emptyBuffer}fromString(t,n){return Buffer.from(t,n)}toString(t,n){return t instanceof Buffer?t.toString(n):new qT.TextDecoder(n).decode(t)}asNative(t,n){return n===void 0?t instanceof Buffer?t:Buffer.from(t):t instanceof Buffer?t.slice(0,n):Buffer.from(t,0,n)}allocNative(t){return Buffer.allocUnsafe(t)}},My=class{stream;constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),ci.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),ci.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),ci.Disposable.create(()=>this.stream.off("end",t))}onData(t){return this.stream.on("data",t),ci.Disposable.create(()=>this.stream.off("data",t))}},$y=class{stream;constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),ci.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),ci.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),ci.Disposable.create(()=>this.stream.off("end",t))}write(t,n){return new Promise((r,o)=>{let s=a=>{a==null?r():o(a)};typeof t=="string"?this.stream.write(t,n,s):this.stream.write(t,s)})}end(){this.stream.end()}},BT=Object.freeze({messageBuffer:Object.freeze({create:e=>new Oy(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(n){return Promise.reject(n)}}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new qT.TextDecoder(t.charset).decode(e)))}catch(n){return Promise.reject(n)}}})}),stream:Object.freeze({asReadableStream:e=>new My(e),asWritableStream:e=>new $y(e)}),console,timer:Object.freeze({setTimeout(e,t,...n){let r=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){let n=setImmediate(e,...t);return{dispose:()=>clearImmediate(n)}},setInterval(e,t,...n){let r=setInterval(e,t,...n);return{dispose:()=>clearInterval(r)}}})});function qy(){return BT}(function(e){function t(){ci.RAL.install(BT)}e.install=t})(qy||(qy={}));By.default=qy});var Gy=C(Re=>{"use strict";var UT=Re&&Re.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),H2=Re&&Re.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Vy=Re&&Re.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&UT(n,t,r[o]);return H2(n,t),n}})(),V2=Re&&Re.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&UT(t,e,n)},G2=Re&&Re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Re,"__esModule",{value:!0});Re.StreamMessageWriter=Re.StreamMessageReader=Re.SocketMessageWriter=Re.SocketMessageReader=Re.PortMessageWriter=Re.PortMessageReader=Re.IPCMessageWriter=Re.IPCMessageReader=void 0;Re.generateRandomPipeName=Q2;Re.createClientPipeTransport=Z2;Re.createServerPipeTransport=eG;Re.createClientSocketTransport=tG;Re.createServerSocketTransport=nG;Re.createMessageConnection=oG;var Wc=G2(jT());Wc.default.install();var z2=Vy(require("path")),K2=Vy(require("os")),Y2=Vy(require("fs")),WT=require("crypto"),tf=require("net"),Gn=ri();V2(ri(),Re);var jy=class extends Gn.AbstractMessageReader{process;constructor(t){super(),this.process=t;let n=this.process;n.on("error",r=>this.fireError(r)),n.on("close",()=>this.fireClose())}listen(t){return this.process.on("message",t),Gn.Disposable.create(()=>this.process.off("message",t))}};Re.IPCMessageReader=jy;var Wy=class extends Gn.AbstractMessageWriter{process;errorCount;constructor(t){super(),this.process=t,this.errorCount=0;let n=this.process;n.on("error",r=>this.fireError(r)),n.on("close",()=>this.fireClose)}write(t){try{return typeof this.process.send=="function"&&this.process.send(t,void 0,void 0,n=>{n?(this.errorCount++,this.handleError(n,t)):this.errorCount=0}),Promise.resolve()}catch(n){return this.handleError(n,t),Promise.reject(n)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){}};Re.IPCMessageWriter=Wy;var Uy=class extends Gn.AbstractMessageReader{onData;constructor(t){super(),this.onData=new Gn.Emitter,t.on("close",()=>this.fireClose),t.on("error",n=>this.fireError(n)),t.on("message",n=>{this.onData.fire(n)})}listen(t){return this.onData.event(t)}};Re.PortMessageReader=Uy;var Hy=class extends Gn.AbstractMessageWriter{port;errorCount;constructor(t){super(),this.port=t,this.errorCount=0,t.on("close",()=>this.fireClose()),t.on("error",n=>this.fireError(n))}write(t){try{return this.port.postMessage(t),Promise.resolve()}catch(n){return this.handleError(n,t),Promise.reject(n)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){}};Re.PortMessageWriter=Hy;var Oo=class extends Gn.ReadableStreamMessageReader{constructor(t,n="utf-8"){super((0,Wc.default)().stream.asReadableStream(t),n)}};Re.SocketMessageReader=Oo;var Mo=class extends Gn.WriteableStreamMessageWriter{socket;constructor(t,n){super((0,Wc.default)().stream.asWritableStream(t),n),this.socket=t}dispose(){super.dispose(),this.socket.destroy()}};Re.SocketMessageWriter=Mo;var Zd=class extends Gn.ReadableStreamMessageReader{constructor(t,n){super((0,Wc.default)().stream.asReadableStream(t),n)}};Re.StreamMessageReader=Zd;var ef=class extends Gn.WriteableStreamMessageWriter{constructor(t,n){super((0,Wc.default)().stream.asWritableStream(t),n)}};Re.StreamMessageWriter=ef;var X2=process.env.XDG_RUNTIME_DIR,J2=new Map([["linux",107],["darwin",102]]);function Q2(){if(process.platform==="win32")return`\\\\.\\pipe\\lsp-${(0,WT.randomBytes)(16).toString("hex")}-sock`;let e=32,t=10,n=Y2.realpathSync(X2??K2.tmpdir()),r=J2.get(process.platform);if(r!==void 0&&(e=Math.min(r-n.length-t,e)),e<16)throw new Error(`Unable to generate a random pipe name with ${e} characters.`);let o=(0,WT.randomBytes)(Math.floor(e/2)).toString("hex");return z2.join(n,`lsp-${o}.sock`)}function Z2(e,t="utf-8"){let n,r=new Promise((o,s)=>{n=o});return new Promise((o,s)=>{let a=(0,tf.createServer)(c=>{a.close(),n([new Oo(c,t),new Mo(c,t)])});a.on("error",s),a.listen(e,()=>{a.removeListener("error",s),o({onConnected:()=>r})})})}function eG(e,t="utf-8"){let n=(0,tf.createConnection)(e);return[new Oo(n,t),new Mo(n,t)]}function tG(e,t="utf-8"){let n,r=new Promise((o,s)=>{n=o});return new Promise((o,s)=>{let a=(0,tf.createServer)(c=>{a.close(),n([new Oo(c,t),new Mo(c,t)])});a.on("error",s),a.listen(e,"127.0.0.1",()=>{a.removeListener("error",s),o({onConnected:()=>r})})})}function nG(e,t="utf-8"){let n=(0,tf.createConnection)(e,"127.0.0.1");return[new Oo(n,t),new Mo(n,t)]}function rG(e){let t=e;return t.read!==void 0&&t.addListener!==void 0}function iG(e){let t=e;return t.write!==void 0&&t.addListener!==void 0}function oG(e,t,n,r){n||(n=Gn.NullLogger);let o=rG(e)?new Zd(e):e,s=iG(t)?new ef(t):t;return Gn.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,Gn.createMessageConnection)(o,s,n,r)}});var zy=C(li=>{"use strict";var sG=li&&li.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),HT=li&&li.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&sG(t,e,n)};Object.defineProperty(li,"__esModule",{value:!0});li.createProtocolConnection=cG;var aG=Gy();HT(Gy(),li);HT(_t(),li);function cG(e,t,n,r){return(0,aG.createMessageConnection)(e,t,n,r)}});var zT=C(ln=>{"use strict";var lG=ln&&ln.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),GT=ln&&ln.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&lG(t,e,n)};Object.defineProperty(ln,"__esModule",{value:!0});ln.ProposedFeatures=ln.NotebookDocuments=ln.TextDocuments=ln.SemanticTokensBuilder=void 0;var uG=gy();Object.defineProperty(ln,"SemanticTokensBuilder",{enumerable:!0,get:function(){return uG.SemanticTokensBuilder}});GT(_t(),ln);var dG=Sy();Object.defineProperty(ln,"TextDocuments",{enumerable:!0,get:function(){return dG.TextDocuments}});var fG=vy();Object.defineProperty(ln,"NotebookDocuments",{enumerable:!0,get:function(){return fG.NotebookDocuments}});GT(Ty(),ln);var VT;(function(e){e.all={__brand:"features"}})(VT||(ln.ProposedFeatures=VT={}))});var le=C(gn=>{"use strict";var JT=gn&&gn.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),mG=gn&&gn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),QT=gn&&gn.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),o=0;o<r.length;o++)r[o]!=="default"&&JT(n,t,r[o]);return mG(n,t),n}})(),ZT=gn&&gn.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&JT(t,e,n)};Object.defineProperty(gn,"__esModule",{value:!0});gn.Files=void 0;gn.createConnection=_G;var KT=require("node:util"),Ky=QT(Wu()),pG=Ty(),Uc=QT($T()),$o=zy();ZT(zy(),gn);ZT(zT(),gn);var YT;(function(e){e.uriToFilePath=Uc.uriToFilePath,e.resolveGlobalNodePath=Uc.resolveGlobalNodePath,e.resolveGlobalYarnPath=Uc.resolveGlobalYarnPath,e.resolve=Uc.resolve,e.resolveModulePath=Uc.resolveModulePath})(YT||(gn.Files=YT={}));var XT;function nf(){if(XT!==void 0)try{XT.end()}catch{}}var Qs=!1,eA;function hG(){let e="--clientProcessId";function t(n){try{let r=parseInt(n);isNaN(r)||(eA=setInterval(()=>{try{process.kill(r,0)}catch{nf(),process.exit(Qs?0:1)}},3e3))}catch{}}for(let n=2;n<process.argv.length;n++){let r=process.argv[n];if(r===e&&n+1<process.argv.length){t(process.argv[n+1]);return}else{let o=r.split("=");o[0]===e&&t(o[1])}}}hG();var gG={initialize:e=>{let t=e.processId;Ky.number(t)&&eA===void 0&&setInterval(()=>{try{process.kill(t,0)}catch{process.exit(Qs?0:1)}},3e3)},get shutdownReceived(){return Qs},set shutdownReceived(e){Qs=e},exit:e=>{nf(),process.exit(e)}};function _G(e,t,n,r){let o,s,a,c;return e!==void 0&&e.__brand==="features"&&(o=e,e=t,t=n,n=r),$o.ConnectionStrategy.is(e)||$o.ConnectionOptions.is(e)?c=e:(s=e,a=t,c=n),yG(s,a,c,o)}function yG(e,t,n,r){let o=!1;if(!e&&!t&&process.argv.length>2){let c,l,u=process.argv.slice(2);for(let d=0;d<u.length;d++){let f=u[d];if(f==="--node-ipc"){e=new $o.IPCMessageReader(process),t=new $o.IPCMessageWriter(process);break}else if(f==="--stdio"){o=!0,e=process.stdin,t=process.stdout;break}else if(f==="--socket"){c=parseInt(u[d+1]);break}else if(f==="--pipe"){l=u[d+1];break}else{let m=f.split("=");if(m[0]==="--socket"){c=parseInt(m[1]);break}else if(m[0]==="--pipe"){l=m[1];break}}}if(c){let d=(0,$o.createServerSocketTransport)(c);e=d[0],t=d[1]}else if(l){let d=(0,$o.createServerPipeTransport)(l);e=d[0],t=d[1]}}let s="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!e)throw new Error("Connection input stream is not set. "+s);if(!t)throw new Error("Connection output stream is not set. "+s);if(Ky.func(e.read)&&Ky.func(e.on)){let c=e;c.on("end",()=>{nf(),process.exit(Qs?0:1)}),c.on("close",()=>{nf(),process.exit(Qs?0:1)})}let a=c=>{let l=(0,$o.createProtocolConnection)(e,t,c,n);return o&&bG(c),l};return(0,pG.createConnection)(a,gG,r)}function bG(e){function t(r){return r.map(o=>typeof o=="string"?o:(0,KT.inspect)(o)).join(" ")}let n=new Map;console.assert=function(o,...s){if(!o)if(s.length===0)e.error("Assertion failed");else{let[a,...c]=s;e.error(`Assertion failed: ${a} ${t(c)}`)}},console.count=function(o="default"){let s=String(o),a=n.get(s)??0;a+=1,n.set(s,a),e.log(`${s}: ${s}`)},console.countReset=function(o){o===void 0?n.clear():n.delete(String(o))},console.debug=function(...o){e.log(t(o))},console.dir=function(o,s){e.log((0,KT.inspect)(o,s))},console.log=function(...o){e.log(t(o))},console.error=function(...o){e.error(t(o))},console.trace=function(...o){let s=new Error().stack.replace(/(.+\n){2}/,""),a="Trace";o.length!==0&&(a+=`: ${t(o)}`),e.log(`${a}
14
+ ${s}`)},console.warn=function(...o){e.warn(t(o))}}});var uI=C(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.splitWhen=la.flatten=void 0;function BG(e){return e.reduce((t,n)=>[].concat(t,n),[])}la.flatten=BG;function jG(e,t){let n=[[]],r=0;for(let o of e)t(o)?(r++,n[r]=[]):n[r].push(o);return n}la.splitWhen=jG});var dI=C(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.isEnoentCodeError=void 0;function WG(e){return e.code==="ENOENT"}gf.isEnoentCodeError=WG});var fI=C(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.createDirentFromStats=void 0;var bb=class{constructor(t,n){this.name=t,this.isBlockDevice=n.isBlockDevice.bind(n),this.isCharacterDevice=n.isCharacterDevice.bind(n),this.isDirectory=n.isDirectory.bind(n),this.isFIFO=n.isFIFO.bind(n),this.isFile=n.isFile.bind(n),this.isSocket=n.isSocket.bind(n),this.isSymbolicLink=n.isSymbolicLink.bind(n)}};function UG(e,t){return new bb(e,t)}_f.createDirentFromStats=UG});var gI=C(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.convertPosixPathToPattern=It.convertWindowsPathToPattern=It.convertPathToPattern=It.escapePosixPath=It.escapeWindowsPath=It.escape=It.removeLeadingDotSegment=It.makeAbsolute=It.unixify=void 0;var HG=require("os"),VG=require("path"),mI=HG.platform()==="win32",GG=2,zG=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,KG=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,YG=/^\\\\([.?])/,XG=/\\(?![!()+@[\]{}])/g;function JG(e){return e.replace(/\\/g,"/")}It.unixify=JG;function QG(e,t){return VG.resolve(e,t)}It.makeAbsolute=QG;function ZG(e){if(e.charAt(0)==="."){let t=e.charAt(1);if(t==="/"||t==="\\")return e.slice(GG)}return e}It.removeLeadingDotSegment=ZG;It.escape=mI?Sb:wb;function Sb(e){return e.replace(KG,"\\$2")}It.escapeWindowsPath=Sb;function wb(e){return e.replace(zG,"\\$2")}It.escapePosixPath=wb;It.convertPathToPattern=mI?pI:hI;function pI(e){return Sb(e).replace(YG,"//$1").replace(XG,"/")}It.convertWindowsPathToPattern=pI;function hI(e){return wb(e)}It.convertPosixPathToPattern=hI});var yI=C((cse,_I)=>{_I.exports=function(t){if(typeof t!="string"||t==="")return!1;for(var n;n=/(\\).|([@?!+*]\(.*\))/g.exec(t);){if(n[2])return!0;t=t.slice(n.index+n[0].length)}return!1}});var wI=C((lse,SI)=>{var ez=yI(),bI={"{":"}","(":")","[":"]"},tz=function(e){if(e[0]==="!")return!0;for(var t=0,n=-2,r=-2,o=-2,s=-2,a=-2;t<e.length;){if(e[t]==="*"||e[t+1]==="?"&&/[\].+)]/.test(e[t])||r!==-1&&e[t]==="["&&e[t+1]!=="]"&&(r<t&&(r=e.indexOf("]",t)),r>t&&(a===-1||a>r||(a=e.indexOf("\\",t),a===-1||a>r)))||o!==-1&&e[t]==="{"&&e[t+1]!=="}"&&(o=e.indexOf("}",t),o>t&&(a=e.indexOf("\\",t),a===-1||a>o))||s!==-1&&e[t]==="("&&e[t+1]==="?"&&/[:!=]/.test(e[t+2])&&e[t+3]!==")"&&(s=e.indexOf(")",t),s>t&&(a=e.indexOf("\\",t),a===-1||a>s))||n!==-1&&e[t]==="("&&e[t+1]!=="|"&&(n<t&&(n=e.indexOf("|",t)),n!==-1&&e[n+1]!==")"&&(s=e.indexOf(")",n),s>n&&(a=e.indexOf("\\",n),a===-1||a>s))))return!0;if(e[t]==="\\"){var c=e[t+1];t+=2;var l=bI[c];if(l){var u=e.indexOf(l,t);u!==-1&&(t=u+1)}if(e[t]==="!")return!0}else t++}return!1},nz=function(e){if(e[0]==="!")return!0;for(var t=0;t<e.length;){if(/[*?{}()[\]]/.test(e[t]))return!0;if(e[t]==="\\"){var n=e[t+1];t+=2;var r=bI[n];if(r){var o=e.indexOf(r,t);o!==-1&&(t=o+1)}if(e[t]==="!")return!0}else t++}return!1};SI.exports=function(t,n){if(typeof t!="string"||t==="")return!1;if(ez(t))return!0;var r=tz;return n&&n.strict===!1&&(r=nz),r(t)}});var vI=C((use,xI)=>{"use strict";var rz=wI(),iz=require("path").posix.dirname,oz=require("os").platform()==="win32",xb="/",sz=/\\/g,az=/[\{\[].*[\}\]]$/,cz=/(^|[^\\])([\{\[]|\([^\)]+$)/,lz=/\\([\!\*\?\|\[\]\(\)\{\}])/g;xI.exports=function(t,n){var r=Object.assign({flipBackslashes:!0},n);r.flipBackslashes&&oz&&t.indexOf(xb)<0&&(t=t.replace(sz,xb)),az.test(t)&&(t+=xb),t+="a";do t=iz(t);while(rz(t)||cz.test(t));return t.replace(lz,"$1")}});var yf=C(or=>{"use strict";or.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;or.find=(e,t)=>e.nodes.find(n=>n.type===t);or.exceedsLimit=(e,t,n=1,r)=>r===!1||!or.isInteger(e)||!or.isInteger(t)?!1:(Number(t)-Number(e))/Number(n)>=r;or.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)};or.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;or.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;or.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;or.reduce=e=>e.reduce((t,n)=>(n.type==="text"&&t.push(n.value),n.type==="range"&&(n.type="text"),t),[]);or.flatten=(...e)=>{let t=[],n=r=>{for(let o=0;o<r.length;o++){let s=r[o];if(Array.isArray(s)){n(s);continue}s!==void 0&&t.push(s)}return t};return n(e),t}});var bf=C((fse,PI)=>{"use strict";var CI=yf();PI.exports=(e,t={})=>{let n=(r,o={})=>{let s=t.escapeInvalid&&CI.isInvalidBrace(o),a=r.invalid===!0&&t.escapeInvalid===!0,c="";if(r.value)return(s||a)&&CI.isOpenOrClose(r)?"\\"+r.value:r.value;if(r.value)return r.value;if(r.nodes)for(let l of r.nodes)c+=n(l);return c};return n(e)}});var EI=C((mse,NI)=>{"use strict";NI.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var OI=C((pse,LI)=>{"use strict";var RI=EI(),Ho=(e,t,n)=>{if(RI(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(t===void 0||e===t)return String(e);if(RI(t)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let r={relaxZeros:!0,...n};typeof r.strictZeros=="boolean"&&(r.relaxZeros=r.strictZeros===!1);let o=String(r.relaxZeros),s=String(r.shorthand),a=String(r.capture),c=String(r.wrap),l=e+":"+t+"="+o+s+a+c;if(Ho.cache.hasOwnProperty(l))return Ho.cache[l].result;let u=Math.min(e,t),d=Math.max(e,t);if(Math.abs(u-d)===1){let h=e+"|"+t;return r.capture?`(${h})`:r.wrap===!1?h:`(?:${h})`}let f=FI(e)||FI(t),m={min:e,max:t,a:u,b:d},p=[],g=[];if(f&&(m.isPadded=f,m.maxLen=String(m.max).length),u<0){let h=d<0?Math.abs(d):1;g=TI(h,Math.abs(u),m,r),u=m.a=0}return d>=0&&(p=TI(u,d,m,r)),m.negatives=g,m.positives=p,m.result=uz(g,p,r),r.capture===!0?m.result=`(${m.result})`:r.wrap!==!1&&p.length+g.length>1&&(m.result=`(?:${m.result})`),Ho.cache[l]=m,m.result};function uz(e,t,n){let r=vb(e,t,"-",!1,n)||[],o=vb(t,e,"",!1,n)||[],s=vb(e,t,"-?",!0,n)||[];return r.concat(s).concat(o).join("|")}function dz(e,t){let n=1,r=1,o=II(e,n),s=new Set([t]);for(;e<=o&&o<=t;)s.add(o),n+=1,o=II(e,n);for(o=DI(t+1,r)-1;e<o&&o<=t;)s.add(o),r+=1,o=DI(t+1,r)-1;return s=[...s],s.sort(pz),s}function fz(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=mz(e,t),o=r.length,s="",a=0;for(let c=0;c<o;c++){let[l,u]=r[c];l===u?s+=l:l!=="0"||u!=="9"?s+=hz(l,u,n):a++}return a&&(s+=n.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[a],digits:o}}function TI(e,t,n,r){let o=dz(e,t),s=[],a=e,c;for(let l=0;l<o.length;l++){let u=o[l],d=fz(String(a),String(u),r),f="";if(!n.isPadded&&c&&c.pattern===d.pattern){c.count.length>1&&c.count.pop(),c.count.push(d.count[0]),c.string=c.pattern+kI(c.count),a=u+1;continue}n.isPadded&&(f=gz(u,n,r)),d.string=f+d.pattern+kI(d.count),s.push(d),a=u+1,c=d}return s}function vb(e,t,n,r,o){let s=[];for(let a of e){let{string:c}=a;!r&&!AI(t,"string",c)&&s.push(n+c),r&&AI(t,"string",c)&&s.push(n+c)}return s}function mz(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}function pz(e,t){return e>t?1:t>e?-1:0}function AI(e,t,n){return e.some(r=>r[t]===n)}function II(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function DI(e,t){return e-e%Math.pow(10,t)}function kI(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function hz(e,t,n){return`[${e}${t-e===1?"":"-"}${t}]`}function FI(e){return/^-?(0+)\d/.test(e)}function gz(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),o=n.relaxZeros!==!1;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}Ho.cache={};Ho.clearCache=()=>Ho.cache={};LI.exports=Ho});var Nb=C((hse,UI)=>{"use strict";var _z=require("util"),$I=OI(),MI=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),yz=e=>t=>e===!0?Number(t):String(t),Cb=e=>typeof e=="number"||typeof e=="string"&&e!=="",nl=e=>Number.isInteger(+e),Pb=e=>{let t=`${e}`,n=-1;if(t[0]==="-"&&(t=t.slice(1)),t==="0")return!1;for(;t[++n]==="0";);return n>0},bz=(e,t,n)=>typeof e=="string"||typeof t=="string"?!0:n.stringify===!0,Sz=(e,t,n)=>{if(t>0){let r=e[0]==="-"?"-":"";r&&(e=e.slice(1)),e=r+e.padStart(r?t-1:t,"0")}return n===!1?String(e):e},wf=(e,t)=>{let n=e[0]==="-"?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},wz=(e,t,n)=>{e.negatives.sort((c,l)=>c<l?-1:c>l?1:0),e.positives.sort((c,l)=>c<l?-1:c>l?1:0);let r=t.capture?"":"?:",o="",s="",a;return e.positives.length&&(o=e.positives.map(c=>wf(String(c),n)).join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.map(c=>wf(String(c),n)).join("|")})`),o&&s?a=`${o}|${s}`:a=o||s,t.wrap?`(${r}${a})`:a},qI=(e,t,n,r)=>{if(n)return $I(e,t,{wrap:!1,...r});let o=String.fromCharCode(e);if(e===t)return o;let s=String.fromCharCode(t);return`[${o}-${s}]`},BI=(e,t,n)=>{if(Array.isArray(e)){let r=n.wrap===!0,o=n.capture?"":"?:";return r?`(${o}${e.join("|")})`:e.join("|")}return $I(e,t,n)},jI=(...e)=>new RangeError("Invalid range arguments: "+_z.inspect(...e)),WI=(e,t,n)=>{if(n.strictRanges===!0)throw jI([e,t]);return[]},xz=(e,t)=>{if(t.strictRanges===!0)throw new TypeError(`Expected step "${e}" to be a number`);return[]},vz=(e,t,n=1,r={})=>{let o=Number(e),s=Number(t);if(!Number.isInteger(o)||!Number.isInteger(s)){if(r.strictRanges===!0)throw jI([e,t]);return[]}o===0&&(o=0),s===0&&(s=0);let a=o>s,c=String(e),l=String(t),u=String(n);n=Math.max(Math.abs(n),1);let d=Pb(c)||Pb(l)||Pb(u),f=d?Math.max(c.length,l.length,u.length):0,m=d===!1&&bz(e,t,r)===!1,p=r.transform||yz(m);if(r.toRegex&&n===1)return qI(wf(e,f),wf(t,f),!0,r);let g={negatives:[],positives:[]},h=_=>g[_<0?"negatives":"positives"].push(Math.abs(_)),y=[],w=0;for(;a?o>=s:o<=s;)r.toRegex===!0&&n>1?h(o):y.push(Sz(p(o,w),f,m)),o=a?o-n:o+n,w++;return r.toRegex===!0?n>1?wz(g,r,f):BI(y,null,{wrap:!1,...r}):y},Cz=(e,t,n=1,r={})=>{if(!nl(e)&&e.length>1||!nl(t)&&t.length>1)return WI(e,t,r);let o=r.transform||(m=>String.fromCharCode(m)),s=`${e}`.charCodeAt(0),a=`${t}`.charCodeAt(0),c=s>a,l=Math.min(s,a),u=Math.max(s,a);if(r.toRegex&&n===1)return qI(l,u,!1,r);let d=[],f=0;for(;c?s>=a:s<=a;)d.push(o(s,f)),s=c?s-n:s+n,f++;return r.toRegex===!0?BI(d,null,{wrap:!1,options:r}):d},Sf=(e,t,n,r={})=>{if(t==null&&Cb(e))return[e];if(!Cb(e)||!Cb(t))return WI(e,t,r);if(typeof n=="function")return Sf(e,t,1,{transform:n});if(MI(n))return Sf(e,t,0,n);let o={...r};return o.capture===!0&&(o.wrap=!0),n=n||o.step||1,nl(n)?nl(e)&&nl(t)?vz(e,t,n,o):Cz(e,t,Math.max(Math.abs(n),1),o):n!=null&&!MI(n)?xz(n,o):Sf(e,t,1,n)};UI.exports=Sf});var GI=C((gse,VI)=>{"use strict";var Pz=Nb(),HI=yf(),Nz=(e,t={})=>{let n=(r,o={})=>{let s=HI.isInvalidBrace(o),a=r.invalid===!0&&t.escapeInvalid===!0,c=s===!0||a===!0,l=t.escapeInvalid===!0?"\\":"",u="";if(r.isOpen===!0)return l+r.value;if(r.isClose===!0)return console.log("node.isClose",l,r.value),l+r.value;if(r.type==="open")return c?l+r.value:"(";if(r.type==="close")return c?l+r.value:")";if(r.type==="comma")return r.prev.type==="comma"?"":c?r.value:"|";if(r.value)return r.value;if(r.nodes&&r.ranges>0){let d=HI.reduce(r.nodes),f=Pz(...d,{...t,wrap:!1,toRegex:!0,strictZeros:!0});if(f.length!==0)return d.length>1&&f.length>1?`(${f})`:f}if(r.nodes)for(let d of r.nodes)u+=n(d,r);return u};return n(e)};VI.exports=Nz});var YI=C((_se,KI)=>{"use strict";var Ez=Nb(),zI=bf(),ua=yf(),Vo=(e="",t="",n=!1)=>{let r=[];if(e=[].concat(e),t=[].concat(t),!t.length)return e;if(!e.length)return n?ua.flatten(t).map(o=>`{${o}}`):t;for(let o of e)if(Array.isArray(o))for(let s of o)r.push(Vo(s,t,n));else for(let s of t)n===!0&&typeof s=="string"&&(s=`{${s}}`),r.push(Array.isArray(s)?Vo(o,s,n):o+s);return ua.flatten(r)},Rz=(e,t={})=>{let n=t.rangeLimit===void 0?1e3:t.rangeLimit,r=(o,s={})=>{o.queue=[];let a=s,c=s.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,c=a.queue;if(o.invalid||o.dollar){c.push(Vo(c.pop(),zI(o,t)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){c.push(Vo(c.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let f=ua.reduce(o.nodes);if(ua.exceedsLimit(...f,t.step,n))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let m=Ez(...f,t);m.length===0&&(m=zI(o,t)),c.push(Vo(c.pop(),m)),o.nodes=[];return}let l=ua.encloseBrace(o),u=o.queue,d=o;for(;d.type!=="brace"&&d.type!=="root"&&d.parent;)d=d.parent,u=d.queue;for(let f=0;f<o.nodes.length;f++){let m=o.nodes[f];if(m.type==="comma"&&o.type==="brace"){f===1&&u.push(""),u.push("");continue}if(m.type==="close"){c.push(Vo(c.pop(),u,l));continue}if(m.value&&m.type!=="open"){u.push(Vo(u.pop(),m.value));continue}m.nodes&&r(m,o)}return u};return ua.flatten(r(e))};KI.exports=Rz});var JI=C((yse,XI)=>{"use strict";XI.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
15
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var nD=C((bse,tD)=>{"use strict";var Tz=bf(),{MAX_LENGTH:QI,CHAR_BACKSLASH:Eb,CHAR_BACKTICK:Az,CHAR_COMMA:Iz,CHAR_DOT:Dz,CHAR_LEFT_PARENTHESES:kz,CHAR_RIGHT_PARENTHESES:Fz,CHAR_LEFT_CURLY_BRACE:Lz,CHAR_RIGHT_CURLY_BRACE:Oz,CHAR_LEFT_SQUARE_BRACKET:ZI,CHAR_RIGHT_SQUARE_BRACKET:eD,CHAR_DOUBLE_QUOTE:Mz,CHAR_SINGLE_QUOTE:$z,CHAR_NO_BREAK_SPACE:qz,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Bz}=JI(),jz=(e,t={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let n=t||{},r=typeof n.maxLength=="number"?Math.min(QI,n.maxLength):QI;if(e.length>r)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${r})`);let o={type:"root",input:e,nodes:[]},s=[o],a=o,c=o,l=0,u=e.length,d=0,f=0,m,p=()=>e[d++],g=h=>{if(h.type==="text"&&c.type==="dot"&&(c.type="text"),c&&c.type==="text"&&h.type==="text"){c.value+=h.value;return}return a.nodes.push(h),h.parent=a,h.prev=c,c=h,h};for(g({type:"bos"});d<u;)if(a=s[s.length-1],m=p(),!(m===Bz||m===qz)){if(m===Eb){g({type:"text",value:(t.keepEscaping?m:"")+p()});continue}if(m===eD){g({type:"text",value:"\\"+m});continue}if(m===ZI){l++;let h;for(;d<u&&(h=p());){if(m+=h,h===ZI){l++;continue}if(h===Eb){m+=p();continue}if(h===eD&&(l--,l===0))break}g({type:"text",value:m});continue}if(m===kz){a=g({type:"paren",nodes:[]}),s.push(a),g({type:"text",value:m});continue}if(m===Fz){if(a.type!=="paren"){g({type:"text",value:m});continue}a=s.pop(),g({type:"text",value:m}),a=s[s.length-1];continue}if(m===Mz||m===$z||m===Az){let h=m,y;for(t.keepQuotes!==!0&&(m="");d<u&&(y=p());){if(y===Eb){m+=y+p();continue}if(y===h){t.keepQuotes===!0&&(m+=y);break}m+=y}g({type:"text",value:m});continue}if(m===Lz){f++;let y={type:"brace",open:!0,close:!1,dollar:c.value&&c.value.slice(-1)==="$"||a.dollar===!0,depth:f,commas:0,ranges:0,nodes:[]};a=g(y),s.push(a),g({type:"open",value:m});continue}if(m===Oz){if(a.type!=="brace"){g({type:"text",value:m});continue}let h="close";a=s.pop(),a.close=!0,g({type:h,value:m}),f--,a=s[s.length-1];continue}if(m===Iz&&f>0){if(a.ranges>0){a.ranges=0;let h=a.nodes.shift();a.nodes=[h,{type:"text",value:Tz(a)}]}g({type:"comma",value:m}),a.commas++;continue}if(m===Dz&&f>0&&a.commas===0){let h=a.nodes;if(f===0||h.length===0){g({type:"text",value:m});continue}if(c.type==="dot"){if(a.range=[],c.value+=m,c.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,c.type="text";continue}a.ranges++,a.args=[];continue}if(c.type==="range"){h.pop();let y=h[h.length-1];y.value+=c.value+m,c=y,a.ranges--;continue}g({type:"dot",value:m});continue}g({type:"text",value:m})}do if(a=s.pop(),a.type!=="root"){a.nodes.forEach(w=>{w.nodes||(w.type==="open"&&(w.isOpen=!0),w.type==="close"&&(w.isClose=!0),w.nodes||(w.type="text"),w.invalid=!0)});let h=s[s.length-1],y=h.nodes.indexOf(a);h.nodes.splice(y,1,...a.nodes)}while(s.length>0);return g({type:"eos"}),o};tD.exports=jz});var oD=C((Sse,iD)=>{"use strict";var rD=bf(),Wz=GI(),Uz=YI(),Hz=nD(),Yn=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let o=Yn.create(r,t);Array.isArray(o)?n.push(...o):n.push(o)}else n=[].concat(Yn.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(n=[...new Set(n)]),n};Yn.parse=(e,t={})=>Hz(e,t);Yn.stringify=(e,t={})=>rD(typeof e=="string"?Yn.parse(e,t):e,t);Yn.compile=(e,t={})=>(typeof e=="string"&&(e=Yn.parse(e,t)),Wz(e,t));Yn.expand=(e,t={})=>{typeof e=="string"&&(e=Yn.parse(e,t));let n=Uz(e,t);return t.noempty===!0&&(n=n.filter(Boolean)),t.nodupes===!0&&(n=[...new Set(n)]),n};Yn.create=(e,t={})=>e===""||e.length<3?[e]:t.expand!==!0?Yn.compile(e,t):Yn.expand(e,t);iD.exports=Yn});var rl=C((wse,uD)=>{"use strict";var Vz=require("path"),Ur="\\\\/",sD=`[^${Ur}]`,Gz=0,ui="\\.",zz="\\+",Kz="\\?",xf="\\/",Yz="(?=.)",aD="[^/]",Rb=`(?:${xf}|$)`,cD=`(?:^|${xf})`,Tb=`${ui}{1,2}${Rb}`,Xz=`(?!${ui})`,Jz=`(?!${cD}${Tb})`,Qz=`(?!${ui}{0,1}${Rb})`,Zz=`(?!${Tb})`,eK=`[^.${xf}]`,tK=`${aD}*?`,lD={DOT_LITERAL:ui,PLUS_LITERAL:zz,QMARK_LITERAL:Kz,SLASH_LITERAL:xf,ONE_CHAR:Yz,QMARK:aD,END_ANCHOR:Rb,DOTS_SLASH:Tb,NO_DOT:Xz,NO_DOTS:Jz,NO_DOT_SLASH:Qz,NO_DOTS_SLASH:Zz,QMARK_NO_DOT:eK,STAR:tK,START_ANCHOR:cD},nK={...lD,SLASH_LITERAL:`[${Ur}]`,QMARK:sD,STAR:`${sD}*?`,DOTS_SLASH:`${ui}{1,2}(?:[${Ur}]|$)`,NO_DOT:`(?!${ui})`,NO_DOTS:`(?!(?:^|[${Ur}])${ui}{1,2}(?:[${Ur}]|$))`,NO_DOT_SLASH:`(?!${ui}{0,1}(?:[${Ur}]|$))`,NO_DOTS_SLASH:`(?!${ui}{1,2}(?:[${Ur}]|$))`,QMARK_NO_DOT:`[^.${Ur}]`,START_ANCHOR:`(?:^|[${Ur}])`,END_ANCHOR:`(?:[${Ur}]|$)`},rK={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};uD.exports={DEFAULT_MAX_EXTGLOB_RECURSION:Gz,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:rK,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:Vz.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?nK:lD}}});var il=C(An=>{"use strict";var iK=require("path"),oK=process.platform==="win32",{REGEX_BACKSLASH:sK,REGEX_REMOVE_BACKSLASH:aK,REGEX_SPECIAL_CHARS:cK,REGEX_SPECIAL_CHARS_GLOBAL:lK}=rl();An.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);An.hasRegexChars=e=>cK.test(e);An.isRegexChar=e=>e.length===1&&An.hasRegexChars(e);An.escapeRegex=e=>e.replace(lK,"\\$1");An.toPosixSlashes=e=>e.replace(sK,"/");An.removeBackslashes=e=>e.replace(aK,t=>t==="\\"?"":t);An.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};An.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:oK===!0||iK.sep==="\\";An.escapeLast=(e,t,n)=>{let r=e.lastIndexOf(t,n);return r===-1?e:e[r-1]==="\\"?An.escapeLast(e,t,r-1):`${e.slice(0,r)}\\${e.slice(r)}`};An.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n};An.wrapOutput=(e,t={},n={})=>{let r=n.contains?"":"^",o=n.contains?"":"$",s=`${r}(?:${e})${o}`;return t.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var yD=C((vse,_D)=>{"use strict";var dD=il(),{CHAR_ASTERISK:Ab,CHAR_AT:uK,CHAR_BACKWARD_SLASH:ol,CHAR_COMMA:dK,CHAR_DOT:Ib,CHAR_EXCLAMATION_MARK:Db,CHAR_FORWARD_SLASH:gD,CHAR_LEFT_CURLY_BRACE:kb,CHAR_LEFT_PARENTHESES:Fb,CHAR_LEFT_SQUARE_BRACKET:fK,CHAR_PLUS:mK,CHAR_QUESTION_MARK:fD,CHAR_RIGHT_CURLY_BRACE:pK,CHAR_RIGHT_PARENTHESES:mD,CHAR_RIGHT_SQUARE_BRACKET:hK}=rl(),pD=e=>e===gD||e===ol,hD=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},gK=(e,t)=>{let n=t||{},r=e.length-1,o=n.parts===!0||n.scanToEnd===!0,s=[],a=[],c=[],l=e,u=-1,d=0,f=0,m=!1,p=!1,g=!1,h=!1,y=!1,w=!1,_=!1,b=!1,S=!1,N=!1,R=0,$,I,U={value:"",depth:0,isGlob:!1},de=()=>u>=r,F=()=>l.charCodeAt(u+1),Q=()=>($=I,l.charCodeAt(++u));for(;u<r;){I=Q();let wt;if(I===ol){_=U.backslashes=!0,I=Q(),I===kb&&(w=!0);continue}if(w===!0||I===kb){for(R++;de()!==!0&&(I=Q());){if(I===ol){_=U.backslashes=!0,Q();continue}if(I===kb){R++;continue}if(w!==!0&&I===Ib&&(I=Q())===Ib){if(m=U.isBrace=!0,g=U.isGlob=!0,N=!0,o===!0)continue;break}if(w!==!0&&I===dK){if(m=U.isBrace=!0,g=U.isGlob=!0,N=!0,o===!0)continue;break}if(I===pK&&(R--,R===0)){w=!1,m=U.isBrace=!0,N=!0;break}}if(o===!0)continue;break}if(I===gD){if(s.push(u),a.push(U),U={value:"",depth:0,isGlob:!1},N===!0)continue;if($===Ib&&u===d+1){d+=2;continue}f=u+1;continue}if(n.noext!==!0&&(I===mK||I===uK||I===Ab||I===fD||I===Db)===!0&&F()===Fb){if(g=U.isGlob=!0,h=U.isExtglob=!0,N=!0,I===Db&&u===d&&(S=!0),o===!0){for(;de()!==!0&&(I=Q());){if(I===ol){_=U.backslashes=!0,I=Q();continue}if(I===mD){g=U.isGlob=!0,N=!0;break}}continue}break}if(I===Ab){if($===Ab&&(y=U.isGlobstar=!0),g=U.isGlob=!0,N=!0,o===!0)continue;break}if(I===fD){if(g=U.isGlob=!0,N=!0,o===!0)continue;break}if(I===fK){for(;de()!==!0&&(wt=Q());){if(wt===ol){_=U.backslashes=!0,Q();continue}if(wt===hK){p=U.isBracket=!0,g=U.isGlob=!0,N=!0;break}}if(o===!0)continue;break}if(n.nonegate!==!0&&I===Db&&u===d){b=U.negated=!0,d++;continue}if(n.noparen!==!0&&I===Fb){if(g=U.isGlob=!0,o===!0){for(;de()!==!0&&(I=Q());){if(I===Fb){_=U.backslashes=!0,I=Q();continue}if(I===mD){N=!0;break}}continue}break}if(g===!0){if(N=!0,o===!0)continue;break}}n.noext===!0&&(h=!1,g=!1);let pe=l,ot="",M="";d>0&&(ot=l.slice(0,d),l=l.slice(d),f-=d),pe&&g===!0&&f>0?(pe=l.slice(0,f),M=l.slice(f)):g===!0?(pe="",M=l):pe=l,pe&&pe!==""&&pe!=="/"&&pe!==l&&pD(pe.charCodeAt(pe.length-1))&&(pe=pe.slice(0,-1)),n.unescape===!0&&(M&&(M=dD.removeBackslashes(M)),pe&&_===!0&&(pe=dD.removeBackslashes(pe)));let O={prefix:ot,input:e,start:d,base:pe,glob:M,isBrace:m,isBracket:p,isGlob:g,isExtglob:h,isGlobstar:y,negated:b,negatedExtglob:S};if(n.tokens===!0&&(O.maxDepth=0,pD(I)||a.push(U),O.tokens=a),n.parts===!0||n.tokens===!0){let wt;for(let D=0;D<s.length;D++){let j=wt?wt+1:d,z=s[D],ie=e.slice(j,z);n.tokens&&(D===0&&d!==0?(a[D].isPrefix=!0,a[D].value=ot):a[D].value=ie,hD(a[D]),O.maxDepth+=a[D].depth),(D!==0||ie!=="")&&c.push(ie),wt=z}if(wt&&wt+1<e.length){let D=e.slice(wt+1);c.push(D),n.tokens&&(a[a.length-1].value=D,hD(a[a.length-1]),O.maxDepth+=a[a.length-1].depth)}O.slashes=s,O.parts=c}return O};_D.exports=gK});var vD=C((Cse,xD)=>{"use strict";var sl=rl(),un=il(),{MAX_LENGTH:vf,POSIX_REGEX_SOURCE:_K,REGEX_NON_SPECIAL_CHARS:yK,REGEX_SPECIAL_CHARS_BACKREF:bK,REPLACEMENTS:bD}=sl,SK=(e,t)=>{if(typeof t.expandRange=="function")return t.expandRange(...e,t);e.sort();let n=`[${e.join("-")}]`;try{new RegExp(n)}catch{return e.map(o=>un.escapeRegex(o)).join("..")}return n},da=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,SD=e=>{let t=[],n=0,r=0,o=0,s="",a=!1;for(let c of e){if(a===!0){s+=c,a=!1;continue}if(c==="\\"){s+=c,a=!0;continue}if(c==='"'){o=o===1?0:1,s+=c;continue}if(o===0){if(c==="[")n++;else if(c==="]"&&n>0)n--;else if(n===0){if(c==="(")r++;else if(c===")"&&r>0)r--;else if(c==="|"&&r===0){t.push(s),s="";continue}}}s+=c}return t.push(s),t},wK=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n==="\\"){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},wD=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(wK(t))return t.replace(/\\(.)/g,"$1")},xK=e=>{let t=e.map(wD).filter(Boolean);for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){let o=t[n],s=t[r],a=o[0];if(!(!a||o!==a.repeat(o.length)||s!==a.repeat(s.length))&&(o===s||o.startsWith(s)||s.startsWith(o)))return!0}return!1},Lb=(e,t=!0)=>{if(e[0]!=="+"&&e[0]!=="*"||e[1]!=="(")return;let n=0,r=0,o=0,s=!1;for(let a=1;a<e.length;a++){let c=e[a];if(s===!0){s=!1;continue}if(c==="\\"){s=!0;continue}if(c==='"'){o=o===1?0:1;continue}if(o!==1){if(c==="["){n++;continue}if(c==="]"&&n>0){n--;continue}if(!(n>0)){if(c==="("){r++;continue}if(c===")"&&(r--,r===0))return t===!0&&a!==e.length-1?void 0:{type:e[0],body:e.slice(2,a),end:a}}}}},vK=e=>{let t=0,n=[];for(;t<e.length;){let o=Lb(e.slice(t),!1);if(!o||o.type!=="*")return;let s=SD(o.body).map(c=>c.trim());if(s.length!==1)return;let a=wD(s[0]);if(!a||a.length!==1)return;n.push(a),t+=o.end+1}return n.length<1?void 0:`${n.length===1?un.escapeRegex(n[0]):`[${n.map(o=>un.escapeRegex(o)).join("")}]`}*`},CK=e=>{let t=0,n=e.trim(),r=Lb(n);for(;r;)t++,n=r.body.trim(),r=Lb(n);return t},PK=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let n=typeof t.maxExtglobRecursion=="number"?t.maxExtglobRecursion:sl.DEFAULT_MAX_EXTGLOB_RECURSION,r=SD(e).map(o=>o.trim());if(r.length>1&&(r.some(o=>o==="")||r.some(o=>/^[*?]+$/.test(o))||xK(r)))return{risky:!0};for(let o of r){let s=vK(o);if(s)return{risky:!0,safeOutput:s};if(CK(o)>n)return{risky:!0}}return{risky:!1}},Ob=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=bD[e]||e;let n={...t},r=typeof n.maxLength=="number"?Math.min(vf,n.maxLength):vf,o=e.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);let s={type:"bos",value:"",output:n.prepend||""},a=[s],c=n.capture?"":"?:",l=un.isWindows(t),u=sl.globChars(l),d=sl.extglobChars(u),{DOT_LITERAL:f,PLUS_LITERAL:m,SLASH_LITERAL:p,ONE_CHAR:g,DOTS_SLASH:h,NO_DOT:y,NO_DOT_SLASH:w,NO_DOTS_SLASH:_,QMARK:b,QMARK_NO_DOT:S,STAR:N,START_ANCHOR:R}=u,$=V=>`(${c}(?:(?!${R}${V.dot?h:f}).)*?)`,I=n.dot?"":y,U=n.dot?b:S,de=n.bash===!0?$(n):N;n.capture&&(de=`(${de})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let F={input:e,index:-1,start:0,dot:n.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};e=un.removePrefix(e,F),o=e.length;let Q=[],pe=[],ot=[],M=s,O,wt=()=>F.index===o-1,D=F.peek=(V=1)=>e[F.index+V],j=F.advance=()=>e[++F.index]||"",z=()=>e.slice(F.index+1),ie=(V="",Be=0)=>{F.consumed+=V,F.index+=Be},se=V=>{F.output+=V.output!=null?V.output:V.value,ie(V.value)},xt=()=>{let V=1;for(;D()==="!"&&(D(2)!=="("||D(3)==="?");)j(),F.start++,V++;return V%2===0?!1:(F.negated=!0,F.start++,!0)},vt=V=>{F[V]++,ot.push(V)},Mt=V=>{F[V]--,ot.pop()},ce=V=>{if(M.type==="globstar"){let Be=F.braces>0&&(V.type==="comma"||V.type==="brace"),W=V.extglob===!0||Q.length&&(V.type==="pipe"||V.type==="paren");V.type!=="slash"&&V.type!=="paren"&&!Be&&!W&&(F.output=F.output.slice(0,-M.output.length),M.type="star",M.value="*",M.output=de,F.output+=M.output)}if(Q.length&&V.type!=="paren"&&(Q[Q.length-1].inner+=V.value),(V.value||V.output)&&se(V),M&&M.type==="text"&&V.type==="text"){M.value+=V.value,M.output=(M.output||"")+V.value;return}V.prev=M,a.push(V),M=V},vn=(V,Be)=>{let W={...d[Be],conditions:1,inner:""};W.prev=M,W.parens=F.parens,W.output=F.output,W.startIndex=F.index,W.tokensIndex=a.length;let he=(n.capture?"(":"")+W.open;vt("parens"),ce({type:V,value:Be,output:F.output?"":g}),ce({type:"paren",extglob:!0,value:j(),output:he}),Q.push(W)},ei=V=>{let Be=e.slice(V.startIndex,F.index+1),W=e.slice(V.startIndex+2,F.index),he=PK(W,n);if((V.type==="plus"||V.type==="star")&&he.risky){let Ue=he.safeOutput?(V.output?"":g)+(n.capture?`(${he.safeOutput})`:he.safeOutput):void 0,Cn=a[V.tokensIndex];Cn.type="text",Cn.value=Be,Cn.output=Ue||un.escapeRegex(Be);for(let Zn=V.tokensIndex+1;Zn<a.length;Zn++)a[Zn].value="",a[Zn].output="",delete a[Zn].suffix;F.output=V.output+Cn.output,F.backtrack=!0,ce({type:"paren",extglob:!0,value:O,output:""}),Mt("parens");return}let Ae=V.close+(n.capture?")":""),Ct;if(V.type==="negate"){let Ue=de;if(V.inner&&V.inner.length>1&&V.inner.includes("/")&&(Ue=$(n)),(Ue!==de||wt()||/^\)+$/.test(z()))&&(Ae=V.close=`)$))${Ue}`),V.inner.includes("*")&&(Ct=z())&&/^\.[^\\/.]+$/.test(Ct)){let Cn=Ob(Ct,{...t,fastpaths:!1}).output;Ae=V.close=`)${Cn})${Ue})`}V.prev.type==="bos"&&(F.negatedExtglob=!0)}ce({type:"paren",extglob:!0,value:O,output:Ae}),Mt("parens")};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let V=!1,Be=e.replace(bK,(W,he,Ae,Ct,Ue,Cn)=>Ct==="\\"?(V=!0,W):Ct==="?"?he?he+Ct+(Ue?b.repeat(Ue.length):""):Cn===0?U+(Ue?b.repeat(Ue.length):""):b.repeat(Ae.length):Ct==="."?f.repeat(Ae.length):Ct==="*"?he?he+Ct+(Ue?de:""):de:he?W:`\\${W}`);return V===!0&&(n.unescape===!0?Be=Be.replace(/\\/g,""):Be=Be.replace(/\\+/g,W=>W.length%2===0?"\\\\":W?"\\":"")),Be===e&&n.contains===!0?(F.output=e,F):(F.output=un.wrapOutput(Be,F,t),F)}for(;!wt();){if(O=j(),O==="\0")continue;if(O==="\\"){let W=D();if(W==="/"&&n.bash!==!0||W==="."||W===";")continue;if(!W){O+="\\",ce({type:"text",value:O});continue}let he=/^\\+/.exec(z()),Ae=0;if(he&&he[0].length>2&&(Ae=he[0].length,F.index+=Ae,Ae%2!==0&&(O+="\\")),n.unescape===!0?O=j():O+=j(),F.brackets===0){ce({type:"text",value:O});continue}}if(F.brackets>0&&(O!=="]"||M.value==="["||M.value==="[^")){if(n.posix!==!1&&O===":"){let W=M.value.slice(1);if(W.includes("[")&&(M.posix=!0,W.includes(":"))){let he=M.value.lastIndexOf("["),Ae=M.value.slice(0,he),Ct=M.value.slice(he+2),Ue=_K[Ct];if(Ue){M.value=Ae+Ue,F.backtrack=!0,j(),!s.output&&a.indexOf(M)===1&&(s.output=g);continue}}}(O==="["&&D()!==":"||O==="-"&&D()==="]")&&(O=`\\${O}`),O==="]"&&(M.value==="["||M.value==="[^")&&(O=`\\${O}`),n.posix===!0&&O==="!"&&M.value==="["&&(O="^"),M.value+=O,se({value:O});continue}if(F.quotes===1&&O!=='"'){O=un.escapeRegex(O),M.value+=O,se({value:O});continue}if(O==='"'){F.quotes=F.quotes===1?0:1,n.keepQuotes===!0&&ce({type:"text",value:O});continue}if(O==="("){vt("parens"),ce({type:"paren",value:O});continue}if(O===")"){if(F.parens===0&&n.strictBrackets===!0)throw new SyntaxError(da("opening","("));let W=Q[Q.length-1];if(W&&F.parens===W.parens+1){ei(Q.pop());continue}ce({type:"paren",value:O,output:F.parens?")":"\\)"}),Mt("parens");continue}if(O==="["){if(n.nobracket===!0||!z().includes("]")){if(n.nobracket!==!0&&n.strictBrackets===!0)throw new SyntaxError(da("closing","]"));O=`\\${O}`}else vt("brackets");ce({type:"bracket",value:O});continue}if(O==="]"){if(n.nobracket===!0||M&&M.type==="bracket"&&M.value.length===1){ce({type:"text",value:O,output:`\\${O}`});continue}if(F.brackets===0){if(n.strictBrackets===!0)throw new SyntaxError(da("opening","["));ce({type:"text",value:O,output:`\\${O}`});continue}Mt("brackets");let W=M.value.slice(1);if(M.posix!==!0&&W[0]==="^"&&!W.includes("/")&&(O=`/${O}`),M.value+=O,se({value:O}),n.literalBrackets===!1||un.hasRegexChars(W))continue;let he=un.escapeRegex(M.value);if(F.output=F.output.slice(0,-M.value.length),n.literalBrackets===!0){F.output+=he,M.value=he;continue}M.value=`(${c}${he}|${M.value})`,F.output+=M.value;continue}if(O==="{"&&n.nobrace!==!0){vt("braces");let W={type:"brace",value:O,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};pe.push(W),ce(W);continue}if(O==="}"){let W=pe[pe.length-1];if(n.nobrace===!0||!W){ce({type:"text",value:O,output:O});continue}let he=")";if(W.dots===!0){let Ae=a.slice(),Ct=[];for(let Ue=Ae.length-1;Ue>=0&&(a.pop(),Ae[Ue].type!=="brace");Ue--)Ae[Ue].type!=="dots"&&Ct.unshift(Ae[Ue].value);he=SK(Ct,n),F.backtrack=!0}if(W.comma!==!0&&W.dots!==!0){let Ae=F.output.slice(0,W.outputIndex),Ct=F.tokens.slice(W.tokensIndex);W.value=W.output="\\{",O=he="\\}",F.output=Ae;for(let Ue of Ct)F.output+=Ue.output||Ue.value}ce({type:"brace",value:O,output:he}),Mt("braces"),pe.pop();continue}if(O==="|"){Q.length>0&&Q[Q.length-1].conditions++,ce({type:"text",value:O});continue}if(O===","){let W=O,he=pe[pe.length-1];he&&ot[ot.length-1]==="braces"&&(he.comma=!0,W="|"),ce({type:"comma",value:O,output:W});continue}if(O==="/"){if(M.type==="dot"&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",a.pop(),M=s;continue}ce({type:"slash",value:O,output:p});continue}if(O==="."){if(F.braces>0&&M.type==="dot"){M.value==="."&&(M.output=f);let W=pe[pe.length-1];M.type="dots",M.output+=O,M.value+=O,W.dots=!0;continue}if(F.braces+F.parens===0&&M.type!=="bos"&&M.type!=="slash"){ce({type:"text",value:O,output:f});continue}ce({type:"dot",value:O,output:f});continue}if(O==="?"){if(!(M&&M.value==="(")&&n.noextglob!==!0&&D()==="("&&D(2)!=="?"){vn("qmark",O);continue}if(M&&M.type==="paren"){let he=D(),Ae=O;if(he==="<"&&!un.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(M.value==="("&&!/[!=<:]/.test(he)||he==="<"&&!/<([!=]|\w+>)/.test(z()))&&(Ae=`\\${O}`),ce({type:"text",value:O,output:Ae});continue}if(n.dot!==!0&&(M.type==="slash"||M.type==="bos")){ce({type:"qmark",value:O,output:S});continue}ce({type:"qmark",value:O,output:b});continue}if(O==="!"){if(n.noextglob!==!0&&D()==="("&&(D(2)!=="?"||!/[!=<:]/.test(D(3)))){vn("negate",O);continue}if(n.nonegate!==!0&&F.index===0){xt();continue}}if(O==="+"){if(n.noextglob!==!0&&D()==="("&&D(2)!=="?"){vn("plus",O);continue}if(M&&M.value==="("||n.regex===!1){ce({type:"plus",value:O,output:m});continue}if(M&&(M.type==="bracket"||M.type==="paren"||M.type==="brace")||F.parens>0){ce({type:"plus",value:O});continue}ce({type:"plus",value:m});continue}if(O==="@"){if(n.noextglob!==!0&&D()==="("&&D(2)!=="?"){ce({type:"at",extglob:!0,value:O,output:""});continue}ce({type:"text",value:O});continue}if(O!=="*"){(O==="$"||O==="^")&&(O=`\\${O}`);let W=yK.exec(z());W&&(O+=W[0],F.index+=W[0].length),ce({type:"text",value:O});continue}if(M&&(M.type==="globstar"||M.star===!0)){M.type="star",M.star=!0,M.value+=O,M.output=de,F.backtrack=!0,F.globstar=!0,ie(O);continue}let V=z();if(n.noextglob!==!0&&/^\([^?]/.test(V)){vn("star",O);continue}if(M.type==="star"){if(n.noglobstar===!0){ie(O);continue}let W=M.prev,he=W.prev,Ae=W.type==="slash"||W.type==="bos",Ct=he&&(he.type==="star"||he.type==="globstar");if(n.bash===!0&&(!Ae||V[0]&&V[0]!=="/")){ce({type:"star",value:O,output:""});continue}let Ue=F.braces>0&&(W.type==="comma"||W.type==="brace"),Cn=Q.length&&(W.type==="pipe"||W.type==="paren");if(!Ae&&W.type!=="paren"&&!Ue&&!Cn){ce({type:"star",value:O,output:""});continue}for(;V.slice(0,3)==="/**";){let Zn=e[F.index+4];if(Zn&&Zn!=="/")break;V=V.slice(3),ie("/**",3)}if(W.type==="bos"&&wt()){M.type="globstar",M.value+=O,M.output=$(n),F.output=M.output,F.globstar=!0,ie(O);continue}if(W.type==="slash"&&W.prev.type!=="bos"&&!Ct&&wt()){F.output=F.output.slice(0,-(W.output+M.output).length),W.output=`(?:${W.output}`,M.type="globstar",M.output=$(n)+(n.strictSlashes?")":"|$)"),M.value+=O,F.globstar=!0,F.output+=W.output+M.output,ie(O);continue}if(W.type==="slash"&&W.prev.type!=="bos"&&V[0]==="/"){let Zn=V[1]!==void 0?"|$":"";F.output=F.output.slice(0,-(W.output+M.output).length),W.output=`(?:${W.output}`,M.type="globstar",M.output=`${$(n)}${p}|${p}${Zn})`,M.value+=O,F.output+=W.output+M.output,F.globstar=!0,ie(O+j()),ce({type:"slash",value:"/",output:""});continue}if(W.type==="bos"&&V[0]==="/"){M.type="globstar",M.value+=O,M.output=`(?:^|${p}|${$(n)}${p})`,F.output=M.output,F.globstar=!0,ie(O+j()),ce({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-M.output.length),M.type="globstar",M.output=$(n),M.value+=O,F.output+=M.output,F.globstar=!0,ie(O);continue}let Be={type:"star",value:O,output:de};if(n.bash===!0){Be.output=".*?",(M.type==="bos"||M.type==="slash")&&(Be.output=I+Be.output),ce(Be);continue}if(M&&(M.type==="bracket"||M.type==="paren")&&n.regex===!0){Be.output=O,ce(Be);continue}(F.index===F.start||M.type==="slash"||M.type==="dot")&&(M.type==="dot"?(F.output+=w,M.output+=w):n.dot===!0?(F.output+=_,M.output+=_):(F.output+=I,M.output+=I),D()!=="*"&&(F.output+=g,M.output+=g)),ce(Be)}for(;F.brackets>0;){if(n.strictBrackets===!0)throw new SyntaxError(da("closing","]"));F.output=un.escapeLast(F.output,"["),Mt("brackets")}for(;F.parens>0;){if(n.strictBrackets===!0)throw new SyntaxError(da("closing",")"));F.output=un.escapeLast(F.output,"("),Mt("parens")}for(;F.braces>0;){if(n.strictBrackets===!0)throw new SyntaxError(da("closing","}"));F.output=un.escapeLast(F.output,"{"),Mt("braces")}if(n.strictSlashes!==!0&&(M.type==="star"||M.type==="bracket")&&ce({type:"maybe_slash",value:"",output:`${p}?`}),F.backtrack===!0){F.output="";for(let V of F.tokens)F.output+=V.output!=null?V.output:V.value,V.suffix&&(F.output+=V.suffix)}return F};Ob.fastpaths=(e,t)=>{let n={...t},r=typeof n.maxLength=="number"?Math.min(vf,n.maxLength):vf,o=e.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);e=bD[e]||e;let s=un.isWindows(t),{DOT_LITERAL:a,SLASH_LITERAL:c,ONE_CHAR:l,DOTS_SLASH:u,NO_DOT:d,NO_DOTS:f,NO_DOTS_SLASH:m,STAR:p,START_ANCHOR:g}=sl.globChars(s),h=n.dot?f:d,y=n.dot?m:d,w=n.capture?"":"?:",_={negated:!1,prefix:""},b=n.bash===!0?".*?":p;n.capture&&(b=`(${b})`);let S=I=>I.noglobstar===!0?b:`(${w}(?:(?!${g}${I.dot?u:a}).)*?)`,N=I=>{switch(I){case"*":return`${h}${l}${b}`;case".*":return`${a}${l}${b}`;case"*.*":return`${h}${b}${a}${l}${b}`;case"*/*":return`${h}${b}${c}${l}${y}${b}`;case"**":return h+S(n);case"**/*":return`(?:${h}${S(n)}${c})?${y}${l}${b}`;case"**/*.*":return`(?:${h}${S(n)}${c})?${y}${b}${a}${l}${b}`;case"**/.*":return`(?:${h}${S(n)}${c})?${a}${l}${b}`;default:{let U=/^(.*?)\.(\w+)$/.exec(I);if(!U)return;let de=N(U[1]);return de?de+a+U[2]:void 0}}},R=un.removePrefix(e,_),$=N(R);return $&&n.strictSlashes!==!0&&($+=`${c}?`),$};xD.exports=Ob});var PD=C((Pse,CD)=>{"use strict";var NK=require("path"),EK=yD(),Mb=vD(),$b=il(),RK=rl(),TK=e=>e&&typeof e=="object"&&!Array.isArray(e),Pt=(e,t,n=!1)=>{if(Array.isArray(e)){let d=e.map(m=>Pt(m,t,n));return m=>{for(let p of d){let g=p(m);if(g)return g}return!1}}let r=TK(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let o=t||{},s=$b.isWindows(t),a=r?Pt.compileRe(e,t):Pt.makeRe(e,t,!1,!0),c=a.state;delete a.state;let l=()=>!1;if(o.ignore){let d={...t,ignore:null,onMatch:null,onResult:null};l=Pt(o.ignore,d,n)}let u=(d,f=!1)=>{let{isMatch:m,match:p,output:g}=Pt.test(d,a,t,{glob:e,posix:s}),h={glob:e,state:c,regex:a,posix:s,input:d,output:g,match:p,isMatch:m};return typeof o.onResult=="function"&&o.onResult(h),m===!1?(h.isMatch=!1,f?h:!1):l(d)?(typeof o.onIgnore=="function"&&o.onIgnore(h),h.isMatch=!1,f?h:!1):(typeof o.onMatch=="function"&&o.onMatch(h),f?h:!0)};return n&&(u.state=c),u};Pt.test=(e,t,n,{glob:r,posix:o}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let s=n||{},a=s.format||(o?$b.toPosixSlashes:null),c=e===r,l=c&&a?a(e):e;return c===!1&&(l=a?a(e):e,c=l===r),(c===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?c=Pt.matchBase(e,t,n,o):c=t.exec(l)),{isMatch:!!c,match:c,output:l}};Pt.matchBase=(e,t,n,r=$b.isWindows(n))=>(t instanceof RegExp?t:Pt.makeRe(t,n)).test(NK.basename(e));Pt.isMatch=(e,t,n)=>Pt(t,n)(e);Pt.parse=(e,t)=>Array.isArray(e)?e.map(n=>Pt.parse(n,t)):Mb(e,{...t,fastpaths:!1});Pt.scan=(e,t)=>EK(e,t);Pt.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let o=t||{},s=o.contains?"":"^",a=o.contains?"":"$",c=`${s}(?:${e.output})${a}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=Pt.toRegex(c,t);return r===!0&&(l.state=e),l};Pt.makeRe=(e,t={},n=!1,r=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(o.output=Mb.fastpaths(e,t)),o.output||(o=Mb(e,t)),Pt.compileRe(o,t,n,r)};Pt.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(n){if(t&&t.debug===!0)throw n;return/$^/}};Pt.constants=RK;CD.exports=Pt});var ED=C((Nse,ND)=>{"use strict";ND.exports=PD()});var kD=C((Ese,DD)=>{"use strict";var TD=require("util"),AD=oD(),Hr=ED(),qb=il(),RD=e=>e===""||e==="./",ID=e=>{let t=e.indexOf("{");return t>-1&&e.indexOf("}",t)>-1},tt=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let r=new Set,o=new Set,s=new Set,a=0,c=d=>{s.add(d.output),n&&n.onResult&&n.onResult(d)};for(let d=0;d<t.length;d++){let f=Hr(String(t[d]),{...n,onResult:c},!0),m=f.state.negated||f.state.negatedExtglob;m&&a++;for(let p of e){let g=f(p,!0);(m?!g.isMatch:g.isMatch)&&(m?r.add(g.output):(r.delete(g.output),o.add(g.output)))}}let u=(a===t.length?[...s]:[...o]).filter(d=>!r.has(d));if(n&&u.length===0){if(n.failglob===!0)throw new Error(`No matches found for "${t.join(", ")}"`);if(n.nonull===!0||n.nullglob===!0)return n.unescape?t.map(d=>d.replace(/\\/g,"")):t}return u};tt.match=tt;tt.matcher=(e,t)=>Hr(e,t);tt.isMatch=(e,t,n)=>Hr(t,n)(e);tt.any=tt.isMatch;tt.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],s=c=>{n.onResult&&n.onResult(c),o.push(c.output)},a=new Set(tt(e,t,{...n,onResult:s}));for(let c of o)a.has(c)||r.add(c);return[...r]};tt.contains=(e,t,n)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${TD.inspect(e)}"`);if(Array.isArray(t))return t.some(r=>tt.contains(e,r,n));if(typeof t=="string"){if(RD(e)||RD(t))return!1;if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t))return!0}return tt.isMatch(e,t,{...n,contains:!0})};tt.matchKeys=(e,t,n)=>{if(!qb.isObject(e))throw new TypeError("Expected the first argument to be an object");let r=tt(Object.keys(e),t,n),o={};for(let s of r)o[s]=e[s];return o};tt.some=(e,t,n)=>{let r=[].concat(e);for(let o of[].concat(t)){let s=Hr(String(o),n);if(r.some(a=>s(a)))return!0}return!1};tt.every=(e,t,n)=>{let r=[].concat(e);for(let o of[].concat(t)){let s=Hr(String(o),n);if(!r.every(a=>s(a)))return!1}return!0};tt.all=(e,t,n)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${TD.inspect(e)}"`);return[].concat(t).every(r=>Hr(r,n)(e))};tt.capture=(e,t,n)=>{let r=qb.isWindows(n),s=Hr.makeRe(String(e),{...n,capture:!0}).exec(r?qb.toPosixSlashes(t):t);if(s)return s.slice(1).map(a=>a===void 0?"":a)};tt.makeRe=(...e)=>Hr.makeRe(...e);tt.scan=(...e)=>Hr.scan(...e);tt.parse=(e,t)=>{let n=[];for(let r of[].concat(e||[]))for(let o of AD(String(r),t))n.push(Hr.parse(o,t));return n};tt.braces=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return t&&t.nobrace===!0||!ID(e)?[e]:AD(e,t)};tt.braceExpand=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return tt.braces(e,{...t,expand:!0})};tt.hasBraces=ID;DD.exports=tt});var UD=C(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.isAbsolute=ae.partitionAbsoluteAndRelative=ae.removeDuplicateSlashes=ae.matchAny=ae.convertPatternsToRe=ae.makeRe=ae.getPatternParts=ae.expandBraceExpansion=ae.expandPatternsWithBraceExpansion=ae.isAffectDepthOfReadingPattern=ae.endsWithSlashGlobStar=ae.hasGlobStar=ae.getBaseDirectory=ae.isPatternRelatedToParentDirectory=ae.getPatternsOutsideCurrentDirectory=ae.getPatternsInsideCurrentDirectory=ae.getPositivePatterns=ae.getNegativePatterns=ae.isPositivePattern=ae.isNegativePattern=ae.convertToNegativePattern=ae.convertToPositivePattern=ae.isDynamicPattern=ae.isStaticPattern=void 0;var FD=require("path"),AK=vI(),Bb=kD(),LD="**",IK="\\",DK=/[*?]|^!/,kK=/\[[^[]*]/,FK=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,LK=/[!*+?@]\([^(]*\)/,OK=/,|\.\./,MK=/(?!^)\/{2,}/g;function OD(e,t={}){return!MD(e,t)}ae.isStaticPattern=OD;function MD(e,t={}){return e===""?!1:!!(t.caseSensitiveMatch===!1||e.includes(IK)||DK.test(e)||kK.test(e)||FK.test(e)||t.extglob!==!1&&LK.test(e)||t.braceExpansion!==!1&&$K(e))}ae.isDynamicPattern=MD;function $K(e){let t=e.indexOf("{");if(t===-1)return!1;let n=e.indexOf("}",t+1);if(n===-1)return!1;let r=e.slice(t,n);return OK.test(r)}function qK(e){return Cf(e)?e.slice(1):e}ae.convertToPositivePattern=qK;function BK(e){return"!"+e}ae.convertToNegativePattern=BK;function Cf(e){return e.startsWith("!")&&e[1]!=="("}ae.isNegativePattern=Cf;function $D(e){return!Cf(e)}ae.isPositivePattern=$D;function jK(e){return e.filter(Cf)}ae.getNegativePatterns=jK;function WK(e){return e.filter($D)}ae.getPositivePatterns=WK;function UK(e){return e.filter(t=>!jb(t))}ae.getPatternsInsideCurrentDirectory=UK;function HK(e){return e.filter(jb)}ae.getPatternsOutsideCurrentDirectory=HK;function jb(e){return e.startsWith("..")||e.startsWith("./..")}ae.isPatternRelatedToParentDirectory=jb;function VK(e){return AK(e,{flipBackslashes:!1})}ae.getBaseDirectory=VK;function GK(e){return e.includes(LD)}ae.hasGlobStar=GK;function qD(e){return e.endsWith("/"+LD)}ae.endsWithSlashGlobStar=qD;function zK(e){let t=FD.basename(e);return qD(e)||OD(t)}ae.isAffectDepthOfReadingPattern=zK;function KK(e){return e.reduce((t,n)=>t.concat(BD(n)),[])}ae.expandPatternsWithBraceExpansion=KK;function BD(e){let t=Bb.braces(e,{expand:!0,nodupes:!0,keepEscaping:!0});return t.sort((n,r)=>n.length-r.length),t.filter(n=>n!=="")}ae.expandBraceExpansion=BD;function YK(e,t){let{parts:n}=Bb.scan(e,Object.assign(Object.assign({},t),{parts:!0}));return n.length===0&&(n=[e]),n[0].startsWith("/")&&(n[0]=n[0].slice(1),n.unshift("")),n}ae.getPatternParts=YK;function jD(e,t){return Bb.makeRe(e,t)}ae.makeRe=jD;function XK(e,t){return e.map(n=>jD(n,t))}ae.convertPatternsToRe=XK;function JK(e,t){return t.some(n=>n.test(e))}ae.matchAny=JK;function QK(e){return e.replace(MK,"/")}ae.removeDuplicateSlashes=QK;function ZK(e){let t=[],n=[];for(let r of e)WD(r)?t.push(r):n.push(r);return[t,n]}ae.partitionAbsoluteAndRelative=ZK;function WD(e){return FD.isAbsolute(e)}ae.isAbsolute=WD});var zD=C((Tse,GD)=>{"use strict";var e3=require("stream"),HD=e3.PassThrough,t3=Array.prototype.slice;GD.exports=n3;function n3(){let e=[],t=t3.call(arguments),n=!1,r=t[t.length-1];r&&!Array.isArray(r)&&r.pipe==null?t.pop():r={};let o=r.end!==!1,s=r.pipeError===!0;r.objectMode==null&&(r.objectMode=!0),r.highWaterMark==null&&(r.highWaterMark=64*1024);let a=HD(r);function c(){for(let d=0,f=arguments.length;d<f;d++)e.push(VD(arguments[d],r));return l(),this}function l(){if(n)return;n=!0;let d=e.shift();if(!d){process.nextTick(u);return}Array.isArray(d)||(d=[d]);let f=d.length+1;function m(){--f>0||(n=!1,l())}function p(g){function h(){g.removeListener("merge2UnpipeEnd",h),g.removeListener("end",h),s&&g.removeListener("error",y),m()}function y(w){a.emit("error",w)}if(g._readableState.endEmitted)return m();g.on("merge2UnpipeEnd",h),g.on("end",h),s&&g.on("error",y),g.pipe(a,{end:!1}),g.resume()}for(let g=0;g<d.length;g++)p(d[g]);m()}function u(){n=!1,a.emit("queueDrain"),o&&a.end()}return a.setMaxListeners(0),a.add=c,a.on("unpipe",function(d){d.emit("merge2UnpipeEnd")}),t.length&&c.apply(null,t),a}function VD(e,t){if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)e[n]=VD(e[n],t);else{if(!e._readableState&&e.pipe&&(e=e.pipe(HD(t))),!e._readableState||!e.pause||!e.pipe)throw new Error("Only readable stream can be merged.");e.pause()}return e}});var YD=C(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.merge=void 0;var r3=zD();function i3(e){let t=r3(e);return e.forEach(n=>{n.once("error",r=>t.emit("error",r))}),t.once("close",()=>KD(e)),t.once("end",()=>KD(e)),t}Pf.merge=i3;function KD(e){e.forEach(t=>t.emit("close"))}});var XD=C(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.isEmpty=fa.isString=void 0;function o3(e){return typeof e=="string"}fa.isString=o3;function s3(e){return e===""}fa.isEmpty=s3});var di=C(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.string=dn.stream=dn.pattern=dn.path=dn.fs=dn.errno=dn.array=void 0;var a3=uI();dn.array=a3;var c3=dI();dn.errno=c3;var l3=fI();dn.fs=l3;var u3=gI();dn.path=u3;var d3=UD();dn.pattern=d3;var f3=YD();dn.stream=f3;var m3=XD();dn.string=m3});var ek=C(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.convertPatternGroupToTask=fn.convertPatternGroupsToTasks=fn.groupPatternsByBaseDirectory=fn.getNegativePatternsAsPositive=fn.getPositivePatterns=fn.convertPatternsToTasks=fn.generate=void 0;var wr=di();function p3(e,t){let n=JD(e,t),r=JD(t.ignore,t),o=QD(n),s=ZD(n,r),a=o.filter(d=>wr.pattern.isStaticPattern(d,t)),c=o.filter(d=>wr.pattern.isDynamicPattern(d,t)),l=Wb(a,s,!1),u=Wb(c,s,!0);return l.concat(u)}fn.generate=p3;function JD(e,t){let n=e;return t.braceExpansion&&(n=wr.pattern.expandPatternsWithBraceExpansion(n)),t.baseNameMatch&&(n=n.map(r=>r.includes("/")?r:`**/${r}`)),n.map(r=>wr.pattern.removeDuplicateSlashes(r))}function Wb(e,t,n){let r=[],o=wr.pattern.getPatternsOutsideCurrentDirectory(e),s=wr.pattern.getPatternsInsideCurrentDirectory(e),a=Ub(o),c=Ub(s);return r.push(...Hb(a,t,n)),"."in c?r.push(Vb(".",s,t,n)):r.push(...Hb(c,t,n)),r}fn.convertPatternsToTasks=Wb;function QD(e){return wr.pattern.getPositivePatterns(e)}fn.getPositivePatterns=QD;function ZD(e,t){return wr.pattern.getNegativePatterns(e).concat(t).map(wr.pattern.convertToPositivePattern)}fn.getNegativePatternsAsPositive=ZD;function Ub(e){let t={};return e.reduce((n,r)=>{let o=wr.pattern.getBaseDirectory(r);return o in n?n[o].push(r):n[o]=[r],n},t)}fn.groupPatternsByBaseDirectory=Ub;function Hb(e,t,n){return Object.keys(e).map(r=>Vb(r,e[r],t,n))}fn.convertPatternGroupsToTasks=Hb;function Vb(e,t,n,r){return{dynamic:r,positive:t,negative:n,base:e,patterns:[].concat(t,n.map(wr.pattern.convertToNegativePattern))}}fn.convertPatternGroupToTask=Vb});var nk=C(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.read=void 0;function h3(e,t,n){t.fs.lstat(e,(r,o)=>{if(r!==null){tk(n,r);return}if(!o.isSymbolicLink()||!t.followSymbolicLink){Gb(n,o);return}t.fs.stat(e,(s,a)=>{if(s!==null){if(t.throwErrorOnBrokenSymbolicLink){tk(n,s);return}Gb(n,o);return}t.markSymbolicLink&&(a.isSymbolicLink=()=>!0),Gb(n,a)})})}Nf.read=h3;function tk(e,t){e(t)}function Gb(e,t){e(null,t)}});var rk=C(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.read=void 0;function g3(e,t){let n=t.fs.lstatSync(e);if(!n.isSymbolicLink()||!t.followSymbolicLink)return n;try{let r=t.fs.statSync(e);return t.markSymbolicLink&&(r.isSymbolicLink=()=>!0),r}catch(r){if(!t.throwErrorOnBrokenSymbolicLink)return n;throw r}}Ef.read=g3});var ik=C(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.createFileSystemAdapter=Ui.FILE_SYSTEM_ADAPTER=void 0;var Rf=require("fs");Ui.FILE_SYSTEM_ADAPTER={lstat:Rf.lstat,stat:Rf.stat,lstatSync:Rf.lstatSync,statSync:Rf.statSync};function _3(e){return e===void 0?Ui.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Ui.FILE_SYSTEM_ADAPTER),e)}Ui.createFileSystemAdapter=_3});var ok=C(Kb=>{"use strict";Object.defineProperty(Kb,"__esModule",{value:!0});var y3=ik(),zb=class{constructor(t={}){this._options=t,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=y3.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(t,n){return t??n}};Kb.default=zb});var Go=C(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.statSync=Hi.stat=Hi.Settings=void 0;var sk=nk(),b3=rk(),Yb=ok();Hi.Settings=Yb.default;function S3(e,t,n){if(typeof t=="function"){sk.read(e,Xb(),t);return}sk.read(e,Xb(t),n)}Hi.stat=S3;function w3(e,t){let n=Xb(t);return b3.read(e,n)}Hi.statSync=w3;function Xb(e={}){return e instanceof Yb.default?e:new Yb.default(e)}});var lk=C((qse,ck)=>{var ak;ck.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):e=>(ak||(ak=Promise.resolve())).then(e).catch(t=>setTimeout(()=>{throw t},0))});var dk=C((Bse,uk)=>{uk.exports=v3;var x3=lk();function v3(e,t){let n,r,o,s=!0;Array.isArray(e)?(n=[],r=e.length):(o=Object.keys(e),n={},r=o.length);function a(l){function u(){t&&t(l,n),t=null}s?x3(u):u()}function c(l,u,d){n[l]=d,(--r===0||u)&&a(u)}r?o?o.forEach(function(l){e[l](function(u,d){c(l,u,d)})}):e.forEach(function(l,u){l(function(d,f){c(u,d,f)})}):a(null),s=!1}});var Jb=C(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var Tf=process.versions.node.split(".");if(Tf[0]===void 0||Tf[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var fk=Number.parseInt(Tf[0],10),C3=Number.parseInt(Tf[1],10),mk=10,P3=10,N3=fk>mk,E3=fk===mk&&C3>=P3;Af.IS_SUPPORT_READDIR_WITH_FILE_TYPES=N3||E3});var pk=C(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.createDirentFromStats=void 0;var Qb=class{constructor(t,n){this.name=t,this.isBlockDevice=n.isBlockDevice.bind(n),this.isCharacterDevice=n.isCharacterDevice.bind(n),this.isDirectory=n.isDirectory.bind(n),this.isFIFO=n.isFIFO.bind(n),this.isFile=n.isFile.bind(n),this.isSocket=n.isSocket.bind(n),this.isSymbolicLink=n.isSymbolicLink.bind(n)}};function R3(e,t){return new Qb(e,t)}If.createDirentFromStats=R3});var Zb=C(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.fs=void 0;var T3=pk();Df.fs=T3});var eS=C(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.joinPathSegments=void 0;function A3(e,t,n){return e.endsWith(n)?e+t:e+n+t}kf.joinPathSegments=A3});var Sk=C(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.readdir=Vi.readdirWithFileTypes=Vi.read=void 0;var I3=Go(),hk=dk(),D3=Jb(),gk=Zb(),_k=eS();function k3(e,t,n){if(!t.stats&&D3.IS_SUPPORT_READDIR_WITH_FILE_TYPES){yk(e,t,n);return}bk(e,t,n)}Vi.read=k3;function yk(e,t,n){t.fs.readdir(e,{withFileTypes:!0},(r,o)=>{if(r!==null){Ff(n,r);return}let s=o.map(c=>({dirent:c,name:c.name,path:_k.joinPathSegments(e,c.name,t.pathSegmentSeparator)}));if(!t.followSymbolicLinks){tS(n,s);return}let a=s.map(c=>F3(c,t));hk(a,(c,l)=>{if(c!==null){Ff(n,c);return}tS(n,l)})})}Vi.readdirWithFileTypes=yk;function F3(e,t){return n=>{if(!e.dirent.isSymbolicLink()){n(null,e);return}t.fs.stat(e.path,(r,o)=>{if(r!==null){if(t.throwErrorOnBrokenSymbolicLink){n(r);return}n(null,e);return}e.dirent=gk.fs.createDirentFromStats(e.name,o),n(null,e)})}}function bk(e,t,n){t.fs.readdir(e,(r,o)=>{if(r!==null){Ff(n,r);return}let s=o.map(a=>{let c=_k.joinPathSegments(e,a,t.pathSegmentSeparator);return l=>{I3.stat(c,t.fsStatSettings,(u,d)=>{if(u!==null){l(u);return}let f={name:a,path:c,dirent:gk.fs.createDirentFromStats(a,d)};t.stats&&(f.stats=d),l(null,f)})}});hk(s,(a,c)=>{if(a!==null){Ff(n,a);return}tS(n,c)})})}Vi.readdir=bk;function Ff(e,t){e(t)}function tS(e,t){e(null,t)}});var Pk=C(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.readdir=Gi.readdirWithFileTypes=Gi.read=void 0;var L3=Go(),O3=Jb(),wk=Zb(),xk=eS();function M3(e,t){return!t.stats&&O3.IS_SUPPORT_READDIR_WITH_FILE_TYPES?vk(e,t):Ck(e,t)}Gi.read=M3;function vk(e,t){return t.fs.readdirSync(e,{withFileTypes:!0}).map(r=>{let o={dirent:r,name:r.name,path:xk.joinPathSegments(e,r.name,t.pathSegmentSeparator)};if(o.dirent.isSymbolicLink()&&t.followSymbolicLinks)try{let s=t.fs.statSync(o.path);o.dirent=wk.fs.createDirentFromStats(o.name,s)}catch(s){if(t.throwErrorOnBrokenSymbolicLink)throw s}return o})}Gi.readdirWithFileTypes=vk;function Ck(e,t){return t.fs.readdirSync(e).map(r=>{let o=xk.joinPathSegments(e,r,t.pathSegmentSeparator),s=L3.statSync(o,t.fsStatSettings),a={name:r,path:o,dirent:wk.fs.createDirentFromStats(r,s)};return t.stats&&(a.stats=s),a})}Gi.readdir=Ck});var Nk=C(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.createFileSystemAdapter=zi.FILE_SYSTEM_ADAPTER=void 0;var ma=require("fs");zi.FILE_SYSTEM_ADAPTER={lstat:ma.lstat,stat:ma.stat,lstatSync:ma.lstatSync,statSync:ma.statSync,readdir:ma.readdir,readdirSync:ma.readdirSync};function $3(e){return e===void 0?zi.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},zi.FILE_SYSTEM_ADAPTER),e)}zi.createFileSystemAdapter=$3});var Ek=C(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});var q3=require("path"),B3=Go(),j3=Nk(),nS=class{constructor(t={}){this._options=t,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=j3.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,q3.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new B3.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(t,n){return t??n}};rS.default=nS});var Lf=C(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.Settings=Ki.scandirSync=Ki.scandir=void 0;var Rk=Sk(),W3=Pk(),iS=Ek();Ki.Settings=iS.default;function U3(e,t,n){if(typeof t=="function"){Rk.read(e,oS(),t);return}Rk.read(e,oS(t),n)}Ki.scandir=U3;function H3(e,t){let n=oS(t);return W3.read(e,n)}Ki.scandirSync=H3;function oS(e={}){return e instanceof iS.default?e:new iS.default(e)}});var Ak=C((Xse,Tk)=>{"use strict";function V3(e){var t=new e,n=t;function r(){var s=t;return s.next?t=s.next:(t=new e,n=t),s.next=null,s}function o(s){n.next=s,n=s}return{get:r,release:o}}Tk.exports=V3});var Dk=C((Jse,sS)=>{"use strict";var G3=Ak();function Ik(e,t,n){if(typeof e=="function"&&(n=t,t=e,e=null),!(n>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var r=G3(z3),o=null,s=null,a=0,c=null,l={push:h,drain:In,saturated:In,pause:d,paused:!1,get concurrency(){return n},set concurrency(R){if(!(R>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(n=R,!l.paused)for(;o&&a<n;)a++,w()},running:u,resume:p,idle:g,length:f,getQueue:m,unshift:y,empty:In,kill:_,killAndDrain:b,error:N,abort:S};return l;function u(){return a}function d(){l.paused=!0}function f(){for(var R=o,$=0;R;)R=R.next,$++;return $}function m(){for(var R=o,$=[];R;)$.push(R.value),R=R.next;return $}function p(){if(l.paused){if(l.paused=!1,o===null){a++,w();return}for(;o&&a<n;)a++,w()}}function g(){return a===0&&l.length()===0}function h(R,$){var I=r.get();I.context=e,I.release=w,I.value=R,I.callback=$||In,I.errorHandler=c,a>=n||l.paused?s?(s.next=I,s=I):(o=I,s=I,l.saturated()):(a++,t.call(e,I.value,I.worked))}function y(R,$){var I=r.get();I.context=e,I.release=w,I.value=R,I.callback=$||In,I.errorHandler=c,a>=n||l.paused?o?(I.next=o,o=I):(o=I,s=I,l.saturated()):(a++,t.call(e,I.value,I.worked))}function w(R){R&&r.release(R);var $=o;$&&a<=n?l.paused?a--:(s===o&&(s=null),o=$.next,$.next=null,t.call(e,$.value,$.worked),s===null&&l.empty()):--a===0&&l.drain()}function _(){o=null,s=null,l.drain=In}function b(){o=null,s=null,l.drain(),l.drain=In}function S(){var R=o;for(o=null,s=null;R;){var $=R.next,I=R.callback,U=R.errorHandler,de=R.value,F=R.context;R.value=null,R.callback=In,R.errorHandler=null,U&&U(new Error("abort"),de),I.call(F,new Error("abort")),R.release(R),R=$}l.drain=In}function N(R){c=R}}function In(){}function z3(){this.value=null,this.callback=In,this.next=null,this.release=In,this.context=null,this.errorHandler=null;var e=this;this.worked=function(n,r){var o=e.callback,s=e.errorHandler,a=e.value;e.value=null,e.callback=In,e.errorHandler&&s(n,a),o.call(e.context,n,r),e.release(e)}}function K3(e,t,n){typeof e=="function"&&(n=t,t=e,e=null);function r(d,f){t.call(this,d).then(function(m){f(null,m)},f)}var o=Ik(e,r,n),s=o.push,a=o.unshift;return o.push=c,o.unshift=l,o.drained=u,o;function c(d){var f=new Promise(function(m,p){s(d,function(g,h){if(g){p(g);return}m(h)})});return f.catch(In),f}function l(d){var f=new Promise(function(m,p){a(d,function(g,h){if(g){p(g);return}m(h)})});return f.catch(In),f}function u(){var d=new Promise(function(f){process.nextTick(function(){if(o.idle())f();else{var m=o.drain;o.drain=function(){typeof m=="function"&&m(),f(),o.drain=m}}})});return d}}sS.exports=Ik;sS.exports.promise=K3});var Of=C(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.joinPathSegments=Vr.replacePathSegmentSeparator=Vr.isAppliedFilter=Vr.isFatalError=void 0;function Y3(e,t){return e.errorFilter===null?!0:!e.errorFilter(t)}Vr.isFatalError=Y3;function X3(e,t){return e===null||e(t)}Vr.isAppliedFilter=X3;function J3(e,t){return e.split(/[/\\]/).join(t)}Vr.replacePathSegmentSeparator=J3;function Q3(e,t,n){return e===""?t:e.endsWith(n)?e+t:e+n+t}Vr.joinPathSegments=Q3});var lS=C(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});var Z3=Of(),aS=class{constructor(t,n){this._root=t,this._settings=n,this._root=Z3.replacePathSegmentSeparator(t,n.pathSegmentSeparator)}};cS.default=aS});var fS=C(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});var eY=require("events"),tY=Lf(),nY=Dk(),Mf=Of(),rY=lS(),uS=class extends rY.default{constructor(t,n){super(t,n),this._settings=n,this._scandir=tY.scandir,this._emitter=new eY.EventEmitter,this._queue=nY(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(t){this._emitter.on("entry",t)}onError(t){this._emitter.once("error",t)}onEnd(t){this._emitter.once("end",t)}_pushToQueue(t,n){let r={directory:t,base:n};this._queue.push(r,o=>{o!==null&&this._handleError(o)})}_worker(t,n){this._scandir(t.directory,this._settings.fsScandirSettings,(r,o)=>{if(r!==null){n(r,void 0);return}for(let s of o)this._handleEntry(s,t.base);n(null,void 0)})}_handleError(t){this._isDestroyed||!Mf.isFatalError(this._settings,t)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",t))}_handleEntry(t,n){if(this._isDestroyed||this._isFatalError)return;let r=t.path;n!==void 0&&(t.path=Mf.joinPathSegments(n,t.name,this._settings.pathSegmentSeparator)),Mf.isAppliedFilter(this._settings.entryFilter,t)&&this._emitEntry(t),t.dirent.isDirectory()&&Mf.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(r,n===void 0?void 0:t.path)}_emitEntry(t){this._emitter.emit("entry",t)}};dS.default=uS});var kk=C(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});var iY=fS(),mS=class{constructor(t,n){this._root=t,this._settings=n,this._reader=new iY.default(this._root,this._settings),this._storage=[]}read(t){this._reader.onError(n=>{oY(t,n)}),this._reader.onEntry(n=>{this._storage.push(n)}),this._reader.onEnd(()=>{sY(t,this._storage)}),this._reader.read()}};pS.default=mS;function oY(e,t){e(t)}function sY(e,t){e(null,t)}});var Fk=C(gS=>{"use strict";Object.defineProperty(gS,"__esModule",{value:!0});var aY=require("stream"),cY=fS(),hS=class{constructor(t,n){this._root=t,this._settings=n,this._reader=new cY.default(this._root,this._settings),this._stream=new aY.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(t=>{this._stream.emit("error",t)}),this._reader.onEntry(t=>{this._stream.push(t)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};gS.default=hS});var Lk=C(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});var lY=Lf(),$f=Of(),uY=lS(),_S=class extends uY.default{constructor(){super(...arguments),this._scandir=lY.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(t,n){this._queue.add({directory:t,base:n})}_handleQueue(){for(let t of this._queue.values())this._handleDirectory(t.directory,t.base)}_handleDirectory(t,n){try{let r=this._scandir(t,this._settings.fsScandirSettings);for(let o of r)this._handleEntry(o,n)}catch(r){this._handleError(r)}}_handleError(t){if($f.isFatalError(this._settings,t))throw t}_handleEntry(t,n){let r=t.path;n!==void 0&&(t.path=$f.joinPathSegments(n,t.name,this._settings.pathSegmentSeparator)),$f.isAppliedFilter(this._settings.entryFilter,t)&&this._pushToStorage(t),t.dirent.isDirectory()&&$f.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(r,n===void 0?void 0:t.path)}_pushToStorage(t){this._storage.push(t)}};yS.default=_S});var Ok=C(SS=>{"use strict";Object.defineProperty(SS,"__esModule",{value:!0});var dY=Lk(),bS=class{constructor(t,n){this._root=t,this._settings=n,this._reader=new dY.default(this._root,this._settings)}read(){return this._reader.read()}};SS.default=bS});var Mk=C(xS=>{"use strict";Object.defineProperty(xS,"__esModule",{value:!0});var fY=require("path"),mY=Lf(),wS=class{constructor(t={}){this._options=t,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,fY.sep),this.fsScandirSettings=new mY.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(t,n){return t??n}};xS.default=wS});var Bf=C(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.Settings=Gr.walkStream=Gr.walkSync=Gr.walk=void 0;var $k=kk(),pY=Fk(),hY=Ok(),vS=Mk();Gr.Settings=vS.default;function gY(e,t,n){if(typeof t=="function"){new $k.default(e,qf()).read(t);return}new $k.default(e,qf(t)).read(n)}Gr.walk=gY;function _Y(e,t){let n=qf(t);return new hY.default(e,n).read()}Gr.walkSync=_Y;function yY(e,t){let n=qf(t);return new pY.default(e,n).read()}Gr.walkStream=yY;function qf(e={}){return e instanceof vS.default?e:new vS.default(e)}});var jf=C(PS=>{"use strict";Object.defineProperty(PS,"__esModule",{value:!0});var bY=require("path"),SY=Go(),qk=di(),CS=class{constructor(t){this._settings=t,this._fsStatSettings=new SY.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(t){return bY.resolve(this._settings.cwd,t)}_makeEntry(t,n){let r={name:n,path:n,dirent:qk.fs.createDirentFromStats(n,t)};return this._settings.stats&&(r.stats=t),r}_isFatalError(t){return!qk.errno.isEnoentCodeError(t)&&!this._settings.suppressErrors}};PS.default=CS});var RS=C(ES=>{"use strict";Object.defineProperty(ES,"__esModule",{value:!0});var wY=require("stream"),xY=Go(),vY=Bf(),CY=jf(),NS=class extends CY.default{constructor(){super(...arguments),this._walkStream=vY.walkStream,this._stat=xY.stat}dynamic(t,n){return this._walkStream(t,n)}static(t,n){let r=t.map(this._getFullEntryPath,this),o=new wY.PassThrough({objectMode:!0});o._write=(s,a,c)=>this._getEntry(r[s],t[s],n).then(l=>{l!==null&&n.entryFilter(l)&&o.push(l),s===r.length-1&&o.end(),c()}).catch(c);for(let s=0;s<r.length;s++)o.write(s);return o}_getEntry(t,n,r){return this._getStat(t).then(o=>this._makeEntry(o,n)).catch(o=>{if(r.errorFilter(o))return null;throw o})}_getStat(t){return new Promise((n,r)=>{this._stat(t,this._fsStatSettings,(o,s)=>o===null?n(s):r(o))})}};ES.default=NS});var Bk=C(AS=>{"use strict";Object.defineProperty(AS,"__esModule",{value:!0});var PY=Bf(),NY=jf(),EY=RS(),TS=class extends NY.default{constructor(){super(...arguments),this._walkAsync=PY.walk,this._readerStream=new EY.default(this._settings)}dynamic(t,n){return new Promise((r,o)=>{this._walkAsync(t,n,(s,a)=>{s===null?r(a):o(s)})})}async static(t,n){let r=[],o=this._readerStream.static(t,n);return new Promise((s,a)=>{o.once("error",a),o.on("data",c=>r.push(c)),o.once("end",()=>s(r))})}};AS.default=TS});var jk=C(DS=>{"use strict";Object.defineProperty(DS,"__esModule",{value:!0});var al=di(),IS=class{constructor(t,n,r){this._patterns=t,this._settings=n,this._micromatchOptions=r,this._storage=[],this._fillStorage()}_fillStorage(){for(let t of this._patterns){let n=this._getPatternSegments(t),r=this._splitSegmentsIntoSections(n);this._storage.push({complete:r.length<=1,pattern:t,segments:n,sections:r})}}_getPatternSegments(t){return al.pattern.getPatternParts(t,this._micromatchOptions).map(r=>al.pattern.isDynamicPattern(r,this._settings)?{dynamic:!0,pattern:r,patternRe:al.pattern.makeRe(r,this._micromatchOptions)}:{dynamic:!1,pattern:r})}_splitSegmentsIntoSections(t){return al.array.splitWhen(t,n=>n.dynamic&&al.pattern.hasGlobStar(n.pattern))}};DS.default=IS});var Wk=C(FS=>{"use strict";Object.defineProperty(FS,"__esModule",{value:!0});var RY=jk(),kS=class extends RY.default{match(t){let n=t.split("/"),r=n.length,o=this._storage.filter(s=>!s.complete||s.segments.length>r);for(let s of o){let a=s.sections[0];if(!s.complete&&r>a.length||n.every((l,u)=>{let d=s.segments[u];return!!(d.dynamic&&d.patternRe.test(l)||!d.dynamic&&d.pattern===l)}))return!0}return!1}};FS.default=kS});var Uk=C(OS=>{"use strict";Object.defineProperty(OS,"__esModule",{value:!0});var Wf=di(),TY=Wk(),LS=class{constructor(t,n){this._settings=t,this._micromatchOptions=n}getFilter(t,n,r){let o=this._getMatcher(n),s=this._getNegativePatternsRe(r);return a=>this._filter(t,a,o,s)}_getMatcher(t){return new TY.default(t,this._settings,this._micromatchOptions)}_getNegativePatternsRe(t){let n=t.filter(Wf.pattern.isAffectDepthOfReadingPattern);return Wf.pattern.convertPatternsToRe(n,this._micromatchOptions)}_filter(t,n,r,o){if(this._isSkippedByDeep(t,n.path)||this._isSkippedSymbolicLink(n))return!1;let s=Wf.path.removeLeadingDotSegment(n.path);return this._isSkippedByPositivePatterns(s,r)?!1:this._isSkippedByNegativePatterns(s,o)}_isSkippedByDeep(t,n){return this._settings.deep===1/0?!1:this._getEntryLevel(t,n)>=this._settings.deep}_getEntryLevel(t,n){let r=n.split("/").length;if(t==="")return r;let o=t.split("/").length;return r-o}_isSkippedSymbolicLink(t){return!this._settings.followSymbolicLinks&&t.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(t,n){return!this._settings.baseNameMatch&&!n.match(t)}_isSkippedByNegativePatterns(t,n){return!Wf.pattern.matchAny(t,n)}};OS.default=LS});var Hk=C($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0});var Yi=di(),MS=class{constructor(t,n){this._settings=t,this._micromatchOptions=n,this.index=new Map}getFilter(t,n){let[r,o]=Yi.pattern.partitionAbsoluteAndRelative(n),s={positive:{all:Yi.pattern.convertPatternsToRe(t,this._micromatchOptions)},negative:{absolute:Yi.pattern.convertPatternsToRe(r,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:Yi.pattern.convertPatternsToRe(o,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return a=>this._filter(a,s)}_filter(t,n){let r=Yi.path.removeLeadingDotSegment(t.path);if(this._settings.unique&&this._isDuplicateEntry(r)||this._onlyFileFilter(t)||this._onlyDirectoryFilter(t))return!1;let o=this._isMatchToPatternsSet(r,n,t.dirent.isDirectory());return this._settings.unique&&o&&this._createIndexRecord(r),o}_isDuplicateEntry(t){return this.index.has(t)}_createIndexRecord(t){this.index.set(t,void 0)}_onlyFileFilter(t){return this._settings.onlyFiles&&!t.dirent.isFile()}_onlyDirectoryFilter(t){return this._settings.onlyDirectories&&!t.dirent.isDirectory()}_isMatchToPatternsSet(t,n,r){return!(!this._isMatchToPatterns(t,n.positive.all,r)||this._isMatchToPatterns(t,n.negative.relative,r)||this._isMatchToAbsoluteNegative(t,n.negative.absolute,r))}_isMatchToAbsoluteNegative(t,n,r){if(n.length===0)return!1;let o=Yi.path.makeAbsolute(this._settings.cwd,t);return this._isMatchToPatterns(o,n,r)}_isMatchToPatterns(t,n,r){if(n.length===0)return!1;let o=Yi.pattern.matchAny(t,n);return!o&&r?Yi.pattern.matchAny(t+"/",n):o}};$S.default=MS});var Vk=C(BS=>{"use strict";Object.defineProperty(BS,"__esModule",{value:!0});var AY=di(),qS=class{constructor(t){this._settings=t}getFilter(){return t=>this._isNonFatalError(t)}_isNonFatalError(t){return AY.errno.isEnoentCodeError(t)||this._settings.suppressErrors}};BS.default=qS});var zk=C(WS=>{"use strict";Object.defineProperty(WS,"__esModule",{value:!0});var Gk=di(),jS=class{constructor(t){this._settings=t}getTransformer(){return t=>this._transform(t)}_transform(t){let n=t.path;return this._settings.absolute&&(n=Gk.path.makeAbsolute(this._settings.cwd,n),n=Gk.path.unixify(n)),this._settings.markDirectories&&t.dirent.isDirectory()&&(n+="/"),this._settings.objectMode?Object.assign(Object.assign({},t),{path:n}):n}};WS.default=jS});var Uf=C(HS=>{"use strict";Object.defineProperty(HS,"__esModule",{value:!0});var IY=require("path"),DY=Uk(),kY=Hk(),FY=Vk(),LY=zk(),US=class{constructor(t){this._settings=t,this.errorFilter=new FY.default(this._settings),this.entryFilter=new kY.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new DY.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new LY.default(this._settings)}_getRootDirectory(t){return IY.resolve(this._settings.cwd,t.base)}_getReaderOptions(t){let n=t.base==="."?"":t.base;return{basePath:n,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(n,t.positive,t.negative),entryFilter:this.entryFilter.getFilter(t.positive,t.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};HS.default=US});var Kk=C(GS=>{"use strict";Object.defineProperty(GS,"__esModule",{value:!0});var OY=Bk(),MY=Uf(),VS=class extends MY.default{constructor(){super(...arguments),this._reader=new OY.default(this._settings)}async read(t){let n=this._getRootDirectory(t),r=this._getReaderOptions(t);return(await this.api(n,t,r)).map(s=>r.transform(s))}api(t,n,r){return n.dynamic?this._reader.dynamic(t,r):this._reader.static(n.patterns,r)}};GS.default=VS});var Yk=C(KS=>{"use strict";Object.defineProperty(KS,"__esModule",{value:!0});var $Y=require("stream"),qY=RS(),BY=Uf(),zS=class extends BY.default{constructor(){super(...arguments),this._reader=new qY.default(this._settings)}read(t){let n=this._getRootDirectory(t),r=this._getReaderOptions(t),o=this.api(n,t,r),s=new $Y.Readable({objectMode:!0,read:()=>{}});return o.once("error",a=>s.emit("error",a)).on("data",a=>s.emit("data",r.transform(a))).once("end",()=>s.emit("end")),s.once("close",()=>o.destroy()),s}api(t,n,r){return n.dynamic?this._reader.dynamic(t,r):this._reader.static(n.patterns,r)}};KS.default=zS});var Xk=C(XS=>{"use strict";Object.defineProperty(XS,"__esModule",{value:!0});var jY=Go(),WY=Bf(),UY=jf(),YS=class extends UY.default{constructor(){super(...arguments),this._walkSync=WY.walkSync,this._statSync=jY.statSync}dynamic(t,n){return this._walkSync(t,n)}static(t,n){let r=[];for(let o of t){let s=this._getFullEntryPath(o),a=this._getEntry(s,o,n);a===null||!n.entryFilter(a)||r.push(a)}return r}_getEntry(t,n,r){try{let o=this._getStat(t);return this._makeEntry(o,n)}catch(o){if(r.errorFilter(o))return null;throw o}}_getStat(t){return this._statSync(t,this._fsStatSettings)}};XS.default=YS});var Jk=C(QS=>{"use strict";Object.defineProperty(QS,"__esModule",{value:!0});var HY=Xk(),VY=Uf(),JS=class extends VY.default{constructor(){super(...arguments),this._reader=new HY.default(this._settings)}read(t){let n=this._getRootDirectory(t),r=this._getReaderOptions(t);return this.api(n,t,r).map(r.transform)}api(t,n,r){return n.dynamic?this._reader.dynamic(t,r):this._reader.static(n.patterns,r)}};QS.default=JS});var Qk=C(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var pa=require("fs"),GY=require("os"),zY=Math.max(GY.cpus().length,1);ha.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:pa.lstat,lstatSync:pa.lstatSync,stat:pa.stat,statSync:pa.statSync,readdir:pa.readdir,readdirSync:pa.readdirSync};var ZS=class{constructor(t={}){this._options=t,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,zY),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(t,n){return t===void 0?n:t}_getFileSystemMethods(t={}){return Object.assign(Object.assign({},ha.DEFAULT_FILE_SYSTEM_ADAPTER),t)}};ha.default=ZS});var t0=C((xae,e0)=>{"use strict";var Zk=ek(),KY=Kk(),YY=Yk(),XY=Jk(),ew=Qk(),sr=di();async function tw(e,t){xr(e);let n=nw(e,KY.default,t),r=await Promise.all(n);return sr.array.flatten(r)}(function(e){e.glob=e,e.globSync=t,e.globStream=n,e.async=e;function t(u,d){xr(u);let f=nw(u,XY.default,d);return sr.array.flatten(f)}e.sync=t;function n(u,d){xr(u);let f=nw(u,YY.default,d);return sr.stream.merge(f)}e.stream=n;function r(u,d){xr(u);let f=[].concat(u),m=new ew.default(d);return Zk.generate(f,m)}e.generateTasks=r;function o(u,d){xr(u);let f=new ew.default(d);return sr.pattern.isDynamicPattern(u,f)}e.isDynamicPattern=o;function s(u){return xr(u),sr.path.escape(u)}e.escapePath=s;function a(u){return xr(u),sr.path.convertPathToPattern(u)}e.convertPathToPattern=a;let c;(function(u){function d(m){return xr(m),sr.path.escapePosixPath(m)}u.escapePath=d;function f(m){return xr(m),sr.path.convertPosixPathToPattern(m)}u.convertPathToPattern=f})(c=e.posix||(e.posix={}));let l;(function(u){function d(m){return xr(m),sr.path.escapeWindowsPath(m)}u.escapePath=d;function f(m){return xr(m),sr.path.convertWindowsPathToPattern(m)}u.convertPathToPattern=f})(l=e.win32||(e.win32={}))})(tw||(tw={}));function nw(e,t,n){let r=[].concat(e),o=new ew.default(n),s=Zk.generate(r,o),a=new t(o);return s.map(a.read,a)}function xr(e){if(![].concat(e).every(r=>sr.string.isString(r)&&!sr.string.isEmpty(r)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}e0.exports=tw});var Ie=C(Qt=>{"use strict";var ow=Symbol.for("yaml.alias"),p0=Symbol.for("yaml.document"),Qf=Symbol.for("yaml.map"),h0=Symbol.for("yaml.pair"),sw=Symbol.for("yaml.scalar"),Zf=Symbol.for("yaml.seq"),fi=Symbol.for("yaml.node.type"),JY=e=>!!e&&typeof e=="object"&&e[fi]===ow,QY=e=>!!e&&typeof e=="object"&&e[fi]===p0,ZY=e=>!!e&&typeof e=="object"&&e[fi]===Qf,e8=e=>!!e&&typeof e=="object"&&e[fi]===h0,g0=e=>!!e&&typeof e=="object"&&e[fi]===sw,t8=e=>!!e&&typeof e=="object"&&e[fi]===Zf;function _0(e){if(e&&typeof e=="object")switch(e[fi]){case Qf:case Zf:return!0}return!1}function n8(e){if(e&&typeof e=="object")switch(e[fi]){case ow:case Qf:case sw:case Zf:return!0}return!1}var r8=e=>(g0(e)||_0(e))&&!!e.anchor;Qt.ALIAS=ow;Qt.DOC=p0;Qt.MAP=Qf;Qt.NODE_TYPE=fi;Qt.PAIR=h0;Qt.SCALAR=sw;Qt.SEQ=Zf;Qt.hasAnchor=r8;Qt.isAlias=JY;Qt.isCollection=_0;Qt.isDocument=QY;Qt.isMap=ZY;Qt.isNode=n8;Qt.isPair=e8;Qt.isScalar=g0;Qt.isSeq=t8});var ll=C(aw=>{"use strict";var $t=Ie(),Dn=Symbol("break visit"),y0=Symbol("skip children"),zr=Symbol("remove node");function em(e,t){let n=b0(t);$t.isDocument(e)?ga(null,e.contents,n,Object.freeze([e]))===zr&&(e.contents=null):ga(null,e,n,Object.freeze([]))}em.BREAK=Dn;em.SKIP=y0;em.REMOVE=zr;function ga(e,t,n,r){let o=S0(e,t,n,r);if($t.isNode(o)||$t.isPair(o))return w0(e,r,o),ga(e,o,n,r);if(typeof o!="symbol"){if($t.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=ga(s,t.items[s],n,r);if(typeof a=="number")s=a-1;else{if(a===Dn)return Dn;a===zr&&(t.items.splice(s,1),s-=1)}}}else if($t.isPair(t)){r=Object.freeze(r.concat(t));let s=ga("key",t.key,n,r);if(s===Dn)return Dn;s===zr&&(t.key=null);let a=ga("value",t.value,n,r);if(a===Dn)return Dn;a===zr&&(t.value=null)}}return o}async function tm(e,t){let n=b0(t);$t.isDocument(e)?await _a(null,e.contents,n,Object.freeze([e]))===zr&&(e.contents=null):await _a(null,e,n,Object.freeze([]))}tm.BREAK=Dn;tm.SKIP=y0;tm.REMOVE=zr;async function _a(e,t,n,r){let o=await S0(e,t,n,r);if($t.isNode(o)||$t.isPair(o))return w0(e,r,o),_a(e,o,n,r);if(typeof o!="symbol"){if($t.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=await _a(s,t.items[s],n,r);if(typeof a=="number")s=a-1;else{if(a===Dn)return Dn;a===zr&&(t.items.splice(s,1),s-=1)}}}else if($t.isPair(t)){r=Object.freeze(r.concat(t));let s=await _a("key",t.key,n,r);if(s===Dn)return Dn;s===zr&&(t.key=null);let a=await _a("value",t.value,n,r);if(a===Dn)return Dn;a===zr&&(t.value=null)}}return o}function b0(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function S0(e,t,n,r){if(typeof n=="function")return n(e,t,r);if($t.isMap(t))return n.Map?.(e,t,r);if($t.isSeq(t))return n.Seq?.(e,t,r);if($t.isPair(t))return n.Pair?.(e,t,r);if($t.isScalar(t))return n.Scalar?.(e,t,r);if($t.isAlias(t))return n.Alias?.(e,t,r)}function w0(e,t,n){let r=t[t.length-1];if($t.isCollection(r))r.items[e]=n;else if($t.isPair(r))e==="key"?r.key=n:r.value=n;else if($t.isDocument(r))r.contents=n;else{let o=$t.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${o} parent`)}}aw.visit=em;aw.visitAsync=tm});var cw=C(v0=>{"use strict";var x0=Ie(),i8=ll(),o8={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},s8=e=>e.replace(/[!,[\]{}]/g,t=>o8[t]),ul=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.trim().split(/[ \t]+/),o=r.shift();switch(o){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,a]=r;return this.tags[s]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let a=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,a),!1}}default:return n(0,`Unknown directive ${o}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}let[,r,o]=t.match(/^(.*!)([^!]*)$/s);o||n(`The ${t} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(o)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+s8(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),o;if(t&&r.length>0&&x0.isNode(t.contents)){let s={};i8.visit(t.contents,(a,c)=>{x0.isNode(c)&&c.tag&&(s[c.tag]=!0)}),o=Object.keys(s)}else o=[];for(let[s,a]of r)s==="!!"&&a==="tag:yaml.org,2002:"||(!t||o.some(c=>c.startsWith(a)))&&n.push(`%TAG ${s} ${a}`);return n.join(`
16
+ `)}};ul.defaultYaml={explicit:!1,version:"1.2"};ul.defaultTags={"!!":"tag:yaml.org,2002:"};v0.Directives=ul});var nm=C(dl=>{"use strict";var C0=Ie(),a8=ll();function c8(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function P0(e){let t=new Set;return a8.visit(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function N0(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function l8(e,t){let n=[],r=new Map,o=null;return{onAnchor:s=>{n.push(s),o??(o=P0(e));let a=N0(t,o);return o.add(a),a},setAnchors:()=>{for(let s of n){let a=r.get(s);if(typeof a=="object"&&a.anchor&&(C0.isScalar(a.node)||C0.isCollection(a.node)))a.node.anchor=a.anchor;else{let c=new Error("Failed to resolve repeated object (this should not happen)");throw c.source=s,c}}},sourceObjects:r}}dl.anchorIsValid=c8;dl.anchorNames=P0;dl.createNodeAnchors=l8;dl.findNewAnchor=N0});var lw=C(E0=>{"use strict";function fl(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let o=0,s=r.length;o<s;++o){let a=r[o],c=fl(e,r,String(o),a);c===void 0?delete r[o]:c!==a&&(r[o]=c)}else if(r instanceof Map)for(let o of Array.from(r.keys())){let s=r.get(o),a=fl(e,r,o,s);a===void 0?r.delete(o):a!==s&&r.set(o,a)}else if(r instanceof Set)for(let o of Array.from(r)){let s=fl(e,r,o,o);s===void 0?r.delete(o):s!==o&&(r.delete(o),r.add(s))}else for(let[o,s]of Object.entries(r)){let a=fl(e,r,o,s);a===void 0?delete r[o]:a!==s&&(r[o]=a)}return e.call(t,n,r)}E0.applyReviver=fl});var Qi=C(T0=>{"use strict";var u8=Ie();function R0(e,t,n){if(Array.isArray(e))return e.map((r,o)=>R0(r,String(o),n));if(e&&typeof e.toJSON=="function"){if(!n||!u8.hasAnchor(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let o=e.toJSON(t,n);return n.onCreate&&n.onCreate(o),o}return typeof e=="bigint"&&!n?.keep?Number(e):e}T0.toJS=R0});var rm=C(I0=>{"use strict";var d8=lw(),A0=Ie(),f8=Qi(),uw=class{constructor(t){Object.defineProperty(this,A0.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:o,reviver:s}={}){if(!A0.isDocument(t))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=f8.toJS(this,"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?d8.applyReviver(s,{"":c},"",c):c}};I0.NodeBase=uw});var ml=C(D0=>{"use strict";var m8=nm(),p8=ll(),ya=Ie(),h8=rm(),g8=Qi(),dw=class extends h8.NodeBase{constructor(t){super(ya.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],p8.visit(t,{Node:(s,a)=>{(ya.isAlias(a)||ya.hasAnchor(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let o;for(let s of r){if(s===this)break;s.anchor===this.source&&(o=s)}return o}toJSON(t,n){if(!n)return{source:this.source};let{anchors:r,doc:o,maxAliasCount:s}=n,a=this.resolve(o,n);if(!a){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let c=r.get(a);if(c||(g8.toJS(a,null,n),c=r.get(a)),c?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(s>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=im(o,a,r)),c.count*c.aliasCount>s)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return c.res}toString(t,n,r){let o=`*${this.source}`;if(t){if(m8.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${o} `}return o}};function im(e,t,n){if(ya.isAlias(t)){let r=t.resolve(e),o=n&&r&&n.get(r);return o?o.count*o.aliasCount:0}else if(ya.isCollection(t)){let r=0;for(let o of t.items){let s=im(e,o,n);s>r&&(r=s)}return r}else if(ya.isPair(t)){let r=im(e,t.key,n),o=im(e,t.value,n);return Math.max(r,o)}return 1}D0.Alias=dw});var Dt=C(fw=>{"use strict";var _8=Ie(),y8=rm(),b8=Qi(),S8=e=>!e||typeof e!="function"&&typeof e!="object",Zi=class extends y8.NodeBase{constructor(t){super(_8.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:b8.toJS(this.value,t,n)}toString(){return String(this.value)}};Zi.BLOCK_FOLDED="BLOCK_FOLDED";Zi.BLOCK_LITERAL="BLOCK_LITERAL";Zi.PLAIN="PLAIN";Zi.QUOTE_DOUBLE="QUOTE_DOUBLE";Zi.QUOTE_SINGLE="QUOTE_SINGLE";fw.Scalar=Zi;fw.isScalarValue=S8});var pl=C(F0=>{"use strict";var w8=ml(),Yo=Ie(),k0=Dt(),x8="tag:yaml.org,2002:";function v8(e,t,n){if(t){let r=n.filter(s=>s.tag===t),o=r.find(s=>!s.format)??r[0];if(!o)throw new Error(`Tag ${t} not found`);return o}return n.find(r=>r.identify?.(e)&&!r.format)}function C8(e,t,n){if(Yo.isDocument(e)&&(e=e.contents),Yo.isNode(e))return e;if(Yo.isPair(e)){let f=n.schema[Yo.MAP].createNode?.(n.schema,null,n);return f.items.push(e),f}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:o,onTagObj:s,schema:a,sourceObjects:c}=n,l;if(r&&e&&typeof e=="object"){if(l=c.get(e),l)return l.anchor??(l.anchor=o(e)),new w8.Alias(l.anchor);l={anchor:null,node:null},c.set(e,l)}t?.startsWith("!!")&&(t=x8+t.slice(2));let u=v8(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let f=new k0.Scalar(e);return l&&(l.node=f),f}u=e instanceof Map?a[Yo.MAP]:Symbol.iterator in Object(e)?a[Yo.SEQ]:a[Yo.MAP]}s&&(s(u),delete n.onTagObj);let d=u?.createNode?u.createNode(n.schema,e,n):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(n.schema,e,n):new k0.Scalar(e);return t?d.tag=t:u.default||(d.tag=u.tag),l&&(l.node=d),d}F0.createNode=C8});var sm=C(om=>{"use strict";var P8=pl(),Kr=Ie(),N8=rm();function mw(e,t,n){let r=n;for(let o=t.length-1;o>=0;--o){let s=t[o];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let a=[];a[s]=r,r=a}else r=new Map([[s,r]])}return P8.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var L0=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,pw=class extends N8.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>Kr.isNode(r)||Kr.isPair(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(L0(t))this.add(n);else{let[r,...o]=t,s=this.get(r,!0);if(Kr.isCollection(s))s.addIn(o,n);else if(s===void 0&&this.schema)this.set(r,mw(this.schema,o,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}deleteIn(t){let[n,...r]=t;if(r.length===0)return this.delete(n);let o=this.get(n,!0);if(Kr.isCollection(o))return o.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){let[r,...o]=t,s=this.get(r,!0);return o.length===0?!n&&Kr.isScalar(s)?s.value:s:Kr.isCollection(s)?s.getIn(o,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Kr.isPair(n))return!1;let r=n.value;return r==null||t&&Kr.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[n,...r]=t;if(r.length===0)return this.has(n);let o=this.get(n,!0);return Kr.isCollection(o)?o.hasIn(r):!1}setIn(t,n){let[r,...o]=t;if(o.length===0)this.set(r,n);else{let s=this.get(r,!0);if(Kr.isCollection(s))s.setIn(o,n);else if(s===void 0&&this.schema)this.set(r,mw(this.schema,o,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}};om.Collection=pw;om.collectionFromPath=mw;om.isEmptyPath=L0});var hl=C(am=>{"use strict";var E8=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function hw(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var R8=(e,t,n)=>e.endsWith(`
17
+ `)?hw(n,t):n.includes(`
18
18
  `)?`
19
- `+gw(n,t):(e.endsWith(" ")?"":" ")+n;sm.indentComment=gw;sm.lineComment=E8;sm.stringifyComment=N8});var M0=C(hl=>{"use strict";var R8="flow",_w="block",am="quoted";function T8(e,t,n="flow",{indentAtStart:r,lineWidth:o=80,minContentWidth:s=20,onFold:a,onOverflow:c}={}){if(!o||o<0)return e;o<s&&(s=0);let l=Math.max(1+s,1+o-t.length);if(e.length<=l)return e;let u=[],d={},f=o-t.length;typeof r=="number"&&(r>o-Math.max(2,s)?u.push(0):f=o-r);let m,p,g=!1,h=-1,y=-1,w=-1;n===_w&&(h=O0(e,h,t.length),h!==-1&&(f=h+l));for(let b;b=e[h+=1];){if(n===am&&b==="\\"){switch(y=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(b===`
20
- `)n===_w&&(h=O0(e,h,t.length)),f=h+t.length+l,m=void 0;else{if(b===" "&&p&&p!==" "&&p!==`
19
+ `+hw(n,t):(e.endsWith(" ")?"":" ")+n;am.indentComment=hw;am.lineComment=R8;am.stringifyComment=E8});var M0=C(gl=>{"use strict";var T8="flow",gw="block",cm="quoted";function A8(e,t,n="flow",{indentAtStart:r,lineWidth:o=80,minContentWidth:s=20,onFold:a,onOverflow:c}={}){if(!o||o<0)return e;o<s&&(s=0);let l=Math.max(1+s,1+o-t.length);if(e.length<=l)return e;let u=[],d={},f=o-t.length;typeof r=="number"&&(r>o-Math.max(2,s)?u.push(0):f=o-r);let m,p,g=!1,h=-1,y=-1,w=-1;n===gw&&(h=O0(e,h,t.length),h!==-1&&(f=h+l));for(let b;b=e[h+=1];){if(n===cm&&b==="\\"){switch(y=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(b===`
20
+ `)n===gw&&(h=O0(e,h,t.length)),f=h+t.length+l,m=void 0;else{if(b===" "&&p&&p!==" "&&p!==`
21
21
  `&&p!==" "){let S=e[h+1];S&&S!==" "&&S!==`
22
- `&&S!==" "&&(m=h)}if(h>=f)if(m)u.push(m),f=m+l,m=void 0;else if(n===am){for(;p===" "||p===" ";)p=b,b=e[h+=1],g=!0;let S=h>w+1?h-2:y-1;if(d[S])return e;u.push(S),d[S]=!0,f=S+l,m=void 0}else g=!0}p=b}if(g&&c&&c(),u.length===0)return e;a&&a();let _=e.slice(0,u[0]);for(let b=0;b<u.length;++b){let S=u[b],N=u[b+1]||e.length;S===0?_=`
23
- ${t}${e.slice(0,N)}`:(n===am&&d[S]&&(_+=`${e[S]}\\`),_+=`
22
+ `&&S!==" "&&(m=h)}if(h>=f)if(m)u.push(m),f=m+l,m=void 0;else if(n===cm){for(;p===" "||p===" ";)p=b,b=e[h+=1],g=!0;let S=h>w+1?h-2:y-1;if(d[S])return e;u.push(S),d[S]=!0,f=S+l,m=void 0}else g=!0}p=b}if(g&&c&&c(),u.length===0)return e;a&&a();let _=e.slice(0,u[0]);for(let b=0;b<u.length;++b){let S=u[b],N=u[b+1]||e.length;S===0?_=`
23
+ ${t}${e.slice(0,N)}`:(n===cm&&d[S]&&(_+=`${e[S]}\\`),_+=`
24
24
  ${t}${e.slice(S+1,N)}`)}return _}function O0(e,t,n){let r=t,o=t+1,s=e[o];for(;s===" "||s===" ";)if(t<o+n)s=e[++t];else{do s=e[++t];while(s&&s!==`
25
- `);r=t,o=t+1,s=e[o]}return r}hl.FOLD_BLOCK=_w;hl.FOLD_FLOW=R8;hl.FOLD_QUOTED=am;hl.foldFlowLines=T8});var _l=C($0=>{"use strict";var vr=Dt(),eo=M0(),lm=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),um=e=>/^(%|---|\.\.\.)/m.test(e);function A8(e,t,n){if(!t||t<0)return!1;let r=t-n,o=e.length;if(o<=r)return!1;for(let s=0,a=0;s<o;++s)if(e[s]===`
26
- `){if(s-a>r)return!0;if(a=s+1,o-a<=r)return!1}return!0}function gl(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,o=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(um(e)?" ":""),a="",c=0;for(let l=0,u=n[l];u;u=n[++l])if(u===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(a+=n.slice(c,l)+"\\ ",l+=1,c=l,u="\\"),u==="\\")switch(n[l+1]){case"u":{a+=n.slice(c,l);let d=n.substr(l+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(l,6)}l+=5,c=l+1}break;case"n":if(r||n[l+2]==='"'||n.length<o)l+=1;else{for(a+=n.slice(c,l)+`
25
+ `);r=t,o=t+1,s=e[o]}return r}gl.FOLD_BLOCK=gw;gl.FOLD_FLOW=T8;gl.FOLD_QUOTED=cm;gl.foldFlowLines=A8});var yl=C($0=>{"use strict";var vr=Dt(),eo=M0(),um=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),dm=e=>/^(%|---|\.\.\.)/m.test(e);function I8(e,t,n){if(!t||t<0)return!1;let r=t-n,o=e.length;if(o<=r)return!1;for(let s=0,a=0;s<o;++s)if(e[s]===`
26
+ `){if(s-a>r)return!0;if(a=s+1,o-a<=r)return!1}return!0}function _l(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,o=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(dm(e)?" ":""),a="",c=0;for(let l=0,u=n[l];u;u=n[++l])if(u===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(a+=n.slice(c,l)+"\\ ",l+=1,c=l,u="\\"),u==="\\")switch(n[l+1]){case"u":{a+=n.slice(c,l);let d=n.substr(l+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(l,6)}l+=5,c=l+1}break;case"n":if(r||n[l+2]==='"'||n.length<o)l+=1;else{for(a+=n.slice(c,l)+`
27
27
 
28
28
  `;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)a+=`
29
- `,l+=2;a+=s,n[l+2]===" "&&(a+="\\"),l+=1,c=l+1}break;default:l+=1}return a=c?a+n.slice(c):n,r?a:eo.foldFlowLines(a,s,eo.FOLD_QUOTED,lm(t,!1))}function yw(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
30
- `)||/[ \t]\n|\n[ \t]/.test(e))return gl(e,t);let n=t.indent||(um(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
31
- ${n}`)+"'";return t.implicitKey?r:eo.foldFlowLines(r,n,eo.FOLD_FLOW,lm(t,!1))}function ba(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=gl;else{let o=e.includes('"'),s=e.includes("'");o&&!s?r=yw:s&&!o?r=gl:r=n?yw:gl}return r(e,t)}var bw;try{bw=new RegExp(`(^|(?<!
29
+ `,l+=2;a+=s,n[l+2]===" "&&(a+="\\"),l+=1,c=l+1}break;default:l+=1}return a=c?a+n.slice(c):n,r?a:eo.foldFlowLines(a,s,eo.FOLD_QUOTED,um(t,!1))}function _w(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
30
+ `)||/[ \t]\n|\n[ \t]/.test(e))return _l(e,t);let n=t.indent||(dm(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
31
+ ${n}`)+"'";return t.implicitKey?r:eo.foldFlowLines(r,n,eo.FOLD_FLOW,um(t,!1))}function ba(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=_l;else{let o=e.includes('"'),s=e.includes("'");o&&!s?r=_w:s&&!o?r=_l:r=n?_w:_l}return r(e,t)}var yw;try{yw=new RegExp(`(^|(?<!
32
32
  ))
33
33
  +(?!
34
- |$)`,"g")}catch{bw=/\n+(?!\n|$)/g}function cm({comment:e,type:t,value:n},r,o,s){let{blockQuote:a,commentString:c,lineWidth:l}=r.options;if(!a||/\n[\t ]+$/.test(n))return ba(n,r);let u=r.indent||(r.forceBlockIndent||um(n)?" ":""),d=a==="literal"?!0:a==="folded"||t===vr.Scalar.BLOCK_FOLDED?!1:t===vr.Scalar.BLOCK_LITERAL?!0:!A8(n,l,u.length);if(!n)return d?`|
34
+ |$)`,"g")}catch{yw=/\n+(?!\n|$)/g}function lm({comment:e,type:t,value:n},r,o,s){let{blockQuote:a,commentString:c,lineWidth:l}=r.options;if(!a||/\n[\t ]+$/.test(n))return ba(n,r);let u=r.indent||(r.forceBlockIndent||dm(n)?" ":""),d=a==="literal"?!0:a==="folded"||t===vr.Scalar.BLOCK_FOLDED?!1:t===vr.Scalar.BLOCK_LITERAL?!0:!I8(n,l,u.length);if(!n)return d?`|
35
35
  `:`>
36
36
  `;let f,m;for(m=n.length;m>0;--m){let N=n[m-1];if(N!==`
37
37
  `&&N!==" "&&N!==" ")break}let p=n.substring(m),g=p.indexOf(`
38
38
  `);g===-1?f="-":n===p||g!==p.length-1?(f="+",s&&s()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
39
- `&&(p=p.slice(0,-1)),p=p.replace(bw,`$&${u}`));let h=!1,y,w=-1;for(y=0;y<n.length;++y){let N=n[y];if(N===" ")h=!0;else if(N===`
39
+ `&&(p=p.slice(0,-1)),p=p.replace(yw,`$&${u}`));let h=!1,y,w=-1;for(y=0;y<n.length;++y){let N=n[y];if(N===" ")h=!0;else if(N===`
40
40
  `)w=y;else break}let _=n.substring(0,w<y?w+1:y);_&&(n=n.substring(_.length),_=_.replace(/\n+/g,`$&${u}`));let S=(h?u?"2":"1":"")+f;if(e&&(S+=" "+c(e.replace(/ ?[\r\n]+/g," ")),o&&o()),!d){let N=n.replace(/\n+/g,`
41
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),R=!1,$=lm(r,!0);a!=="folded"&&t!==vr.Scalar.BLOCK_FOLDED&&($.onOverflow=()=>{R=!0});let I=eo.foldFlowLines(`${_}${N}${p}`,u,eo.FOLD_BLOCK,$);if(!R)return`>${S}
41
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),R=!1,$=um(r,!0);a!=="folded"&&t!==vr.Scalar.BLOCK_FOLDED&&($.onOverflow=()=>{R=!0});let I=eo.foldFlowLines(`${_}${N}${p}`,u,eo.FOLD_BLOCK,$);if(!R)return`>${S}
42
42
  ${u}${I}`}return n=n.replace(/\n+/g,`$&${u}`),`|${S}
43
- ${u}${_}${n}${p}`}function I8(e,t,n,r){let{type:o,value:s}=e,{actualString:a,implicitKey:c,indent:l,indentStep:u,inFlow:d}=t;if(c&&s.includes(`
43
+ ${u}${_}${n}${p}`}function D8(e,t,n,r){let{type:o,value:s}=e,{actualString:a,implicitKey:c,indent:l,indentStep:u,inFlow:d}=t;if(c&&s.includes(`
44
44
  `)||d&&/[[\]{},]/.test(s))return ba(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return c||d||!s.includes(`
45
- `)?ba(s,t):cm(e,t,n,r);if(!c&&!d&&o!==vr.Scalar.PLAIN&&s.includes(`
46
- `))return cm(e,t,n,r);if(um(s)){if(l==="")return t.forceBlockIndent=!0,cm(e,t,n,r);if(c&&l===u)return ba(s,t)}let f=s.replace(/\n+/g,`$&
47
- ${l}`);if(a){let m=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(f),{compat:p,tags:g}=t.doc.schema;if(g.some(m)||p?.some(m))return ba(s,t)}return c?f:eo.foldFlowLines(f,l,eo.FOLD_FLOW,lm(t,!1))}function D8(e,t,n,r){let{implicitKey:o,inFlow:s}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==vr.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(c=vr.Scalar.QUOTE_DOUBLE);let l=d=>{switch(d){case vr.Scalar.BLOCK_FOLDED:case vr.Scalar.BLOCK_LITERAL:return o||s?ba(a.value,t):cm(a,t,n,r);case vr.Scalar.QUOTE_DOUBLE:return gl(a.value,t);case vr.Scalar.QUOTE_SINGLE:return yw(a.value,t);case vr.Scalar.PLAIN:return I8(a,t,n,r);default:return null}},u=l(c);if(u===null){let{defaultKeyType:d,defaultStringType:f}=t.options,m=o&&d||f;if(u=l(m),u===null)throw new Error(`Unsupported default string type ${m}`)}return u}$0.stringifyString=D8});var yl=C(Sw=>{"use strict";var k8=tm(),to=Ie(),F8=pl(),L8=_l();function O8(e,t){let n=Object.assign({blockQuote:!0,commentString:F8.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function M8(e,t){if(t.tag){let o=e.filter(s=>s.tag===t.tag);if(o.length>0)return o.find(s=>s.format===t.format)??o[0]}let n,r;if(to.isScalar(t)){r=t.value;let o=e.filter(s=>s.identify?.(r));if(o.length>1){let s=o.filter(a=>a.test);s.length>0&&(o=s)}n=o.find(s=>s.format===t.format)??o.find(s=>!s.format)}else r=t,n=e.find(o=>o.nodeClass&&r instanceof o.nodeClass);if(!n){let o=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${o} value`)}return n}function $8(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let o=[],s=(to.isScalar(e)||to.isCollection(e))&&e.anchor;s&&k8.anchorIsValid(s)&&(n.add(s),o.push(`&${s}`));let a=e.tag??(t.default?null:t.tag);return a&&o.push(r.directives.tagString(a)),o.join(" ")}function q8(e,t,n,r){if(to.isPair(e))return e.toString(t,n,r);if(to.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let o,s=to.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>o=l});o??(o=M8(t.doc.schema.tags,s));let a=$8(s,o,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);let c=typeof o.stringify=="function"?o.stringify(s,t,n,r):to.isScalar(s)?L8.stringifyString(s,t,n,r):s.toString(t,n,r);return a?to.isScalar(s)||c[0]==="{"||c[0]==="["?`${a} ${c}`:`${a}
48
- ${t.indent}${c}`:c}Sw.createStringifyContext=O8;Sw.stringify=q8});var W0=C(j0=>{"use strict";var mi=Ie(),q0=Dt(),B0=yl(),bl=pl();function B8({key:e,value:t},n,r,o){let{allNullValues:s,doc:a,indent:c,indentStep:l,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n,m=mi.isNode(e)&&e.comment||null;if(f){if(m)throw new Error("With simple keys, key nodes cannot have comments");if(mi.isCollection(e)||!mi.isNode(e)&&typeof e=="object"){let $="With simple keys, collection cannot be used as a key value";throw new Error($)}}let p=!f&&(!e||m&&t==null&&!n.inFlow||mi.isCollection(e)||(mi.isScalar(e)?e.type===q0.Scalar.BLOCK_FOLDED||e.type===q0.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!s),indent:c+l});let g=!1,h=!1,y=B0.stringify(e,n,()=>g=!0,()=>h=!0);if(!p&&!n.inFlow&&y.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(s||t==null)return g&&r&&r(),y===""?"?":p?`? ${y}`:y}else if(s&&!f||t==null&&p)return y=`? ${y}`,m&&!g?y+=bl.lineComment(y,n.indent,u(m)):h&&o&&o(),y;g&&(m=null),p?(m&&(y+=bl.lineComment(y,n.indent,u(m))),y=`? ${y}
49
- ${c}:`):(y=`${y}:`,m&&(y+=bl.lineComment(y,n.indent,u(m))));let w,_,b;mi.isNode(t)?(w=!!t.spaceBefore,_=t.commentBefore,b=t.comment):(w=!1,_=null,b=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!m&&mi.isScalar(t)&&(n.indentAtStart=y.length+1),h=!1,!d&&l.length>=2&&!n.inFlow&&!p&&mi.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let S=!1,N=B0.stringify(t,n,()=>S=!0,()=>h=!0),R=" ";if(m||w||_){if(R=w?`
45
+ `)?ba(s,t):lm(e,t,n,r);if(!c&&!d&&o!==vr.Scalar.PLAIN&&s.includes(`
46
+ `))return lm(e,t,n,r);if(dm(s)){if(l==="")return t.forceBlockIndent=!0,lm(e,t,n,r);if(c&&l===u)return ba(s,t)}let f=s.replace(/\n+/g,`$&
47
+ ${l}`);if(a){let m=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(f),{compat:p,tags:g}=t.doc.schema;if(g.some(m)||p?.some(m))return ba(s,t)}return c?f:eo.foldFlowLines(f,l,eo.FOLD_FLOW,um(t,!1))}function k8(e,t,n,r){let{implicitKey:o,inFlow:s}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==vr.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(c=vr.Scalar.QUOTE_DOUBLE);let l=d=>{switch(d){case vr.Scalar.BLOCK_FOLDED:case vr.Scalar.BLOCK_LITERAL:return o||s?ba(a.value,t):lm(a,t,n,r);case vr.Scalar.QUOTE_DOUBLE:return _l(a.value,t);case vr.Scalar.QUOTE_SINGLE:return _w(a.value,t);case vr.Scalar.PLAIN:return D8(a,t,n,r);default:return null}},u=l(c);if(u===null){let{defaultKeyType:d,defaultStringType:f}=t.options,m=o&&d||f;if(u=l(m),u===null)throw new Error(`Unsupported default string type ${m}`)}return u}$0.stringifyString=k8});var bl=C(bw=>{"use strict";var F8=nm(),to=Ie(),L8=hl(),O8=yl();function M8(e,t){let n=Object.assign({blockQuote:!0,commentString:L8.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function $8(e,t){if(t.tag){let o=e.filter(s=>s.tag===t.tag);if(o.length>0)return o.find(s=>s.format===t.format)??o[0]}let n,r;if(to.isScalar(t)){r=t.value;let o=e.filter(s=>s.identify?.(r));if(o.length>1){let s=o.filter(a=>a.test);s.length>0&&(o=s)}n=o.find(s=>s.format===t.format)??o.find(s=>!s.format)}else r=t,n=e.find(o=>o.nodeClass&&r instanceof o.nodeClass);if(!n){let o=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${o} value`)}return n}function q8(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let o=[],s=(to.isScalar(e)||to.isCollection(e))&&e.anchor;s&&F8.anchorIsValid(s)&&(n.add(s),o.push(`&${s}`));let a=e.tag??(t.default?null:t.tag);return a&&o.push(r.directives.tagString(a)),o.join(" ")}function B8(e,t,n,r){if(to.isPair(e))return e.toString(t,n,r);if(to.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let o,s=to.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>o=l});o??(o=$8(t.doc.schema.tags,s));let a=q8(s,o,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);let c=typeof o.stringify=="function"?o.stringify(s,t,n,r):to.isScalar(s)?O8.stringifyString(s,t,n,r):s.toString(t,n,r);return a?to.isScalar(s)||c[0]==="{"||c[0]==="["?`${a} ${c}`:`${a}
48
+ ${t.indent}${c}`:c}bw.createStringifyContext=M8;bw.stringify=B8});var W0=C(j0=>{"use strict";var mi=Ie(),q0=Dt(),B0=bl(),Sl=hl();function j8({key:e,value:t},n,r,o){let{allNullValues:s,doc:a,indent:c,indentStep:l,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n,m=mi.isNode(e)&&e.comment||null;if(f){if(m)throw new Error("With simple keys, key nodes cannot have comments");if(mi.isCollection(e)||!mi.isNode(e)&&typeof e=="object"){let $="With simple keys, collection cannot be used as a key value";throw new Error($)}}let p=!f&&(!e||m&&t==null&&!n.inFlow||mi.isCollection(e)||(mi.isScalar(e)?e.type===q0.Scalar.BLOCK_FOLDED||e.type===q0.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!s),indent:c+l});let g=!1,h=!1,y=B0.stringify(e,n,()=>g=!0,()=>h=!0);if(!p&&!n.inFlow&&y.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(s||t==null)return g&&r&&r(),y===""?"?":p?`? ${y}`:y}else if(s&&!f||t==null&&p)return y=`? ${y}`,m&&!g?y+=Sl.lineComment(y,n.indent,u(m)):h&&o&&o(),y;g&&(m=null),p?(m&&(y+=Sl.lineComment(y,n.indent,u(m))),y=`? ${y}
49
+ ${c}:`):(y=`${y}:`,m&&(y+=Sl.lineComment(y,n.indent,u(m))));let w,_,b;mi.isNode(t)?(w=!!t.spaceBefore,_=t.commentBefore,b=t.comment):(w=!1,_=null,b=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!m&&mi.isScalar(t)&&(n.indentAtStart=y.length+1),h=!1,!d&&l.length>=2&&!n.inFlow&&!p&&mi.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let S=!1,N=B0.stringify(t,n,()=>S=!0,()=>h=!0),R=" ";if(m||w||_){if(R=w?`
50
50
  `:"",_){let $=u(_);R+=`
51
- ${bl.indentComment($,n.indent)}`}N===""&&!n.inFlow?R===`
51
+ ${Sl.indentComment($,n.indent)}`}N===""&&!n.inFlow?R===`
52
52
  `&&b&&(R=`
53
53
 
54
54
  `):R+=`
55
55
  ${n.indent}`}else if(!p&&mi.isCollection(t)){let $=N[0],I=N.indexOf(`
56
56
  `),U=I!==-1,de=n.inFlow??t.flow??t.items.length===0;if(U||!de){let F=!1;if(U&&($==="&"||$==="!")){let Q=N.indexOf(" ");$==="&"&&Q!==-1&&Q<I&&N[Q+1]==="!"&&(Q=N.indexOf(" ",Q+1)),(Q===-1||I<Q)&&(F=!0)}F||(R=`
57
57
  ${n.indent}`)}}else(N===""||N[0]===`
58
- `)&&(R="");return y+=R+N,n.inFlow?S&&r&&r():b&&!S?y+=bl.lineComment(y,n.indent,u(b)):h&&o&&o(),y}j0.stringifyPair=B8});var xw=C(ww=>{"use strict";var U0=require("process");function j8(e,...t){e==="debug"&&console.log(...t)}function W8(e,t){(e==="debug"||e==="warn")&&(typeof U0.emitWarning=="function"?U0.emitWarning(t):console.warn(t))}ww.debug=j8;ww.warn=W8});var hm=C(pm=>{"use strict";var mm=Ie(),H0=Dt(),dm="<<",fm={identify:e=>e===dm||typeof e=="symbol"&&e.description===dm,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new H0.Scalar(Symbol(dm)),{addToJSMap:V0}),stringify:()=>dm},U8=(e,t)=>(fm.identify(t)||mm.isScalar(t)&&(!t.type||t.type===H0.Scalar.PLAIN)&&fm.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===fm.tag&&n.default);function V0(e,t,n){let r=G0(e,n);if(mm.isSeq(r))for(let o of r.items)vw(e,t,o);else if(Array.isArray(r))for(let o of r)vw(e,t,o);else vw(e,t,r)}function vw(e,t,n){let r=G0(e,n);if(!mm.isMap(r))throw new Error("Merge sources must be maps or map aliases");let o=r.toJSON(null,e,Map);for(let[s,a]of o)t instanceof Map?t.has(s)||t.set(s,a):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function G0(e,t){return e&&mm.isAlias(t)?t.resolve(e.doc,e):t}pm.addMergeToJSMap=V0;pm.isMergeKey=U8;pm.merge=fm});var Pw=C(Y0=>{"use strict";var H8=xw(),z0=hm(),V8=yl(),K0=Ie(),Cw=Qi();function G8(e,t,{key:n,value:r}){if(K0.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(z0.isMergeKey(e,n))z0.addMergeToJSMap(e,t,r);else{let o=Cw.toJS(n,"",e);if(t instanceof Map)t.set(o,Cw.toJS(r,o,e));else if(t instanceof Set)t.add(o);else{let s=z8(n,o,e),a=Cw.toJS(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function z8(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(K0.isNode(e)&&n?.doc){let r=V8.createStringifyContext(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let o=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(o);s.length>40&&(s=s.substring(0,36)+'..."'),H8.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return o}return JSON.stringify(t)}Y0.addPairToJSMap=G8});var no=C(Nw=>{"use strict";var X0=ml(),K8=W0(),Y8=Pw(),gm=Ie();function X8(e,t,n){let r=X0.createNode(e,void 0,n),o=X0.createNode(t,void 0,n);return new _m(r,o)}var _m=class e{constructor(t,n=null){Object.defineProperty(this,gm.NODE_TYPE,{value:gm.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return gm.isNode(n)&&(n=n.clone(t)),gm.isNode(r)&&(r=r.clone(t)),new e(n,r)}toJSON(t,n){let r=n?.mapAsMap?new Map:{};return Y8.addPairToJSMap(n,r,this)}toString(t,n,r){return t?.doc?K8.stringifyPair(this,t,n,r):JSON.stringify(this)}};Nw.Pair=_m;Nw.createPair=X8});var Ew=C(Q0=>{"use strict";var Xo=Ie(),J0=yl(),ym=pl();function J8(e,t,n){return(t.inFlow??e.flow?Z8:Q8)(e,t,n)}function Q8({comment:e,items:t},n,{blockItemPrefix:r,flowChars:o,itemIndent:s,onChompKeep:a,onComment:c}){let{indent:l,options:{commentString:u}}=n,d=Object.assign({},n,{indent:s,type:null}),f=!1,m=[];for(let g=0;g<t.length;++g){let h=t[g],y=null;if(Xo.isNode(h))!f&&h.spaceBefore&&m.push(""),bm(n,m,h.commentBefore,f),h.comment&&(y=h.comment);else if(Xo.isPair(h)){let _=Xo.isNode(h.key)?h.key:null;_&&(!f&&_.spaceBefore&&m.push(""),bm(n,m,_.commentBefore,f))}f=!1;let w=J0.stringify(h,d,()=>y=null,()=>f=!0);y&&(w+=ym.lineComment(w,s,u(y))),f&&y&&(f=!1),m.push(r+w)}let p;if(m.length===0)p=o.start+o.end;else{p=m[0];for(let g=1;g<m.length;++g){let h=m[g];p+=h?`
58
+ `)&&(R="");return y+=R+N,n.inFlow?S&&r&&r():b&&!S?y+=Sl.lineComment(y,n.indent,u(b)):h&&o&&o(),y}j0.stringifyPair=j8});var ww=C(Sw=>{"use strict";var U0=require("process");function W8(e,...t){e==="debug"&&console.log(...t)}function U8(e,t){(e==="debug"||e==="warn")&&(typeof U0.emitWarning=="function"?U0.emitWarning(t):console.warn(t))}Sw.debug=W8;Sw.warn=U8});var gm=C(hm=>{"use strict";var pm=Ie(),H0=Dt(),fm="<<",mm={identify:e=>e===fm||typeof e=="symbol"&&e.description===fm,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new H0.Scalar(Symbol(fm)),{addToJSMap:V0}),stringify:()=>fm},H8=(e,t)=>(mm.identify(t)||pm.isScalar(t)&&(!t.type||t.type===H0.Scalar.PLAIN)&&mm.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===mm.tag&&n.default);function V0(e,t,n){let r=G0(e,n);if(pm.isSeq(r))for(let o of r.items)xw(e,t,o);else if(Array.isArray(r))for(let o of r)xw(e,t,o);else xw(e,t,r)}function xw(e,t,n){let r=G0(e,n);if(!pm.isMap(r))throw new Error("Merge sources must be maps or map aliases");let o=r.toJSON(null,e,Map);for(let[s,a]of o)t instanceof Map?t.has(s)||t.set(s,a):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function G0(e,t){return e&&pm.isAlias(t)?t.resolve(e.doc,e):t}hm.addMergeToJSMap=V0;hm.isMergeKey=H8;hm.merge=mm});var Cw=C(Y0=>{"use strict";var V8=ww(),z0=gm(),G8=bl(),K0=Ie(),vw=Qi();function z8(e,t,{key:n,value:r}){if(K0.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(z0.isMergeKey(e,n))z0.addMergeToJSMap(e,t,r);else{let o=vw.toJS(n,"",e);if(t instanceof Map)t.set(o,vw.toJS(r,o,e));else if(t instanceof Set)t.add(o);else{let s=K8(n,o,e),a=vw.toJS(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function K8(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(K0.isNode(e)&&n?.doc){let r=G8.createStringifyContext(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let o=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(o);s.length>40&&(s=s.substring(0,36)+'..."'),V8.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return o}return JSON.stringify(t)}Y0.addPairToJSMap=z8});var no=C(Pw=>{"use strict";var X0=pl(),Y8=W0(),X8=Cw(),_m=Ie();function J8(e,t,n){let r=X0.createNode(e,void 0,n),o=X0.createNode(t,void 0,n);return new ym(r,o)}var ym=class e{constructor(t,n=null){Object.defineProperty(this,_m.NODE_TYPE,{value:_m.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return _m.isNode(n)&&(n=n.clone(t)),_m.isNode(r)&&(r=r.clone(t)),new e(n,r)}toJSON(t,n){let r=n?.mapAsMap?new Map:{};return X8.addPairToJSMap(n,r,this)}toString(t,n,r){return t?.doc?Y8.stringifyPair(this,t,n,r):JSON.stringify(this)}};Pw.Pair=ym;Pw.createPair=J8});var Nw=C(Q0=>{"use strict";var Xo=Ie(),J0=bl(),bm=hl();function Q8(e,t,n){return(t.inFlow??e.flow?e4:Z8)(e,t,n)}function Z8({comment:e,items:t},n,{blockItemPrefix:r,flowChars:o,itemIndent:s,onChompKeep:a,onComment:c}){let{indent:l,options:{commentString:u}}=n,d=Object.assign({},n,{indent:s,type:null}),f=!1,m=[];for(let g=0;g<t.length;++g){let h=t[g],y=null;if(Xo.isNode(h))!f&&h.spaceBefore&&m.push(""),Sm(n,m,h.commentBefore,f),h.comment&&(y=h.comment);else if(Xo.isPair(h)){let _=Xo.isNode(h.key)?h.key:null;_&&(!f&&_.spaceBefore&&m.push(""),Sm(n,m,_.commentBefore,f))}f=!1;let w=J0.stringify(h,d,()=>y=null,()=>f=!0);y&&(w+=bm.lineComment(w,s,u(y))),f&&y&&(f=!1),m.push(r+w)}let p;if(m.length===0)p=o.start+o.end;else{p=m[0];for(let g=1;g<m.length;++g){let h=m[g];p+=h?`
59
59
  ${l}${h}`:`
60
60
  `}}return e?(p+=`
61
- `+ym.indentComment(u(e),l),c&&c()):f&&a&&a(),p}function Z8({items:e},t,{flowChars:n,itemIndent:r}){let{indent:o,indentStep:s,flowCollectionPadding:a,options:{commentString:c}}=t;r+=s;let l=Object.assign({},t,{indent:r,inFlow:!0,type:null}),u=!1,d=0,f=[];for(let g=0;g<e.length;++g){let h=e[g],y=null;if(Xo.isNode(h))h.spaceBefore&&f.push(""),bm(t,f,h.commentBefore,!1),h.comment&&(y=h.comment);else if(Xo.isPair(h)){let _=Xo.isNode(h.key)?h.key:null;_&&(_.spaceBefore&&f.push(""),bm(t,f,_.commentBefore,!1),_.comment&&(u=!0));let b=Xo.isNode(h.value)?h.value:null;b?(b.comment&&(y=b.comment),b.commentBefore&&(u=!0)):h.value==null&&_?.comment&&(y=_.comment)}y&&(u=!0);let w=J0.stringify(h,l,()=>y=null);u||(u=f.length>d||w.includes(`
62
- `)),g<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(u||(u=f.reduce((_,b)=>_+b.length+2,2)+(w.length+2)>t.options.lineWidth)),u&&(w+=",")),y&&(w+=ym.lineComment(w,r,c(y))),f.push(w),d=f.length}let{start:m,end:p}=n;if(f.length===0)return m+p;if(!u){let g=f.reduce((h,y)=>h+y.length+2,2);u=t.options.lineWidth>0&&g>t.options.lineWidth}if(u){let g=m;for(let h of f)g+=h?`
61
+ `+bm.indentComment(u(e),l),c&&c()):f&&a&&a(),p}function e4({items:e},t,{flowChars:n,itemIndent:r}){let{indent:o,indentStep:s,flowCollectionPadding:a,options:{commentString:c}}=t;r+=s;let l=Object.assign({},t,{indent:r,inFlow:!0,type:null}),u=!1,d=0,f=[];for(let g=0;g<e.length;++g){let h=e[g],y=null;if(Xo.isNode(h))h.spaceBefore&&f.push(""),Sm(t,f,h.commentBefore,!1),h.comment&&(y=h.comment);else if(Xo.isPair(h)){let _=Xo.isNode(h.key)?h.key:null;_&&(_.spaceBefore&&f.push(""),Sm(t,f,_.commentBefore,!1),_.comment&&(u=!0));let b=Xo.isNode(h.value)?h.value:null;b?(b.comment&&(y=b.comment),b.commentBefore&&(u=!0)):h.value==null&&_?.comment&&(y=_.comment)}y&&(u=!0);let w=J0.stringify(h,l,()=>y=null);u||(u=f.length>d||w.includes(`
62
+ `)),g<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(u||(u=f.reduce((_,b)=>_+b.length+2,2)+(w.length+2)>t.options.lineWidth)),u&&(w+=",")),y&&(w+=bm.lineComment(w,r,c(y))),f.push(w),d=f.length}let{start:m,end:p}=n;if(f.length===0)return m+p;if(!u){let g=f.reduce((h,y)=>h+y.length+2,2);u=t.options.lineWidth>0&&g>t.options.lineWidth}if(u){let g=m;for(let h of f)g+=h?`
63
63
  ${s}${o}${h}`:`
64
64
  `;return`${g}
65
- ${o}${p}`}else return`${m}${a}${f.join(" ")}${a}${p}`}function bm({indent:e,options:{commentString:t}},n,r,o){if(r&&o&&(r=r.replace(/^\n+/,"")),r){let s=ym.indentComment(t(r),e);n.push(s.trimStart())}}Q0.stringifyCollection=J8});var io=C(Tw=>{"use strict";var e4=Ew(),t4=Pw(),n4=om(),ro=Ie(),Sm=no(),r4=Dt();function Sl(e,t){let n=ro.isScalar(t)?t.value:t;for(let r of e)if(ro.isPair(r)&&(r.key===t||r.key===n||ro.isScalar(r.key)&&r.key.value===n))return r}var Rw=class extends n4.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(ro.MAP,t),this.items=[]}static from(t,n,r){let{keepUndefined:o,replacer:s}=r,a=new this(t),c=(l,u)=>{if(typeof s=="function")u=s.call(n,l,u);else if(Array.isArray(s)&&!s.includes(l))return;(u!==void 0||o)&&a.items.push(Sm.createPair(l,u,r))};if(n instanceof Map)for(let[l,u]of n)c(l,u);else if(n&&typeof n=="object")for(let l of Object.keys(n))c(l,n[l]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){let r;ro.isPair(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Sm.Pair(t,t?.value):r=new Sm.Pair(t.key,t.value);let o=Sl(this.items,r.key),s=this.schema?.sortMapEntries;if(o){if(!n)throw new Error(`Key ${r.key} already set`);ro.isScalar(o.value)&&r4.isScalarValue(r.value)?o.value.value=r.value:o.value=r.value}else if(s){let a=this.items.findIndex(c=>s(r,c)<0);a===-1?this.items.push(r):this.items.splice(a,0,r)}else this.items.push(r)}delete(t){let n=Sl(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let o=Sl(this.items,t)?.value;return(!n&&ro.isScalar(o)?o.value:o)??void 0}has(t){return!!Sl(this.items,t)}set(t,n){this.add(new Sm.Pair(t,n),!0)}toJSON(t,n,r){let o=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(o);for(let s of this.items)t4.addPairToJSMap(n,o,s);return o}toString(t,n,r){if(!t)return JSON.stringify(this);for(let o of this.items)if(!ro.isPair(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),e4.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}};Tw.YAMLMap=Rw;Tw.findPair=Sl});var Sa=C(eF=>{"use strict";var i4=Ie(),Z0=io(),o4={collection:"map",default:!0,nodeClass:Z0.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return i4.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Z0.YAMLMap.from(e,t,n)};eF.map=o4});var oo=C(tF=>{"use strict";var s4=ml(),a4=Ew(),c4=om(),xm=Ie(),l4=Dt(),u4=Qi(),Aw=class extends c4.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(xm.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=wm(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let r=wm(t);if(typeof r!="number")return;let o=this.items[r];return!n&&xm.isScalar(o)?o.value:o}has(t){let n=wm(t);return typeof n=="number"&&n<this.items.length}set(t,n){let r=wm(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let o=this.items[r];xm.isScalar(o)&&l4.isScalarValue(n)?o.value=n:this.items[r]=n}toJSON(t,n){let r=[];n?.onCreate&&n.onCreate(r);let o=0;for(let s of this.items)r.push(u4.toJS(s,String(o++),n));return r}toString(t,n,r){return t?a4.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(t,n,r){let{replacer:o}=r,s=new this(t);if(n&&Symbol.iterator in Object(n)){let a=0;for(let c of n){if(typeof o=="function"){let l=n instanceof Set?c:String(a++);c=o.call(n,l,c)}s.items.push(s4.createNode(c,void 0,r))}}return s}};function wm(e){let t=xm.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}tF.YAMLSeq=Aw});var wa=C(rF=>{"use strict";var d4=Ie(),nF=oo(),f4={collection:"seq",default:!0,nodeClass:nF.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return d4.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>nF.YAMLSeq.from(e,t,n)};rF.seq=f4});var wl=C(iF=>{"use strict";var m4=_l(),p4={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),m4.stringifyString(e,t,n,r)}};iF.string=p4});var vm=C(aF=>{"use strict";var oF=Dt(),sF={identify:e=>e==null,createNode:()=>new oF.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new oF.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&sF.test.test(e)?e:t.options.nullStr};aF.nullTag=sF});var Iw=C(lF=>{"use strict";var h4=Dt(),cF={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new h4.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&cF.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};lF.boolTag=cF});var xa=C(uF=>{"use strict";function g4({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);let o=typeof r=="number"?r:Number(r);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let a=s.indexOf(".");a<0&&(a=s.length,s+=".");let c=t-(s.length-a-1);for(;c-- >0;)s+="0"}return s}uF.stringifyNumber=g4});var kw=C(Cm=>{"use strict";var _4=Dt(),Dw=xa(),y4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Dw.stringifyNumber},b4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Dw.stringifyNumber(e)}},S4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new _4.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Dw.stringifyNumber};Cm.float=S4;Cm.floatExp=b4;Cm.floatNaN=y4});var Lw=C(Nm=>{"use strict";var dF=xa(),Pm=e=>typeof e=="bigint"||Number.isInteger(e),Fw=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function fF(e,t,n){let{value:r}=e;return Pm(r)&&r>=0?n+r.toString(t):dF.stringifyNumber(e)}var w4={identify:e=>Pm(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Fw(e,2,8,n),stringify:e=>fF(e,8,"0o")},x4={identify:Pm,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Fw(e,0,10,n),stringify:dF.stringifyNumber},v4={identify:e=>Pm(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Fw(e,2,16,n),stringify:e=>fF(e,16,"0x")};Nm.int=x4;Nm.intHex=v4;Nm.intOct=w4});var pF=C(mF=>{"use strict";var C4=Sa(),P4=vm(),N4=wa(),E4=wl(),R4=Iw(),Ow=kw(),Mw=Lw(),T4=[C4.map,N4.seq,E4.string,P4.nullTag,R4.boolTag,Mw.intOct,Mw.int,Mw.intHex,Ow.floatNaN,Ow.floatExp,Ow.float];mF.schema=T4});var _F=C(gF=>{"use strict";var A4=Dt(),I4=Sa(),D4=wa();function hF(e){return typeof e=="bigint"||Number.isInteger(e)}var Em=({value:e})=>JSON.stringify(e),k4=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Em},{identify:e=>e==null,createNode:()=>new A4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Em},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Em},{identify:hF,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>hF(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Em}],F4={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},L4=[I4.map,D4.seq].concat(k4,F4);gF.schema=L4});var qw=C(yF=>{"use strict";var xl=require("buffer"),$w=Dt(),O4=_l(),M4={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof xl.Buffer=="function")return xl.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let o=0;o<n.length;++o)r[o]=n.charCodeAt(o);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},r,o,s){if(!n)return"";let a=n,c;if(typeof xl.Buffer=="function")c=a instanceof xl.Buffer?a.toString("base64"):xl.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let u=0;u<a.length;++u)l+=String.fromCharCode(a[u]);c=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=$w.Scalar.BLOCK_LITERAL),t!==$w.Scalar.QUOTE_DOUBLE){let l=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),u=Math.ceil(c.length/l),d=new Array(u);for(let f=0,m=0;f<u;++f,m+=l)d[f]=c.substr(m,l);c=d.join(t===$w.Scalar.BLOCK_LITERAL?`
66
- `:" ")}return O4.stringifyString({comment:e,type:t,value:c},r,o,s)}};yF.binary=M4});var Am=C(Tm=>{"use strict";var Rm=Ie(),Bw=no(),$4=Dt(),q4=oo();function bF(e,t){if(Rm.isSeq(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Rm.isPair(r)){if(Rm.isMap(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let o=r.items[0]||new Bw.Pair(new $4.Scalar(null));if(r.commentBefore&&(o.key.commentBefore=o.key.commentBefore?`${r.commentBefore}
65
+ ${o}${p}`}else return`${m}${a}${f.join(" ")}${a}${p}`}function Sm({indent:e,options:{commentString:t}},n,r,o){if(r&&o&&(r=r.replace(/^\n+/,"")),r){let s=bm.indentComment(t(r),e);n.push(s.trimStart())}}Q0.stringifyCollection=Q8});var io=C(Rw=>{"use strict";var t4=Nw(),n4=Cw(),r4=sm(),ro=Ie(),wm=no(),i4=Dt();function wl(e,t){let n=ro.isScalar(t)?t.value:t;for(let r of e)if(ro.isPair(r)&&(r.key===t||r.key===n||ro.isScalar(r.key)&&r.key.value===n))return r}var Ew=class extends r4.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(ro.MAP,t),this.items=[]}static from(t,n,r){let{keepUndefined:o,replacer:s}=r,a=new this(t),c=(l,u)=>{if(typeof s=="function")u=s.call(n,l,u);else if(Array.isArray(s)&&!s.includes(l))return;(u!==void 0||o)&&a.items.push(wm.createPair(l,u,r))};if(n instanceof Map)for(let[l,u]of n)c(l,u);else if(n&&typeof n=="object")for(let l of Object.keys(n))c(l,n[l]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){let r;ro.isPair(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new wm.Pair(t,t?.value):r=new wm.Pair(t.key,t.value);let o=wl(this.items,r.key),s=this.schema?.sortMapEntries;if(o){if(!n)throw new Error(`Key ${r.key} already set`);ro.isScalar(o.value)&&i4.isScalarValue(r.value)?o.value.value=r.value:o.value=r.value}else if(s){let a=this.items.findIndex(c=>s(r,c)<0);a===-1?this.items.push(r):this.items.splice(a,0,r)}else this.items.push(r)}delete(t){let n=wl(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let o=wl(this.items,t)?.value;return(!n&&ro.isScalar(o)?o.value:o)??void 0}has(t){return!!wl(this.items,t)}set(t,n){this.add(new wm.Pair(t,n),!0)}toJSON(t,n,r){let o=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(o);for(let s of this.items)n4.addPairToJSMap(n,o,s);return o}toString(t,n,r){if(!t)return JSON.stringify(this);for(let o of this.items)if(!ro.isPair(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),t4.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}};Rw.YAMLMap=Ew;Rw.findPair=wl});var Sa=C(eF=>{"use strict";var o4=Ie(),Z0=io(),s4={collection:"map",default:!0,nodeClass:Z0.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return o4.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Z0.YAMLMap.from(e,t,n)};eF.map=s4});var oo=C(tF=>{"use strict";var a4=pl(),c4=Nw(),l4=sm(),vm=Ie(),u4=Dt(),d4=Qi(),Tw=class extends l4.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(vm.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=xm(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let r=xm(t);if(typeof r!="number")return;let o=this.items[r];return!n&&vm.isScalar(o)?o.value:o}has(t){let n=xm(t);return typeof n=="number"&&n<this.items.length}set(t,n){let r=xm(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let o=this.items[r];vm.isScalar(o)&&u4.isScalarValue(n)?o.value=n:this.items[r]=n}toJSON(t,n){let r=[];n?.onCreate&&n.onCreate(r);let o=0;for(let s of this.items)r.push(d4.toJS(s,String(o++),n));return r}toString(t,n,r){return t?c4.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(t,n,r){let{replacer:o}=r,s=new this(t);if(n&&Symbol.iterator in Object(n)){let a=0;for(let c of n){if(typeof o=="function"){let l=n instanceof Set?c:String(a++);c=o.call(n,l,c)}s.items.push(a4.createNode(c,void 0,r))}}return s}};function xm(e){let t=vm.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}tF.YAMLSeq=Tw});var wa=C(rF=>{"use strict";var f4=Ie(),nF=oo(),m4={collection:"seq",default:!0,nodeClass:nF.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return f4.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>nF.YAMLSeq.from(e,t,n)};rF.seq=m4});var xl=C(iF=>{"use strict";var p4=yl(),h4={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),p4.stringifyString(e,t,n,r)}};iF.string=h4});var Cm=C(aF=>{"use strict";var oF=Dt(),sF={identify:e=>e==null,createNode:()=>new oF.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new oF.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&sF.test.test(e)?e:t.options.nullStr};aF.nullTag=sF});var Aw=C(lF=>{"use strict";var g4=Dt(),cF={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new g4.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&cF.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};lF.boolTag=cF});var xa=C(uF=>{"use strict";function _4({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);let o=typeof r=="number"?r:Number(r);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let a=s.indexOf(".");a<0&&(a=s.length,s+=".");let c=t-(s.length-a-1);for(;c-- >0;)s+="0"}return s}uF.stringifyNumber=_4});var Dw=C(Pm=>{"use strict";var y4=Dt(),Iw=xa(),b4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Iw.stringifyNumber},S4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Iw.stringifyNumber(e)}},w4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new y4.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Iw.stringifyNumber};Pm.float=w4;Pm.floatExp=S4;Pm.floatNaN=b4});var Fw=C(Em=>{"use strict";var dF=xa(),Nm=e=>typeof e=="bigint"||Number.isInteger(e),kw=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function fF(e,t,n){let{value:r}=e;return Nm(r)&&r>=0?n+r.toString(t):dF.stringifyNumber(e)}var x4={identify:e=>Nm(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>kw(e,2,8,n),stringify:e=>fF(e,8,"0o")},v4={identify:Nm,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>kw(e,0,10,n),stringify:dF.stringifyNumber},C4={identify:e=>Nm(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>kw(e,2,16,n),stringify:e=>fF(e,16,"0x")};Em.int=v4;Em.intHex=C4;Em.intOct=x4});var pF=C(mF=>{"use strict";var P4=Sa(),N4=Cm(),E4=wa(),R4=xl(),T4=Aw(),Lw=Dw(),Ow=Fw(),A4=[P4.map,E4.seq,R4.string,N4.nullTag,T4.boolTag,Ow.intOct,Ow.int,Ow.intHex,Lw.floatNaN,Lw.floatExp,Lw.float];mF.schema=A4});var _F=C(gF=>{"use strict";var I4=Dt(),D4=Sa(),k4=wa();function hF(e){return typeof e=="bigint"||Number.isInteger(e)}var Rm=({value:e})=>JSON.stringify(e),F4=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Rm},{identify:e=>e==null,createNode:()=>new I4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Rm},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Rm},{identify:hF,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>hF(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Rm}],L4={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},O4=[D4.map,k4.seq].concat(F4,L4);gF.schema=O4});var $w=C(yF=>{"use strict";var vl=require("buffer"),Mw=Dt(),M4=yl(),$4={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof vl.Buffer=="function")return vl.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let o=0;o<n.length;++o)r[o]=n.charCodeAt(o);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},r,o,s){if(!n)return"";let a=n,c;if(typeof vl.Buffer=="function")c=a instanceof vl.Buffer?a.toString("base64"):vl.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let u=0;u<a.length;++u)l+=String.fromCharCode(a[u]);c=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Mw.Scalar.BLOCK_LITERAL),t!==Mw.Scalar.QUOTE_DOUBLE){let l=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),u=Math.ceil(c.length/l),d=new Array(u);for(let f=0,m=0;f<u;++f,m+=l)d[f]=c.substr(m,l);c=d.join(t===Mw.Scalar.BLOCK_LITERAL?`
66
+ `:" ")}return M4.stringifyString({comment:e,type:t,value:c},r,o,s)}};yF.binary=$4});var Im=C(Am=>{"use strict";var Tm=Ie(),qw=no(),q4=Dt(),B4=oo();function bF(e,t){if(Tm.isSeq(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Tm.isPair(r)){if(Tm.isMap(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let o=r.items[0]||new qw.Pair(new q4.Scalar(null));if(r.commentBefore&&(o.key.commentBefore=o.key.commentBefore?`${r.commentBefore}
67
67
  ${o.key.commentBefore}`:r.commentBefore),r.comment){let s=o.value??o.key;s.comment=s.comment?`${r.comment}
68
- ${s.comment}`:r.comment}r=o}e.items[n]=Rm.isPair(r)?r:new Bw.Pair(r)}}else t("Expected a sequence for this tag");return e}function SF(e,t,n){let{replacer:r}=n,o=new q4.YAMLSeq(e);o.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(s++),a));let c,l;if(Array.isArray(a))if(a.length===2)c=a[0],l=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let u=Object.keys(a);if(u.length===1)c=u[0],l=a[c];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else c=a;o.items.push(Bw.createPair(c,l,n))}return o}var B4={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:bF,createNode:SF};Tm.createPairs=SF;Tm.pairs=B4;Tm.resolvePairs=bF});var Uw=C(Ww=>{"use strict";var wF=Ie(),jw=Qi(),vl=io(),j4=oo(),xF=Am(),Jo=class e extends j4.YAMLSeq{constructor(){super(),this.add=vl.YAMLMap.prototype.add.bind(this),this.delete=vl.YAMLMap.prototype.delete.bind(this),this.get=vl.YAMLMap.prototype.get.bind(this),this.has=vl.YAMLMap.prototype.has.bind(this),this.set=vl.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let r=new Map;n?.onCreate&&n.onCreate(r);for(let o of this.items){let s,a;if(wF.isPair(o)?(s=jw.toJS(o.key,"",n),a=jw.toJS(o.value,s,n)):s=jw.toJS(o,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,a)}return r}static from(t,n,r){let o=xF.createPairs(t,n,r),s=new this;return s.items=o.items,s}};Jo.tag="tag:yaml.org,2002:omap";var W4={collection:"seq",identify:e=>e instanceof Map,nodeClass:Jo,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=xF.resolvePairs(e,t),r=[];for(let{key:o}of n.items)wF.isScalar(o)&&(r.includes(o.value)?t(`Ordered maps must not include duplicate keys: ${o.value}`):r.push(o.value));return Object.assign(new Jo,n)},createNode:(e,t,n)=>Jo.from(e,t,n)};Ww.YAMLOMap=Jo;Ww.omap=W4});var EF=C(Hw=>{"use strict";var vF=Dt();function CF({value:e,source:t},n){return t&&(e?PF:NF).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var PF={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new vF.Scalar(!0),stringify:CF},NF={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new vF.Scalar(!1),stringify:CF};Hw.falseTag=NF;Hw.trueTag=PF});var RF=C(Im=>{"use strict";var U4=Dt(),Vw=xa(),H4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Vw.stringifyNumber},V4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Vw.stringifyNumber(e)}},G4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new U4.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:Vw.stringifyNumber};Im.float=G4;Im.floatExp=V4;Im.floatNaN=H4});var AF=C(Pl=>{"use strict";var TF=xa(),Cl=e=>typeof e=="bigint"||Number.isInteger(e);function Dm(e,t,n,{intAsBigInt:r}){let o=e[0];if((o==="-"||o==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let a=BigInt(e);return o==="-"?BigInt(-1)*a:a}let s=parseInt(e,n);return o==="-"?-1*s:s}function Gw(e,t,n){let{value:r}=e;if(Cl(r)){let o=r.toString(t);return r<0?"-"+n+o.substr(1):n+o}return TF.stringifyNumber(e)}var z4={identify:Cl,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Dm(e,2,2,n),stringify:e=>Gw(e,2,"0b")},K4={identify:Cl,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Dm(e,1,8,n),stringify:e=>Gw(e,8,"0")},Y4={identify:Cl,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Dm(e,0,10,n),stringify:TF.stringifyNumber},X4={identify:Cl,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Dm(e,2,16,n),stringify:e=>Gw(e,16,"0x")};Pl.int=Y4;Pl.intBin=z4;Pl.intHex=X4;Pl.intOct=K4});var Kw=C(zw=>{"use strict";var Lm=Ie(),km=no(),Fm=io(),Qo=class e extends Fm.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Lm.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new km.Pair(t.key,null):n=new km.Pair(t,null),Fm.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let r=Fm.findPair(this.items,t);return!n&&Lm.isPair(r)?Lm.isScalar(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=Fm.findPair(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new km.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){let{replacer:o}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof o=="function"&&(a=o.call(n,a,a)),s.items.push(km.createPair(a,null,r));return s}};Qo.tag="tag:yaml.org,2002:set";var J4={collection:"map",identify:e=>e instanceof Set,nodeClass:Qo,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Qo.from(e,t,n),resolve(e,t){if(Lm.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Qo,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};zw.YAMLSet=Qo;zw.set=J4});var Xw=C(Om=>{"use strict";var Q4=xa();function Yw(e,t){let n=e[0],r=n==="-"||n==="+"?e.substring(1):e,o=a=>t?BigInt(a):Number(a),s=r.replace(/_/g,"").split(":").reduce((a,c)=>a*o(60)+o(c),o(0));return n==="-"?o(-1)*s:s}function IF(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Q4.stringifyNumber(e);let r="";t<0&&(r="-",t*=n(-1));let o=n(60),s=[t%o];return t<60?s.unshift(0):(t=(t-s[0])/o,s.unshift(t%o),t>=60&&(t=(t-s[0])/o,s.unshift(t))),r+s.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Z4={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Yw(e,n),stringify:IF},e6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Yw(e,!1),stringify:IF},DF={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(DF.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,o,s,a,c]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,u=Date.UTC(n,r-1,o,s||0,a||0,c||0,l),d=t[8];if(d&&d!=="Z"){let f=Yw(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Om.floatTime=e6;Om.intTime=Z4;Om.timestamp=DF});var LF=C(FF=>{"use strict";var t6=Sa(),n6=vm(),r6=wa(),i6=wl(),o6=qw(),kF=EF(),Jw=RF(),Mm=AF(),s6=hm(),a6=Uw(),c6=Am(),l6=Kw(),Qw=Xw(),u6=[t6.map,r6.seq,i6.string,n6.nullTag,kF.trueTag,kF.falseTag,Mm.intBin,Mm.intOct,Mm.int,Mm.intHex,Jw.floatNaN,Jw.floatExp,Jw.float,o6.binary,s6.merge,a6.omap,c6.pairs,l6.set,Qw.intTime,Qw.floatTime,Qw.timestamp];FF.schema=u6});var VF=C(tx=>{"use strict";var qF=Sa(),d6=vm(),BF=wa(),f6=wl(),m6=Iw(),Zw=kw(),ex=Lw(),p6=pF(),h6=_F(),jF=qw(),Nl=hm(),WF=Uw(),UF=Am(),OF=LF(),HF=Kw(),$m=Xw(),MF=new Map([["core",p6.schema],["failsafe",[qF.map,BF.seq,f6.string]],["json",h6.schema],["yaml11",OF.schema],["yaml-1.1",OF.schema]]),$F={binary:jF.binary,bool:m6.boolTag,float:Zw.float,floatExp:Zw.floatExp,floatNaN:Zw.floatNaN,floatTime:$m.floatTime,int:ex.int,intHex:ex.intHex,intOct:ex.intOct,intTime:$m.intTime,map:qF.map,merge:Nl.merge,null:d6.nullTag,omap:WF.omap,pairs:UF.pairs,seq:BF.seq,set:HF.set,timestamp:$m.timestamp},g6={"tag:yaml.org,2002:binary":jF.binary,"tag:yaml.org,2002:merge":Nl.merge,"tag:yaml.org,2002:omap":WF.omap,"tag:yaml.org,2002:pairs":UF.pairs,"tag:yaml.org,2002:set":HF.set,"tag:yaml.org,2002:timestamp":$m.timestamp};function _6(e,t,n){let r=MF.get(t);if(r&&!e)return n&&!r.includes(Nl.merge)?r.concat(Nl.merge):r.slice();let o=r;if(!o)if(Array.isArray(e))o=[];else{let s=Array.from(MF.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(let s of e)o=o.concat(s);else typeof e=="function"&&(o=e(o.slice()));return n&&(o=o.concat(Nl.merge)),o.reduce((s,a)=>{let c=typeof a=="string"?$F[a]:a;if(!c){let l=JSON.stringify(a),u=Object.keys($F).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${u}`)}return s.includes(c)||s.push(c),s},[])}tx.coreKnownTags=g6;tx.getTags=_6});var ix=C(GF=>{"use strict";var nx=Ie(),y6=Sa(),b6=wa(),S6=wl(),qm=VF(),w6=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,rx=class e{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:o,schema:s,sortMapEntries:a,toStringDefaults:c}){this.compat=Array.isArray(t)?qm.getTags(t,"compat"):t?qm.getTags(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=o?qm.coreKnownTags:{},this.tags=qm.getTags(n,this.name,r),this.toStringOptions=c??null,Object.defineProperty(this,nx.MAP,{value:y6.map}),Object.defineProperty(this,nx.SCALAR,{value:S6.string}),Object.defineProperty(this,nx.SEQ,{value:b6.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?w6:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};GF.Schema=rx});var KF=C(zF=>{"use strict";var x6=Ie(),ox=yl(),El=pl();function v6(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let o=ox.createStringifyContext(e,t),{commentString:s}=o.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=s(e.commentBefore);n.unshift(El.indentComment(l,""))}let a=!1,c=null;if(e.contents){if(x6.isNode(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let d=s(e.contents.commentBefore);n.push(El.indentComment(d,""))}o.forceBlockIndent=!!e.comment,c=e.contents.comment}let l=c?void 0:()=>a=!0,u=ox.stringify(e.contents,o,()=>c=null,l);c&&(u+=El.lineComment(u,"",s(c))),(u[0]==="|"||u[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${u}`:n.push(u)}else n.push(ox.stringify(e.contents,o));if(e.directives?.docEnd)if(e.comment){let l=s(e.comment);l.includes(`
69
- `)?(n.push("..."),n.push(El.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=e.comment;l&&a&&(l=l.replace(/^\n+/,"")),l&&((!a||c)&&n[n.length-1]!==""&&n.push(""),n.push(El.indentComment(s(l),"")))}return n.join(`
68
+ ${s.comment}`:r.comment}r=o}e.items[n]=Tm.isPair(r)?r:new qw.Pair(r)}}else t("Expected a sequence for this tag");return e}function SF(e,t,n){let{replacer:r}=n,o=new B4.YAMLSeq(e);o.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(s++),a));let c,l;if(Array.isArray(a))if(a.length===2)c=a[0],l=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let u=Object.keys(a);if(u.length===1)c=u[0],l=a[c];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else c=a;o.items.push(qw.createPair(c,l,n))}return o}var j4={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:bF,createNode:SF};Am.createPairs=SF;Am.pairs=j4;Am.resolvePairs=bF});var Ww=C(jw=>{"use strict";var wF=Ie(),Bw=Qi(),Cl=io(),W4=oo(),xF=Im(),Jo=class e extends W4.YAMLSeq{constructor(){super(),this.add=Cl.YAMLMap.prototype.add.bind(this),this.delete=Cl.YAMLMap.prototype.delete.bind(this),this.get=Cl.YAMLMap.prototype.get.bind(this),this.has=Cl.YAMLMap.prototype.has.bind(this),this.set=Cl.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let r=new Map;n?.onCreate&&n.onCreate(r);for(let o of this.items){let s,a;if(wF.isPair(o)?(s=Bw.toJS(o.key,"",n),a=Bw.toJS(o.value,s,n)):s=Bw.toJS(o,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,a)}return r}static from(t,n,r){let o=xF.createPairs(t,n,r),s=new this;return s.items=o.items,s}};Jo.tag="tag:yaml.org,2002:omap";var U4={collection:"seq",identify:e=>e instanceof Map,nodeClass:Jo,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=xF.resolvePairs(e,t),r=[];for(let{key:o}of n.items)wF.isScalar(o)&&(r.includes(o.value)?t(`Ordered maps must not include duplicate keys: ${o.value}`):r.push(o.value));return Object.assign(new Jo,n)},createNode:(e,t,n)=>Jo.from(e,t,n)};jw.YAMLOMap=Jo;jw.omap=U4});var EF=C(Uw=>{"use strict";var vF=Dt();function CF({value:e,source:t},n){return t&&(e?PF:NF).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var PF={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new vF.Scalar(!0),stringify:CF},NF={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new vF.Scalar(!1),stringify:CF};Uw.falseTag=NF;Uw.trueTag=PF});var RF=C(Dm=>{"use strict";var H4=Dt(),Hw=xa(),V4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Hw.stringifyNumber},G4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Hw.stringifyNumber(e)}},z4={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new H4.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:Hw.stringifyNumber};Dm.float=z4;Dm.floatExp=G4;Dm.floatNaN=V4});var AF=C(Nl=>{"use strict";var TF=xa(),Pl=e=>typeof e=="bigint"||Number.isInteger(e);function km(e,t,n,{intAsBigInt:r}){let o=e[0];if((o==="-"||o==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let a=BigInt(e);return o==="-"?BigInt(-1)*a:a}let s=parseInt(e,n);return o==="-"?-1*s:s}function Vw(e,t,n){let{value:r}=e;if(Pl(r)){let o=r.toString(t);return r<0?"-"+n+o.substr(1):n+o}return TF.stringifyNumber(e)}var K4={identify:Pl,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>km(e,2,2,n),stringify:e=>Vw(e,2,"0b")},Y4={identify:Pl,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>km(e,1,8,n),stringify:e=>Vw(e,8,"0")},X4={identify:Pl,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>km(e,0,10,n),stringify:TF.stringifyNumber},J4={identify:Pl,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>km(e,2,16,n),stringify:e=>Vw(e,16,"0x")};Nl.int=X4;Nl.intBin=K4;Nl.intHex=J4;Nl.intOct=Y4});var zw=C(Gw=>{"use strict";var Om=Ie(),Fm=no(),Lm=io(),Qo=class e extends Lm.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Om.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Fm.Pair(t.key,null):n=new Fm.Pair(t,null),Lm.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let r=Lm.findPair(this.items,t);return!n&&Om.isPair(r)?Om.isScalar(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=Lm.findPair(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Fm.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){let{replacer:o}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof o=="function"&&(a=o.call(n,a,a)),s.items.push(Fm.createPair(a,null,r));return s}};Qo.tag="tag:yaml.org,2002:set";var Q4={collection:"map",identify:e=>e instanceof Set,nodeClass:Qo,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Qo.from(e,t,n),resolve(e,t){if(Om.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Qo,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Gw.YAMLSet=Qo;Gw.set=Q4});var Yw=C(Mm=>{"use strict";var Z4=xa();function Kw(e,t){let n=e[0],r=n==="-"||n==="+"?e.substring(1):e,o=a=>t?BigInt(a):Number(a),s=r.replace(/_/g,"").split(":").reduce((a,c)=>a*o(60)+o(c),o(0));return n==="-"?o(-1)*s:s}function IF(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Z4.stringifyNumber(e);let r="";t<0&&(r="-",t*=n(-1));let o=n(60),s=[t%o];return t<60?s.unshift(0):(t=(t-s[0])/o,s.unshift(t%o),t>=60&&(t=(t-s[0])/o,s.unshift(t))),r+s.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var e6={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Kw(e,n),stringify:IF},t6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Kw(e,!1),stringify:IF},DF={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(DF.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,o,s,a,c]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,u=Date.UTC(n,r-1,o,s||0,a||0,c||0,l),d=t[8];if(d&&d!=="Z"){let f=Kw(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Mm.floatTime=t6;Mm.intTime=e6;Mm.timestamp=DF});var LF=C(FF=>{"use strict";var n6=Sa(),r6=Cm(),i6=wa(),o6=xl(),s6=$w(),kF=EF(),Xw=RF(),$m=AF(),a6=gm(),c6=Ww(),l6=Im(),u6=zw(),Jw=Yw(),d6=[n6.map,i6.seq,o6.string,r6.nullTag,kF.trueTag,kF.falseTag,$m.intBin,$m.intOct,$m.int,$m.intHex,Xw.floatNaN,Xw.floatExp,Xw.float,s6.binary,a6.merge,c6.omap,l6.pairs,u6.set,Jw.intTime,Jw.floatTime,Jw.timestamp];FF.schema=d6});var VF=C(ex=>{"use strict";var qF=Sa(),f6=Cm(),BF=wa(),m6=xl(),p6=Aw(),Qw=Dw(),Zw=Fw(),h6=pF(),g6=_F(),jF=$w(),El=gm(),WF=Ww(),UF=Im(),OF=LF(),HF=zw(),qm=Yw(),MF=new Map([["core",h6.schema],["failsafe",[qF.map,BF.seq,m6.string]],["json",g6.schema],["yaml11",OF.schema],["yaml-1.1",OF.schema]]),$F={binary:jF.binary,bool:p6.boolTag,float:Qw.float,floatExp:Qw.floatExp,floatNaN:Qw.floatNaN,floatTime:qm.floatTime,int:Zw.int,intHex:Zw.intHex,intOct:Zw.intOct,intTime:qm.intTime,map:qF.map,merge:El.merge,null:f6.nullTag,omap:WF.omap,pairs:UF.pairs,seq:BF.seq,set:HF.set,timestamp:qm.timestamp},_6={"tag:yaml.org,2002:binary":jF.binary,"tag:yaml.org,2002:merge":El.merge,"tag:yaml.org,2002:omap":WF.omap,"tag:yaml.org,2002:pairs":UF.pairs,"tag:yaml.org,2002:set":HF.set,"tag:yaml.org,2002:timestamp":qm.timestamp};function y6(e,t,n){let r=MF.get(t);if(r&&!e)return n&&!r.includes(El.merge)?r.concat(El.merge):r.slice();let o=r;if(!o)if(Array.isArray(e))o=[];else{let s=Array.from(MF.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(let s of e)o=o.concat(s);else typeof e=="function"&&(o=e(o.slice()));return n&&(o=o.concat(El.merge)),o.reduce((s,a)=>{let c=typeof a=="string"?$F[a]:a;if(!c){let l=JSON.stringify(a),u=Object.keys($F).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${u}`)}return s.includes(c)||s.push(c),s},[])}ex.coreKnownTags=_6;ex.getTags=y6});var rx=C(GF=>{"use strict";var tx=Ie(),b6=Sa(),S6=wa(),w6=xl(),Bm=VF(),x6=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,nx=class e{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:o,schema:s,sortMapEntries:a,toStringDefaults:c}){this.compat=Array.isArray(t)?Bm.getTags(t,"compat"):t?Bm.getTags(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=o?Bm.coreKnownTags:{},this.tags=Bm.getTags(n,this.name,r),this.toStringOptions=c??null,Object.defineProperty(this,tx.MAP,{value:b6.map}),Object.defineProperty(this,tx.SCALAR,{value:w6.string}),Object.defineProperty(this,tx.SEQ,{value:S6.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?x6:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};GF.Schema=nx});var KF=C(zF=>{"use strict";var v6=Ie(),ix=bl(),Rl=hl();function C6(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let o=ix.createStringifyContext(e,t),{commentString:s}=o.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=s(e.commentBefore);n.unshift(Rl.indentComment(l,""))}let a=!1,c=null;if(e.contents){if(v6.isNode(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let d=s(e.contents.commentBefore);n.push(Rl.indentComment(d,""))}o.forceBlockIndent=!!e.comment,c=e.contents.comment}let l=c?void 0:()=>a=!0,u=ix.stringify(e.contents,o,()=>c=null,l);c&&(u+=Rl.lineComment(u,"",s(c))),(u[0]==="|"||u[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${u}`:n.push(u)}else n.push(ix.stringify(e.contents,o));if(e.directives?.docEnd)if(e.comment){let l=s(e.comment);l.includes(`
69
+ `)?(n.push("..."),n.push(Rl.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=e.comment;l&&a&&(l=l.replace(/^\n+/,"")),l&&((!a||c)&&n[n.length-1]!==""&&n.push(""),n.push(Rl.indentComment(s(l),"")))}return n.join(`
70
70
  `)+`
71
- `}zF.stringifyDocument=v6});var Rl=C(YF=>{"use strict";var C6=fl(),va=om(),ar=Ie(),P6=no(),N6=Qi(),E6=ix(),R6=KF(),sx=tm(),T6=uw(),A6=ml(),ax=lw(),cx=class e{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ar.NODE_TYPE,{value:ar.DOC});let o=null;typeof n=="function"||Array.isArray(n)?o=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:a}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new ax.Directives({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,o,r)}clone(){let t=Object.create(e.prototype,{[ar.NODE_TYPE]:{value:ar.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=ar.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Ca(this.contents)&&this.contents.add(t)}addIn(t,n){Ca(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let r=sx.anchorNames(this);t.anchor=!n||r.has(n)?sx.findNewAnchor(n||"a",r):n}return new C6.Alias(t.anchor)}createNode(t,n,r){let o;if(typeof n=="function")t=n.call({"":t},"",t),o=n;else if(Array.isArray(n)){let y=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,w=n.filter(y).map(String);w.length>0&&(n=n.concat(w)),o=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:a,flow:c,keepUndefined:l,onTagObj:u,tag:d}=r??{},{onAnchor:f,setAnchors:m,sourceObjects:p}=sx.createNodeAnchors(this,a||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:u,replacer:o,schema:this.schema,sourceObjects:p},h=A6.createNode(t,d,g);return c&&ar.isCollection(h)&&(h.flow=!0),m(),h}createPair(t,n,r={}){let o=this.createNode(t,null,r),s=this.createNode(n,null,r);return new P6.Pair(o,s)}delete(t){return Ca(this.contents)?this.contents.delete(t):!1}deleteIn(t){return va.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):Ca(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return ar.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return va.isEmptyPath(t)?!n&&ar.isScalar(this.contents)?this.contents.value:this.contents:ar.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return ar.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return va.isEmptyPath(t)?this.contents!==void 0:ar.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=va.collectionFromPath(this.schema,[t],n):Ca(this.contents)&&this.contents.set(t,n)}setIn(t,n){va.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=va.collectionFromPath(this.schema,Array.from(t),n):Ca(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ax.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new ax.Directives({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let o=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new E6.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:o,onAnchor:s,reviver:a}={}){let c={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},l=N6.toJS(this.contents,n??"",c);if(typeof s=="function")for(let{count:u,res:d}of c.anchors.values())s(d,u);return typeof a=="function"?T6.applyReviver(a,{"":l},"",l):l}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return R6.stringifyDocument(this,t)}};function Ca(e){if(ar.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}YF.Document=cx});var Il=C(Al=>{"use strict";var Tl=class extends Error{constructor(t,n,r,o){super(),this.name=t,this.code=r,this.message=o,this.pos=n}},lx=class extends Tl{constructor(t,n,r){super("YAMLParseError",t,n,r)}},ux=class extends Tl{constructor(t,n,r){super("YAMLWarning",t,n,r)}},I6=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(c=>t.linePos(c));let{line:r,col:o}=n.linePos[0];n.message+=` at line ${r}, column ${o}`;let s=o-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&a.length>80){let c=Math.min(s-39,a.length-79);a="\u2026"+a.substring(c),s-=c-1}if(a.length>80&&(a=a.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(a.substring(0,s))){let c=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);c.length>80&&(c=c.substring(0,79)+`\u2026
71
+ `}zF.stringifyDocument=C6});var Tl=C(YF=>{"use strict";var P6=ml(),va=sm(),ar=Ie(),N6=no(),E6=Qi(),R6=rx(),T6=KF(),ox=nm(),A6=lw(),I6=pl(),sx=cw(),ax=class e{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ar.NODE_TYPE,{value:ar.DOC});let o=null;typeof n=="function"||Array.isArray(n)?o=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:a}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new sx.Directives({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,o,r)}clone(){let t=Object.create(e.prototype,{[ar.NODE_TYPE]:{value:ar.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=ar.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Ca(this.contents)&&this.contents.add(t)}addIn(t,n){Ca(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let r=ox.anchorNames(this);t.anchor=!n||r.has(n)?ox.findNewAnchor(n||"a",r):n}return new P6.Alias(t.anchor)}createNode(t,n,r){let o;if(typeof n=="function")t=n.call({"":t},"",t),o=n;else if(Array.isArray(n)){let y=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,w=n.filter(y).map(String);w.length>0&&(n=n.concat(w)),o=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:a,flow:c,keepUndefined:l,onTagObj:u,tag:d}=r??{},{onAnchor:f,setAnchors:m,sourceObjects:p}=ox.createNodeAnchors(this,a||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:u,replacer:o,schema:this.schema,sourceObjects:p},h=I6.createNode(t,d,g);return c&&ar.isCollection(h)&&(h.flow=!0),m(),h}createPair(t,n,r={}){let o=this.createNode(t,null,r),s=this.createNode(n,null,r);return new N6.Pair(o,s)}delete(t){return Ca(this.contents)?this.contents.delete(t):!1}deleteIn(t){return va.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):Ca(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return ar.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return va.isEmptyPath(t)?!n&&ar.isScalar(this.contents)?this.contents.value:this.contents:ar.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return ar.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return va.isEmptyPath(t)?this.contents!==void 0:ar.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=va.collectionFromPath(this.schema,[t],n):Ca(this.contents)&&this.contents.set(t,n)}setIn(t,n){va.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=va.collectionFromPath(this.schema,Array.from(t),n):Ca(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new sx.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new sx.Directives({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let o=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new R6.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:o,onAnchor:s,reviver:a}={}){let c={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},l=E6.toJS(this.contents,n??"",c);if(typeof s=="function")for(let{count:u,res:d}of c.anchors.values())s(d,u);return typeof a=="function"?A6.applyReviver(a,{"":l},"",l):l}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return T6.stringifyDocument(this,t)}};function Ca(e){if(ar.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}YF.Document=ax});var Dl=C(Il=>{"use strict";var Al=class extends Error{constructor(t,n,r,o){super(),this.name=t,this.code=r,this.message=o,this.pos=n}},cx=class extends Al{constructor(t,n,r){super("YAMLParseError",t,n,r)}},lx=class extends Al{constructor(t,n,r){super("YAMLWarning",t,n,r)}},D6=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(c=>t.linePos(c));let{line:r,col:o}=n.linePos[0];n.message+=` at line ${r}, column ${o}`;let s=o-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&a.length>80){let c=Math.min(s-39,a.length-79);a="\u2026"+a.substring(c),s-=c-1}if(a.length>80&&(a=a.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(a.substring(0,s))){let c=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);c.length>80&&(c=c.substring(0,79)+`\u2026
72
72
  `),a=c+a}if(/[^ ]/.test(a)){let c=1,l=n.linePos[1];l?.line===r&&l.col>o&&(c=Math.max(1,Math.min(l.col-o,80-s)));let u=" ".repeat(s)+"^".repeat(c);n.message+=`:
73
73
 
74
74
  ${a}
75
75
  ${u}
76
- `}};Al.YAMLError=Tl;Al.YAMLParseError=lx;Al.YAMLWarning=ux;Al.prettifyError=I6});var Dl=C(XF=>{"use strict";function D6(e,{flow:t,indicator:n,next:r,offset:o,onError:s,parentIndent:a,startOnNewline:c}){let l=!1,u=c,d=c,f="",m="",p=!1,g=!1,h=null,y=null,w=null,_=null,b=null,S=null,N=null;for(let I of e)switch(g&&(I.type!=="space"&&I.type!=="newline"&&I.type!=="comma"&&s(I.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(u&&I.type!=="comment"&&I.type!=="newline"&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),I.type){case"space":!t&&(n!=="doc-start"||r?.type!=="flow-collection")&&I.source.includes(" ")&&(h=I),d=!0;break;case"comment":{d||s(I,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let U=I.source.substring(1)||" ";f?f+=m+U:f=U,m="",u=!1;break}case"newline":u?f?f+=I.source:(!S||n!=="seq-item-ind")&&(l=!0):m+=I.source,u=!0,p=!0,(y||w)&&(_=I),d=!0;break;case"anchor":y&&s(I,"MULTIPLE_ANCHORS","A node can have at most one anchor"),I.source.endsWith(":")&&s(I.offset+I.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=I,N??(N=I.offset),u=!1,d=!1,g=!0;break;case"tag":{w&&s(I,"MULTIPLE_TAGS","A node can have at most one tag"),w=I,N??(N=I.offset),u=!1,d=!1,g=!0;break}case n:(y||w)&&s(I,"BAD_PROP_ORDER",`Anchors and tags must be after the ${I.source} indicator`),S&&s(I,"UNEXPECTED_TOKEN",`Unexpected ${I.source} in ${t??"collection"}`),S=I,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){b&&s(I,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=I,u=!1,d=!1;break}default:s(I,"UNEXPECTED_TOKEN",`Unexpected ${I.type} token`),u=!1,d=!1}let R=e[e.length-1],$=R?R.offset+R.source.length:o;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(u&&h.indent<=a||r?.type==="block-map"||r?.type==="block-seq")&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:S,spaceBefore:l,comment:f,hasNewline:p,anchor:y,tag:w,newlineAfterProp:_,end:$,start:N??$}}XF.resolveProps=D6});var Bm=C(JF=>{"use strict";function dx(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
77
- `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(dx(t.key)||dx(t.value))return!0}return!1;default:return!0}}JF.containsNewline=dx});var fx=C(QF=>{"use strict";var k6=Bm();function F6(e,t,n){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&k6.containsNewline(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}QF.flowIndentCheck=F6});var mx=C(eL=>{"use strict";var ZF=Ie();function L6(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let o=typeof r=="function"?r:(s,a)=>s===a||ZF.isScalar(s)&&ZF.isScalar(a)&&s.value===a.value;return t.some(s=>o(s.key,n))}eL.mapIncludes=L6});var sL=C(oL=>{"use strict";var tL=no(),O6=io(),nL=Dl(),M6=Bm(),rL=fx(),$6=mx(),iL="All mapping items must start at the same column";function q6({composeNode:e,composeEmptyNode:t},n,r,o,s){let a=s?.nodeClass??O6.YAMLMap,c=new a(n.schema);n.atRoot&&(n.atRoot=!1);let l=r.offset,u=null;for(let d of r.items){let{start:f,key:m,sep:p,value:g}=d,h=nL.resolveProps(f,{indicator:"explicit-key-ind",next:m??p?.[0],offset:l,onError:o,parentIndent:r.indent,startOnNewline:!0}),y=!h.found;if(y){if(m&&(m.type==="block-seq"?o(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in m&&m.indent!==r.indent&&o(l,"BAD_INDENT",iL)),!h.anchor&&!h.tag&&!p){u=h.end,h.comment&&(c.comment?c.comment+=`
78
- `+h.comment:c.comment=h.comment);continue}(h.newlineAfterProp||M6.containsNewline(m))&&o(m??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&o(l,"BAD_INDENT",iL);n.atKey=!0;let w=h.end,_=m?e(n,m,h,o):t(n,w,f,null,h,o);n.schema.compat&&rL.flowIndentCheck(r.indent,m,o),n.atKey=!1,$6.mapIncludes(n,c.items,_)&&o(w,"DUPLICATE_KEY","Map keys must be unique");let b=nL.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:_.range[2],onError:o,parentIndent:r.indent,startOnNewline:!m||m.type==="block-scalar"});if(l=b.end,b.found){y&&(g?.type==="block-map"&&!b.hasNewline&&o(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<b.found.offset-1024&&o(_.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=g?e(n,g,b,o):t(n,l,p,null,b,o);n.schema.compat&&rL.flowIndentCheck(r.indent,g,o),l=S.range[2];let N=new tL.Pair(_,S);n.options.keepSourceTokens&&(N.srcToken=d),c.items.push(N)}else{y&&o(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(_.comment?_.comment+=`
79
- `+b.comment:_.comment=b.comment);let S=new tL.Pair(_);n.options.keepSourceTokens&&(S.srcToken=d),c.items.push(S)}}return u&&u<l&&o(u,"IMPOSSIBLE","Map comment with trailing content"),c.range=[r.offset,l,u??l],c}oL.resolveBlockMap=q6});var cL=C(aL=>{"use strict";var B6=oo(),j6=Dl(),W6=fx();function U6({composeNode:e,composeEmptyNode:t},n,r,o,s){let a=s?.nodeClass??B6.YAMLSeq,c=new a(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=r.offset,u=null;for(let{start:d,value:f}of r.items){let m=j6.resolveProps(d,{indicator:"seq-item-ind",next:f,offset:l,onError:o,parentIndent:r.indent,startOnNewline:!0});if(!m.found)if(m.anchor||m.tag||f)f?.type==="block-seq"?o(m.end,"BAD_INDENT","All sequence items must start at the same column"):o(l,"MISSING_CHAR","Sequence item without - indicator");else{u=m.end,m.comment&&(c.comment=m.comment);continue}let p=f?e(n,f,m,o):t(n,m.end,d,null,m,o);n.schema.compat&&W6.flowIndentCheck(r.indent,f,o),l=p.range[2],c.items.push(p)}return c.range=[r.offset,l,u??l],c}aL.resolveBlockSeq=U6});var Pa=C(lL=>{"use strict";function H6(e,t,n,r){let o="";if(e){let s=!1,a="";for(let c of e){let{source:l,type:u}=c;switch(u){case"space":s=!0;break;case"comment":{n&&!s&&r(c,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=l.substring(1)||" ";o?o+=a+d:o=d,a="";break}case"newline":o&&(a+=l),s=!0;break;default:r(c,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}t+=l.length}}return{comment:o,offset:t}}lL.resolveEnd=H6});var mL=C(fL=>{"use strict";var V6=Ie(),G6=no(),uL=io(),z6=oo(),K6=Pa(),dL=Dl(),Y6=Bm(),X6=mx(),px="Block collections are not allowed within flow collections",hx=e=>e&&(e.type==="block-map"||e.type==="block-seq");function J6({composeNode:e,composeEmptyNode:t},n,r,o,s){let a=r.start.source==="{",c=a?"flow map":"flow sequence",l=s?.nodeClass??(a?uL.YAMLMap:z6.YAMLSeq),u=new l(n.schema);u.flow=!0;let d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let y=0;y<r.items.length;++y){let w=r.items[y],{start:_,key:b,sep:S,value:N}=w,R=dL.resolveProps(_,{flow:c,indicator:"explicit-key-ind",next:b??S?.[0],offset:f,onError:o,parentIndent:r.indent,startOnNewline:!1});if(!R.found){if(!R.anchor&&!R.tag&&!S&&!N){y===0&&R.comma?o(R.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${c}`):y<r.items.length-1&&o(R.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${c}`),R.comment&&(u.comment?u.comment+=`
80
- `+R.comment:u.comment=R.comment),f=R.end;continue}!a&&n.options.strict&&Y6.containsNewline(b)&&o(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)R.comma&&o(R.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${c}`);else if(R.comma||o(R.start,"MISSING_CHAR",`Missing , between ${c} items`),R.comment){let $="";e:for(let I of _)switch(I.type){case"comma":case"space":break;case"comment":$=I.source.substring(1);break e;default:break e}if($){let I=u.items[u.items.length-1];V6.isPair(I)&&(I=I.value??I.key),I.comment?I.comment+=`
81
- `+$:I.comment=$,R.comment=R.comment.substring($.length+1)}}if(!a&&!S&&!R.found){let $=N?e(n,N,R,o):t(n,R.end,S,null,R,o);u.items.push($),f=$.range[2],hx(N)&&o($.range,"BLOCK_IN_FLOW",px)}else{n.atKey=!0;let $=R.end,I=b?e(n,b,R,o):t(n,$,_,null,R,o);hx(b)&&o(I.range,"BLOCK_IN_FLOW",px),n.atKey=!1;let U=dL.resolveProps(S??[],{flow:c,indicator:"map-value-ind",next:N,offset:I.range[2],onError:o,parentIndent:r.indent,startOnNewline:!1});if(U.found){if(!a&&!R.found&&n.options.strict){if(S)for(let Q of S){if(Q===U.found)break;if(Q.type==="newline"){o(Q,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}R.start<U.found.offset-1024&&o(U.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else N&&("source"in N&&N.source?.[0]===":"?o(N,"MISSING_CHAR",`Missing space after : in ${c}`):o(U.start,"MISSING_CHAR",`Missing , or : between ${c} items`));let de=N?e(n,N,U,o):U.found?t(n,U.end,S,null,U,o):null;de?hx(N)&&o(de.range,"BLOCK_IN_FLOW",px):U.comment&&(I.comment?I.comment+=`
82
- `+U.comment:I.comment=U.comment);let F=new G6.Pair(I,de);if(n.options.keepSourceTokens&&(F.srcToken=w),a){let Q=u;X6.mapIncludes(n,Q.items,I)&&o($,"DUPLICATE_KEY","Map keys must be unique"),Q.items.push(F)}else{let Q=new uL.YAMLMap(n.schema);Q.flow=!0,Q.items.push(F);let pe=(de??I).range;Q.range=[I.range[0],pe[1],pe[2]],u.items.push(Q)}f=de?de.range[2]:U.end}}let m=a?"}":"]",[p,...g]=r.end,h=f;if(p?.source===m)h=p.offset+p.source.length;else{let y=c[0].toUpperCase()+c.substring(1),w=d?`${y} must end with a ${m}`:`${y} in block collection must be sufficiently indented and end with a ${m}`;o(f,d?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let y=K6.resolveEnd(g,h,n.options.strict,o);y.comment&&(u.comment?u.comment+=`
83
- `+y.comment:u.comment=y.comment),u.range=[r.offset,h,y.offset]}else u.range=[r.offset,h,h];return u}fL.resolveFlowCollection=J6});var hL=C(pL=>{"use strict";var Q6=Ie(),Z6=Dt(),eX=io(),tX=oo(),nX=sL(),rX=cL(),iX=mL();function gx(e,t,n,r,o,s){let a=n.type==="block-map"?nX.resolveBlockMap(e,t,n,r,s):n.type==="block-seq"?rX.resolveBlockSeq(e,t,n,r,s):iX.resolveFlowCollection(e,t,n,r,s),c=a.constructor;return o==="!"||o===c.tagName?(a.tag=c.tagName,a):(o&&(a.tag=o),a)}function oX(e,t,n,r,o){let s=r.tag,a=s?t.directives.tagName(s.source,m=>o(s,"TAG_RESOLVE_FAILED",m)):null;if(n.type==="block-seq"){let{anchor:m,newlineAfterProp:p}=r,g=m&&s?m.offset>s.offset?m:s:m??s;g&&(!p||p.offset<g.offset)&&o(g,"MISSING_CHAR","Missing newline after block sequence props")}let c=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!a||a==="!"||a===eX.YAMLMap.tagName&&c==="map"||a===tX.YAMLSeq.tagName&&c==="seq")return gx(e,t,n,o,a);let l=t.schema.tags.find(m=>m.tag===a&&m.collection===c);if(!l){let m=t.schema.knownTags[a];if(m?.collection===c)t.schema.tags.push(Object.assign({},m,{default:!1})),l=m;else return m?o(s,"BAD_COLLECTION_TYPE",`${m.tag} used for ${c} collection, but expects ${m.collection??"scalar"}`,!0):o(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),gx(e,t,n,o,a)}let u=gx(e,t,n,o,a,l),d=l.resolve?.(u,m=>o(s,"TAG_RESOLVE_FAILED",m),t.options)??u,f=Q6.isNode(d)?d:new Z6.Scalar(d);return f.range=u.range,f.tag=a,l?.format&&(f.format=l.format),f}pL.composeCollection=oX});var yx=C(gL=>{"use strict";var _x=Dt();function sX(e,t,n){let r=t.offset,o=aX(t,e.options.strict,n);if(!o)return{value:"",type:null,comment:"",range:[r,r,r]};let s=o.mode===">"?_x.Scalar.BLOCK_FOLDED:_x.Scalar.BLOCK_LITERAL,a=t.source?cX(t.source):[],c=a.length;for(let h=a.length-1;h>=0;--h){let y=a[h][1];if(y===""||y==="\r")c=h;else break}if(c===0){let h=o.chomp==="+"&&a.length>0?`
76
+ `}};Il.YAMLError=Al;Il.YAMLParseError=cx;Il.YAMLWarning=lx;Il.prettifyError=D6});var kl=C(XF=>{"use strict";function k6(e,{flow:t,indicator:n,next:r,offset:o,onError:s,parentIndent:a,startOnNewline:c}){let l=!1,u=c,d=c,f="",m="",p=!1,g=!1,h=null,y=null,w=null,_=null,b=null,S=null,N=null;for(let I of e)switch(g&&(I.type!=="space"&&I.type!=="newline"&&I.type!=="comma"&&s(I.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(u&&I.type!=="comment"&&I.type!=="newline"&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),I.type){case"space":!t&&(n!=="doc-start"||r?.type!=="flow-collection")&&I.source.includes(" ")&&(h=I),d=!0;break;case"comment":{d||s(I,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let U=I.source.substring(1)||" ";f?f+=m+U:f=U,m="",u=!1;break}case"newline":u?f?f+=I.source:(!S||n!=="seq-item-ind")&&(l=!0):m+=I.source,u=!0,p=!0,(y||w)&&(_=I),d=!0;break;case"anchor":y&&s(I,"MULTIPLE_ANCHORS","A node can have at most one anchor"),I.source.endsWith(":")&&s(I.offset+I.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=I,N??(N=I.offset),u=!1,d=!1,g=!0;break;case"tag":{w&&s(I,"MULTIPLE_TAGS","A node can have at most one tag"),w=I,N??(N=I.offset),u=!1,d=!1,g=!0;break}case n:(y||w)&&s(I,"BAD_PROP_ORDER",`Anchors and tags must be after the ${I.source} indicator`),S&&s(I,"UNEXPECTED_TOKEN",`Unexpected ${I.source} in ${t??"collection"}`),S=I,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){b&&s(I,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=I,u=!1,d=!1;break}default:s(I,"UNEXPECTED_TOKEN",`Unexpected ${I.type} token`),u=!1,d=!1}let R=e[e.length-1],$=R?R.offset+R.source.length:o;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(u&&h.indent<=a||r?.type==="block-map"||r?.type==="block-seq")&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:S,spaceBefore:l,comment:f,hasNewline:p,anchor:y,tag:w,newlineAfterProp:_,end:$,start:N??$}}XF.resolveProps=k6});var jm=C(JF=>{"use strict";function ux(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
77
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(ux(t.key)||ux(t.value))return!0}return!1;default:return!0}}JF.containsNewline=ux});var dx=C(QF=>{"use strict";var F6=jm();function L6(e,t,n){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&F6.containsNewline(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}QF.flowIndentCheck=L6});var fx=C(eL=>{"use strict";var ZF=Ie();function O6(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let o=typeof r=="function"?r:(s,a)=>s===a||ZF.isScalar(s)&&ZF.isScalar(a)&&s.value===a.value;return t.some(s=>o(s.key,n))}eL.mapIncludes=O6});var sL=C(oL=>{"use strict";var tL=no(),M6=io(),nL=kl(),$6=jm(),rL=dx(),q6=fx(),iL="All mapping items must start at the same column";function B6({composeNode:e,composeEmptyNode:t},n,r,o,s){let a=s?.nodeClass??M6.YAMLMap,c=new a(n.schema);n.atRoot&&(n.atRoot=!1);let l=r.offset,u=null;for(let d of r.items){let{start:f,key:m,sep:p,value:g}=d,h=nL.resolveProps(f,{indicator:"explicit-key-ind",next:m??p?.[0],offset:l,onError:o,parentIndent:r.indent,startOnNewline:!0}),y=!h.found;if(y){if(m&&(m.type==="block-seq"?o(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in m&&m.indent!==r.indent&&o(l,"BAD_INDENT",iL)),!h.anchor&&!h.tag&&!p){u=h.end,h.comment&&(c.comment?c.comment+=`
78
+ `+h.comment:c.comment=h.comment);continue}(h.newlineAfterProp||$6.containsNewline(m))&&o(m??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&o(l,"BAD_INDENT",iL);n.atKey=!0;let w=h.end,_=m?e(n,m,h,o):t(n,w,f,null,h,o);n.schema.compat&&rL.flowIndentCheck(r.indent,m,o),n.atKey=!1,q6.mapIncludes(n,c.items,_)&&o(w,"DUPLICATE_KEY","Map keys must be unique");let b=nL.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:_.range[2],onError:o,parentIndent:r.indent,startOnNewline:!m||m.type==="block-scalar"});if(l=b.end,b.found){y&&(g?.type==="block-map"&&!b.hasNewline&&o(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<b.found.offset-1024&&o(_.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let S=g?e(n,g,b,o):t(n,l,p,null,b,o);n.schema.compat&&rL.flowIndentCheck(r.indent,g,o),l=S.range[2];let N=new tL.Pair(_,S);n.options.keepSourceTokens&&(N.srcToken=d),c.items.push(N)}else{y&&o(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(_.comment?_.comment+=`
79
+ `+b.comment:_.comment=b.comment);let S=new tL.Pair(_);n.options.keepSourceTokens&&(S.srcToken=d),c.items.push(S)}}return u&&u<l&&o(u,"IMPOSSIBLE","Map comment with trailing content"),c.range=[r.offset,l,u??l],c}oL.resolveBlockMap=B6});var cL=C(aL=>{"use strict";var j6=oo(),W6=kl(),U6=dx();function H6({composeNode:e,composeEmptyNode:t},n,r,o,s){let a=s?.nodeClass??j6.YAMLSeq,c=new a(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=r.offset,u=null;for(let{start:d,value:f}of r.items){let m=W6.resolveProps(d,{indicator:"seq-item-ind",next:f,offset:l,onError:o,parentIndent:r.indent,startOnNewline:!0});if(!m.found)if(m.anchor||m.tag||f)f?.type==="block-seq"?o(m.end,"BAD_INDENT","All sequence items must start at the same column"):o(l,"MISSING_CHAR","Sequence item without - indicator");else{u=m.end,m.comment&&(c.comment=m.comment);continue}let p=f?e(n,f,m,o):t(n,m.end,d,null,m,o);n.schema.compat&&U6.flowIndentCheck(r.indent,f,o),l=p.range[2],c.items.push(p)}return c.range=[r.offset,l,u??l],c}aL.resolveBlockSeq=H6});var Pa=C(lL=>{"use strict";function V6(e,t,n,r){let o="";if(e){let s=!1,a="";for(let c of e){let{source:l,type:u}=c;switch(u){case"space":s=!0;break;case"comment":{n&&!s&&r(c,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=l.substring(1)||" ";o?o+=a+d:o=d,a="";break}case"newline":o&&(a+=l),s=!0;break;default:r(c,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}t+=l.length}}return{comment:o,offset:t}}lL.resolveEnd=V6});var mL=C(fL=>{"use strict";var G6=Ie(),z6=no(),uL=io(),K6=oo(),Y6=Pa(),dL=kl(),X6=jm(),J6=fx(),mx="Block collections are not allowed within flow collections",px=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Q6({composeNode:e,composeEmptyNode:t},n,r,o,s){let a=r.start.source==="{",c=a?"flow map":"flow sequence",l=s?.nodeClass??(a?uL.YAMLMap:K6.YAMLSeq),u=new l(n.schema);u.flow=!0;let d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let y=0;y<r.items.length;++y){let w=r.items[y],{start:_,key:b,sep:S,value:N}=w,R=dL.resolveProps(_,{flow:c,indicator:"explicit-key-ind",next:b??S?.[0],offset:f,onError:o,parentIndent:r.indent,startOnNewline:!1});if(!R.found){if(!R.anchor&&!R.tag&&!S&&!N){y===0&&R.comma?o(R.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${c}`):y<r.items.length-1&&o(R.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${c}`),R.comment&&(u.comment?u.comment+=`
80
+ `+R.comment:u.comment=R.comment),f=R.end;continue}!a&&n.options.strict&&X6.containsNewline(b)&&o(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)R.comma&&o(R.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${c}`);else if(R.comma||o(R.start,"MISSING_CHAR",`Missing , between ${c} items`),R.comment){let $="";e:for(let I of _)switch(I.type){case"comma":case"space":break;case"comment":$=I.source.substring(1);break e;default:break e}if($){let I=u.items[u.items.length-1];G6.isPair(I)&&(I=I.value??I.key),I.comment?I.comment+=`
81
+ `+$:I.comment=$,R.comment=R.comment.substring($.length+1)}}if(!a&&!S&&!R.found){let $=N?e(n,N,R,o):t(n,R.end,S,null,R,o);u.items.push($),f=$.range[2],px(N)&&o($.range,"BLOCK_IN_FLOW",mx)}else{n.atKey=!0;let $=R.end,I=b?e(n,b,R,o):t(n,$,_,null,R,o);px(b)&&o(I.range,"BLOCK_IN_FLOW",mx),n.atKey=!1;let U=dL.resolveProps(S??[],{flow:c,indicator:"map-value-ind",next:N,offset:I.range[2],onError:o,parentIndent:r.indent,startOnNewline:!1});if(U.found){if(!a&&!R.found&&n.options.strict){if(S)for(let Q of S){if(Q===U.found)break;if(Q.type==="newline"){o(Q,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}R.start<U.found.offset-1024&&o(U.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else N&&("source"in N&&N.source?.[0]===":"?o(N,"MISSING_CHAR",`Missing space after : in ${c}`):o(U.start,"MISSING_CHAR",`Missing , or : between ${c} items`));let de=N?e(n,N,U,o):U.found?t(n,U.end,S,null,U,o):null;de?px(N)&&o(de.range,"BLOCK_IN_FLOW",mx):U.comment&&(I.comment?I.comment+=`
82
+ `+U.comment:I.comment=U.comment);let F=new z6.Pair(I,de);if(n.options.keepSourceTokens&&(F.srcToken=w),a){let Q=u;J6.mapIncludes(n,Q.items,I)&&o($,"DUPLICATE_KEY","Map keys must be unique"),Q.items.push(F)}else{let Q=new uL.YAMLMap(n.schema);Q.flow=!0,Q.items.push(F);let pe=(de??I).range;Q.range=[I.range[0],pe[1],pe[2]],u.items.push(Q)}f=de?de.range[2]:U.end}}let m=a?"}":"]",[p,...g]=r.end,h=f;if(p?.source===m)h=p.offset+p.source.length;else{let y=c[0].toUpperCase()+c.substring(1),w=d?`${y} must end with a ${m}`:`${y} in block collection must be sufficiently indented and end with a ${m}`;o(f,d?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let y=Y6.resolveEnd(g,h,n.options.strict,o);y.comment&&(u.comment?u.comment+=`
83
+ `+y.comment:u.comment=y.comment),u.range=[r.offset,h,y.offset]}else u.range=[r.offset,h,h];return u}fL.resolveFlowCollection=Q6});var hL=C(pL=>{"use strict";var Z6=Ie(),eX=Dt(),tX=io(),nX=oo(),rX=sL(),iX=cL(),oX=mL();function hx(e,t,n,r,o,s){let a=n.type==="block-map"?rX.resolveBlockMap(e,t,n,r,s):n.type==="block-seq"?iX.resolveBlockSeq(e,t,n,r,s):oX.resolveFlowCollection(e,t,n,r,s),c=a.constructor;return o==="!"||o===c.tagName?(a.tag=c.tagName,a):(o&&(a.tag=o),a)}function sX(e,t,n,r,o){let s=r.tag,a=s?t.directives.tagName(s.source,m=>o(s,"TAG_RESOLVE_FAILED",m)):null;if(n.type==="block-seq"){let{anchor:m,newlineAfterProp:p}=r,g=m&&s?m.offset>s.offset?m:s:m??s;g&&(!p||p.offset<g.offset)&&o(g,"MISSING_CHAR","Missing newline after block sequence props")}let c=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!a||a==="!"||a===tX.YAMLMap.tagName&&c==="map"||a===nX.YAMLSeq.tagName&&c==="seq")return hx(e,t,n,o,a);let l=t.schema.tags.find(m=>m.tag===a&&m.collection===c);if(!l){let m=t.schema.knownTags[a];if(m?.collection===c)t.schema.tags.push(Object.assign({},m,{default:!1})),l=m;else return m?o(s,"BAD_COLLECTION_TYPE",`${m.tag} used for ${c} collection, but expects ${m.collection??"scalar"}`,!0):o(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),hx(e,t,n,o,a)}let u=hx(e,t,n,o,a,l),d=l.resolve?.(u,m=>o(s,"TAG_RESOLVE_FAILED",m),t.options)??u,f=Z6.isNode(d)?d:new eX.Scalar(d);return f.range=u.range,f.tag=a,l?.format&&(f.format=l.format),f}pL.composeCollection=sX});var _x=C(gL=>{"use strict";var gx=Dt();function aX(e,t,n){let r=t.offset,o=cX(t,e.options.strict,n);if(!o)return{value:"",type:null,comment:"",range:[r,r,r]};let s=o.mode===">"?gx.Scalar.BLOCK_FOLDED:gx.Scalar.BLOCK_LITERAL,a=t.source?lX(t.source):[],c=a.length;for(let h=a.length-1;h>=0;--h){let y=a[h][1];if(y===""||y==="\r")c=h;else break}if(c===0){let h=o.chomp==="+"&&a.length>0?`
84
84
  `.repeat(Math.max(1,a.length-1)):"",y=r+o.length;return t.source&&(y+=t.source.length),{value:h,type:s,comment:o.comment,range:[r,y,y]}}let l=t.indent+o.indent,u=t.offset+o.length,d=0;for(let h=0;h<c;++h){let[y,w]=a[h];if(w===""||w==="\r")o.indent===0&&y.length>l&&(l=y.length);else{y.length<l&&n(u+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),o.indent===0&&(l=y.length),d=h,l===0&&!e.atRoot&&n(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=y.length+w.length+1}for(let h=a.length-1;h>=c;--h)a[h][0].length>l&&(c=h+1);let f="",m="",p=!1;for(let h=0;h<d;++h)f+=a[h][0].slice(l)+`
85
- `;for(let h=d;h<c;++h){let[y,w]=a[h];u+=y.length+w.length+1;let _=w[w.length-1]==="\r";if(_&&(w=w.slice(0,-1)),w&&y.length<l){let S=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;n(u-w.length-(_?2:1),"BAD_INDENT",S),y=""}s===_x.Scalar.BLOCK_LITERAL?(f+=m+y.slice(l)+w,m=`
85
+ `;for(let h=d;h<c;++h){let[y,w]=a[h];u+=y.length+w.length+1;let _=w[w.length-1]==="\r";if(_&&(w=w.slice(0,-1)),w&&y.length<l){let S=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;n(u-w.length-(_?2:1),"BAD_INDENT",S),y=""}s===gx.Scalar.BLOCK_LITERAL?(f+=m+y.slice(l)+w,m=`
86
86
  `):y.length>l||w[0]===" "?(m===" "?m=`
87
87
  `:!p&&m===`
88
88
  `&&(m=`
@@ -95,228 +95,228 @@ ${u}
95
95
  `+a[h][0].slice(l);f[f.length-1]!==`
96
96
  `&&(f+=`
97
97
  `);break;default:f+=`
98
- `}let g=r+o.length+t.source.length;return{value:f,type:s,comment:o.comment,range:[r,g,g]}}function aX({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:o}=t[0],s=o[0],a=0,c="",l=-1;for(let m=1;m<o.length;++m){let p=o[m];if(!c&&(p==="-"||p==="+"))c=p;else{let g=Number(p);!a&&g?a=g:l===-1&&(l=e+m)}}l!==-1&&r(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${o}`);let u=!1,d="",f=o.length;for(let m=1;m<t.length;++m){let p=t[m];switch(p.type){case"space":u=!0;case"newline":f+=p.source.length;break;case"comment":n&&!u&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,d=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",g);let h=p.source;h&&typeof h=="string"&&(f+=h.length)}}}return{mode:s,indent:a,chomp:c,comment:d,length:f}}function cX(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let a=1;a<t.length;a+=2)s.push([t[a],t[a+1]]);return s}gL.resolveBlockScalar=sX});var Sx=C(yL=>{"use strict";var bx=Dt(),lX=Pa();function uX(e,t,n){let{offset:r,type:o,source:s,end:a}=e,c,l,u=(m,p,g)=>n(r+m,p,g);switch(o){case"scalar":c=bx.Scalar.PLAIN,l=dX(s,u);break;case"single-quoted-scalar":c=bx.Scalar.QUOTE_SINGLE,l=fX(s,u);break;case"double-quoted-scalar":c=bx.Scalar.QUOTE_DOUBLE,l=mX(s,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let d=r+s.length,f=lX.resolveEnd(a,d,t,n);return{value:l,type:c,comment:f.comment,range:[r,d,f.offset]}}function dX(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),_L(e)}function fX(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),_L(e.slice(1,-1)).replace(/''/g,"'")}function _L(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
98
+ `}let g=r+o.length+t.source.length;return{value:f,type:s,comment:o.comment,range:[r,g,g]}}function cX({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:o}=t[0],s=o[0],a=0,c="",l=-1;for(let m=1;m<o.length;++m){let p=o[m];if(!c&&(p==="-"||p==="+"))c=p;else{let g=Number(p);!a&&g?a=g:l===-1&&(l=e+m)}}l!==-1&&r(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${o}`);let u=!1,d="",f=o.length;for(let m=1;m<t.length;++m){let p=t[m];switch(p.type){case"space":u=!0;case"newline":f+=p.source.length;break;case"comment":n&&!u&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,d=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",g);let h=p.source;h&&typeof h=="string"&&(f+=h.length)}}}return{mode:s,indent:a,chomp:c,comment:d,length:f}}function lX(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let a=1;a<t.length;a+=2)s.push([t[a],t[a+1]]);return s}gL.resolveBlockScalar=aX});var bx=C(yL=>{"use strict";var yx=Dt(),uX=Pa();function dX(e,t,n){let{offset:r,type:o,source:s,end:a}=e,c,l,u=(m,p,g)=>n(r+m,p,g);switch(o){case"scalar":c=yx.Scalar.PLAIN,l=fX(s,u);break;case"single-quoted-scalar":c=yx.Scalar.QUOTE_SINGLE,l=mX(s,u);break;case"double-quoted-scalar":c=yx.Scalar.QUOTE_DOUBLE,l=pX(s,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let d=r+s.length,f=uX.resolveEnd(a,d,t,n);return{value:l,type:c,comment:f.comment,range:[r,d,f.offset]}}function fX(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),_L(e)}function mX(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),_L(e.slice(1,-1)).replace(/''/g,"'")}function _L(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
99
99
  `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
100
100
  `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let o=r[1],s=" ",a=t.lastIndex;for(n.lastIndex=a;r=n.exec(e);)r[1]===""?s===`
101
101
  `?o+=s:s=`
102
- `:(o+=s+r[1],s=" "),a=n.lastIndex;let c=/[ \t]*(.*)/sy;return c.lastIndex=a,r=c.exec(e),o+s+(r?.[1]??"")}function mX(e,t){let n="";for(let r=1;r<e.length-1;++r){let o=e[r];if(!(o==="\r"&&e[r+1]===`
102
+ `:(o+=s+r[1],s=" "),a=n.lastIndex;let c=/[ \t]*(.*)/sy;return c.lastIndex=a,r=c.exec(e),o+s+(r?.[1]??"")}function pX(e,t){let n="";for(let r=1;r<e.length-1;++r){let o=e[r];if(!(o==="\r"&&e[r+1]===`
103
103
  `))if(o===`
104
- `){let{fold:s,offset:a}=pX(e,r);n+=s,r=a}else if(o==="\\"){let s=e[++r],a=hX[s];if(a)n+=a;else if(s===`
104
+ `){let{fold:s,offset:a}=hX(e,r);n+=s,r=a}else if(o==="\\"){let s=e[++r],a=gX[s];if(a)n+=a;else if(s===`
105
105
  `)for(s=e[r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="\r"&&e[r+1]===`
106
- `)for(s=e[++r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="x"||s==="u"||s==="U"){let c=s==="x"?2:s==="u"?4:8;n+=gX(e,r+1,c,t),r+=c}else{let c=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${c}`),n+=c}}else if(o===" "||o===" "){let s=r,a=e[r+1];for(;a===" "||a===" ";)a=e[++r+1];a!==`
106
+ `)for(s=e[++r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="x"||s==="u"||s==="U"){let c=s==="x"?2:s==="u"?4:8;n+=_X(e,r+1,c,t),r+=c}else{let c=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${c}`),n+=c}}else if(o===" "||o===" "){let s=r,a=e[r+1];for(;a===" "||a===" ";)a=e[++r+1];a!==`
107
107
  `&&!(a==="\r"&&e[r+2]===`
108
- `)&&(n+=r>s?e.slice(s,r+1):o)}else n+=o}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function pX(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===`
108
+ `)&&(n+=r>s?e.slice(s,r+1):o)}else n+=o}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function hX(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===`
109
109
  `||r==="\r")&&!(r==="\r"&&e[t+2]!==`
110
110
  `);)r===`
111
111
  `&&(n+=`
112
- `),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}var hX={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
113
- `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function gX(e,t,n,r){let o=e.substr(t,n),a=o.length===n&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;try{return String.fromCodePoint(a)}catch{let c=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${c}`),c}}yL.resolveFlowScalar=uX});var wL=C(SL=>{"use strict";var Zo=Ie(),bL=Dt(),_X=yx(),yX=Sx();function bX(e,t,n,r){let{value:o,type:s,comment:a,range:c}=t.type==="block-scalar"?_X.resolveBlockScalar(e,t,r):yX.resolveFlowScalar(t,e.options.strict,r),l=n?e.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null,u;e.options.stringKeys&&e.atKey?u=e.schema[Zo.SCALAR]:l?u=SX(e.schema,o,l,n,r):t.type==="scalar"?u=wX(e,o,t,r):u=e.schema[Zo.SCALAR];let d;try{let f=u.resolve(o,m=>r(n??t,"TAG_RESOLVE_FAILED",m),e.options);d=Zo.isScalar(f)?f:new bL.Scalar(f)}catch(f){let m=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",m),d=new bL.Scalar(o)}return d.range=c,d.source=o,s&&(d.type=s),l&&(d.tag=l),u.format&&(d.format=u.format),a&&(d.comment=a),d}function SX(e,t,n,r,o){if(n==="!")return e[Zo.SCALAR];let s=[];for(let c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)s.push(c);else return c;for(let c of s)if(c.test?.test(t))return c;let a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(o(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Zo.SCALAR])}function wX({atKey:e,directives:t,schema:n},r,o,s){let a=n.tags.find(c=>(c.default===!0||e&&c.default==="key")&&c.test?.test(r))||n[Zo.SCALAR];if(n.compat){let c=n.compat.find(l=>l.default&&l.test?.test(r))??n[Zo.SCALAR];if(a.tag!==c.tag){let l=t.tagString(a.tag),u=t.tagString(c.tag),d=`Value may be parsed as either ${l} or ${u}`;s(o,"TAG_RESOLVE_FAILED",d,!0)}}return a}SL.composeScalar=bX});var vL=C(xL=>{"use strict";function xX(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let o=t[r];switch(o.type){case"space":case"comment":case"newline":e-=o.source.length;continue}for(o=t[++r];o?.type==="space";)e+=o.source.length,o=t[++r];break}}return e}xL.emptyScalarPosition=xX});var NL=C(xx=>{"use strict";var vX=fl(),CX=Ie(),PX=hL(),CL=wL(),NX=Pa(),EX=vL(),RX={composeNode:PL,composeEmptyNode:wx};function PL(e,t,n,r){let o=e.atKey,{spaceBefore:s,comment:a,anchor:c,tag:l}=n,u,d=!0;switch(t.type){case"alias":u=TX(e,t,r),(c||l)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=CL.composeScalar(e,t,l,r),c&&(u.anchor=c.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=PX.composeCollection(RX,e,t,n,r),c&&(u.anchor=c.source.substring(1))}catch(f){let m=f instanceof Error?f.message:String(f);r(t,"RESOURCE_EXHAUSTION",m)}break;default:{let f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=wx(e,t.offset,void 0,null,n,r)),c&&u.anchor===""&&r(c,"BAD_ALIAS","Anchor cannot be an empty string"),o&&e.options.stringKeys&&(!CX.isScalar(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function wx(e,t,n,r,{spaceBefore:o,comment:s,anchor:a,tag:c,end:l},u){let d={type:"scalar",offset:EX.emptyScalarPosition(t,n,r),indent:-1,source:""},f=CL.composeScalar(e,d,c,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),o&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=l),f}function TX({options:e},{offset:t,source:n,end:r},o){let s=new vX.Alias(n.substring(1));s.source===""&&o(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&o(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=t+n.length,c=NX.resolveEnd(r,a,e.strict,o);return s.range=[t,a,c.offset],c.comment&&(s.comment=c.comment),s}xx.composeEmptyNode=wx;xx.composeNode=PL});var TL=C(RL=>{"use strict";var AX=Rl(),EL=NL(),IX=Pa(),DX=Dl();function kX(e,t,{offset:n,start:r,value:o,end:s},a){let c=Object.assign({_directives:t},e),l=new AX.Document(void 0,c),u={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=DX.resolveProps(r,{indicator:"doc-start",next:o??s?.[0],offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=o?EL.composeNode(u,o,d,a):EL.composeEmptyNode(u,d.end,r,null,d,a);let f=l.contents.range[2],m=IX.resolveEnd(s,f,!1,a);return m.comment&&(l.comment=m.comment),l.range=[n,f,m.offset],l}RL.composeDoc=kX});var Cx=C(DL=>{"use strict";var FX=require("process"),LX=lw(),OX=Rl(),kl=Il(),AL=Ie(),MX=TL(),$X=Pa();function Fl(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function IL(e){let t="",n=!1,r=!1;for(let o=0;o<e.length;++o){let s=e[o];switch(s[0]){case"#":t+=(t===""?"":r?`
112
+ `),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}var gX={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
113
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function _X(e,t,n,r){let o=e.substr(t,n),a=o.length===n&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;try{return String.fromCodePoint(a)}catch{let c=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${c}`),c}}yL.resolveFlowScalar=dX});var wL=C(SL=>{"use strict";var Zo=Ie(),bL=Dt(),yX=_x(),bX=bx();function SX(e,t,n,r){let{value:o,type:s,comment:a,range:c}=t.type==="block-scalar"?yX.resolveBlockScalar(e,t,r):bX.resolveFlowScalar(t,e.options.strict,r),l=n?e.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null,u;e.options.stringKeys&&e.atKey?u=e.schema[Zo.SCALAR]:l?u=wX(e.schema,o,l,n,r):t.type==="scalar"?u=xX(e,o,t,r):u=e.schema[Zo.SCALAR];let d;try{let f=u.resolve(o,m=>r(n??t,"TAG_RESOLVE_FAILED",m),e.options);d=Zo.isScalar(f)?f:new bL.Scalar(f)}catch(f){let m=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",m),d=new bL.Scalar(o)}return d.range=c,d.source=o,s&&(d.type=s),l&&(d.tag=l),u.format&&(d.format=u.format),a&&(d.comment=a),d}function wX(e,t,n,r,o){if(n==="!")return e[Zo.SCALAR];let s=[];for(let c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)s.push(c);else return c;for(let c of s)if(c.test?.test(t))return c;let a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(o(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Zo.SCALAR])}function xX({atKey:e,directives:t,schema:n},r,o,s){let a=n.tags.find(c=>(c.default===!0||e&&c.default==="key")&&c.test?.test(r))||n[Zo.SCALAR];if(n.compat){let c=n.compat.find(l=>l.default&&l.test?.test(r))??n[Zo.SCALAR];if(a.tag!==c.tag){let l=t.tagString(a.tag),u=t.tagString(c.tag),d=`Value may be parsed as either ${l} or ${u}`;s(o,"TAG_RESOLVE_FAILED",d,!0)}}return a}SL.composeScalar=SX});var vL=C(xL=>{"use strict";function vX(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let o=t[r];switch(o.type){case"space":case"comment":case"newline":e-=o.source.length;continue}for(o=t[++r];o?.type==="space";)e+=o.source.length,o=t[++r];break}}return e}xL.emptyScalarPosition=vX});var NL=C(wx=>{"use strict";var CX=ml(),PX=Ie(),NX=hL(),CL=wL(),EX=Pa(),RX=vL(),TX={composeNode:PL,composeEmptyNode:Sx};function PL(e,t,n,r){let o=e.atKey,{spaceBefore:s,comment:a,anchor:c,tag:l}=n,u,d=!0;switch(t.type){case"alias":u=AX(e,t,r),(c||l)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=CL.composeScalar(e,t,l,r),c&&(u.anchor=c.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=NX.composeCollection(TX,e,t,n,r),c&&(u.anchor=c.source.substring(1))}catch(f){let m=f instanceof Error?f.message:String(f);r(t,"RESOURCE_EXHAUSTION",m)}break;default:{let f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=Sx(e,t.offset,void 0,null,n,r)),c&&u.anchor===""&&r(c,"BAD_ALIAS","Anchor cannot be an empty string"),o&&e.options.stringKeys&&(!PX.isScalar(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function Sx(e,t,n,r,{spaceBefore:o,comment:s,anchor:a,tag:c,end:l},u){let d={type:"scalar",offset:RX.emptyScalarPosition(t,n,r),indent:-1,source:""},f=CL.composeScalar(e,d,c,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),o&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=l),f}function AX({options:e},{offset:t,source:n,end:r},o){let s=new CX.Alias(n.substring(1));s.source===""&&o(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&o(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=t+n.length,c=EX.resolveEnd(r,a,e.strict,o);return s.range=[t,a,c.offset],c.comment&&(s.comment=c.comment),s}wx.composeEmptyNode=Sx;wx.composeNode=PL});var TL=C(RL=>{"use strict";var IX=Tl(),EL=NL(),DX=Pa(),kX=kl();function FX(e,t,{offset:n,start:r,value:o,end:s},a){let c=Object.assign({_directives:t},e),l=new IX.Document(void 0,c),u={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=kX.resolveProps(r,{indicator:"doc-start",next:o??s?.[0],offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=o?EL.composeNode(u,o,d,a):EL.composeEmptyNode(u,d.end,r,null,d,a);let f=l.contents.range[2],m=DX.resolveEnd(s,f,!1,a);return m.comment&&(l.comment=m.comment),l.range=[n,f,m.offset],l}RL.composeDoc=FX});var vx=C(DL=>{"use strict";var LX=require("process"),OX=cw(),MX=Tl(),Fl=Dl(),AL=Ie(),$X=TL(),qX=Pa();function Ll(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function IL(e){let t="",n=!1,r=!1;for(let o=0;o<e.length;++o){let s=e[o];switch(s[0]){case"#":t+=(t===""?"":r?`
114
114
 
115
115
  `:`
116
- `)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":e[o+1]?.[0]!=="#"&&(o+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var vx=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,o,s)=>{let a=Fl(n);s?this.warnings.push(new kl.YAMLWarning(a,r,o)):this.errors.push(new kl.YAMLParseError(a,r,o))},this.directives=new LX.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:r,afterEmptyLine:o}=IL(this.prelude);if(r){let s=t.contents;if(n)t.comment=t.comment?`${t.comment}
116
+ `)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":e[o+1]?.[0]!=="#"&&(o+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var xx=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,o,s)=>{let a=Ll(n);s?this.warnings.push(new Fl.YAMLWarning(a,r,o)):this.errors.push(new Fl.YAMLParseError(a,r,o))},this.directives=new OX.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:r,afterEmptyLine:o}=IL(this.prelude);if(r){let s=t.contents;if(n)t.comment=t.comment?`${t.comment}
117
117
  ${r}`:r;else if(o||t.directives.docStart||!s)t.commentBefore=r;else if(AL.isCollection(s)&&!s.flow&&s.items.length>0){let a=s.items[0];AL.isPair(a)&&(a=a.key);let c=a.commentBefore;a.commentBefore=c?`${r}
118
118
  ${c}`:r}else{let a=s.commentBefore;s.commentBefore=a?`${r}
119
- ${a}`:r}}if(n){for(let s=0;s<this.errors.length;++s)t.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)t.warnings.push(this.warnings[s])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:IL(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,r=-1){for(let o of t)yield*this.next(o);yield*this.end(n,r)}*next(t){switch(FX.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,r,o)=>{let s=Fl(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,o)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=MX.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new kl.YAMLParseError(Fl(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new kl.YAMLParseError(Fl(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=$X.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
120
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new kl.YAMLParseError(Fl(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),o=new OX.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),o.range=[0,n,n],this.decorate(o,!1),yield o}}};DL.Composer=vx});var LL=C(jm=>{"use strict";var qX=yx(),BX=Sx(),jX=Il(),kL=_l();function WX(e,t=!0,n){if(e){let r=(o,s,a)=>{let c=typeof o=="number"?o:Array.isArray(o)?o[0]:o.offset;if(n)n(c,s,a);else throw new jX.YAMLParseError([c,c+1],s,a)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return BX.resolveFlowScalar(e,t,r);case"block-scalar":return qX.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function UX(e,t){let{implicitKey:n=!1,indent:r,inFlow:o=!1,offset:s=-1,type:a="PLAIN"}=t,c=kL.stringifyString({type:a,value:e},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:r,source:`
119
+ ${a}`:r}}if(n){for(let s=0;s<this.errors.length;++s)t.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)t.warnings.push(this.warnings[s])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:IL(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,r=-1){for(let o of t)yield*this.next(o);yield*this.end(n,r)}*next(t){switch(LX.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,r,o)=>{let s=Ll(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,o)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=$X.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new Fl.YAMLParseError(Ll(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Fl.YAMLParseError(Ll(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=qX.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
120
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Fl.YAMLParseError(Ll(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),o=new MX.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),o.range=[0,n,n],this.decorate(o,!1),yield o}}};DL.Composer=xx});var LL=C(Wm=>{"use strict";var BX=_x(),jX=bx(),WX=Dl(),kL=yl();function UX(e,t=!0,n){if(e){let r=(o,s,a)=>{let c=typeof o=="number"?o:Array.isArray(o)?o[0]:o.offset;if(n)n(c,s,a);else throw new WX.YAMLParseError([c,c+1],s,a)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return jX.resolveFlowScalar(e,t,r);case"block-scalar":return BX.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function HX(e,t){let{implicitKey:n=!1,indent:r,inFlow:o=!1,offset:s=-1,type:a="PLAIN"}=t,c=kL.stringifyString({type:a,value:e},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:r,source:`
121
121
  `}];switch(c[0]){case"|":case">":{let u=c.indexOf(`
122
122
  `),d=c.substring(0,u),f=c.substring(u+1)+`
123
123
  `,m=[{type:"block-scalar-header",offset:s,indent:r,source:d}];return FL(m,l)||m.push({type:"newline",offset:-1,indent:r,source:`
124
- `}),{type:"block-scalar",offset:s,indent:r,props:m,source:f}}case'"':return{type:"double-quoted-scalar",offset:s,indent:r,source:c,end:l};case"'":return{type:"single-quoted-scalar",offset:s,indent:r,source:c,end:l};default:return{type:"scalar",offset:s,indent:r,source:c,end:l}}}function HX(e,t,n={}){let{afterKey:r=!1,implicitKey:o=!1,inFlow:s=!1,type:a}=n,c="indent"in e?e.indent:null;if(r&&typeof c=="number"&&(c+=2),!a)switch(e.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let u=e.props[0];if(u.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let l=kL.stringifyString({type:a,value:t},{implicitKey:o||c===null,indent:c!==null&&c>0?" ".repeat(c):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":VX(e,l);break;case'"':Px(e,l,"double-quoted-scalar");break;case"'":Px(e,l,"single-quoted-scalar");break;default:Px(e,l,"scalar")}}function VX(e,t){let n=t.indexOf(`
124
+ `}),{type:"block-scalar",offset:s,indent:r,props:m,source:f}}case'"':return{type:"double-quoted-scalar",offset:s,indent:r,source:c,end:l};case"'":return{type:"single-quoted-scalar",offset:s,indent:r,source:c,end:l};default:return{type:"scalar",offset:s,indent:r,source:c,end:l}}}function VX(e,t,n={}){let{afterKey:r=!1,implicitKey:o=!1,inFlow:s=!1,type:a}=n,c="indent"in e?e.indent:null;if(r&&typeof c=="number"&&(c+=2),!a)switch(e.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let u=e.props[0];if(u.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let l=kL.stringifyString({type:a,value:t},{implicitKey:o||c===null,indent:c!==null&&c>0?" ".repeat(c):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":GX(e,l);break;case'"':Cx(e,l,"double-quoted-scalar");break;case"'":Cx(e,l,"single-quoted-scalar");break;default:Cx(e,l,"scalar")}}function GX(e,t){let n=t.indexOf(`
125
125
  `),r=t.substring(0,n),o=t.substring(n+1)+`
126
126
  `;if(e.type==="block-scalar"){let s=e.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=r,e.source=o}else{let{offset:s}=e,a="indent"in e?e.indent:-1,c=[{type:"block-scalar-header",offset:s,indent:a,source:r}];FL(c,"end"in e?e.end:void 0)||c.push({type:"newline",offset:-1,indent:a,source:`
127
- `});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:a,props:c,source:o})}}function FL(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function Px(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),o=t.length;e.props[0].type==="block-scalar-header"&&(o-=e.props[0].source.length);for(let s of r)s.offset+=o;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case"block-map":case"block-seq":{let o={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
128
- `};delete e.items,Object.assign(e,{type:n,source:t,end:[o]});break}default:{let r="indent"in e?e.indent:-1,o="end"in e&&Array.isArray(e.end)?e.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(e))s!=="type"&&s!=="offset"&&delete e[s];Object.assign(e,{type:n,indent:r,source:t,end:o})}}}jm.createScalarToken=UX;jm.resolveAsScalar=WX;jm.setScalarValue=HX});var ML=C(OL=>{"use strict";var GX=e=>"type"in e?Um(e):Wm(e);function Um(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=Um(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=Wm(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=Wm(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=Wm(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function Wm({start:e,key:t,sep:n,value:r}){let o="";for(let s of e)o+=s.source;if(t&&(o+=Um(t)),n)for(let s of n)o+=s.source;return r&&(o+=Um(r)),o}OL.stringify=GX});var jL=C(BL=>{"use strict";var Nx=Symbol("break visit"),zX=Symbol("skip children"),$L=Symbol("remove item");function es(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),qL(Object.freeze([]),e,t)}es.BREAK=Nx;es.SKIP=zX;es.REMOVE=$L;es.itemAtPath=(e,t)=>{let n=e;for(let[r,o]of t){let s=n?.[r];if(s&&"items"in s)n=s.items[o];else return}return n};es.parentCollection=(e,t)=>{let n=es.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],o=n?.[r];if(o&&"items"in o)return o;throw new Error("Parent collection not found")};function qL(e,t,n){let r=n(t,e);if(typeof r=="symbol")return r;for(let o of["key","value"]){let s=t[o];if(s&&"items"in s){for(let a=0;a<s.items.length;++a){let c=qL(Object.freeze(e.concat([[o,a]])),s.items[a],n);if(typeof c=="number")a=c-1;else{if(c===Nx)return Nx;c===$L&&(s.items.splice(a,1),a-=1)}}typeof r=="function"&&o==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}BL.visit=es});var Hm=C(kn=>{"use strict";var Ex=LL(),KX=ML(),YX=jL(),Rx="\uFEFF",Tx="",Ax="",Ix="",XX=e=>!!e&&"items"in e,JX=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function QX(e){switch(e){case Rx:return"<BOM>";case Tx:return"<DOC>";case Ax:return"<FLOW_END>";case Ix:return"<SCALAR>";default:return JSON.stringify(e)}}function ZX(e){switch(e){case Rx:return"byte-order-mark";case Tx:return"doc-mode";case Ax:return"flow-error-end";case Ix:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
127
+ `});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:a,props:c,source:o})}}function FL(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function Cx(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),o=t.length;e.props[0].type==="block-scalar-header"&&(o-=e.props[0].source.length);for(let s of r)s.offset+=o;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case"block-map":case"block-seq":{let o={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
128
+ `};delete e.items,Object.assign(e,{type:n,source:t,end:[o]});break}default:{let r="indent"in e?e.indent:-1,o="end"in e&&Array.isArray(e.end)?e.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(e))s!=="type"&&s!=="offset"&&delete e[s];Object.assign(e,{type:n,indent:r,source:t,end:o})}}}Wm.createScalarToken=HX;Wm.resolveAsScalar=UX;Wm.setScalarValue=VX});var ML=C(OL=>{"use strict";var zX=e=>"type"in e?Hm(e):Um(e);function Hm(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=Hm(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=Um(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=Um(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=Um(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function Um({start:e,key:t,sep:n,value:r}){let o="";for(let s of e)o+=s.source;if(t&&(o+=Hm(t)),n)for(let s of n)o+=s.source;return r&&(o+=Hm(r)),o}OL.stringify=zX});var jL=C(BL=>{"use strict";var Px=Symbol("break visit"),KX=Symbol("skip children"),$L=Symbol("remove item");function es(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),qL(Object.freeze([]),e,t)}es.BREAK=Px;es.SKIP=KX;es.REMOVE=$L;es.itemAtPath=(e,t)=>{let n=e;for(let[r,o]of t){let s=n?.[r];if(s&&"items"in s)n=s.items[o];else return}return n};es.parentCollection=(e,t)=>{let n=es.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],o=n?.[r];if(o&&"items"in o)return o;throw new Error("Parent collection not found")};function qL(e,t,n){let r=n(t,e);if(typeof r=="symbol")return r;for(let o of["key","value"]){let s=t[o];if(s&&"items"in s){for(let a=0;a<s.items.length;++a){let c=qL(Object.freeze(e.concat([[o,a]])),s.items[a],n);if(typeof c=="number")a=c-1;else{if(c===Px)return Px;c===$L&&(s.items.splice(a,1),a-=1)}}typeof r=="function"&&o==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}BL.visit=es});var Vm=C(kn=>{"use strict";var Nx=LL(),YX=ML(),XX=jL(),Ex="\uFEFF",Rx="",Tx="",Ax="",JX=e=>!!e&&"items"in e,QX=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function ZX(e){switch(e){case Ex:return"<BOM>";case Rx:return"<DOC>";case Tx:return"<FLOW_END>";case Ax:return"<SCALAR>";default:return JSON.stringify(e)}}function eJ(e){switch(e){case Ex:return"byte-order-mark";case Rx:return"doc-mode";case Tx:return"flow-error-end";case Ax:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
129
129
  `:case`\r
130
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}kn.createScalarToken=Ex.createScalarToken;kn.resolveAsScalar=Ex.resolveAsScalar;kn.setScalarValue=Ex.setScalarValue;kn.stringify=KX.stringify;kn.visit=YX.visit;kn.BOM=Rx;kn.DOCUMENT=Tx;kn.FLOW_END=Ax;kn.SCALAR=Ix;kn.isCollection=XX;kn.isScalar=JX;kn.prettyToken=QX;kn.tokenType=ZX});var Fx=C(UL=>{"use strict";var Ll=Hm();function Cr(e){switch(e){case void 0:case" ":case`
131
- `:case"\r":case" ":return!0;default:return!1}}var WL=new Set("0123456789ABCDEFabcdef"),eJ=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Vm=new Set(",[]{}"),tJ=new Set(` ,[]{}
132
- \r `),Dx=e=>!e||tJ.has(e),kx=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
130
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}kn.createScalarToken=Nx.createScalarToken;kn.resolveAsScalar=Nx.resolveAsScalar;kn.setScalarValue=Nx.setScalarValue;kn.stringify=YX.stringify;kn.visit=XX.visit;kn.BOM=Ex;kn.DOCUMENT=Rx;kn.FLOW_END=Tx;kn.SCALAR=Ax;kn.isCollection=JX;kn.isScalar=QX;kn.prettyToken=ZX;kn.tokenType=eJ});var kx=C(UL=>{"use strict";var Ol=Vm();function Cr(e){switch(e){case void 0:case" ":case`
131
+ `:case"\r":case" ":return!0;default:return!1}}var WL=new Set("0123456789ABCDEFabcdef"),tJ=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Gm=new Set(",[]{}"),nJ=new Set(` ,[]{}
132
+ \r `),Ix=e=>!e||nJ.has(e),Dx=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
133
133
  `?!0:n==="\r"?this.buffer[t+1]===`
134
134
  `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+t];if(n==="\r"){let o=this.buffer[r+t+1];if(o===`
135
135
  `||!o&&!this.atEnd)return t+r+1}return n===`
136
136
  `||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&Cr(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
137
- `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Ll.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,r=t.indexOf("#");for(;r!==-1;){let s=t[r-1];if(s===" "||s===" "){n=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let s=t[n-1];if(s===" "||s===" ")n-=1;else break}let o=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield Ll.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&Cr(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Cr(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Cr(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Dx),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let o=this.getLine();if(o===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&o[0]!=="#"||r===0&&(o.startsWith("---")||o.startsWith("..."))&&Cr(o[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(o[0]==="]"||o[0]==="}")))return this.flowLevel=0,yield Ll.FLOW_END,yield*this.parseLineStart();let s=0;for(;o[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),o[s]){case void 0:return"flow";case"#":return yield*this.pushCount(o.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Dx),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||Cr(a)||a===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),o=r.indexOf(`
137
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Ol.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,r=t.indexOf("#");for(;r!==-1;){let s=t[r-1];if(s===" "||s===" "){n=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let s=t[n-1];if(s===" "||s===" ")n-=1;else break}let o=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield Ol.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&Cr(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Cr(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Cr(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ix),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let o=this.getLine();if(o===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&o[0]!=="#"||r===0&&(o.startsWith("---")||o.startsWith("..."))&&Cr(o[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(o[0]==="]"||o[0]==="}")))return this.flowLevel=0,yield Ol.FLOW_END,yield*this.parseLineStart();let s=0;for(;o[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),o[s]){case void 0:return"flow";case"#":return yield*this.pushCount(o.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Ix),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||Cr(a)||a===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),o=r.indexOf(`
138
138
  `,this.pos);if(o!==-1){for(;o!==-1;){let s=this.continueScalar(o+1);if(s===-1)break;o=r.indexOf(`
139
139
  `,s)}o!==-1&&(n=o-(r[o-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Cr(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case`
140
140
  `:t=s,n=0;break;case"\r":{let a=this.buffer[s+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===`
141
141
  `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(t+1);if(s===-1)break;t=this.buffer.indexOf(`
142
142
  `,s)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let o=t+1;for(r=this.buffer[o];r===" ";)r=this.buffer[++o];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
143
143
  `;)r=this.buffer[++o];t=o-1}else if(!this.blockScalarKeep)do{let s=t-1,a=this.buffer[s];a==="\r"&&(a=this.buffer[--s]);let c=s;for(;a===" ";)a=this.buffer[--s];if(a===`
144
- `&&s>=this.pos&&s+1+n>c)t=s;else break}while(!0);return yield Ll.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,r=this.pos-1,o;for(;o=this.buffer[++r];)if(o===":"){let s=this.buffer[r+1];if(Cr(s)||t&&Vm.has(s))break;n=r}else if(Cr(o)){let s=this.buffer[r+1];if(o==="\r"&&(s===`
144
+ `&&s>=this.pos&&s+1+n>c)t=s;else break}while(!0);return yield Ol.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,r=this.pos-1,o;for(;o=this.buffer[++r];)if(o===":"){let s=this.buffer[r+1];if(Cr(s)||t&&Gm.has(s))break;n=r}else if(Cr(o)){let s=this.buffer[r+1];if(o==="\r"&&(s===`
145
145
  `?(r+=1,o=`
146
- `,s=this.buffer[r+1]):n=r),s==="#"||t&&Vm.has(s))break;if(o===`
147
- `){let a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&Vm.has(o))break;n=r}return!o&&!this.atEnd?this.setNext("plain-scalar"):(yield Ll.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Dx),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(Cr(r)||n&&Vm.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Cr(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(eJ.has(n))n=this.buffer[++t];else if(n==="%"&&WL.has(this.buffer[t+1])&&WL.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
146
+ `,s=this.buffer[r+1]):n=r),s==="#"||t&&Gm.has(s))break;if(o===`
147
+ `){let a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&Gm.has(o))break;n=r}return!o&&!this.atEnd?this.setNext("plain-scalar"):(yield Ol.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Ix),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(Cr(r)||n&&Gm.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Cr(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(tJ.has(n))n=this.buffer[++t];else if(n==="%"&&WL.has(this.buffer[t+1])&&WL.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
148
148
  `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
149
- `?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");let o=n-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=n),o}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};UL.Lexer=kx});var Ox=C(HL=>{"use strict";var Lx=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n<r;){let s=n+r>>1;this.lineStarts[s]<t?n=s+1:r=s}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let o=this.lineStarts[n-1];return{line:n,col:t-o+1}}}};HL.LineCounter=Lx});var $x=C(YL=>{"use strict";var nJ=require("process"),VL=Hm(),rJ=Fx();function so(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function GL(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function KL(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Gm(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Na(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function zm(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function zL(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!so(t.start,"explicit-key-ind")&&!so(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,KL(t.value)?t.value.end?zm(t.value.end,t.sep):t.value.end=t.sep:zm(t.start,t.sep),delete t.sep)}var Mx=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new rJ.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,n))yield*this.next(r);n||(yield*this.end())}*next(t){if(this.source=t,nJ.env.LOG_TOKENS&&console.log("|",VL.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=VL.tokenType(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&zL(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let o=r.items[r.items.length-1];if(o.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=n;else{Object.assign(o,{key:n,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{let o=r.items[r.items.length-1];o.value?r.items.push({start:[],value:n}):o.value=n;break}case"flow-collection":{let o=r.items[r.items.length-1];!o||o.value?r.items.push({start:[],key:n,sep:[]}):o.sep?o.value=n:Object.assign(o,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let o=n.items[n.items.length-1];o&&!o.sep&&!o.value&&o.start.length>0&&GL(o.start)===-1&&(n.indent===0||o.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(r.type==="document"?r.end=o.start:r.items.push({start:o.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{GL(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=Gm(this.peek(2)),r=Na(n),o;t.end?(o=t.end,o.push(this.sourceToken),delete t.end):o=[this.sourceToken];let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
149
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");let o=n-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=n),o}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};UL.Lexer=Dx});var Lx=C(HL=>{"use strict";var Fx=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n<r;){let s=n+r>>1;this.lineStarts[s]<t?n=s+1:r=s}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let o=this.lineStarts[n-1];return{line:n,col:t-o+1}}}};HL.LineCounter=Fx});var Mx=C(YL=>{"use strict";var rJ=require("process"),VL=Vm(),iJ=kx();function so(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function GL(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function KL(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function zm(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Na(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Km(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function zL(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!so(t.start,"explicit-key-ind")&&!so(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,KL(t.value)?t.value.end?Km(t.value.end,t.sep):t.value.end=t.sep:Km(t.start,t.sep),delete t.sep)}var Ox=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new iJ.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,n))yield*this.next(r);n||(yield*this.end())}*next(t){if(this.source=t,rJ.env.LOG_TOKENS&&console.log("|",VL.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=VL.tokenType(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&zL(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let o=r.items[r.items.length-1];if(o.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=n;else{Object.assign(o,{key:n,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{let o=r.items[r.items.length-1];o.value?r.items.push({start:[],value:n}):o.value=n;break}case"flow-collection":{let o=r.items[r.items.length-1];!o||o.value?r.items.push({start:[],key:n,sep:[]}):o.sep?o.value=n:Object.assign(o,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let o=n.items[n.items.length-1];o&&!o.sep&&!o.value&&o.start.length>0&&GL(o.start)===-1&&(n.indent===0||o.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(r.type==="document"?r.end=o.start:r.items.push({start:o.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{GL(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=zm(this.peek(2)),r=Na(n),o;t.end?(o=t.end,o.push(this.sourceToken),delete t.end):o=[this.sourceToken];let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
150
150
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
151
- `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){zm(o,n.start),o.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,o=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(o&&n.sep&&!n.value){let a=[];for(let c=0;c<n.sep.length;++c){let l=n.sep[c];switch(l.type){case"newline":a.push(c);break;case"space":break;case"comment":l.indent>t.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(s=n.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":o||n.value?(s.push(this.sourceToken),t.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):o||n.value?(s.push(this.sourceToken),t.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(so(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(KL(n.key)&&!so(n.sep,"newline")){let a=Na(n.start),c=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:c,sep:l}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(so(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let a=Na(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||o?t.items.push({start:s,key:null,sep:[this.sourceToken]}):so(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);o||n.value?(t.items.push({start:s,key:a,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(a):(Object.assign(n,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(t);if(a){if(a.type==="block-seq"){if(!n.explicitKey&&n.sep&&!so(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:s});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){zm(o,n.start),o.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||so(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:o,sep:[]}):n.sep?this.stack.push(o):Object.assign(n,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let o=Gm(r),s=Na(o);zL(t);let a=t.end.splice(1,t.end.length);a.push(this.sourceToken);let c={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=c}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
151
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){Km(o,n.start),o.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,o=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(o&&n.sep&&!n.value){let a=[];for(let c=0;c<n.sep.length;++c){let l=n.sep[c];switch(l.type){case"newline":a.push(c);break;case"space":break;case"comment":l.indent>t.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(s=n.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":o||n.value?(s.push(this.sourceToken),t.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):o||n.value?(s.push(this.sourceToken),t.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(so(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(KL(n.key)&&!so(n.sep,"newline")){let a=Na(n.start),c=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:c,sep:l}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(so(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let a=Na(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||o?t.items.push({start:s,key:null,sep:[this.sourceToken]}):so(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);o||n.value?(t.items.push({start:s,key:a,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(a):(Object.assign(n,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(t);if(a){if(a.type==="block-seq"){if(!n.explicitKey&&n.sep&&!so(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:s});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){Km(o,n.start),o.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||so(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:o,sep:[]}):n.sep?this.stack.push(o):Object.assign(n,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let o=zm(r),s=Na(o);zL(t);let a=t.end.splice(1,t.end.length);a.push(this.sourceToken);let c={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=c}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
152
152
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
153
- `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Gm(t),r=Na(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Gm(t),r=Na(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};YL.Parser=Mx});var eO=C(Ml=>{"use strict";var XL=Cx(),iJ=Rl(),Ol=Il(),oJ=xw(),sJ=Ie(),aJ=Ox(),JL=$x();function QL(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new aJ.LineCounter||null,prettyErrors:t}}function cJ(e,t={}){let{lineCounter:n,prettyErrors:r}=QL(t),o=new JL.Parser(n?.addNewLine),s=new XL.Composer(t),a=Array.from(s.compose(o.parse(e)));if(r&&n)for(let c of a)c.errors.forEach(Ol.prettifyError(e,n)),c.warnings.forEach(Ol.prettifyError(e,n));return a.length>0?a:Object.assign([],{empty:!0},s.streamInfo())}function ZL(e,t={}){let{lineCounter:n,prettyErrors:r}=QL(t),o=new JL.Parser(n?.addNewLine),s=new XL.Composer(t),a=null;for(let c of s.compose(o.parse(e),!0,e.length))if(!a)a=c;else if(a.options.logLevel!=="silent"){a.errors.push(new Ol.YAMLParseError(c.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(Ol.prettifyError(e,n)),a.warnings.forEach(Ol.prettifyError(e,n))),a}function lJ(e,t,n){let r;typeof t=="function"?r=t:n===void 0&&t&&typeof t=="object"&&(n=t);let o=ZL(e,n);if(!o)return null;if(o.warnings.forEach(s=>oJ.warn(o.options.logLevel,s)),o.errors.length>0){if(o.options.logLevel!=="silent")throw o.errors[0];o.errors=[]}return o.toJS(Object.assign({reviver:r},n))}function uJ(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let o=Math.round(n);n=o<1?void 0:o>8?{indent:8}:{indent:o}}if(e===void 0){let{keepUndefined:o}=n??t??{};if(!o)return}return sJ.isDocument(e)&&!r?e.toString(n):new iJ.Document(e,r,n).toString(n)}Ml.parse=lJ;Ml.parseAllDocuments=cJ;Ml.parseDocument=ZL;Ml.stringify=uJ});var Bx=C($e=>{"use strict";var dJ=Cx(),fJ=Rl(),mJ=ix(),qx=Il(),pJ=fl(),ao=Ie(),hJ=no(),gJ=Dt(),_J=io(),yJ=oo(),bJ=Hm(),SJ=Fx(),wJ=Ox(),xJ=$x(),Km=eO(),tO=cl();$e.Composer=dJ.Composer;$e.Document=fJ.Document;$e.Schema=mJ.Schema;$e.YAMLError=qx.YAMLError;$e.YAMLParseError=qx.YAMLParseError;$e.YAMLWarning=qx.YAMLWarning;$e.Alias=pJ.Alias;$e.isAlias=ao.isAlias;$e.isCollection=ao.isCollection;$e.isDocument=ao.isDocument;$e.isMap=ao.isMap;$e.isNode=ao.isNode;$e.isPair=ao.isPair;$e.isScalar=ao.isScalar;$e.isSeq=ao.isSeq;$e.Pair=hJ.Pair;$e.Scalar=gJ.Scalar;$e.YAMLMap=_J.YAMLMap;$e.YAMLSeq=yJ.YAMLSeq;$e.CST=bJ;$e.Lexer=SJ.Lexer;$e.LineCounter=wJ.LineCounter;$e.Parser=xJ.Parser;$e.parse=Km.parse;$e.parseAllDocuments=Km.parseAllDocuments;$e.parseDocument=Km.parseDocument;$e.stringify=Km.stringify;$e.visit=tO.visit;$e.visitAsync=tO.visitAsync});var F1=C((qde,k1)=>{var{hasOwnProperty:xv}=Object.prototype,vv=(e,t={})=>{typeof t=="string"&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<"u"&&process.platform,t.bracketedArray=t.bracketedArray!==!1;let n=t.platform==="win32"?`\r
153
+ `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=zm(t),r=Na(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=zm(t),r=Na(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};YL.Parser=Ox});var eO=C($l=>{"use strict";var XL=vx(),oJ=Tl(),Ml=Dl(),sJ=ww(),aJ=Ie(),cJ=Lx(),JL=Mx();function QL(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new cJ.LineCounter||null,prettyErrors:t}}function lJ(e,t={}){let{lineCounter:n,prettyErrors:r}=QL(t),o=new JL.Parser(n?.addNewLine),s=new XL.Composer(t),a=Array.from(s.compose(o.parse(e)));if(r&&n)for(let c of a)c.errors.forEach(Ml.prettifyError(e,n)),c.warnings.forEach(Ml.prettifyError(e,n));return a.length>0?a:Object.assign([],{empty:!0},s.streamInfo())}function ZL(e,t={}){let{lineCounter:n,prettyErrors:r}=QL(t),o=new JL.Parser(n?.addNewLine),s=new XL.Composer(t),a=null;for(let c of s.compose(o.parse(e),!0,e.length))if(!a)a=c;else if(a.options.logLevel!=="silent"){a.errors.push(new Ml.YAMLParseError(c.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(Ml.prettifyError(e,n)),a.warnings.forEach(Ml.prettifyError(e,n))),a}function uJ(e,t,n){let r;typeof t=="function"?r=t:n===void 0&&t&&typeof t=="object"&&(n=t);let o=ZL(e,n);if(!o)return null;if(o.warnings.forEach(s=>sJ.warn(o.options.logLevel,s)),o.errors.length>0){if(o.options.logLevel!=="silent")throw o.errors[0];o.errors=[]}return o.toJS(Object.assign({reviver:r},n))}function dJ(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let o=Math.round(n);n=o<1?void 0:o>8?{indent:8}:{indent:o}}if(e===void 0){let{keepUndefined:o}=n??t??{};if(!o)return}return aJ.isDocument(e)&&!r?e.toString(n):new oJ.Document(e,r,n).toString(n)}$l.parse=uJ;$l.parseAllDocuments=lJ;$l.parseDocument=ZL;$l.stringify=dJ});var qx=C($e=>{"use strict";var fJ=vx(),mJ=Tl(),pJ=rx(),$x=Dl(),hJ=ml(),ao=Ie(),gJ=no(),_J=Dt(),yJ=io(),bJ=oo(),SJ=Vm(),wJ=kx(),xJ=Lx(),vJ=Mx(),Ym=eO(),tO=ll();$e.Composer=fJ.Composer;$e.Document=mJ.Document;$e.Schema=pJ.Schema;$e.YAMLError=$x.YAMLError;$e.YAMLParseError=$x.YAMLParseError;$e.YAMLWarning=$x.YAMLWarning;$e.Alias=hJ.Alias;$e.isAlias=ao.isAlias;$e.isCollection=ao.isCollection;$e.isDocument=ao.isDocument;$e.isMap=ao.isMap;$e.isNode=ao.isNode;$e.isPair=ao.isPair;$e.isScalar=ao.isScalar;$e.isSeq=ao.isSeq;$e.Pair=gJ.Pair;$e.Scalar=_J.Scalar;$e.YAMLMap=yJ.YAMLMap;$e.YAMLSeq=bJ.YAMLSeq;$e.CST=SJ;$e.Lexer=wJ.Lexer;$e.LineCounter=xJ.LineCounter;$e.Parser=vJ.Parser;$e.parse=Ym.parse;$e.parseAllDocuments=Ym.parseAllDocuments;$e.parseDocument=Ym.parseDocument;$e.stringify=Ym.stringify;$e.visit=tO.visit;$e.visitAsync=tO.visitAsync});var F1=C((Bde,k1)=>{var{hasOwnProperty:wv}=Object.prototype,xv=(e,t={})=>{typeof t=="string"&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<"u"&&process.platform,t.bracketedArray=t.bracketedArray!==!1;let n=t.platform==="win32"?`\r
154
154
  `:`
155
- `,r=t.whitespace?" = ":"=",o=[],s=t.sort?Object.keys(e).sort():Object.keys(e),a=0;t.align&&(a=_i(s.filter(u=>e[u]===null||Array.isArray(e[u])||typeof e[u]!="object").map(u=>Array.isArray(e[u])?`${u}[]`:u).concat([""]).reduce((u,d)=>_i(u).length>=_i(d).length?u:d)).length);let c="",l=t.bracketedArray?"[]":"";for(let u of s){let d=e[u];if(d&&Array.isArray(d))for(let f of d)c+=_i(`${u}${l}`).padEnd(a," ")+r+_i(f)+n;else d&&typeof d=="object"?o.push(u):c+=_i(u).padEnd(a," ")+r+_i(d)+n}t.section&&c.length&&(c="["+_i(t.section)+"]"+(t.newline?n+n:n)+c);for(let u of o){let d=I1(u,".").join("\\."),f=(t.section?t.section+".":"")+d,m=vv(e[u],{...t,section:f});c.length&&m.length&&(c+=n),c+=m}return c};function I1(e,t){var n=0,r=0,o=0,s=[];do if(o=e.indexOf(t,n),o!==-1){if(n=o+t.length,o>0&&e[o-1]==="\\")continue;s.push(e.slice(r,o)),r=o+t.length}while(o!==-1);return s.push(e.slice(r)),s}var A1=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;let n=Object.create(null),r=n,o=null,s=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,a=e.split(/[\r\n]+/g),c={};for(let u of a){if(!u||u.match(/^\s*[;#]/)||u.match(/^\s*$/))continue;let d=u.match(s);if(!d)continue;if(d[1]!==void 0){if(o=mp(d[1]),o==="__proto__"){r=Object.create(null);continue}r=n[o]=n[o]||Object.create(null);continue}let f=mp(d[2]),m;t.bracketedArray?m=f.length>2&&f.slice(-2)==="[]":(c[f]=(c?.[f]||0)+1,m=c[f]>1);let p=m&&f.endsWith("[]")?f.slice(0,-2):f;if(p==="__proto__")continue;let g=d[3]?mp(d[4]):!0,h=g==="true"||g==="false"||g==="null"?JSON.parse(g):g;m&&(xv.call(r,p)?Array.isArray(r[p])||(r[p]=[r[p]]):r[p]=[]),Array.isArray(r[p])?r[p].push(h):r[p]=h}let l=[];for(let u of Object.keys(n)){if(!xv.call(n,u)||typeof n[u]!="object"||Array.isArray(n[u]))continue;let d=I1(u,".");r=n;let f=d.pop(),m=f.replace(/\\\./g,".");for(let p of d)p!=="__proto__"&&((!xv.call(r,p)||typeof r[p]!="object")&&(r[p]=Object.create(null)),r=r[p]);r===n&&m===f||(r[m]=n[u],l.push(u))}for(let u of l)delete n[u];return n},D1=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),_i=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&D1(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),mp=e=>{if(e=(e||"").trim(),D1(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let t=!1,n="";for(let r=0,o=e.length;r<o;r++){let s=e.charAt(r);if(t)"\\;#".indexOf(s)!==-1?n+=s:n+="\\"+s,t=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?t=!0:n+=s}}return t&&(n+="\\"),n.trim()}return e};k1.exports={parse:A1,decode:A1,stringify:vv,encode:vv,safe:_i,unsafe:mp}});var qu=class e{constructor(t,n,r,o){this._uri=t,this._languageId=n,this._version=r,this._content=o,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let n=this.offsetAt(t.start),r=this.offsetAt(t.end);return this._content.substring(n,r)}return this._content}update(t,n){for(let r of t)if(e.isIncremental(r)){let o=qP(r.range),s=this.offsetAt(o.start),a=this.offsetAt(o.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(a,this._content.length);let c=Math.max(o.start.line,0),l=Math.max(o.end.line,0),u=this._lineOffsets,d=MP(r.text,!1,s);if(l-c===d.length)for(let m=0,p=d.length;m<p;m++)u[m+c+1]=d[m];else d.length<1e4?u.splice(c+1,l-c,...d):this._lineOffsets=u=u.slice(0,c+1).concat(d,u.slice(l+1));let f=r.text.length-(a-s);if(f!==0)for(let m=c+1+d.length,p=u.length;m<p;m++)u[m]=u[m]+f}else if(e.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=MP(this._content,!0)),this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),r=0,o=n.length;if(o===0)return{line:0,character:t};for(;r<o;){let a=Math.floor((r+o)/2);n[a]>t?o=a:r=a+1}let s=r-1;return t=this.ensureBeforeEOL(t,n[s]),{line:s,character:t-n[s]}}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line];if(t.character<=0)return r;let o=t.line+1<n.length?n[t.line+1]:this._content.length,s=Math.min(r+t.character,o);return this.ensureBeforeEOL(s,r)}getLineRange(t){let n=this.getLineOffsets();if(t>=n.length){let a=n.length-1;return{start:{line:a,character:0},end:{line:a,character:this._content.length-n[a]}}}else if(t<0)return{start:{line:0,character:0},end:{line:0,character:0}};let r=n[t],o=t+1<n.length?n[t+1]:this._content.length,s=this.ensureBeforeEOL(o,r);return{start:{line:t,character:0},end:{line:t,character:s-r}}}getEOLCharacters(t){let n=this.getLineOffsets();if(t>=n.length)return"";if(t<0)return"";let r=t+1<n.length?n[t+1]:this._content.length,o=this.ensureBeforeEOL(r,n[t]);return this._content.substring(o,r)}ensureBeforeEOL(t,n){for(;t>n&&$P(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}},Bu;(function(e){function t(o,s,a,c){return new qu(o,s,a,c)}e.create=t;function n(o,s,a){if(o instanceof qu)return o.update(s,a),o;throw new Error("TextDocument.update: document must be created by TextDocument.create")}e.update=n;function r(o,s){let a=o.getText(),c=Eh(s.map(mH),(d,f)=>{let m=d.range.start.line-f.range.start.line;return m===0?d.range.start.character-f.range.start.character:m}),l=0,u=[];for(let d of c){let f=o.offsetAt(d.range.start);if(f<l)throw new Error("Overlapping edit");f>l&&u.push(a.substring(l,f)),d.newText.length&&u.push(d.newText),l=o.offsetAt(d.range.end)}return u.push(a.substr(l)),u.join("")}e.applyEdits=r})(Bu||(Bu={}));function Eh(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),o=e.slice(n);Eh(r,t),Eh(o,t);let s=0,a=0,c=0;for(;s<r.length&&a<o.length;)t(r[s],o[a])<=0?e[c++]=r[s++]:e[c++]=o[a++];for(;s<r.length;)e[c++]=r[s++];for(;a<o.length;)e[c++]=o[a++];return e}function MP(e,t,n=0){let r=t?[n]:[];for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);$P(s)&&(s===13&&o+1<e.length&&e.charCodeAt(o+1)===10&&o++,r.push(n+o+1))}return r}function $P(e){return e===13||e===10}function qP(e){let t=e.start,n=e.end;return t.line>n.line||t.line===n.line&&t.character>n.character?{start:n,end:t}:e}function mH(e){let t=qP(e.range);return t!==e.range?{newText:e.newText,range:t}:e}var hc=B(le());var nf=require("node:url");function Ne(e){return e.startsWith("file://")?(0,nf.pathToFileURL)((0,nf.fileURLToPath)(e)).toString():e}function nA(e,t,n){let{warn:r,thresholdMs:o,tag:s}=t,a=performance.now(),c=()=>Math.round(performance.now()-a),l=f=>r(`[${s}] ${e} ${f}`),u=()=>{let f=c();f>o&&l(`took ${f}ms`)},d;try{d=n()}catch(f){throw l(`threw after ${c()}ms`),f}return d instanceof Promise?d.then(f=>(u(),f),f=>{throw l(`threw after ${c()}ms`),f}):(u(),d)}var rA=parseInt(process.env.BGFORGE_LSP_SLOW_MS??"",10),iA=Number.isFinite(rA)?rA:50;function xe(e,t,n){let{warn:r,thresholdMs:o=iA}=n;return function(...s){return nA(e,{warn:r,thresholdMs:o,tag:"lsp-timing"},()=>t(...s))}}function oA(e,t=iA){return{warn:n=>e.warn(n),thresholdMs:t}}var aoe=B(le()),Yy,Xy;function sA(e,t){Yy=e,Xy=t}function Mr(){if(!Yy)throw new Error("LSP connection not initialized. Call initLspConnection first.");return Yy}function aA(){if(!Xy)throw new Error("Documents manager not initialized. Call initLspConnection first.");return Xy}var Jy;function cA(e){Jy=e}function Zs(e){if(!Jy)throw new Error("Settings service not initialized. Call initSettingsService first.");return Jy(e)}var ea=class{timers=new Map;delayMs;constructor(t){this.delayMs=t}schedule(t,n){let r=this.timers.get(t);r!==void 0&&clearTimeout(r),this.timers.set(t,setTimeout(()=>{this.timers.delete(t),n()},this.delayMs))}cancel(t){let n=this.timers.get(t);return n!==void 0?(clearTimeout(n),this.timers.delete(t),!0):!1}has(t){return this.timers.has(t)}dispose(){for(let t of this.timers.values())clearTimeout(t);this.timers.clear()}};function lA(){let e=new Set,t;return{markAffected(n){e.clear();for(let r of n)e.add(r);t&&clearTimeout(t),t=setTimeout(()=>{e.clear()},3e3)},consumeAffected(n){return e.delete(n)},isAffected(n){return e.has(n)},dispose(){t&&clearTimeout(t),t=void 0,e.clear()}}}var jW=require("node:url"),Sh=B(le());var uA=!1;function Qy(e){uA=e}function T(e,t="info"){if(t==="debug"&&!uA)return;let n=Mr().console;switch(t){case"debug":n.log(`[debug] ${e}`);break;case"info":n.log(e);break;case"warn":n.warn(e);break;case"error":n.error(e);break}}var mt="fallout-ssl",$r="fallout-ssl-tooltip",rf="fallout-worldmap-txt",ta="fallout-msg",qr="typescript",_n="weidu-tp2",Bi="weidu-tp2-tooltip",Tt="weidu-baf",At="weidu-d",Uc="weidu-d-tooltip",Zy="weidu-slb",Hc="weidu-ssl",of="weidu-log",eb="infinity-2da",na="weidu-tra",tb="fallout-scripts-lst",nb=".ssl";var bG=[".h"],rb=[...bG,nb],zn=".tssl",yn=".tbaf",Jt=".td",sf=[".tph",".tpa",".tpp",".tp2"],af=".baf",qo=".d";var Vc=[...sf.map(e=>e.slice(1)),qo.slice(1),af.slice(1),yn.slice(1),Jt.slice(1)],Gc=[nb.slice(1),"h",zn.slice(1)];var cf=[Tt,At,Hc,_n,qr],dA=[ta,na],lf=[mt,qr],fA={[Tt]:"-",[_n]:"#-",[At]:"#.-"};var SG=Object.defineProperty,A=(e,t)=>SG(e,"name",{value:t,configurable:!0}),yoe=class{static{A(this,"Edit")}startPosition;oldEndPosition;newEndPosition;startIndex;oldEndIndex;newEndIndex;constructor({startIndex:e,oldEndIndex:t,newEndIndex:n,startPosition:r,oldEndPosition:o,newEndPosition:s}){this.startIndex=e>>>0,this.oldEndIndex=t>>>0,this.newEndIndex=n>>>0,this.startPosition=r,this.oldEndPosition=o,this.newEndPosition=s}editPoint(e,t){let n=t,r={...e};if(t>=this.oldEndIndex){n=this.newEndIndex+(t-this.oldEndIndex);let o=e.row;r.row=this.newEndPosition.row+(e.row-this.oldEndPosition.row),r.column=o===this.oldEndPosition.row?this.newEndPosition.column+(e.column-this.oldEndPosition.column):e.column}else t>this.startIndex&&(n=this.newEndIndex,r.row=this.newEndPosition.row,r.column=this.newEndPosition.column);return{point:r,index:n}}editRange(e){let t={startIndex:e.startIndex,startPosition:{...e.startPosition},endIndex:e.endIndex,endPosition:{...e.endPosition}};return e.endIndex>=this.oldEndIndex?e.endIndex!==Number.MAX_SAFE_INTEGER&&(t.endIndex=this.newEndIndex+(e.endIndex-this.oldEndIndex),t.endPosition={row:this.newEndPosition.row+(e.endPosition.row-this.oldEndPosition.row),column:e.endPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.endPosition.column-this.oldEndPosition.column):e.endPosition.column},t.endIndex<this.newEndIndex&&(t.endIndex=Number.MAX_SAFE_INTEGER,t.endPosition={row:Number.MAX_SAFE_INTEGER,column:Number.MAX_SAFE_INTEGER})):e.endIndex>this.startIndex&&(t.endIndex=this.startIndex,t.endPosition={...this.startPosition}),e.startIndex>=this.oldEndIndex?(t.startIndex=this.newEndIndex+(e.startIndex-this.oldEndIndex),t.startPosition={row:this.newEndPosition.row+(e.startPosition.row-this.oldEndPosition.row),column:e.startPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.startPosition.column-this.oldEndPosition.column):e.startPosition.column},t.startIndex<this.newEndIndex&&(t.startIndex=Number.MAX_SAFE_INTEGER,t.startPosition={row:Number.MAX_SAFE_INTEGER,column:Number.MAX_SAFE_INTEGER})):e.startIndex>this.startIndex&&(t.startIndex=this.startIndex,t.startPosition={...this.startPosition}),t}},mA=2,ne=4,ib=4*ne,Tn=5*ne,Br=2*ne,Yc=2*ne+2*Br,Rn={row:0,column:0},ji=Symbol("INTERNAL");function ra(e){if(e!==ji)throw new Error("Illegal constructor")}A(ra,"assertInternal");function Kc(e){return!!e&&typeof e.row=="number"&&typeof e.column=="number"}A(Kc,"isPoint");function SA(e){x=e}A(SA,"setModule");var x;function ia(e){try{return new FinalizationRegistry(e)}catch(t){console.error("Unsupported FinalizationRegistry:",t);return}}A(ia,"newFinalizer");var pA=ia(e=>{x._ts_lookahead_iterator_delete(e)}),wG=class{static{A(this,"LookaheadIterator")}0=0;language;positioned=!1;constructor(e,t,n){ra(e),this[0]=t,this.language=n,pA?.register(this,t,this)}get currentTypeId(){return this.positioned?x._ts_lookahead_iterator_current_symbol(this[0]):null}get currentType(){let e=this.currentTypeId;return e===null?null:this.language.types[e]??x.UTF8ToString(x._ts_language_symbol_name(this.language[0],e))}delete(){pA?.unregister(this),x._ts_lookahead_iterator_delete(this[0]),this[0]=0}reset(e,t){return x._ts_lookahead_iterator_reset(this[0],e[0],t)?(this.language=e,this.positioned=!1,!0):!1}resetState(e){return x._ts_lookahead_iterator_reset_state(this[0],e)?(this.positioned=!1,!0):!1}[Symbol.iterator](){return{next:A(()=>{this.positioned=!!x._ts_lookahead_iterator_next(this[0]);let e=this.currentType;return e===null?{done:!0,value:""}:{done:!1,value:e}},"next")}}};function lb(e,t,n,r){let o=n-t,s=e.textCallback(t,r);if(s){for(t+=s.length;t<n;){let a=e.textCallback(t,r);if(a&&a.length>0)t+=a.length,s+=a;else break}t>n&&(s=s.slice(0,o))}return s??""}A(lb,"getText");var hA=ia(e=>{x._ts_tree_delete(e)}),xG=class ab{static{A(this,"Tree")}0=0;textCallback;language;constructor(t,n,r,o){ra(t),this[0]=n,this.language=r,this.textCallback=o,hA?.register(this,n,this)}copy(){let t=x._ts_tree_copy(this[0]);return new ab(ji,t,this.language,this.textCallback)}delete(){hA?.unregister(this),x._ts_tree_delete(this[0]),this[0]=0}get rootNode(){return x._ts_tree_root_node_wasm(this[0]),st(this)}rootNodeWithOffset(t,n){let r=X+Tn;return x.setValue(r,t,"i32"),rr(r+ne,n),x._ts_tree_root_node_with_offset_wasm(this[0]),st(this)}edit(t){vA(t),x._ts_tree_edit_wasm(this[0])}walk(){return this.rootNode.walk()}getChangedRanges(t){if(!(t instanceof ab))throw new TypeError("Argument must be a Tree");x._ts_tree_get_changed_ranges_wasm(this[0],t[0]);let n=x.getValue(X,"i32"),r=x.getValue(X+ne,"i32"),o=new Array(n);if(n>0){let s=r;for(let a=0;a<n;a++)o[a]=df(s),s+=Yc;x._free(r)}return o}getIncludedRanges(){x._ts_tree_included_ranges_wasm(this[0]);let t=x.getValue(X,"i32"),n=x.getValue(X+ne,"i32"),r=new Array(t);if(t>0){let o=n;for(let s=0;s<t;s++)r[s]=df(o),o+=Yc;x._free(n)}return r}},gA=ia(e=>{x._ts_tree_cursor_delete_wasm(e)}),vG=class wA{static{A(this,"TreeCursor")}0=0;1=0;2=0;3=0;tree;constructor(t,n){ra(t),this.tree=n,Kn(this),gA?.register(this,this.tree[0],this)}copy(){let t=new wA(ji,this.tree);return x._ts_tree_cursor_copy_wasm(this.tree[0]),Kn(t),t}delete(){gA?.unregister(this),Ke(this),x._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}get currentNode(){return Ke(this),x._ts_tree_cursor_current_node_wasm(this.tree[0]),st(this.tree)}get currentFieldId(){return Ke(this),x._ts_tree_cursor_current_field_id_wasm(this.tree[0])}get currentFieldName(){return this.tree.language.fields[this.currentFieldId]}get currentDepth(){return Ke(this),x._ts_tree_cursor_current_depth_wasm(this.tree[0])}get currentDescendantIndex(){return Ke(this),x._ts_tree_cursor_current_descendant_index_wasm(this.tree[0])}get nodeType(){return this.tree.language.types[this.nodeTypeId]||"ERROR"}get nodeTypeId(){return Ke(this),x._ts_tree_cursor_current_node_type_id_wasm(this.tree[0])}get nodeStateId(){return Ke(this),x._ts_tree_cursor_current_node_state_id_wasm(this.tree[0])}get nodeId(){return Ke(this),x._ts_tree_cursor_current_node_id_wasm(this.tree[0])}get nodeIsNamed(){return Ke(this),x._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])===1}get nodeIsMissing(){return Ke(this),x._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])===1}get nodeText(){Ke(this);let t=x._ts_tree_cursor_start_index_wasm(this.tree[0]),n=x._ts_tree_cursor_end_index_wasm(this.tree[0]);x._ts_tree_cursor_start_position_wasm(this.tree[0]);let r=Bo(X);return lb(this.tree,t,n,r)}get startPosition(){return Ke(this),x._ts_tree_cursor_start_position_wasm(this.tree[0]),Bo(X)}get endPosition(){return Ke(this),x._ts_tree_cursor_end_position_wasm(this.tree[0]),Bo(X)}get startIndex(){return Ke(this),x._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return Ke(this),x._ts_tree_cursor_end_index_wasm(this.tree[0])}gotoFirstChild(){Ke(this);let t=x._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return Kn(this),t===1}gotoLastChild(){Ke(this);let t=x._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return Kn(this),t===1}gotoParent(){Ke(this);let t=x._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return Kn(this),t===1}gotoNextSibling(){Ke(this);let t=x._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return Kn(this),t===1}gotoPreviousSibling(){Ke(this);let t=x._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return Kn(this),t===1}gotoDescendant(t){Ke(this),x._ts_tree_cursor_goto_descendant_wasm(this.tree[0],t),Kn(this)}gotoFirstChildForIndex(t){Ke(this),x.setValue(X+ib,t,"i32");let n=x._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return Kn(this),n===1}gotoFirstChildForPosition(t){Ke(this),rr(X+ib,t);let n=x._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return Kn(this),n===1}reset(t){me(t),Ke(this,X+Tn),x._ts_tree_cursor_reset_wasm(this.tree[0]),Kn(this)}resetTo(t){Ke(this,X),Ke(t,X+ib),x._ts_tree_cursor_reset_to_wasm(this.tree[0],t.tree[0]),Kn(this)}},CG=class{static{A(this,"Node")}0=0;_children;_namedChildren;constructor(e,{id:t,tree:n,startIndex:r,startPosition:o,other:s}){ra(e),this[0]=s,this.id=t,this.tree=n,this.startIndex=r,this.startPosition=o}id;startIndex;startPosition;tree;get typeId(){return me(this),x._ts_node_symbol_wasm(this.tree[0])}get grammarId(){return me(this),x._ts_node_grammar_symbol_wasm(this.tree[0])}get type(){return this.tree.language.types[this.typeId]||"ERROR"}get grammarType(){return this.tree.language.types[this.grammarId]||"ERROR"}get isNamed(){return me(this),x._ts_node_is_named_wasm(this.tree[0])===1}get isExtra(){return me(this),x._ts_node_is_extra_wasm(this.tree[0])===1}get isError(){return me(this),x._ts_node_is_error_wasm(this.tree[0])===1}get isMissing(){return me(this),x._ts_node_is_missing_wasm(this.tree[0])===1}get hasChanges(){return me(this),x._ts_node_has_changes_wasm(this.tree[0])===1}get hasError(){return me(this),x._ts_node_has_error_wasm(this.tree[0])===1}get endIndex(){return me(this),x._ts_node_end_index_wasm(this.tree[0])}get endPosition(){return me(this),x._ts_node_end_point_wasm(this.tree[0]),Bo(X)}get text(){return lb(this.tree,this.startIndex,this.endIndex,this.startPosition)}get parseState(){return me(this),x._ts_node_parse_state_wasm(this.tree[0])}get nextParseState(){return me(this),x._ts_node_next_parse_state_wasm(this.tree[0])}equals(e){return this.tree===e.tree&&this.id===e.id}child(e){return me(this),x._ts_node_child_wasm(this.tree[0],e),st(this.tree)}namedChild(e){return me(this),x._ts_node_named_child_wasm(this.tree[0],e),st(this.tree)}childForFieldId(e){return me(this),x._ts_node_child_by_field_id_wasm(this.tree[0],e),st(this.tree)}childForFieldName(e){let t=this.tree.language.fields.indexOf(e);return t!==-1?this.childForFieldId(t):null}fieldNameForChild(e){me(this);let t=x._ts_node_field_name_for_child_wasm(this.tree[0],e);return t?x.AsciiToString(t):null}fieldNameForNamedChild(e){me(this);let t=x._ts_node_field_name_for_named_child_wasm(this.tree[0],e);return t?x.AsciiToString(t):null}childrenForFieldName(e){let t=this.tree.language.fields.indexOf(e);return t!==-1&&t!==0?this.childrenForFieldId(t):[]}childrenForFieldId(e){me(this),x._ts_node_children_by_field_id_wasm(this.tree[0],e);let t=x.getValue(X,"i32"),n=x.getValue(X+ne,"i32"),r=new Array(t);if(t>0){let o=n;for(let s=0;s<t;s++)r[s]=st(this.tree,o),o+=Tn;x._free(n)}return r}firstChildForIndex(e){me(this);let t=X+Tn;return x.setValue(t,e,"i32"),x._ts_node_first_child_for_byte_wasm(this.tree[0]),st(this.tree)}firstNamedChildForIndex(e){me(this);let t=X+Tn;return x.setValue(t,e,"i32"),x._ts_node_first_named_child_for_byte_wasm(this.tree[0]),st(this.tree)}get childCount(){return me(this),x._ts_node_child_count_wasm(this.tree[0])}get namedChildCount(){return me(this),x._ts_node_named_child_count_wasm(this.tree[0])}get firstChild(){return this.child(0)}get firstNamedChild(){return this.namedChild(0)}get lastChild(){return this.child(this.childCount-1)}get lastNamedChild(){return this.namedChild(this.namedChildCount-1)}get children(){if(!this._children){me(this),x._ts_node_children_wasm(this.tree[0]);let e=x.getValue(X,"i32"),t=x.getValue(X+ne,"i32");if(this._children=new Array(e),e>0){let n=t;for(let r=0;r<e;r++)this._children[r]=st(this.tree,n),n+=Tn;x._free(t)}}return this._children}get namedChildren(){if(!this._namedChildren){me(this),x._ts_node_named_children_wasm(this.tree[0]);let e=x.getValue(X,"i32"),t=x.getValue(X+ne,"i32");if(this._namedChildren=new Array(e),e>0){let n=t;for(let r=0;r<e;r++)this._namedChildren[r]=st(this.tree,n),n+=Tn;x._free(t)}}return this._namedChildren}descendantsOfType(e,t=Rn,n=Rn){Array.isArray(e)||(e=[e]);let r=[],o=this.tree.language.types;for(let u of e)u=="ERROR"&&r.push(65535);for(let u=0,d=o.length;u<d;u++)e.includes(o[u])&&r.push(u);let s=x._malloc(ne*r.length);for(let u=0,d=r.length;u<d;u++)x.setValue(s+u*ne,r[u],"i32");me(this),x._ts_node_descendants_of_type_wasm(this.tree[0],s,r.length,t.row,t.column,n.row,n.column);let a=x.getValue(X,"i32"),c=x.getValue(X+ne,"i32"),l=new Array(a);if(a>0){let u=c;for(let d=0;d<a;d++)l[d]=st(this.tree,u),u+=Tn}return x._free(c),x._free(s),l}get nextSibling(){return me(this),x._ts_node_next_sibling_wasm(this.tree[0]),st(this.tree)}get previousSibling(){return me(this),x._ts_node_prev_sibling_wasm(this.tree[0]),st(this.tree)}get nextNamedSibling(){return me(this),x._ts_node_next_named_sibling_wasm(this.tree[0]),st(this.tree)}get previousNamedSibling(){return me(this),x._ts_node_prev_named_sibling_wasm(this.tree[0]),st(this.tree)}get descendantCount(){return me(this),x._ts_node_descendant_count_wasm(this.tree[0])}get parent(){return me(this),x._ts_node_parent_wasm(this.tree[0]),st(this.tree)}childWithDescendant(e){return me(this),me(e,1),x._ts_node_child_with_descendant_wasm(this.tree[0]),st(this.tree)}descendantForIndex(e,t=e){if(typeof e!="number"||typeof t!="number")throw new Error("Arguments must be numbers");me(this);let n=X+Tn;return x.setValue(n,e,"i32"),x.setValue(n+ne,t,"i32"),x._ts_node_descendant_for_index_wasm(this.tree[0]),st(this.tree)}namedDescendantForIndex(e,t=e){if(typeof e!="number"||typeof t!="number")throw new Error("Arguments must be numbers");me(this);let n=X+Tn;return x.setValue(n,e,"i32"),x.setValue(n+ne,t,"i32"),x._ts_node_named_descendant_for_index_wasm(this.tree[0]),st(this.tree)}descendantForPosition(e,t=e){if(!Kc(e)||!Kc(t))throw new Error("Arguments must be {row, column} objects");me(this);let n=X+Tn;return rr(n,e),rr(n+Br,t),x._ts_node_descendant_for_position_wasm(this.tree[0]),st(this.tree)}namedDescendantForPosition(e,t=e){if(!Kc(e)||!Kc(t))throw new Error("Arguments must be {row, column} objects");me(this);let n=X+Tn;return rr(n,e),rr(n+Br,t),x._ts_node_named_descendant_for_position_wasm(this.tree[0]),st(this.tree)}walk(){return me(this),x._ts_tree_cursor_new_wasm(this.tree[0]),new vG(ji,this.tree)}edit(e){if(this.startIndex>=e.oldEndIndex){this.startIndex=e.newEndIndex+(this.startIndex-e.oldEndIndex);let t,n;this.startPosition.row>e.oldEndPosition.row?(t=this.startPosition.row-e.oldEndPosition.row,n=this.startPosition.column):(t=0,n=this.startPosition.column,this.startPosition.column>=e.oldEndPosition.column&&(n=this.startPosition.column-e.oldEndPosition.column)),t>0?(this.startPosition.row+=t,this.startPosition.column=n):this.startPosition.column+=n}else this.startIndex>e.startIndex&&(this.startIndex=e.newEndIndex,this.startPosition.row=e.newEndPosition.row,this.startPosition.column=e.newEndPosition.column)}toString(){me(this);let e=x._ts_node_to_string_wasm(this.tree[0]),t=x.AsciiToString(e);return x._free(e),t}};function cb(e,t,n,r,o){for(let s=0,a=o.length;s<a;s++){let c=x.getValue(n,"i32");n+=ne;let l=st(t,n);n+=Tn,o[s]={patternIndex:r,name:e.captureNames[c],node:l}}return n}A(cb,"unmarshalCaptures");function me(e,t=0){let n=X+t*Tn;x.setValue(n,e.id,"i32"),n+=ne,x.setValue(n,e.startIndex,"i32"),n+=ne,x.setValue(n,e.startPosition.row,"i32"),n+=ne,x.setValue(n,e.startPosition.column,"i32"),n+=ne,x.setValue(n,e[0],"i32")}A(me,"marshalNode");function st(e,t=X){let n=x.getValue(t,"i32");if(t+=ne,n===0)return null;let r=x.getValue(t,"i32");t+=ne;let o=x.getValue(t,"i32");t+=ne;let s=x.getValue(t,"i32");t+=ne;let a=x.getValue(t,"i32");return new CG(ji,{id:n,tree:e,startIndex:r,startPosition:{row:o,column:s},other:a})}A(st,"unmarshalNode");function Ke(e,t=X){x.setValue(t+0*ne,e[0],"i32"),x.setValue(t+1*ne,e[1],"i32"),x.setValue(t+2*ne,e[2],"i32"),x.setValue(t+3*ne,e[3],"i32")}A(Ke,"marshalTreeCursor");function Kn(e){e[0]=x.getValue(X+0*ne,"i32"),e[1]=x.getValue(X+1*ne,"i32"),e[2]=x.getValue(X+2*ne,"i32"),e[3]=x.getValue(X+3*ne,"i32")}A(Kn,"unmarshalTreeCursor");function rr(e,t){x.setValue(e,t.row,"i32"),x.setValue(e+ne,t.column,"i32")}A(rr,"marshalPoint");function Bo(e){return{row:x.getValue(e,"i32")>>>0,column:x.getValue(e+ne,"i32")>>>0}}A(Bo,"unmarshalPoint");function xA(e,t){rr(e,t.startPosition),e+=Br,rr(e,t.endPosition),e+=Br,x.setValue(e,t.startIndex,"i32"),e+=ne,x.setValue(e,t.endIndex,"i32"),e+=ne}A(xA,"marshalRange");function df(e){let t={};return t.startPosition=Bo(e),e+=Br,t.endPosition=Bo(e),e+=Br,t.startIndex=x.getValue(e,"i32")>>>0,e+=ne,t.endIndex=x.getValue(e,"i32")>>>0,t}A(df,"unmarshalRange");function vA(e,t=X){rr(t,e.startPosition),t+=Br,rr(t,e.oldEndPosition),t+=Br,rr(t,e.newEndPosition),t+=Br,x.setValue(t,e.startIndex,"i32"),t+=ne,x.setValue(t,e.oldEndIndex,"i32"),t+=ne,x.setValue(t,e.newEndIndex,"i32"),t+=ne}A(vA,"marshalEdit");function CA(e){let t=x.getValue(e,"i32"),n=x.getValue(e+=ne,"i32"),r=x.getValue(e+=ne,"i32");return{major_version:t,minor_version:n,patch_version:r}}A(CA,"unmarshalLanguageMetadata");var PG=/^tree_sitter_\w+$/,ub=class uf{static{A(this,"Language")}0=0;types;fields;constructor(t,n){ra(t),this[0]=n,this.types=new Array(x._ts_language_symbol_count(this[0]));for(let r=0,o=this.types.length;r<o;r++)x._ts_language_symbol_type(this[0],r)<2&&(this.types[r]=x.UTF8ToString(x._ts_language_symbol_name(this[0],r)));this.fields=new Array(x._ts_language_field_count(this[0])+1);for(let r=0,o=this.fields.length;r<o;r++){let s=x._ts_language_field_name_for_id(this[0],r);s!==0?this.fields[r]=x.UTF8ToString(s):this.fields[r]=null}}get name(){let t=x._ts_language_name(this[0]);return t===0?null:x.UTF8ToString(t)}get abiVersion(){return x._ts_language_abi_version(this[0])}get metadata(){return x._ts_language_metadata_wasm(this[0]),x.getValue(X,"i32")===0?null:CA(X+ne)}get fieldCount(){return this.fields.length-1}get stateCount(){return x._ts_language_state_count(this[0])}fieldIdForName(t){let n=this.fields.indexOf(t);return n!==-1?n:null}fieldNameForId(t){return this.fields[t]??null}idForNodeType(t,n){let r=x.lengthBytesUTF8(t),o=x._malloc(r+1);x.stringToUTF8(t,o,r+1);let s=x._ts_language_symbol_for_name(this[0],o,r,n?1:0);return x._free(o),s||null}get nodeTypeCount(){return x._ts_language_symbol_count(this[0])}nodeTypeForId(t){let n=x._ts_language_symbol_name(this[0],t);return n?x.UTF8ToString(n):null}nodeTypeIsNamed(t){return!!x._ts_language_type_is_named_wasm(this[0],t)}nodeTypeIsVisible(t){return!!x._ts_language_type_is_visible_wasm(this[0],t)}get supertypes(){x._ts_language_supertypes_wasm(this[0]);let t=x.getValue(X,"i32"),n=x.getValue(X+ne,"i32"),r=new Array(t);if(t>0){let o=n;for(let s=0;s<t;s++)r[s]=x.getValue(o,"i16"),o+=mA}return r}subtypes(t){x._ts_language_subtypes_wasm(this[0],t);let n=x.getValue(X,"i32"),r=x.getValue(X+ne,"i32"),o=new Array(n);if(n>0){let s=r;for(let a=0;a<n;a++)o[a]=x.getValue(s,"i16"),s+=mA}return o}nextState(t,n){return x._ts_language_next_state(this[0],t,n)}lookaheadIterator(t){let n=x._ts_lookahead_iterator_new(this[0],t);return n?new wG(ji,n,this):null}static async load(t){let n;if(t instanceof Uint8Array)n=t;else if(globalThis.process?.versions.node)n=await(await import("fs/promises")).readFile(t);else{let o=await fetch(t);if(!o.ok){let a=await o.text();throw new Error(`Language.load failed with status ${o.status}.
155
+ `,r=t.whitespace?" = ":"=",o=[],s=t.sort?Object.keys(e).sort():Object.keys(e),a=0;t.align&&(a=_i(s.filter(u=>e[u]===null||Array.isArray(e[u])||typeof e[u]!="object").map(u=>Array.isArray(e[u])?`${u}[]`:u).concat([""]).reduce((u,d)=>_i(u).length>=_i(d).length?u:d)).length);let c="",l=t.bracketedArray?"[]":"";for(let u of s){let d=e[u];if(d&&Array.isArray(d))for(let f of d)c+=_i(`${u}${l}`).padEnd(a," ")+r+_i(f)+n;else d&&typeof d=="object"?o.push(u):c+=_i(u).padEnd(a," ")+r+_i(d)+n}t.section&&c.length&&(c="["+_i(t.section)+"]"+(t.newline?n+n:n)+c);for(let u of o){let d=I1(u,".").join("\\."),f=(t.section?t.section+".":"")+d,m=xv(e[u],{...t,section:f});c.length&&m.length&&(c+=n),c+=m}return c};function I1(e,t){var n=0,r=0,o=0,s=[];do if(o=e.indexOf(t,n),o!==-1){if(n=o+t.length,o>0&&e[o-1]==="\\")continue;s.push(e.slice(r,o)),r=o+t.length}while(o!==-1);return s.push(e.slice(r)),s}var A1=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;let n=Object.create(null),r=n,o=null,s=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,a=e.split(/[\r\n]+/g),c={};for(let u of a){if(!u||u.match(/^\s*[;#]/)||u.match(/^\s*$/))continue;let d=u.match(s);if(!d)continue;if(d[1]!==void 0){if(o=pp(d[1]),o==="__proto__"){r=Object.create(null);continue}r=n[o]=n[o]||Object.create(null);continue}let f=pp(d[2]),m;t.bracketedArray?m=f.length>2&&f.slice(-2)==="[]":(c[f]=(c?.[f]||0)+1,m=c[f]>1);let p=m&&f.endsWith("[]")?f.slice(0,-2):f;if(p==="__proto__")continue;let g=d[3]?pp(d[4]):!0,h=g==="true"||g==="false"||g==="null"?JSON.parse(g):g;m&&(wv.call(r,p)?Array.isArray(r[p])||(r[p]=[r[p]]):r[p]=[]),Array.isArray(r[p])?r[p].push(h):r[p]=h}let l=[];for(let u of Object.keys(n)){if(!wv.call(n,u)||typeof n[u]!="object"||Array.isArray(n[u]))continue;let d=I1(u,".");r=n;let f=d.pop(),m=f.replace(/\\\./g,".");for(let p of d)p!=="__proto__"&&((!wv.call(r,p)||typeof r[p]!="object")&&(r[p]=Object.create(null)),r=r[p]);r===n&&m===f||(r[m]=n[u],l.push(u))}for(let u of l)delete n[u];return n},D1=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),_i=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&D1(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),pp=e=>{if(e=(e||"").trim(),D1(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let t=!1,n="";for(let r=0,o=e.length;r<o;r++){let s=e.charAt(r);if(t)"\\;#".indexOf(s)!==-1?n+=s:n+="\\"+s,t=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?t=!0:n+=s}}return t&&(n+="\\"),n.trim()}return e};k1.exports={parse:A1,decode:A1,stringify:xv,encode:xv,safe:_i,unsafe:pp}});var Bu=class e{constructor(t,n,r,o){this._uri=t,this._languageId=n,this._version=r,this._content=o,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let n=this.offsetAt(t.start),r=this.offsetAt(t.end);return this._content.substring(n,r)}return this._content}update(t,n){for(let r of t)if(e.isIncremental(r)){let o=$P(r.range),s=this.offsetAt(o.start),a=this.offsetAt(o.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(a,this._content.length);let c=Math.max(o.start.line,0),l=Math.max(o.end.line,0),u=this._lineOffsets,d=OP(r.text,!1,s);if(l-c===d.length)for(let m=0,p=d.length;m<p;m++)u[m+c+1]=d[m];else d.length<1e4?u.splice(c+1,l-c,...d):this._lineOffsets=u=u.slice(0,c+1).concat(d,u.slice(l+1));let f=r.text.length-(a-s);if(f!==0)for(let m=c+1+d.length,p=u.length;m<p;m++)u[m]=u[m]+f}else if(e.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=OP(this._content,!0)),this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),r=0,o=n.length;if(o===0)return{line:0,character:t};for(;r<o;){let a=Math.floor((r+o)/2);n[a]>t?o=a:r=a+1}let s=r-1;return t=this.ensureBeforeEOL(t,n[s]),{line:s,character:t-n[s]}}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line];if(t.character<=0)return r;let o=t.line+1<n.length?n[t.line+1]:this._content.length,s=Math.min(r+t.character,o);return this.ensureBeforeEOL(s,r)}getLineRange(t){let n=this.getLineOffsets();if(t>=n.length){let a=n.length-1;return{start:{line:a,character:0},end:{line:a,character:this._content.length-n[a]}}}else if(t<0)return{start:{line:0,character:0},end:{line:0,character:0}};let r=n[t],o=t+1<n.length?n[t+1]:this._content.length,s=this.ensureBeforeEOL(o,r);return{start:{line:t,character:0},end:{line:t,character:s-r}}}getEOLCharacters(t){let n=this.getLineOffsets();if(t>=n.length)return"";if(t<0)return"";let r=t+1<n.length?n[t+1]:this._content.length,o=this.ensureBeforeEOL(r,n[t]);return this._content.substring(o,r)}ensureBeforeEOL(t,n){for(;t>n&&MP(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}},ju;(function(e){function t(o,s,a,c){return new Bu(o,s,a,c)}e.create=t;function n(o,s,a){if(o instanceof Bu)return o.update(s,a),o;throw new Error("TextDocument.update: document must be created by TextDocument.create")}e.update=n;function r(o,s){let a=o.getText(),c=Eh(s.map(pH),(d,f)=>{let m=d.range.start.line-f.range.start.line;return m===0?d.range.start.character-f.range.start.character:m}),l=0,u=[];for(let d of c){let f=o.offsetAt(d.range.start);if(f<l)throw new Error("Overlapping edit");f>l&&u.push(a.substring(l,f)),d.newText.length&&u.push(d.newText),l=o.offsetAt(d.range.end)}return u.push(a.substr(l)),u.join("")}e.applyEdits=r})(ju||(ju={}));function Eh(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),o=e.slice(n);Eh(r,t),Eh(o,t);let s=0,a=0,c=0;for(;s<r.length&&a<o.length;)t(r[s],o[a])<=0?e[c++]=r[s++]:e[c++]=o[a++];for(;s<r.length;)e[c++]=r[s++];for(;a<o.length;)e[c++]=o[a++];return e}function OP(e,t,n=0){let r=t?[n]:[];for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);MP(s)&&(s===13&&o+1<e.length&&e.charCodeAt(o+1)===10&&o++,r.push(n+o+1))}return r}function MP(e){return e===13||e===10}function $P(e){let t=e.start,n=e.end;return t.line>n.line||t.line===n.line&&t.character>n.character?{start:n,end:t}:e}function pH(e){let t=$P(e.range);return t!==e.range?{newText:e.newText,range:t}:e}var gc=B(le());var rf=require("node:url");function Ne(e){return e.startsWith("file://")?(0,rf.pathToFileURL)((0,rf.fileURLToPath)(e)).toString():e}function tA(e,t,n){let{warn:r,thresholdMs:o,tag:s}=t,a=performance.now(),c=()=>Math.round(performance.now()-a),l=f=>r(`[${s}] ${e} ${f}`),u=()=>{let f=c();f>o&&l(`took ${f}ms`)},d;try{d=n()}catch(f){throw l(`threw after ${c()}ms`),f}return d instanceof Promise?d.then(f=>(u(),f),f=>{throw l(`threw after ${c()}ms`),f}):(u(),d)}var nA=parseInt(process.env.BGFORGE_LSP_SLOW_MS??"",10),rA=Number.isFinite(nA)?nA:50;function xe(e,t,n){let{warn:r,thresholdMs:o=rA}=n;return function(...s){return tA(e,{warn:r,thresholdMs:o,tag:"lsp-timing"},()=>t(...s))}}function iA(e,t=rA){return{warn:n=>e.warn(n),thresholdMs:t}}var coe=B(le()),Yy,Xy;function oA(e,t){Yy=e,Xy=t}function Mr(){if(!Yy)throw new Error("LSP connection not initialized. Call initLspConnection first.");return Yy}function sA(){if(!Xy)throw new Error("Documents manager not initialized. Call initLspConnection first.");return Xy}var Jy;function aA(e){Jy=e}function Zs(e){if(!Jy)throw new Error("Settings service not initialized. Call initSettingsService first.");return Jy(e)}var ea=class{timers=new Map;delayMs;constructor(t){this.delayMs=t}schedule(t,n){let r=this.timers.get(t);r!==void 0&&clearTimeout(r),this.timers.set(t,setTimeout(()=>{this.timers.delete(t),n()},this.delayMs))}cancel(t){let n=this.timers.get(t);return n!==void 0?(clearTimeout(n),this.timers.delete(t),!0):!1}has(t){return this.timers.has(t)}dispose(){for(let t of this.timers.values())clearTimeout(t);this.timers.clear()}};function cA(){let e=new Set,t;return{markAffected(n){e.clear();for(let r of n)e.add(r);t&&clearTimeout(t),t=setTimeout(()=>{e.clear()},3e3)},consumeAffected(n){return e.delete(n)},isAffected(n){return e.has(n)},dispose(){t&&clearTimeout(t),t=void 0,e.clear()}}}var WW=require("node:url"),Sh=B(le());var lA=!1;function uA(e){lA=e}function T(e,t="info"){if(t==="debug"&&!lA)return;let n=Mr().console;switch(t){case"debug":n.log(`[debug] ${e}`);break;case"info":n.log(e);break;case"warn":n.warn(e);break;case"error":n.error(e);break}}var mt="fallout-ssl",$r="fallout-ssl-tooltip",of="fallout-worldmap-txt",ta="fallout-msg",qr="typescript",_n="weidu-tp2",Bi="weidu-tp2-tooltip",Tt="weidu-baf",At="weidu-d",Hc="weidu-d-tooltip",Qy="weidu-slb",Vc="weidu-ssl",sf="weidu-log",Zy="infinity-2da",na="weidu-tra",eb="fallout-scripts-lst",tb=".ssl";var SG=[".h"],nb=[...SG,tb],zn=".tssl",yn=".tbaf",Jt=".td",af=[".tph",".tpa",".tpp",".tp2"],cf=".baf",qo=".d";var Gc=[...af.map(e=>e.slice(1)),qo.slice(1),cf.slice(1),yn.slice(1),Jt.slice(1)],zc=[tb.slice(1),"h",zn.slice(1)];var lf=[Tt,At,Vc,_n,qr],dA=[ta,na],uf=[mt,qr],fA={[Tt]:"-",[_n]:"#-",[At]:"#.-"};var wG=Object.defineProperty,A=(e,t)=>wG(e,"name",{value:t,configurable:!0}),boe=class{static{A(this,"Edit")}startPosition;oldEndPosition;newEndPosition;startIndex;oldEndIndex;newEndIndex;constructor({startIndex:e,oldEndIndex:t,newEndIndex:n,startPosition:r,oldEndPosition:o,newEndPosition:s}){this.startIndex=e>>>0,this.oldEndIndex=t>>>0,this.newEndIndex=n>>>0,this.startPosition=r,this.oldEndPosition=o,this.newEndPosition=s}editPoint(e,t){let n=t,r={...e};if(t>=this.oldEndIndex){n=this.newEndIndex+(t-this.oldEndIndex);let o=e.row;r.row=this.newEndPosition.row+(e.row-this.oldEndPosition.row),r.column=o===this.oldEndPosition.row?this.newEndPosition.column+(e.column-this.oldEndPosition.column):e.column}else t>this.startIndex&&(n=this.newEndIndex,r.row=this.newEndPosition.row,r.column=this.newEndPosition.column);return{point:r,index:n}}editRange(e){let t={startIndex:e.startIndex,startPosition:{...e.startPosition},endIndex:e.endIndex,endPosition:{...e.endPosition}};return e.endIndex>=this.oldEndIndex?e.endIndex!==Number.MAX_SAFE_INTEGER&&(t.endIndex=this.newEndIndex+(e.endIndex-this.oldEndIndex),t.endPosition={row:this.newEndPosition.row+(e.endPosition.row-this.oldEndPosition.row),column:e.endPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.endPosition.column-this.oldEndPosition.column):e.endPosition.column},t.endIndex<this.newEndIndex&&(t.endIndex=Number.MAX_SAFE_INTEGER,t.endPosition={row:Number.MAX_SAFE_INTEGER,column:Number.MAX_SAFE_INTEGER})):e.endIndex>this.startIndex&&(t.endIndex=this.startIndex,t.endPosition={...this.startPosition}),e.startIndex>=this.oldEndIndex?(t.startIndex=this.newEndIndex+(e.startIndex-this.oldEndIndex),t.startPosition={row:this.newEndPosition.row+(e.startPosition.row-this.oldEndPosition.row),column:e.startPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.startPosition.column-this.oldEndPosition.column):e.startPosition.column},t.startIndex<this.newEndIndex&&(t.startIndex=Number.MAX_SAFE_INTEGER,t.startPosition={row:Number.MAX_SAFE_INTEGER,column:Number.MAX_SAFE_INTEGER})):e.startIndex>this.startIndex&&(t.startIndex=this.startIndex,t.startPosition={...this.startPosition}),t}},mA=2,ne=4,rb=4*ne,Tn=5*ne,Br=2*ne,Xc=2*ne+2*Br,Rn={row:0,column:0},ji=Symbol("INTERNAL");function ra(e){if(e!==ji)throw new Error("Illegal constructor")}A(ra,"assertInternal");function Yc(e){return!!e&&typeof e.row=="number"&&typeof e.column=="number"}A(Yc,"isPoint");function SA(e){x=e}A(SA,"setModule");var x;function ia(e){try{return new FinalizationRegistry(e)}catch(t){console.error("Unsupported FinalizationRegistry:",t);return}}A(ia,"newFinalizer");var pA=ia(e=>{x._ts_lookahead_iterator_delete(e)}),xG=class{static{A(this,"LookaheadIterator")}0=0;language;positioned=!1;constructor(e,t,n){ra(e),this[0]=t,this.language=n,pA?.register(this,t,this)}get currentTypeId(){return this.positioned?x._ts_lookahead_iterator_current_symbol(this[0]):null}get currentType(){let e=this.currentTypeId;return e===null?null:this.language.types[e]??x.UTF8ToString(x._ts_language_symbol_name(this.language[0],e))}delete(){pA?.unregister(this),x._ts_lookahead_iterator_delete(this[0]),this[0]=0}reset(e,t){return x._ts_lookahead_iterator_reset(this[0],e[0],t)?(this.language=e,this.positioned=!1,!0):!1}resetState(e){return x._ts_lookahead_iterator_reset_state(this[0],e)?(this.positioned=!1,!0):!1}[Symbol.iterator](){return{next:A(()=>{this.positioned=!!x._ts_lookahead_iterator_next(this[0]);let e=this.currentType;return e===null?{done:!0,value:""}:{done:!1,value:e}},"next")}}};function cb(e,t,n,r){let o=n-t,s=e.textCallback(t,r);if(s){for(t+=s.length;t<n;){let a=e.textCallback(t,r);if(a&&a.length>0)t+=a.length,s+=a;else break}t>n&&(s=s.slice(0,o))}return s??""}A(cb,"getText");var hA=ia(e=>{x._ts_tree_delete(e)}),vG=class sb{static{A(this,"Tree")}0=0;textCallback;language;constructor(t,n,r,o){ra(t),this[0]=n,this.language=r,this.textCallback=o,hA?.register(this,n,this)}copy(){let t=x._ts_tree_copy(this[0]);return new sb(ji,t,this.language,this.textCallback)}delete(){hA?.unregister(this),x._ts_tree_delete(this[0]),this[0]=0}get rootNode(){return x._ts_tree_root_node_wasm(this[0]),st(this)}rootNodeWithOffset(t,n){let r=X+Tn;return x.setValue(r,t,"i32"),rr(r+ne,n),x._ts_tree_root_node_with_offset_wasm(this[0]),st(this)}edit(t){vA(t),x._ts_tree_edit_wasm(this[0])}walk(){return this.rootNode.walk()}getChangedRanges(t){if(!(t instanceof sb))throw new TypeError("Argument must be a Tree");x._ts_tree_get_changed_ranges_wasm(this[0],t[0]);let n=x.getValue(X,"i32"),r=x.getValue(X+ne,"i32"),o=new Array(n);if(n>0){let s=r;for(let a=0;a<n;a++)o[a]=ff(s),s+=Xc;x._free(r)}return o}getIncludedRanges(){x._ts_tree_included_ranges_wasm(this[0]);let t=x.getValue(X,"i32"),n=x.getValue(X+ne,"i32"),r=new Array(t);if(t>0){let o=n;for(let s=0;s<t;s++)r[s]=ff(o),o+=Xc;x._free(n)}return r}},gA=ia(e=>{x._ts_tree_cursor_delete_wasm(e)}),CG=class wA{static{A(this,"TreeCursor")}0=0;1=0;2=0;3=0;tree;constructor(t,n){ra(t),this.tree=n,Kn(this),gA?.register(this,this.tree[0],this)}copy(){let t=new wA(ji,this.tree);return x._ts_tree_cursor_copy_wasm(this.tree[0]),Kn(t),t}delete(){gA?.unregister(this),Ke(this),x._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}get currentNode(){return Ke(this),x._ts_tree_cursor_current_node_wasm(this.tree[0]),st(this.tree)}get currentFieldId(){return Ke(this),x._ts_tree_cursor_current_field_id_wasm(this.tree[0])}get currentFieldName(){return this.tree.language.fields[this.currentFieldId]}get currentDepth(){return Ke(this),x._ts_tree_cursor_current_depth_wasm(this.tree[0])}get currentDescendantIndex(){return Ke(this),x._ts_tree_cursor_current_descendant_index_wasm(this.tree[0])}get nodeType(){return this.tree.language.types[this.nodeTypeId]||"ERROR"}get nodeTypeId(){return Ke(this),x._ts_tree_cursor_current_node_type_id_wasm(this.tree[0])}get nodeStateId(){return Ke(this),x._ts_tree_cursor_current_node_state_id_wasm(this.tree[0])}get nodeId(){return Ke(this),x._ts_tree_cursor_current_node_id_wasm(this.tree[0])}get nodeIsNamed(){return Ke(this),x._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])===1}get nodeIsMissing(){return Ke(this),x._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])===1}get nodeText(){Ke(this);let t=x._ts_tree_cursor_start_index_wasm(this.tree[0]),n=x._ts_tree_cursor_end_index_wasm(this.tree[0]);x._ts_tree_cursor_start_position_wasm(this.tree[0]);let r=Bo(X);return cb(this.tree,t,n,r)}get startPosition(){return Ke(this),x._ts_tree_cursor_start_position_wasm(this.tree[0]),Bo(X)}get endPosition(){return Ke(this),x._ts_tree_cursor_end_position_wasm(this.tree[0]),Bo(X)}get startIndex(){return Ke(this),x._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return Ke(this),x._ts_tree_cursor_end_index_wasm(this.tree[0])}gotoFirstChild(){Ke(this);let t=x._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return Kn(this),t===1}gotoLastChild(){Ke(this);let t=x._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return Kn(this),t===1}gotoParent(){Ke(this);let t=x._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return Kn(this),t===1}gotoNextSibling(){Ke(this);let t=x._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return Kn(this),t===1}gotoPreviousSibling(){Ke(this);let t=x._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return Kn(this),t===1}gotoDescendant(t){Ke(this),x._ts_tree_cursor_goto_descendant_wasm(this.tree[0],t),Kn(this)}gotoFirstChildForIndex(t){Ke(this),x.setValue(X+rb,t,"i32");let n=x._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return Kn(this),n===1}gotoFirstChildForPosition(t){Ke(this),rr(X+rb,t);let n=x._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return Kn(this),n===1}reset(t){me(t),Ke(this,X+Tn),x._ts_tree_cursor_reset_wasm(this.tree[0]),Kn(this)}resetTo(t){Ke(this,X),Ke(t,X+rb),x._ts_tree_cursor_reset_to_wasm(this.tree[0],t.tree[0]),Kn(this)}},PG=class{static{A(this,"Node")}0=0;_children;_namedChildren;constructor(e,{id:t,tree:n,startIndex:r,startPosition:o,other:s}){ra(e),this[0]=s,this.id=t,this.tree=n,this.startIndex=r,this.startPosition=o}id;startIndex;startPosition;tree;get typeId(){return me(this),x._ts_node_symbol_wasm(this.tree[0])}get grammarId(){return me(this),x._ts_node_grammar_symbol_wasm(this.tree[0])}get type(){return this.tree.language.types[this.typeId]||"ERROR"}get grammarType(){return this.tree.language.types[this.grammarId]||"ERROR"}get isNamed(){return me(this),x._ts_node_is_named_wasm(this.tree[0])===1}get isExtra(){return me(this),x._ts_node_is_extra_wasm(this.tree[0])===1}get isError(){return me(this),x._ts_node_is_error_wasm(this.tree[0])===1}get isMissing(){return me(this),x._ts_node_is_missing_wasm(this.tree[0])===1}get hasChanges(){return me(this),x._ts_node_has_changes_wasm(this.tree[0])===1}get hasError(){return me(this),x._ts_node_has_error_wasm(this.tree[0])===1}get endIndex(){return me(this),x._ts_node_end_index_wasm(this.tree[0])}get endPosition(){return me(this),x._ts_node_end_point_wasm(this.tree[0]),Bo(X)}get text(){return cb(this.tree,this.startIndex,this.endIndex,this.startPosition)}get parseState(){return me(this),x._ts_node_parse_state_wasm(this.tree[0])}get nextParseState(){return me(this),x._ts_node_next_parse_state_wasm(this.tree[0])}equals(e){return this.tree===e.tree&&this.id===e.id}child(e){return me(this),x._ts_node_child_wasm(this.tree[0],e),st(this.tree)}namedChild(e){return me(this),x._ts_node_named_child_wasm(this.tree[0],e),st(this.tree)}childForFieldId(e){return me(this),x._ts_node_child_by_field_id_wasm(this.tree[0],e),st(this.tree)}childForFieldName(e){let t=this.tree.language.fields.indexOf(e);return t!==-1?this.childForFieldId(t):null}fieldNameForChild(e){me(this);let t=x._ts_node_field_name_for_child_wasm(this.tree[0],e);return t?x.AsciiToString(t):null}fieldNameForNamedChild(e){me(this);let t=x._ts_node_field_name_for_named_child_wasm(this.tree[0],e);return t?x.AsciiToString(t):null}childrenForFieldName(e){let t=this.tree.language.fields.indexOf(e);return t!==-1&&t!==0?this.childrenForFieldId(t):[]}childrenForFieldId(e){me(this),x._ts_node_children_by_field_id_wasm(this.tree[0],e);let t=x.getValue(X,"i32"),n=x.getValue(X+ne,"i32"),r=new Array(t);if(t>0){let o=n;for(let s=0;s<t;s++)r[s]=st(this.tree,o),o+=Tn;x._free(n)}return r}firstChildForIndex(e){me(this);let t=X+Tn;return x.setValue(t,e,"i32"),x._ts_node_first_child_for_byte_wasm(this.tree[0]),st(this.tree)}firstNamedChildForIndex(e){me(this);let t=X+Tn;return x.setValue(t,e,"i32"),x._ts_node_first_named_child_for_byte_wasm(this.tree[0]),st(this.tree)}get childCount(){return me(this),x._ts_node_child_count_wasm(this.tree[0])}get namedChildCount(){return me(this),x._ts_node_named_child_count_wasm(this.tree[0])}get firstChild(){return this.child(0)}get firstNamedChild(){return this.namedChild(0)}get lastChild(){return this.child(this.childCount-1)}get lastNamedChild(){return this.namedChild(this.namedChildCount-1)}get children(){if(!this._children){me(this),x._ts_node_children_wasm(this.tree[0]);let e=x.getValue(X,"i32"),t=x.getValue(X+ne,"i32");if(this._children=new Array(e),e>0){let n=t;for(let r=0;r<e;r++)this._children[r]=st(this.tree,n),n+=Tn;x._free(t)}}return this._children}get namedChildren(){if(!this._namedChildren){me(this),x._ts_node_named_children_wasm(this.tree[0]);let e=x.getValue(X,"i32"),t=x.getValue(X+ne,"i32");if(this._namedChildren=new Array(e),e>0){let n=t;for(let r=0;r<e;r++)this._namedChildren[r]=st(this.tree,n),n+=Tn;x._free(t)}}return this._namedChildren}descendantsOfType(e,t=Rn,n=Rn){Array.isArray(e)||(e=[e]);let r=[],o=this.tree.language.types;for(let u of e)u=="ERROR"&&r.push(65535);for(let u=0,d=o.length;u<d;u++)e.includes(o[u])&&r.push(u);let s=x._malloc(ne*r.length);for(let u=0,d=r.length;u<d;u++)x.setValue(s+u*ne,r[u],"i32");me(this),x._ts_node_descendants_of_type_wasm(this.tree[0],s,r.length,t.row,t.column,n.row,n.column);let a=x.getValue(X,"i32"),c=x.getValue(X+ne,"i32"),l=new Array(a);if(a>0){let u=c;for(let d=0;d<a;d++)l[d]=st(this.tree,u),u+=Tn}return x._free(c),x._free(s),l}get nextSibling(){return me(this),x._ts_node_next_sibling_wasm(this.tree[0]),st(this.tree)}get previousSibling(){return me(this),x._ts_node_prev_sibling_wasm(this.tree[0]),st(this.tree)}get nextNamedSibling(){return me(this),x._ts_node_next_named_sibling_wasm(this.tree[0]),st(this.tree)}get previousNamedSibling(){return me(this),x._ts_node_prev_named_sibling_wasm(this.tree[0]),st(this.tree)}get descendantCount(){return me(this),x._ts_node_descendant_count_wasm(this.tree[0])}get parent(){return me(this),x._ts_node_parent_wasm(this.tree[0]),st(this.tree)}childWithDescendant(e){return me(this),me(e,1),x._ts_node_child_with_descendant_wasm(this.tree[0]),st(this.tree)}descendantForIndex(e,t=e){if(typeof e!="number"||typeof t!="number")throw new Error("Arguments must be numbers");me(this);let n=X+Tn;return x.setValue(n,e,"i32"),x.setValue(n+ne,t,"i32"),x._ts_node_descendant_for_index_wasm(this.tree[0]),st(this.tree)}namedDescendantForIndex(e,t=e){if(typeof e!="number"||typeof t!="number")throw new Error("Arguments must be numbers");me(this);let n=X+Tn;return x.setValue(n,e,"i32"),x.setValue(n+ne,t,"i32"),x._ts_node_named_descendant_for_index_wasm(this.tree[0]),st(this.tree)}descendantForPosition(e,t=e){if(!Yc(e)||!Yc(t))throw new Error("Arguments must be {row, column} objects");me(this);let n=X+Tn;return rr(n,e),rr(n+Br,t),x._ts_node_descendant_for_position_wasm(this.tree[0]),st(this.tree)}namedDescendantForPosition(e,t=e){if(!Yc(e)||!Yc(t))throw new Error("Arguments must be {row, column} objects");me(this);let n=X+Tn;return rr(n,e),rr(n+Br,t),x._ts_node_named_descendant_for_position_wasm(this.tree[0]),st(this.tree)}walk(){return me(this),x._ts_tree_cursor_new_wasm(this.tree[0]),new CG(ji,this.tree)}edit(e){if(this.startIndex>=e.oldEndIndex){this.startIndex=e.newEndIndex+(this.startIndex-e.oldEndIndex);let t,n;this.startPosition.row>e.oldEndPosition.row?(t=this.startPosition.row-e.oldEndPosition.row,n=this.startPosition.column):(t=0,n=this.startPosition.column,this.startPosition.column>=e.oldEndPosition.column&&(n=this.startPosition.column-e.oldEndPosition.column)),t>0?(this.startPosition.row+=t,this.startPosition.column=n):this.startPosition.column+=n}else this.startIndex>e.startIndex&&(this.startIndex=e.newEndIndex,this.startPosition.row=e.newEndPosition.row,this.startPosition.column=e.newEndPosition.column)}toString(){me(this);let e=x._ts_node_to_string_wasm(this.tree[0]),t=x.AsciiToString(e);return x._free(e),t}};function ab(e,t,n,r,o){for(let s=0,a=o.length;s<a;s++){let c=x.getValue(n,"i32");n+=ne;let l=st(t,n);n+=Tn,o[s]={patternIndex:r,name:e.captureNames[c],node:l}}return n}A(ab,"unmarshalCaptures");function me(e,t=0){let n=X+t*Tn;x.setValue(n,e.id,"i32"),n+=ne,x.setValue(n,e.startIndex,"i32"),n+=ne,x.setValue(n,e.startPosition.row,"i32"),n+=ne,x.setValue(n,e.startPosition.column,"i32"),n+=ne,x.setValue(n,e[0],"i32")}A(me,"marshalNode");function st(e,t=X){let n=x.getValue(t,"i32");if(t+=ne,n===0)return null;let r=x.getValue(t,"i32");t+=ne;let o=x.getValue(t,"i32");t+=ne;let s=x.getValue(t,"i32");t+=ne;let a=x.getValue(t,"i32");return new PG(ji,{id:n,tree:e,startIndex:r,startPosition:{row:o,column:s},other:a})}A(st,"unmarshalNode");function Ke(e,t=X){x.setValue(t+0*ne,e[0],"i32"),x.setValue(t+1*ne,e[1],"i32"),x.setValue(t+2*ne,e[2],"i32"),x.setValue(t+3*ne,e[3],"i32")}A(Ke,"marshalTreeCursor");function Kn(e){e[0]=x.getValue(X+0*ne,"i32"),e[1]=x.getValue(X+1*ne,"i32"),e[2]=x.getValue(X+2*ne,"i32"),e[3]=x.getValue(X+3*ne,"i32")}A(Kn,"unmarshalTreeCursor");function rr(e,t){x.setValue(e,t.row,"i32"),x.setValue(e+ne,t.column,"i32")}A(rr,"marshalPoint");function Bo(e){return{row:x.getValue(e,"i32")>>>0,column:x.getValue(e+ne,"i32")>>>0}}A(Bo,"unmarshalPoint");function xA(e,t){rr(e,t.startPosition),e+=Br,rr(e,t.endPosition),e+=Br,x.setValue(e,t.startIndex,"i32"),e+=ne,x.setValue(e,t.endIndex,"i32"),e+=ne}A(xA,"marshalRange");function ff(e){let t={};return t.startPosition=Bo(e),e+=Br,t.endPosition=Bo(e),e+=Br,t.startIndex=x.getValue(e,"i32")>>>0,e+=ne,t.endIndex=x.getValue(e,"i32")>>>0,t}A(ff,"unmarshalRange");function vA(e,t=X){rr(t,e.startPosition),t+=Br,rr(t,e.oldEndPosition),t+=Br,rr(t,e.newEndPosition),t+=Br,x.setValue(t,e.startIndex,"i32"),t+=ne,x.setValue(t,e.oldEndIndex,"i32"),t+=ne,x.setValue(t,e.newEndIndex,"i32"),t+=ne}A(vA,"marshalEdit");function CA(e){let t=x.getValue(e,"i32"),n=x.getValue(e+=ne,"i32"),r=x.getValue(e+=ne,"i32");return{major_version:t,minor_version:n,patch_version:r}}A(CA,"unmarshalLanguageMetadata");var NG=/^tree_sitter_\w+$/,lb=class df{static{A(this,"Language")}0=0;types;fields;constructor(t,n){ra(t),this[0]=n,this.types=new Array(x._ts_language_symbol_count(this[0]));for(let r=0,o=this.types.length;r<o;r++)x._ts_language_symbol_type(this[0],r)<2&&(this.types[r]=x.UTF8ToString(x._ts_language_symbol_name(this[0],r)));this.fields=new Array(x._ts_language_field_count(this[0])+1);for(let r=0,o=this.fields.length;r<o;r++){let s=x._ts_language_field_name_for_id(this[0],r);s!==0?this.fields[r]=x.UTF8ToString(s):this.fields[r]=null}}get name(){let t=x._ts_language_name(this[0]);return t===0?null:x.UTF8ToString(t)}get abiVersion(){return x._ts_language_abi_version(this[0])}get metadata(){return x._ts_language_metadata_wasm(this[0]),x.getValue(X,"i32")===0?null:CA(X+ne)}get fieldCount(){return this.fields.length-1}get stateCount(){return x._ts_language_state_count(this[0])}fieldIdForName(t){let n=this.fields.indexOf(t);return n!==-1?n:null}fieldNameForId(t){return this.fields[t]??null}idForNodeType(t,n){let r=x.lengthBytesUTF8(t),o=x._malloc(r+1);x.stringToUTF8(t,o,r+1);let s=x._ts_language_symbol_for_name(this[0],o,r,n?1:0);return x._free(o),s||null}get nodeTypeCount(){return x._ts_language_symbol_count(this[0])}nodeTypeForId(t){let n=x._ts_language_symbol_name(this[0],t);return n?x.UTF8ToString(n):null}nodeTypeIsNamed(t){return!!x._ts_language_type_is_named_wasm(this[0],t)}nodeTypeIsVisible(t){return!!x._ts_language_type_is_visible_wasm(this[0],t)}get supertypes(){x._ts_language_supertypes_wasm(this[0]);let t=x.getValue(X,"i32"),n=x.getValue(X+ne,"i32"),r=new Array(t);if(t>0){let o=n;for(let s=0;s<t;s++)r[s]=x.getValue(o,"i16"),o+=mA}return r}subtypes(t){x._ts_language_subtypes_wasm(this[0],t);let n=x.getValue(X,"i32"),r=x.getValue(X+ne,"i32"),o=new Array(n);if(n>0){let s=r;for(let a=0;a<n;a++)o[a]=x.getValue(s,"i16"),s+=mA}return o}nextState(t,n){return x._ts_language_next_state(this[0],t,n)}lookaheadIterator(t){let n=x._ts_lookahead_iterator_new(this[0],t);return n?new xG(ji,n,this):null}static async load(t){let n;if(t instanceof Uint8Array)n=t;else if(globalThis.process?.versions.node)n=await(await import("fs/promises")).readFile(t);else{let o=await fetch(t);if(!o.ok){let a=await o.text();throw new Error(`Language.load failed with status ${o.status}.
156
156
 
157
- ${a}`)}let s=o.clone();try{n=await WebAssembly.compileStreaming(o)}catch(a){console.error("wasm streaming compile failed:",a),console.error("falling back to ArrayBuffer instantiation"),n=new Uint8Array(await s.arrayBuffer())}}let r=await x.loadWebAssemblyModule(n,{loadAsync:!0});return uf.loadFromWasmExports(r,{sync:!1})}static loadFromWasmExports(t,{sync:n}){let r=Object.keys(t),o=r.find(a=>PG.test(a)&&!a.includes("external_scanner_"));if(!o)throw console.log(`Couldn't find language function in Wasm file. Symbols:
158
- ${JSON.stringify(r,null,2)}`),new Error(`Language.${n?"loadSync":"load"} failed: no language function found in Wasm file`);let s=t[o]();return new uf(ji,s)}static loadSync(t){let n=x.loadWebAssemblyModule(t,{loadAsync:!1});return uf.loadFromWasmExports(n,{sync:!0})}};async function PA(moduleArg={}){var moduleRtn,Module=moduleArg,ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope<"u",ENVIRONMENT_IS_NODE=typeof process=="object"&&process.versions?.node&&process.type!="renderer";if(ENVIRONMENT_IS_NODE){let{createRequire:e}=await import("module");var require=e(__imu)}Module.currentQueryProgressCallback=null,Module.currentProgressCallback=null,Module.currentLogCallback=null,Module.currentParseCallback=null;var arguments_=[],thisProgram="./this.program",quit_=A((e,t)=>{throw t},"quit_"),_scriptName=__imu,scriptDirectory="";function locateFile(e){return Module.locateFile?Module.locateFile(e,scriptDirectory):scriptDirectory+e}A(locateFile,"locateFile");var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");_scriptName.startsWith("file:")&&(scriptDirectory=require("path").dirname(require("url").fileURLToPath(_scriptName))+"/"),readBinary=A(e=>{e=isFileURI(e)?new URL(e):e;var t=fs.readFileSync(e);return t},"readBinary"),readAsync=A(async(e,t=!0)=>{e=isFileURI(e)?new URL(e):e;var n=fs.readFileSync(e,t?void 0:"utf8");return n},"readAsync"),process.argv.length>1&&(thisProgram=process.argv[1].replace(/\\/g,"/")),arguments_=process.argv.slice(2),quit_=A((e,t)=>{throw process.exitCode=e,t},"quit_")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}ENVIRONMENT_IS_WORKER&&(readBinary=A(e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)},"readBinary")),readAsync=A(async e=>{if(isFileURI(e))return new Promise((n,r)=>{var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="arraybuffer",o.onload=()=>{if(o.status==200||o.status==0&&o.response){n(o.response);return}r(o.status)},o.onerror=r,o.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)},"readAsync")}var out=console.log.bind(console),err=console.error.bind(console),dynamicLibraries=[],wasmBinary,ABORT=!1,EXITSTATUS,isFileURI=A(e=>e.startsWith("file://"),"isFileURI"),readyPromiseResolve,readyPromiseReject,wasmMemory,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP64,HEAPU64,HEAP_DATA_VIEW,runtimeInitialized=!1;function updateMemoryViews(){var e=wasmMemory.buffer;Module.HEAP8=HEAP8=new Int8Array(e),Module.HEAP16=HEAP16=new Int16Array(e),Module.HEAPU8=HEAPU8=new Uint8Array(e),Module.HEAPU16=HEAPU16=new Uint16Array(e),Module.HEAP32=HEAP32=new Int32Array(e),Module.HEAPU32=HEAPU32=new Uint32Array(e),Module.HEAPF32=HEAPF32=new Float32Array(e),Module.HEAPF64=HEAPF64=new Float64Array(e),Module.HEAP64=HEAP64=new BigInt64Array(e),Module.HEAPU64=HEAPU64=new BigUint64Array(e),Module.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(e),LE_HEAP_UPDATE()}A(updateMemoryViews,"updateMemoryViews");function initMemory(){if(Module.wasmMemory)wasmMemory=Module.wasmMemory;else{var e=Module.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:e/65536,maximum:32768})}updateMemoryViews()}A(initMemory,"initMemory");var __RELOC_FUNCS__=[];function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(onPreRuns)}A(preRun,"preRun");function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),wasmExports.__wasm_call_ctors(),callRuntimeCallbacks(onPostCtors)}A(initRuntime,"initRuntime");function preMain(){}A(preMain,"preMain");function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(onPostRuns)}A(postRun,"postRun");function abort(e){Module.onAbort?.(e),e="Aborted("+e+")",err(e),ABORT=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw readyPromiseReject?.(t),t}A(abort,"abort");var wasmBinaryFile;function findWasmBinary(){return Module.locateFile?locateFile("web-tree-sitter.wasm"):new URL("web-tree-sitter.wasm",__imu).href}A(findWasmBinary,"findWasmBinary");function getBinarySync(e){if(e==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(e);throw"both async and sync fetching of the wasm failed"}A(getBinarySync,"getBinarySync");async function getWasmBinary(e){if(!wasmBinary)try{var t=await readAsync(e);return new Uint8Array(t)}catch{}return getBinarySync(e)}A(getWasmBinary,"getWasmBinary");async function instantiateArrayBuffer(e,t){try{var n=await getWasmBinary(e),r=await WebAssembly.instantiate(n,t);return r}catch(o){err(`failed to asynchronously prepare wasm: ${o}`),abort(o)}}A(instantiateArrayBuffer,"instantiateArrayBuffer");async function instantiateAsync(e,t,n){if(!e&&!isFileURI(t)&&!ENVIRONMENT_IS_NODE)try{var r=fetch(t,{credentials:"same-origin"}),o=await WebAssembly.instantiateStreaming(r,n);return o}catch(s){err(`wasm streaming compile failed: ${s}`),err("falling back to ArrayBuffer instantiation")}return instantiateArrayBuffer(t,n)}A(instantiateAsync,"instantiateAsync");function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}A(getWasmImports,"getWasmImports");async function createWasm(){function e(s,a){wasmExports=s.exports,wasmExports=relocateExports(wasmExports,1024);var c=getDylinkMetadata(a);return c.neededDynlibs&&(dynamicLibraries=c.neededDynlibs.concat(dynamicLibraries)),mergeLibSymbols(wasmExports,"main"),LDSO.init(),loadDylibs(),__RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs),assignWasmExports(wasmExports),wasmExports}A(e,"receiveInstance");function t(s){return e(s.instance,s.module)}A(t,"receiveInstantiationResult");var n=getWasmImports();if(Module.instantiateWasm)return new Promise((s,a)=>{Module.instantiateWasm(n,(c,l)=>{s(e(c,l))})});wasmBinaryFile??=findWasmBinary();var r=await instantiateAsync(wasmBinary,wasmBinaryFile,n),o=t(r);return o}A(createWasm,"createWasm");class ExitStatus{static{A(this,"ExitStatus")}name="ExitStatus";constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(e,t){var n=GOT[t];return n||(n=GOT[t]=new WebAssembly.Global({value:"i32",mutable:!0})),currentModuleWeakSymbols.has(t)||(n.required=!0),n}},LE_ATOMICS_NATIVE_BYTE_ORDER=[],LE_HEAP_LOAD_F32=A(e=>HEAP_DATA_VIEW.getFloat32(e,!0),"LE_HEAP_LOAD_F32"),LE_HEAP_LOAD_F64=A(e=>HEAP_DATA_VIEW.getFloat64(e,!0),"LE_HEAP_LOAD_F64"),LE_HEAP_LOAD_I16=A(e=>HEAP_DATA_VIEW.getInt16(e,!0),"LE_HEAP_LOAD_I16"),LE_HEAP_LOAD_I32=A(e=>HEAP_DATA_VIEW.getInt32(e,!0),"LE_HEAP_LOAD_I32"),LE_HEAP_LOAD_I64=A(e=>HEAP_DATA_VIEW.getBigInt64(e,!0),"LE_HEAP_LOAD_I64"),LE_HEAP_LOAD_U32=A(e=>HEAP_DATA_VIEW.getUint32(e,!0),"LE_HEAP_LOAD_U32"),LE_HEAP_STORE_F32=A((e,t)=>HEAP_DATA_VIEW.setFloat32(e,t,!0),"LE_HEAP_STORE_F32"),LE_HEAP_STORE_F64=A((e,t)=>HEAP_DATA_VIEW.setFloat64(e,t,!0),"LE_HEAP_STORE_F64"),LE_HEAP_STORE_I16=A((e,t)=>HEAP_DATA_VIEW.setInt16(e,t,!0),"LE_HEAP_STORE_I16"),LE_HEAP_STORE_I32=A((e,t)=>HEAP_DATA_VIEW.setInt32(e,t,!0),"LE_HEAP_STORE_I32"),LE_HEAP_STORE_I64=A((e,t)=>HEAP_DATA_VIEW.setBigInt64(e,t,!0),"LE_HEAP_STORE_I64"),LE_HEAP_STORE_U32=A((e,t)=>HEAP_DATA_VIEW.setUint32(e,t,!0),"LE_HEAP_STORE_U32"),callRuntimeCallbacks=A(e=>{for(;e.length>0;)e.shift()(Module)},"callRuntimeCallbacks"),onPostRuns=[],addOnPostRun=A(e=>onPostRuns.push(e),"addOnPostRun"),onPreRuns=[],addOnPreRun=A(e=>onPreRuns.push(e),"addOnPreRun"),UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder:void 0,findStringEnd=A((e,t,n,r)=>{var o=t+n;if(r)return o;for(;e[t]&&!(t>=o);)++t;return t},"findStringEnd"),UTF8ArrayToString=A((e,t=0,n,r)=>{var o=findStringEnd(e,t,n,r);if(o-t>16&&e.buffer&&UTF8Decoder)return UTF8Decoder.decode(e.subarray(t,o));for(var s="";t<o;){var a=e[t++];if(!(a&128)){s+=String.fromCharCode(a);continue}var c=e[t++]&63;if((a&224)==192){s+=String.fromCharCode((a&31)<<6|c);continue}var l=e[t++]&63;if((a&240)==224?a=(a&15)<<12|c<<6|l:a=(a&7)<<18|c<<12|l<<6|e[t++]&63,a<65536)s+=String.fromCharCode(a);else{var u=a-65536;s+=String.fromCharCode(55296|u>>10,56320|u&1023)}}return s},"UTF8ArrayToString"),getDylinkMetadata=A(e=>{var t=0,n=0;function r(){return e[t++]}A(r,"getU8");function o(){for(var Q=0,pe=1;;){var ot=e[t++];if(Q+=(ot&127)*pe,pe*=128,!(ot&128))break}return Q}A(o,"getLEB");function s(){var Q=o();return t+=Q,UTF8ArrayToString(e,t-Q,Q)}A(s,"getString");function a(){for(var Q=o(),pe=[];Q--;)pe.push(s());return pe}A(a,"getStringList");function c(Q,pe){if(Q)throw new Error(pe)}if(A(c,"failIf"),e instanceof WebAssembly.Module){var l=WebAssembly.Module.customSections(e,"dylink.0");c(l.length===0,"need dylink section"),e=new Uint8Array(l[0]),n=e.length}else{var u=new Uint32Array(new Uint8Array(e.subarray(0,24)).buffer),d=u[0]==1836278016||u[0]==6386541;c(!d,"need to see wasm magic number"),c(e[8]!==0,"need the dylink section to be first"),t=9;var f=o();n=t+f;var m=s();c(m!=="dylink.0")}for(var p={neededDynlibs:[],tlsExports:new Set,weakImports:new Set,runtimePaths:[]},g=1,h=2,y=3,w=4,_=5,b=256,S=3,N=1;t<n;){var R=r(),$=o();if(R===g)p.memorySize=o(),p.memoryAlign=o(),p.tableSize=o(),p.tableAlign=o();else if(R===h)p.neededDynlibs=a();else if(R===y)for(var I=o();I--;){var U=s(),de=o();de&b&&p.tlsExports.add(U)}else if(R===w)for(var I=o();I--;){var F=s(),U=s(),de=o();(de&S)==N&&p.weakImports.add(U)}else R===_?p.runtimePaths=a():t+=$}return p},"getDylinkMetadata");function getValue(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":return HEAP8[e];case"i8":return HEAP8[e];case"i16":return LE_HEAP_LOAD_I16((e>>1)*2);case"i32":return LE_HEAP_LOAD_I32((e>>2)*4);case"i64":return LE_HEAP_LOAD_I64((e>>3)*8);case"float":return LE_HEAP_LOAD_F32((e>>2)*4);case"double":return LE_HEAP_LOAD_F64((e>>3)*8);case"*":return LE_HEAP_LOAD_U32((e>>2)*4);default:abort(`invalid type for getValue: ${t}`)}}A(getValue,"getValue");var newDSO=A((e,t,n)=>{var r={refcount:1/0,name:e,exports:n,global:!0};return LDSO.loadedLibsByName[e]=r,t!=null&&(LDSO.loadedLibsByHandle[t]=r),r},"newDSO"),LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=82240,alignMemory=A((e,t)=>Math.ceil(e/t)*t,"alignMemory"),getMemory=A(e=>{if(runtimeInitialized)return _calloc(e,1);var t=___heap_base,n=t+alignMemory(e,16);return ___heap_base=n,GOT.__heap_base.value=n,t},"getMemory"),isInternalSym=A(e=>["__cpp_exception","__c_longjmp","__wasm_apply_data_relocs","__dso_handle","__tls_size","__tls_align","__set_stack_limits","_emscripten_tls_init","__wasm_init_tls","__wasm_call_ctors","__start_em_asm","__stop_em_asm","__start_em_js","__stop_em_js"].includes(e)||e.startsWith("__em_js__"),"isInternalSym"),uleb128EncodeWithLen=A(e=>{let t=e.length;return[t%128|128,t>>7,...e]},"uleb128EncodeWithLen"),wasmTypeCodes={i:127,p:127,j:126,f:125,d:124,e:111},generateTypePack=A(e=>uleb128EncodeWithLen(Array.from(e,t=>{var n=wasmTypeCodes[t];return n})),"generateTypePack"),convertJsFunctionToWasm=A((e,t)=>{var n=Uint8Array.of(0,97,115,109,1,0,0,0,1,...uleb128EncodeWithLen([1,96,...generateTypePack(t.slice(1)),...generateTypePack(t[0]==="v"?"":t[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),r=new WebAssembly.Module(n),o=new WebAssembly.Instance(r,{e:{f:e}}),s=o.exports.f;return s},"convertJsFunctionToWasm"),wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:31,element:"anyfunc"}),getWasmTableEntry=A(e=>{var t=wasmTableMirror[e];return t||(wasmTableMirror[e]=t=wasmTable.get(e)),t},"getWasmTableEntry"),updateTableMap=A((e,t)=>{if(functionsInTableMap)for(var n=e;n<e+t;n++){var r=getWasmTableEntry(n);r&&functionsInTableMap.set(r,n)}},"updateTableMap"),functionsInTableMap,getFunctionAddress=A(e=>(functionsInTableMap||(functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length)),functionsInTableMap.get(e)||0),"getFunctionAddress"),freeTableIndexes=[],getEmptyTableSlot=A(()=>freeTableIndexes.length?freeTableIndexes.pop():wasmTable.grow(1),"getEmptyTableSlot"),setWasmTableEntry=A((e,t)=>{wasmTable.set(e,t),wasmTableMirror[e]=wasmTable.get(e)},"setWasmTableEntry"),addFunction=A((e,t)=>{var n=getFunctionAddress(e);if(n)return n;var r=getEmptyTableSlot();try{setWasmTableEntry(r,e)}catch(s){if(!(s instanceof TypeError))throw s;var o=convertJsFunctionToWasm(e,t);setWasmTableEntry(r,o)}return functionsInTableMap.set(e,r),r},"addFunction"),updateGOT=A((e,t)=>{for(var n in e)if(!isInternalSym(n)){var r=e[n];GOT[n]||=new WebAssembly.Global({value:"i32",mutable:!0}),(t||GOT[n].value==0)&&(typeof r=="function"?GOT[n].value=addFunction(r):typeof r=="number"?GOT[n].value=r:err(`unhandled export type for '${n}': ${typeof r}`))}},"updateGOT"),relocateExports=A((e,t,n)=>{var r={};for(var o in e){var s=e[o];typeof s=="object"&&(s=s.value),typeof s=="number"&&(s+=t),r[o]=s}return updateGOT(r,n),r},"relocateExports"),isSymbolDefined=A(e=>{var t=wasmImports[e];return!(!t||t.stub)},"isSymbolDefined"),dynCall=A((e,t,n=[],r=!1)=>{var o=getWasmTableEntry(t),s=o(...n);function a(c){return c}return A(a,"convert"),s},"dynCall"),stackSave=A(()=>_emscripten_stack_get_current(),"stackSave"),stackRestore=A(e=>__emscripten_stack_restore(e),"stackRestore"),createInvokeFunction=A(e=>(t,...n)=>{var r=stackSave();try{return dynCall(e,t,n)}catch(o){if(stackRestore(r),o!==o+0)throw o;if(_setThrew(1,0),e[0]=="j")return 0n}},"createInvokeFunction"),resolveGlobalSymbol=A((e,t=!1)=>{var n;return isSymbolDefined(e)?n=wasmImports[e]:e.startsWith("invoke_")&&(n=wasmImports[e]=createInvokeFunction(e.split("_")[1])),{sym:n,name:e}},"resolveGlobalSymbol"),onPostCtors=[],addOnPostCtor=A(e=>onPostCtors.push(e),"addOnPostCtor"),UTF8ToString=A((e,t,n)=>e?UTF8ArrayToString(HEAPU8,e,t,n):"","UTF8ToString"),loadWebAssemblyModule=A((binary,flags,libName,localScope,handle)=>{var metadata=getDylinkMetadata(binary);function loadModule(){var memAlign=Math.pow(2,metadata.memoryAlign),memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0,tableBase=metadata.tableSize?wasmTable.length:0;handle&&(HEAP8[handle+8]=1,LE_HEAP_STORE_U32((handle+12>>2)*4,memoryBase),LE_HEAP_STORE_I32((handle+16>>2)*4,metadata.memorySize),LE_HEAP_STORE_U32((handle+20>>2)*4,tableBase),LE_HEAP_STORE_I32((handle+24>>2)*4,metadata.tableSize)),metadata.tableSize&&wasmTable.grow(metadata.tableSize);var moduleExports;function resolveSymbol(e){var t=resolveGlobalSymbol(e).sym;return!t&&localScope&&(t=localScope[e]),t||(t=moduleExports[e]),t}A(resolveSymbol,"resolveSymbol");var proxyHandler={get(e,t){switch(t){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(t in wasmImports&&!wasmImports[t].stub){var n=wasmImports[t];return n}if(!(t in e)){var r;e[t]=(...o)=>(r||=resolveSymbol(t),r(...o))}return e[t]}},proxy=new Proxy({},proxyHandler);currentModuleWeakSymbols=metadata.weakImports;var info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),env:proxy,wasi_snapshot_preview1:proxy};function postInstantiation(module,instance){updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),flags.allowUndefined||reportUndefinedSymbols();function addEmAsm(addr,body){for(var args=[],arity=0;arity<16&&body.indexOf("$"+arity)!=-1;arity++)args.push("$"+arity);args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if(A(addEmAsm,"addEmAsm"),"__start_em_asm"in moduleExports)for(var start=moduleExports.__start_em_asm,stop=moduleExports.__stop_em_asm;start<stop;){var jsString=UTF8ToString(start);addEmAsm(start,jsString),start=HEAPU8.indexOf(0,start)+1}function addEmJs(name,cSig,body){var jsArgs=[];if(cSig=cSig.slice(1,-1),cSig!="void"){cSig=cSig.split(",");for(var i in cSig){var jsArg=cSig[i].split(" ").pop();jsArgs.push(jsArg.replace("*",""))}}var func=`(${jsArgs}) => ${body};`;moduleExports[name]=eval(func)}A(addEmJs,"addEmJs");for(var name in moduleExports)if(name.startsWith("__em_js__")){var start=moduleExports[name],jsString=UTF8ToString(start),parts=jsString.split("<::>");addEmJs(name.replace("__em_js__",""),parts[0],parts[1]),delete moduleExports[name]}var applyRelocs=moduleExports.__wasm_apply_data_relocs;applyRelocs&&(runtimeInitialized?applyRelocs():__RELOC_FUNCS__.push(applyRelocs));var init=moduleExports.__wasm_call_ctors;return init&&(runtimeInitialized?init():addOnPostCtor(init)),moduleExports}if(A(postInstantiation,"postInstantiation"),flags.loadAsync)return(async()=>{var e;return binary instanceof WebAssembly.Module?e=new WebAssembly.Instance(binary,info):{module:binary,instance:e}=await WebAssembly.instantiate(binary,info),postInstantiation(binary,e)})();var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}return A(loadModule,"loadModule"),flags={...flags,rpath:{parentLibPath:libName,paths:metadata.runtimePaths}},flags.loadAsync?metadata.neededDynlibs.reduce((e,t)=>e.then(()=>loadDynamicLibrary(t,flags,localScope)),Promise.resolve()).then(loadModule):(metadata.neededDynlibs.forEach(e=>loadDynamicLibrary(e,flags,localScope)),loadModule())},"loadWebAssemblyModule"),mergeLibSymbols=A((e,t)=>{for(var[n,r]of Object.entries(e)){let o=A(a=>{isSymbolDefined(a)||(wasmImports[a]=r)},"setImport");o(n);let s="__main_argc_argv";n=="main"&&o(s),n==s&&o("main")}},"mergeLibSymbols"),asyncLoad=A(async e=>{var t=await readAsync(e);return new Uint8Array(t)},"asyncLoad");function loadDynamicLibrary(e,t={global:!0,nodelete:!0},n,r){var o=LDSO.loadedLibsByName[e];if(o)return t.global?o.global||(o.global=!0,mergeLibSymbols(o.exports,e)):n&&Object.assign(n,o.exports),t.nodelete&&o.refcount!==1/0&&(o.refcount=1/0),o.refcount++,r&&(LDSO.loadedLibsByHandle[r]=o),t.loadAsync?Promise.resolve(!0):!0;o=newDSO(e,r,"loading"),o.refcount=t.nodelete?1/0:1,o.global=t.global;function s(){if(r){var l=LE_HEAP_LOAD_U32((r+28>>2)*4),u=LE_HEAP_LOAD_U32((r+32>>2)*4);if(l&&u){var d=HEAP8.slice(l,l+u);return t.loadAsync?Promise.resolve(d):d}}var f=locateFile(e);if(t.loadAsync)return asyncLoad(f);if(!readBinary)throw new Error(`${f}: file not found, and synchronous loading of external files is not available`);return readBinary(f)}A(s,"loadLibData");function a(){return t.loadAsync?s().then(l=>loadWebAssemblyModule(l,t,e,n,r)):loadWebAssemblyModule(s(),t,e,n,r)}A(a,"getExports");function c(l){o.global?mergeLibSymbols(l,e):n&&Object.assign(n,l),o.exports=l}return A(c,"moduleLoaded"),t.loadAsync?a().then(l=>(c(l),!0)):(c(a()),!0)}A(loadDynamicLibrary,"loadDynamicLibrary");var reportUndefinedSymbols=A(()=>{for(var[e,t]of Object.entries(GOT))if(t.value==0){var n=resolveGlobalSymbol(e,!0).sym;if(!n&&!t.required)continue;if(typeof n=="function")t.value=addFunction(n,n.sig);else if(typeof n=="number")t.value=n;else throw new Error(`bad export type for '${e}': ${typeof n}`)}},"reportUndefinedSymbols"),runDependencies=0,dependenciesFulfilled=null,removeRunDependency=A(e=>{if(runDependencies--,Module.monitorRunDependencies?.(runDependencies),runDependencies==0&&dependenciesFulfilled){var t=dependenciesFulfilled;dependenciesFulfilled=null,t()}},"removeRunDependency"),addRunDependency=A(e=>{runDependencies++,Module.monitorRunDependencies?.(runDependencies)},"addRunDependency"),loadDylibs=A(async()=>{if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("loadDylibs");for(var e of dynamicLibraries)await loadDynamicLibrary(e,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0});reportUndefinedSymbols(),removeRunDependency("loadDylibs")},"loadDylibs"),noExitRuntime=!0;function setValue(e,t,n="i8"){switch(n.endsWith("*")&&(n="*"),n){case"i1":HEAP8[e]=t;break;case"i8":HEAP8[e]=t;break;case"i16":LE_HEAP_STORE_I16((e>>1)*2,t);break;case"i32":LE_HEAP_STORE_I32((e>>2)*4,t);break;case"i64":LE_HEAP_STORE_I64((e>>3)*8,BigInt(t));break;case"float":LE_HEAP_STORE_F32((e>>2)*4,t);break;case"double":LE_HEAP_STORE_F64((e>>3)*8,t);break;case"*":LE_HEAP_STORE_U32((e>>2)*4,t);break;default:abort(`invalid type for setValue: ${n}`)}}A(setValue,"setValue");var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_high=82240,___stack_low=16704,___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},82240),___table_base=new WebAssembly.Global({value:"i32",mutable:!1},1),__abort_js=A(()=>abort(""),"__abort_js");__abort_js.sig="v";var getHeapMax=A(()=>2147483648,"getHeapMax"),growMemory=A(e=>{var t=wasmMemory.buffer.byteLength,n=(e-t+65535)/65536|0;try{return wasmMemory.grow(n),updateMemoryViews(),1}catch{}},"growMemory"),_emscripten_resize_heap=A(e=>{var t=HEAPU8.length;e>>>=0;var n=getHeapMax();if(e>n)return!1;for(var r=1;r<=4;r*=2){var o=t*(1+.2/r);o=Math.min(o,e+100663296);var s=Math.min(n,alignMemory(Math.max(e,o),65536)),a=growMemory(s);if(a)return!0}return!1},"_emscripten_resize_heap");_emscripten_resize_heap.sig="ip";var _fd_close=A(e=>52,"_fd_close");_fd_close.sig="ii";var INT53_MAX=9007199254740992,INT53_MIN=-9007199254740992,bigintToI53Checked=A(e=>e<INT53_MIN||e>INT53_MAX?NaN:Number(e),"bigintToI53Checked");function _fd_seek(e,t,n,r){return t=bigintToI53Checked(t),70}A(_fd_seek,"_fd_seek"),_fd_seek.sig="iijip";var printCharBuffers=[null,[],[]],printChar=A((e,t)=>{var n=printCharBuffers[e];t===0||t===10?((e===1?out:err)(UTF8ArrayToString(n)),n.length=0):n.push(t)},"printChar"),_fd_write=A((e,t,n,r)=>{for(var o=0,s=0;s<n;s++){var a=LE_HEAP_LOAD_U32((t>>2)*4),c=LE_HEAP_LOAD_U32((t+4>>2)*4);t+=8;for(var l=0;l<c;l++)printChar(e,HEAPU8[a+l]);o+=c}return LE_HEAP_STORE_U32((r>>2)*4,o),0},"_fd_write");_fd_write.sig="iippp";function _tree_sitter_log_callback(e,t){if(Module.currentLogCallback){let n=UTF8ToString(t);Module.currentLogCallback(n,e!==0)}}A(_tree_sitter_log_callback,"_tree_sitter_log_callback");function _tree_sitter_parse_callback(e,t,n,r,o){let a=Module.currentParseCallback(t,{row:n,column:r});typeof a=="string"?(setValue(o,a.length,"i32"),stringToUTF16(a,e,10240)):setValue(o,0,"i32")}A(_tree_sitter_parse_callback,"_tree_sitter_parse_callback");function _tree_sitter_progress_callback(e,t){return Module.currentProgressCallback?Module.currentProgressCallback({currentOffset:e,hasError:t}):!1}A(_tree_sitter_progress_callback,"_tree_sitter_progress_callback");function _tree_sitter_query_progress_callback(e){return Module.currentQueryProgressCallback?Module.currentQueryProgressCallback({currentOffset:e}):!1}A(_tree_sitter_query_progress_callback,"_tree_sitter_query_progress_callback");var runtimeKeepaliveCounter=0,keepRuntimeAlive=A(()=>noExitRuntime||runtimeKeepaliveCounter>0,"keepRuntimeAlive"),_proc_exit=A(e=>{EXITSTATUS=e,keepRuntimeAlive()||(Module.onExit?.(e),ABORT=!0),quit_(e,new ExitStatus(e))},"_proc_exit");_proc_exit.sig="vi";var exitJS=A((e,t)=>{EXITSTATUS=e,_proc_exit(e)},"exitJS"),handleException=A(e=>{if(e instanceof ExitStatus||e=="unwind")return EXITSTATUS;quit_(1,e)},"handleException"),lengthBytesUTF8=A(e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},"lengthBytesUTF8"),stringToUTF8Array=A((e,t,n,r)=>{if(!(r>0))return 0;for(var o=n,s=n+r-1,a=0;a<e.length;++a){var c=e.codePointAt(a);if(c<=127){if(n>=s)break;t[n++]=c}else if(c<=2047){if(n+1>=s)break;t[n++]=192|c>>6,t[n++]=128|c&63}else if(c<=65535){if(n+2>=s)break;t[n++]=224|c>>12,t[n++]=128|c>>6&63,t[n++]=128|c&63}else{if(n+3>=s)break;t[n++]=240|c>>18,t[n++]=128|c>>12&63,t[n++]=128|c>>6&63,t[n++]=128|c&63,a++}}return t[n]=0,n-o},"stringToUTF8Array"),stringToUTF8=A((e,t,n)=>stringToUTF8Array(e,HEAPU8,t,n),"stringToUTF8"),stackAlloc=A(e=>__emscripten_stack_alloc(e),"stackAlloc"),stringToUTF8OnStack=A(e=>{var t=lengthBytesUTF8(e)+1,n=stackAlloc(t);return stringToUTF8(e,n,t),n},"stringToUTF8OnStack"),AsciiToString=A(e=>{for(var t="";;){var n=HEAPU8[e++];if(!n)return t;t+=String.fromCharCode(n)}},"AsciiToString"),stringToUTF16=A((e,t,n)=>{if(n??=2147483647,n<2)return 0;n-=2;for(var r=t,o=n<e.length*2?n/2:e.length,s=0;s<o;++s){var a=e.charCodeAt(s);LE_HEAP_STORE_I16((t>>1)*2,a),t+=2}return LE_HEAP_STORE_I16((t>>1)*2,0),t-r},"stringToUTF16");LE_ATOMICS_NATIVE_BYTE_ORDER=new Int8Array(new Int16Array([1]).buffer)[0]===1?[(e=>e),(e=>e),void 0,(e=>e)]:[(e=>e),(e=>((e&65280)<<8|(e&255)<<24)>>16),void 0,(e=>e>>24&255|e>>8&65280|(e&65280)<<8|(e&255)<<24)];function LE_HEAP_UPDATE(){HEAPU16.unsigned=(e=>e&65535),HEAPU32.unsigned=(e=>e>>>0)}if(A(LE_HEAP_UPDATE,"LE_HEAP_UPDATE"),initMemory(),Module.noExitRuntime&&(noExitRuntime=Module.noExitRuntime),Module.print&&(out=Module.print),Module.printErr&&(err=Module.printErr),Module.dynamicLibraries&&(dynamicLibraries=Module.dynamicLibraries),Module.wasmBinary&&(wasmBinary=Module.wasmBinary),Module.arguments&&(arguments_=Module.arguments),Module.thisProgram&&(thisProgram=Module.thisProgram),Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.shift()();Module.setValue=setValue,Module.getValue=getValue,Module.UTF8ToString=UTF8ToString,Module.stringToUTF8=stringToUTF8,Module.lengthBytesUTF8=lengthBytesUTF8,Module.AsciiToString=AsciiToString,Module.stringToUTF16=stringToUTF16,Module.loadWebAssemblyModule=loadWebAssemblyModule,Module.LE_HEAP_STORE_I64=LE_HEAP_STORE_I64;var ASM_CONSTS={},_malloc,_calloc,_realloc,_free,_ts_range_edit,_memcmp,_ts_language_symbol_count,_ts_language_state_count,_ts_language_abi_version,_ts_language_name,_ts_language_field_count,_ts_language_next_state,_ts_language_symbol_name,_ts_language_symbol_for_name,_strncmp,_ts_language_symbol_type,_ts_language_field_name_for_id,_ts_lookahead_iterator_new,_ts_lookahead_iterator_delete,_ts_lookahead_iterator_reset_state,_ts_lookahead_iterator_reset,_ts_lookahead_iterator_next,_ts_lookahead_iterator_current_symbol,_ts_point_edit,_ts_parser_delete,_ts_parser_reset,_ts_parser_set_language,_ts_parser_set_included_ranges,_ts_query_new,_ts_query_delete,_iswspace,_iswalnum,_ts_query_copy,_ts_query_pattern_count,_ts_query_capture_count,_ts_query_string_count,_ts_query_capture_name_for_id,_ts_query_capture_quantifier_for_id,_ts_query_string_value_for_id,_ts_query_predicates_for_pattern,_ts_query_start_byte_for_pattern,_ts_query_end_byte_for_pattern,_ts_query_is_pattern_rooted,_ts_query_is_pattern_non_local,_ts_query_is_pattern_guaranteed_at_step,_ts_query_disable_capture,_ts_query_disable_pattern,_ts_tree_copy,_ts_tree_delete,_ts_init,_ts_parser_new_wasm,_ts_parser_enable_logger_wasm,_ts_parser_parse_wasm,_ts_parser_included_ranges_wasm,_ts_language_type_is_named_wasm,_ts_language_type_is_visible_wasm,_ts_language_metadata_wasm,_ts_language_supertypes_wasm,_ts_language_subtypes_wasm,_ts_tree_root_node_wasm,_ts_tree_root_node_with_offset_wasm,_ts_tree_edit_wasm,_ts_tree_included_ranges_wasm,_ts_tree_get_changed_ranges_wasm,_ts_tree_cursor_new_wasm,_ts_tree_cursor_copy_wasm,_ts_tree_cursor_delete_wasm,_ts_tree_cursor_reset_wasm,_ts_tree_cursor_reset_to_wasm,_ts_tree_cursor_goto_first_child_wasm,_ts_tree_cursor_goto_last_child_wasm,_ts_tree_cursor_goto_first_child_for_index_wasm,_ts_tree_cursor_goto_first_child_for_position_wasm,_ts_tree_cursor_goto_next_sibling_wasm,_ts_tree_cursor_goto_previous_sibling_wasm,_ts_tree_cursor_goto_descendant_wasm,_ts_tree_cursor_goto_parent_wasm,_ts_tree_cursor_current_node_type_id_wasm,_ts_tree_cursor_current_node_state_id_wasm,_ts_tree_cursor_current_node_is_named_wasm,_ts_tree_cursor_current_node_is_missing_wasm,_ts_tree_cursor_current_node_id_wasm,_ts_tree_cursor_start_position_wasm,_ts_tree_cursor_end_position_wasm,_ts_tree_cursor_start_index_wasm,_ts_tree_cursor_end_index_wasm,_ts_tree_cursor_current_field_id_wasm,_ts_tree_cursor_current_depth_wasm,_ts_tree_cursor_current_descendant_index_wasm,_ts_tree_cursor_current_node_wasm,_ts_node_symbol_wasm,_ts_node_field_name_for_child_wasm,_ts_node_field_name_for_named_child_wasm,_ts_node_children_by_field_id_wasm,_ts_node_first_child_for_byte_wasm,_ts_node_first_named_child_for_byte_wasm,_ts_node_grammar_symbol_wasm,_ts_node_child_count_wasm,_ts_node_named_child_count_wasm,_ts_node_child_wasm,_ts_node_named_child_wasm,_ts_node_child_by_field_id_wasm,_ts_node_next_sibling_wasm,_ts_node_prev_sibling_wasm,_ts_node_next_named_sibling_wasm,_ts_node_prev_named_sibling_wasm,_ts_node_descendant_count_wasm,_ts_node_parent_wasm,_ts_node_child_with_descendant_wasm,_ts_node_descendant_for_index_wasm,_ts_node_named_descendant_for_index_wasm,_ts_node_descendant_for_position_wasm,_ts_node_named_descendant_for_position_wasm,_ts_node_start_point_wasm,_ts_node_end_point_wasm,_ts_node_start_index_wasm,_ts_node_end_index_wasm,_ts_node_to_string_wasm,_ts_node_children_wasm,_ts_node_named_children_wasm,_ts_node_descendants_of_type_wasm,_ts_node_is_named_wasm,_ts_node_has_changes_wasm,_ts_node_has_error_wasm,_ts_node_is_error_wasm,_ts_node_is_missing_wasm,_ts_node_is_extra_wasm,_ts_node_parse_state_wasm,_ts_node_next_parse_state_wasm,_ts_query_matches_wasm,_ts_query_captures_wasm,_memset,_memcpy,_memmove,_iswalpha,_iswblank,_iswdigit,_iswlower,_iswpunct,_iswupper,_iswxdigit,_memchr,_strlen,_strcmp,_strncat,_strncpy,_towlower,_towupper,_setThrew,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___wasm_apply_data_relocs;function assignWasmExports(e){Module._malloc=_malloc=e.malloc,Module._calloc=_calloc=e.calloc,Module._realloc=_realloc=e.realloc,Module._free=_free=e.free,Module._ts_range_edit=_ts_range_edit=e.ts_range_edit,Module._memcmp=_memcmp=e.memcmp,Module._ts_language_symbol_count=_ts_language_symbol_count=e.ts_language_symbol_count,Module._ts_language_state_count=_ts_language_state_count=e.ts_language_state_count,Module._ts_language_abi_version=_ts_language_abi_version=e.ts_language_abi_version,Module._ts_language_name=_ts_language_name=e.ts_language_name,Module._ts_language_field_count=_ts_language_field_count=e.ts_language_field_count,Module._ts_language_next_state=_ts_language_next_state=e.ts_language_next_state,Module._ts_language_symbol_name=_ts_language_symbol_name=e.ts_language_symbol_name,Module._ts_language_symbol_for_name=_ts_language_symbol_for_name=e.ts_language_symbol_for_name,Module._strncmp=_strncmp=e.strncmp,Module._ts_language_symbol_type=_ts_language_symbol_type=e.ts_language_symbol_type,Module._ts_language_field_name_for_id=_ts_language_field_name_for_id=e.ts_language_field_name_for_id,Module._ts_lookahead_iterator_new=_ts_lookahead_iterator_new=e.ts_lookahead_iterator_new,Module._ts_lookahead_iterator_delete=_ts_lookahead_iterator_delete=e.ts_lookahead_iterator_delete,Module._ts_lookahead_iterator_reset_state=_ts_lookahead_iterator_reset_state=e.ts_lookahead_iterator_reset_state,Module._ts_lookahead_iterator_reset=_ts_lookahead_iterator_reset=e.ts_lookahead_iterator_reset,Module._ts_lookahead_iterator_next=_ts_lookahead_iterator_next=e.ts_lookahead_iterator_next,Module._ts_lookahead_iterator_current_symbol=_ts_lookahead_iterator_current_symbol=e.ts_lookahead_iterator_current_symbol,Module._ts_point_edit=_ts_point_edit=e.ts_point_edit,Module._ts_parser_delete=_ts_parser_delete=e.ts_parser_delete,Module._ts_parser_reset=_ts_parser_reset=e.ts_parser_reset,Module._ts_parser_set_language=_ts_parser_set_language=e.ts_parser_set_language,Module._ts_parser_set_included_ranges=_ts_parser_set_included_ranges=e.ts_parser_set_included_ranges,Module._ts_query_new=_ts_query_new=e.ts_query_new,Module._ts_query_delete=_ts_query_delete=e.ts_query_delete,Module._iswspace=_iswspace=e.iswspace,Module._iswalnum=_iswalnum=e.iswalnum,Module._ts_query_copy=_ts_query_copy=e.ts_query_copy,Module._ts_query_pattern_count=_ts_query_pattern_count=e.ts_query_pattern_count,Module._ts_query_capture_count=_ts_query_capture_count=e.ts_query_capture_count,Module._ts_query_string_count=_ts_query_string_count=e.ts_query_string_count,Module._ts_query_capture_name_for_id=_ts_query_capture_name_for_id=e.ts_query_capture_name_for_id,Module._ts_query_capture_quantifier_for_id=_ts_query_capture_quantifier_for_id=e.ts_query_capture_quantifier_for_id,Module._ts_query_string_value_for_id=_ts_query_string_value_for_id=e.ts_query_string_value_for_id,Module._ts_query_predicates_for_pattern=_ts_query_predicates_for_pattern=e.ts_query_predicates_for_pattern,Module._ts_query_start_byte_for_pattern=_ts_query_start_byte_for_pattern=e.ts_query_start_byte_for_pattern,Module._ts_query_end_byte_for_pattern=_ts_query_end_byte_for_pattern=e.ts_query_end_byte_for_pattern,Module._ts_query_is_pattern_rooted=_ts_query_is_pattern_rooted=e.ts_query_is_pattern_rooted,Module._ts_query_is_pattern_non_local=_ts_query_is_pattern_non_local=e.ts_query_is_pattern_non_local,Module._ts_query_is_pattern_guaranteed_at_step=_ts_query_is_pattern_guaranteed_at_step=e.ts_query_is_pattern_guaranteed_at_step,Module._ts_query_disable_capture=_ts_query_disable_capture=e.ts_query_disable_capture,Module._ts_query_disable_pattern=_ts_query_disable_pattern=e.ts_query_disable_pattern,Module._ts_tree_copy=_ts_tree_copy=e.ts_tree_copy,Module._ts_tree_delete=_ts_tree_delete=e.ts_tree_delete,Module._ts_init=_ts_init=e.ts_init,Module._ts_parser_new_wasm=_ts_parser_new_wasm=e.ts_parser_new_wasm,Module._ts_parser_enable_logger_wasm=_ts_parser_enable_logger_wasm=e.ts_parser_enable_logger_wasm,Module._ts_parser_parse_wasm=_ts_parser_parse_wasm=e.ts_parser_parse_wasm,Module._ts_parser_included_ranges_wasm=_ts_parser_included_ranges_wasm=e.ts_parser_included_ranges_wasm,Module._ts_language_type_is_named_wasm=_ts_language_type_is_named_wasm=e.ts_language_type_is_named_wasm,Module._ts_language_type_is_visible_wasm=_ts_language_type_is_visible_wasm=e.ts_language_type_is_visible_wasm,Module._ts_language_metadata_wasm=_ts_language_metadata_wasm=e.ts_language_metadata_wasm,Module._ts_language_supertypes_wasm=_ts_language_supertypes_wasm=e.ts_language_supertypes_wasm,Module._ts_language_subtypes_wasm=_ts_language_subtypes_wasm=e.ts_language_subtypes_wasm,Module._ts_tree_root_node_wasm=_ts_tree_root_node_wasm=e.ts_tree_root_node_wasm,Module._ts_tree_root_node_with_offset_wasm=_ts_tree_root_node_with_offset_wasm=e.ts_tree_root_node_with_offset_wasm,Module._ts_tree_edit_wasm=_ts_tree_edit_wasm=e.ts_tree_edit_wasm,Module._ts_tree_included_ranges_wasm=_ts_tree_included_ranges_wasm=e.ts_tree_included_ranges_wasm,Module._ts_tree_get_changed_ranges_wasm=_ts_tree_get_changed_ranges_wasm=e.ts_tree_get_changed_ranges_wasm,Module._ts_tree_cursor_new_wasm=_ts_tree_cursor_new_wasm=e.ts_tree_cursor_new_wasm,Module._ts_tree_cursor_copy_wasm=_ts_tree_cursor_copy_wasm=e.ts_tree_cursor_copy_wasm,Module._ts_tree_cursor_delete_wasm=_ts_tree_cursor_delete_wasm=e.ts_tree_cursor_delete_wasm,Module._ts_tree_cursor_reset_wasm=_ts_tree_cursor_reset_wasm=e.ts_tree_cursor_reset_wasm,Module._ts_tree_cursor_reset_to_wasm=_ts_tree_cursor_reset_to_wasm=e.ts_tree_cursor_reset_to_wasm,Module._ts_tree_cursor_goto_first_child_wasm=_ts_tree_cursor_goto_first_child_wasm=e.ts_tree_cursor_goto_first_child_wasm,Module._ts_tree_cursor_goto_last_child_wasm=_ts_tree_cursor_goto_last_child_wasm=e.ts_tree_cursor_goto_last_child_wasm,Module._ts_tree_cursor_goto_first_child_for_index_wasm=_ts_tree_cursor_goto_first_child_for_index_wasm=e.ts_tree_cursor_goto_first_child_for_index_wasm,Module._ts_tree_cursor_goto_first_child_for_position_wasm=_ts_tree_cursor_goto_first_child_for_position_wasm=e.ts_tree_cursor_goto_first_child_for_position_wasm,Module._ts_tree_cursor_goto_next_sibling_wasm=_ts_tree_cursor_goto_next_sibling_wasm=e.ts_tree_cursor_goto_next_sibling_wasm,Module._ts_tree_cursor_goto_previous_sibling_wasm=_ts_tree_cursor_goto_previous_sibling_wasm=e.ts_tree_cursor_goto_previous_sibling_wasm,Module._ts_tree_cursor_goto_descendant_wasm=_ts_tree_cursor_goto_descendant_wasm=e.ts_tree_cursor_goto_descendant_wasm,Module._ts_tree_cursor_goto_parent_wasm=_ts_tree_cursor_goto_parent_wasm=e.ts_tree_cursor_goto_parent_wasm,Module._ts_tree_cursor_current_node_type_id_wasm=_ts_tree_cursor_current_node_type_id_wasm=e.ts_tree_cursor_current_node_type_id_wasm,Module._ts_tree_cursor_current_node_state_id_wasm=_ts_tree_cursor_current_node_state_id_wasm=e.ts_tree_cursor_current_node_state_id_wasm,Module._ts_tree_cursor_current_node_is_named_wasm=_ts_tree_cursor_current_node_is_named_wasm=e.ts_tree_cursor_current_node_is_named_wasm,Module._ts_tree_cursor_current_node_is_missing_wasm=_ts_tree_cursor_current_node_is_missing_wasm=e.ts_tree_cursor_current_node_is_missing_wasm,Module._ts_tree_cursor_current_node_id_wasm=_ts_tree_cursor_current_node_id_wasm=e.ts_tree_cursor_current_node_id_wasm,Module._ts_tree_cursor_start_position_wasm=_ts_tree_cursor_start_position_wasm=e.ts_tree_cursor_start_position_wasm,Module._ts_tree_cursor_end_position_wasm=_ts_tree_cursor_end_position_wasm=e.ts_tree_cursor_end_position_wasm,Module._ts_tree_cursor_start_index_wasm=_ts_tree_cursor_start_index_wasm=e.ts_tree_cursor_start_index_wasm,Module._ts_tree_cursor_end_index_wasm=_ts_tree_cursor_end_index_wasm=e.ts_tree_cursor_end_index_wasm,Module._ts_tree_cursor_current_field_id_wasm=_ts_tree_cursor_current_field_id_wasm=e.ts_tree_cursor_current_field_id_wasm,Module._ts_tree_cursor_current_depth_wasm=_ts_tree_cursor_current_depth_wasm=e.ts_tree_cursor_current_depth_wasm,Module._ts_tree_cursor_current_descendant_index_wasm=_ts_tree_cursor_current_descendant_index_wasm=e.ts_tree_cursor_current_descendant_index_wasm,Module._ts_tree_cursor_current_node_wasm=_ts_tree_cursor_current_node_wasm=e.ts_tree_cursor_current_node_wasm,Module._ts_node_symbol_wasm=_ts_node_symbol_wasm=e.ts_node_symbol_wasm,Module._ts_node_field_name_for_child_wasm=_ts_node_field_name_for_child_wasm=e.ts_node_field_name_for_child_wasm,Module._ts_node_field_name_for_named_child_wasm=_ts_node_field_name_for_named_child_wasm=e.ts_node_field_name_for_named_child_wasm,Module._ts_node_children_by_field_id_wasm=_ts_node_children_by_field_id_wasm=e.ts_node_children_by_field_id_wasm,Module._ts_node_first_child_for_byte_wasm=_ts_node_first_child_for_byte_wasm=e.ts_node_first_child_for_byte_wasm,Module._ts_node_first_named_child_for_byte_wasm=_ts_node_first_named_child_for_byte_wasm=e.ts_node_first_named_child_for_byte_wasm,Module._ts_node_grammar_symbol_wasm=_ts_node_grammar_symbol_wasm=e.ts_node_grammar_symbol_wasm,Module._ts_node_child_count_wasm=_ts_node_child_count_wasm=e.ts_node_child_count_wasm,Module._ts_node_named_child_count_wasm=_ts_node_named_child_count_wasm=e.ts_node_named_child_count_wasm,Module._ts_node_child_wasm=_ts_node_child_wasm=e.ts_node_child_wasm,Module._ts_node_named_child_wasm=_ts_node_named_child_wasm=e.ts_node_named_child_wasm,Module._ts_node_child_by_field_id_wasm=_ts_node_child_by_field_id_wasm=e.ts_node_child_by_field_id_wasm,Module._ts_node_next_sibling_wasm=_ts_node_next_sibling_wasm=e.ts_node_next_sibling_wasm,Module._ts_node_prev_sibling_wasm=_ts_node_prev_sibling_wasm=e.ts_node_prev_sibling_wasm,Module._ts_node_next_named_sibling_wasm=_ts_node_next_named_sibling_wasm=e.ts_node_next_named_sibling_wasm,Module._ts_node_prev_named_sibling_wasm=_ts_node_prev_named_sibling_wasm=e.ts_node_prev_named_sibling_wasm,Module._ts_node_descendant_count_wasm=_ts_node_descendant_count_wasm=e.ts_node_descendant_count_wasm,Module._ts_node_parent_wasm=_ts_node_parent_wasm=e.ts_node_parent_wasm,Module._ts_node_child_with_descendant_wasm=_ts_node_child_with_descendant_wasm=e.ts_node_child_with_descendant_wasm,Module._ts_node_descendant_for_index_wasm=_ts_node_descendant_for_index_wasm=e.ts_node_descendant_for_index_wasm,Module._ts_node_named_descendant_for_index_wasm=_ts_node_named_descendant_for_index_wasm=e.ts_node_named_descendant_for_index_wasm,Module._ts_node_descendant_for_position_wasm=_ts_node_descendant_for_position_wasm=e.ts_node_descendant_for_position_wasm,Module._ts_node_named_descendant_for_position_wasm=_ts_node_named_descendant_for_position_wasm=e.ts_node_named_descendant_for_position_wasm,Module._ts_node_start_point_wasm=_ts_node_start_point_wasm=e.ts_node_start_point_wasm,Module._ts_node_end_point_wasm=_ts_node_end_point_wasm=e.ts_node_end_point_wasm,Module._ts_node_start_index_wasm=_ts_node_start_index_wasm=e.ts_node_start_index_wasm,Module._ts_node_end_index_wasm=_ts_node_end_index_wasm=e.ts_node_end_index_wasm,Module._ts_node_to_string_wasm=_ts_node_to_string_wasm=e.ts_node_to_string_wasm,Module._ts_node_children_wasm=_ts_node_children_wasm=e.ts_node_children_wasm,Module._ts_node_named_children_wasm=_ts_node_named_children_wasm=e.ts_node_named_children_wasm,Module._ts_node_descendants_of_type_wasm=_ts_node_descendants_of_type_wasm=e.ts_node_descendants_of_type_wasm,Module._ts_node_is_named_wasm=_ts_node_is_named_wasm=e.ts_node_is_named_wasm,Module._ts_node_has_changes_wasm=_ts_node_has_changes_wasm=e.ts_node_has_changes_wasm,Module._ts_node_has_error_wasm=_ts_node_has_error_wasm=e.ts_node_has_error_wasm,Module._ts_node_is_error_wasm=_ts_node_is_error_wasm=e.ts_node_is_error_wasm,Module._ts_node_is_missing_wasm=_ts_node_is_missing_wasm=e.ts_node_is_missing_wasm,Module._ts_node_is_extra_wasm=_ts_node_is_extra_wasm=e.ts_node_is_extra_wasm,Module._ts_node_parse_state_wasm=_ts_node_parse_state_wasm=e.ts_node_parse_state_wasm,Module._ts_node_next_parse_state_wasm=_ts_node_next_parse_state_wasm=e.ts_node_next_parse_state_wasm,Module._ts_query_matches_wasm=_ts_query_matches_wasm=e.ts_query_matches_wasm,Module._ts_query_captures_wasm=_ts_query_captures_wasm=e.ts_query_captures_wasm,Module._memset=_memset=e.memset,Module._memcpy=_memcpy=e.memcpy,Module._memmove=_memmove=e.memmove,Module._iswalpha=_iswalpha=e.iswalpha,Module._iswblank=_iswblank=e.iswblank,Module._iswdigit=_iswdigit=e.iswdigit,Module._iswlower=_iswlower=e.iswlower,Module._iswpunct=_iswpunct=e.iswpunct,Module._iswupper=_iswupper=e.iswupper,Module._iswxdigit=_iswxdigit=e.iswxdigit,Module._memchr=_memchr=e.memchr,Module._strlen=_strlen=e.strlen,Module._strcmp=_strcmp=e.strcmp,Module._strncat=_strncat=e.strncat,Module._strncpy=_strncpy=e.strncpy,Module._towlower=_towlower=e.towlower,Module._towupper=_towupper=e.towupper,_setThrew=e.setThrew,__emscripten_stack_restore=e._emscripten_stack_restore,__emscripten_stack_alloc=e._emscripten_stack_alloc,_emscripten_stack_get_current=e.emscripten_stack_get_current,___wasm_apply_data_relocs=e.__wasm_apply_data_relocs}A(assignWasmExports,"assignWasmExports");var wasmImports={__heap_base:___heap_base,__indirect_function_table:wasmTable,__memory_base:___memory_base,__stack_high:___stack_high,__stack_low:___stack_low,__stack_pointer:___stack_pointer,__table_base:___table_base,_abort_js:__abort_js,emscripten_resize_heap:_emscripten_resize_heap,fd_close:_fd_close,fd_seek:_fd_seek,fd_write:_fd_write,memory:wasmMemory,tree_sitter_log_callback:_tree_sitter_log_callback,tree_sitter_parse_callback:_tree_sitter_parse_callback,tree_sitter_progress_callback:_tree_sitter_progress_callback,tree_sitter_query_progress_callback:_tree_sitter_query_progress_callback};function callMain(e=[]){var t=resolveGlobalSymbol("main").sym;if(t){e.unshift(thisProgram);var n=e.length,r=stackAlloc((n+1)*4),o=r;e.forEach(a=>{LE_HEAP_STORE_U32((o>>2)*4,stringToUTF8OnStack(a)),o+=4}),LE_HEAP_STORE_U32((o>>2)*4,0);try{var s=t(n,r);return exitJS(s,!0),s}catch(a){return handleException(a)}}}A(callMain,"callMain");function run(e=arguments_){if(runDependencies>0){dependenciesFulfilled=run;return}if(preRun(),runDependencies>0){dependenciesFulfilled=run;return}function t(){if(Module.calledRun=!0,!ABORT){initRuntime(),readyPromiseResolve?.(Module),Module.onRuntimeInitialized?.();var n=Module.noInitialRun||!1;n||callMain(e),postRun()}}A(t,"doRun"),Module.setStatus?(Module.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>Module.setStatus(""),1),t()},1)):t()}A(run,"run");var wasmExports;return wasmExports=await createWasm(),run(),runtimeInitialized?moduleRtn=Module:moduleRtn=new Promise((e,t)=>{readyPromiseResolve=e,readyPromiseReject=t}),moduleRtn}A(PA,"Module");var NG=PA,NA=null;async function EA(e){return NA??=await NG(e)}A(EA,"initializeBinding");function RA(){return!!NA}A(RA,"checkModule");var X,ob,sb,_A=ia(e=>{x._ts_parser_delete(e[0]),x._free(e[1])}),db=class{static{A(this,"Parser")}0=0;1=0;logCallback=null;language=null;static async init(e){SA(await EA(e)),X=x._ts_init(),ob=x.getValue(X,"i32"),sb=x.getValue(X+ne,"i32")}constructor(){this.initialize(),_A?.register(this,[this[0],this[1]],this)}initialize(){if(!RA())throw new Error("cannot construct a Parser before calling `init()`");x._ts_parser_new_wasm(),this[0]=x.getValue(X,"i32"),this[1]=x.getValue(X+ne,"i32")}delete(){_A?.unregister(this),x._ts_parser_delete(this[0]),x._free(this[1]),this[0]=0,this[1]=0}setLanguage(e){let t;if(!e)t=0,this.language=null;else if(e.constructor===ub){t=e[0];let n=x._ts_language_abi_version(t);if(n<sb||ob<n)throw new Error(`Incompatible language version ${n}. Compatibility range ${sb} through ${ob}.`);this.language=e}else throw new Error("Argument must be a Language");return x._ts_parser_set_language(this[0],t),this}parse(e,t,n){if(typeof e=="string")x.currentParseCallback=c=>e.slice(c);else if(typeof e=="function")x.currentParseCallback=e;else throw new Error("Argument must be a string or a function");n?.progressCallback?x.currentProgressCallback=n.progressCallback:x.currentProgressCallback=null,this.logCallback?(x.currentLogCallback=this.logCallback,x._ts_parser_enable_logger_wasm(this[0],1)):(x.currentLogCallback=null,x._ts_parser_enable_logger_wasm(this[0],0));let r=0,o=0;if(n?.includedRanges){r=n.includedRanges.length,o=x._calloc(r,Yc);let c=o;for(let l=0;l<r;l++)xA(c,n.includedRanges[l]),c+=Yc}let s=x._ts_parser_parse_wasm(this[0],this[1],t?t[0]:0,o,r);if(!s)return x.currentParseCallback=null,x.currentLogCallback=null,x.currentProgressCallback=null,null;if(!this.language)throw new Error("Parser must have a language to parse");let a=new xG(ji,s,this.language,x.currentParseCallback);return x.currentParseCallback=null,x.currentLogCallback=null,x.currentProgressCallback=null,a}reset(){x._ts_parser_reset(this[0])}getIncludedRanges(){x._ts_parser_included_ranges_wasm(this[0]);let e=x.getValue(X,"i32"),t=x.getValue(X+ne,"i32"),n=new Array(e);if(e>0){let r=t;for(let o=0;o<e;o++)n[o]=df(r),r+=Yc;x._free(t)}return n}setLogger(e){if(!e)this.logCallback=null;else{if(typeof e!="function")throw new Error("Logger callback must be a function");this.logCallback=e}return this}getLogger(){return this.logCallback}},EG=1,RG=2,TG=/[\w-]+/g,boe={Zero:0,ZeroOrOne:1,ZeroOrMore:2,One:3,OneOrMore:4},yA=A(e=>e.type==="capture","isCaptureStep"),fb=A(e=>e.type==="string","isStringStep"),br={Syntax:1,NodeName:2,FieldName:3,CaptureName:4,PatternStructure:5},zc=class TA extends Error{constructor(t,n,r,o){super(TA.formatMessage(t,n)),this.kind=t,this.info=n,this.index=r,this.length=o,this.name="QueryError"}kind;info;index;length;static{A(this,"QueryError")}static formatMessage(t,n){switch(t){case br.NodeName:return`Bad node name '${n.word}'`;case br.FieldName:return`Bad field name '${n.word}'`;case br.CaptureName:return`Bad capture name @${n.word}`;case br.PatternStructure:return`Bad pattern structure at offset ${n.suffix}`;case br.Syntax:return`Bad syntax at offset ${n.suffix}`}}};function AA(e,t,n,r){if(e.length!==3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 2, got ${e.length-1}`);if(!yA(e[1]))throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}"`);let o=n==="eq?"||n==="any-eq?",s=!n.startsWith("any-");if(yA(e[2])){let a=e[1].name,c=e[2].name;r[t].push(l=>{let u=[],d=[];for(let m of l)m.name===a&&u.push(m.node),m.name===c&&d.push(m.node);let f=A((m,p,g)=>g?m.text===p.text:m.text!==p.text,"compare");return s?u.every(m=>d.some(p=>f(m,p,o))):u.some(m=>d.some(p=>f(m,p,o)))})}else{let a=e[1].name,c=e[2].value,l=A(d=>d.text===c,"matches"),u=A(d=>d.text!==c,"doesNotMatch");r[t].push(d=>{let f=[];for(let p of d)p.name===a&&f.push(p.node);let m=o?l:u;return s?f.every(m):f.some(m)})}}A(AA,"parseAnyPredicate");function IA(e,t,n,r){if(e.length!==3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 2, got ${e.length-1}.`);if(e[1].type!=="capture")throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}".`);if(e[2].type!=="string")throw new Error(`Second argument of \`#${n}\` predicate must be a string. Got @${e[2].name}.`);let o=n==="match?"||n==="any-match?",s=!n.startsWith("any-"),a=e[1].name,c=new RegExp(e[2].value);r[t].push(l=>{let u=[];for(let f of l)f.name===a&&u.push(f.node.text);let d=A((f,m)=>m?c.test(f):!c.test(f),"test");return u.length===0?!o:s?u.every(f=>d(f,o)):u.some(f=>d(f,o))})}A(IA,"parseMatchPredicate");function DA(e,t,n,r){if(e.length<2)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected at least 1. Got ${e.length-1}.`);if(e[1].type!=="capture")throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}".`);let o=n==="any-of?",s=e[1].name,a=e.slice(2);if(!a.every(fb))throw new Error(`Arguments to \`#${n}\` predicate must be strings.".`);let c=a.map(l=>l.value);r[t].push(l=>{let u=[];for(let d of l)d.name===s&&u.push(d.node.text);return u.length===0?!o:u.every(d=>c.includes(d))===o})}A(DA,"parseAnyOfPredicate");function kA(e,t,n,r,o){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(fb))throw new Error(`Arguments to \`#${n}\` predicate must be strings.".`);let s=n==="is?"?r:o;s[t]||(s[t]={}),s[t][e[1].value]=e[2]?.value??null}A(kA,"parseIsPredicate");function FA(e,t,n){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(fb))throw new Error('Arguments to `#set!` predicate must be strings.".');n[t]||(n[t]={}),n[t][e[1].value]=e[2]?.value??null}A(FA,"parseSetDirective");function LA(e,t,n,r,o,s,a,c,l,u,d){if(t===EG){let f=r[n];s.push({type:"capture",name:f})}else if(t===RG)s.push({type:"string",value:o[n]});else if(s.length>0){if(s[0].type!=="string")throw new Error("Predicates must begin with a literal value");let f=s[0].value;switch(f){case"any-not-eq?":case"not-eq?":case"any-eq?":case"eq?":AA(s,e,f,a);break;case"any-not-match?":case"not-match?":case"any-match?":case"match?":IA(s,e,f,a);break;case"not-any-of?":case"any-of?":DA(s,e,f,a);break;case"is?":case"is-not?":kA(s,e,f,u,d);break;case"set!":FA(s,e,l);break;default:c[e].push({operator:f,operands:s.slice(1)})}s.length=0}}A(LA,"parsePattern");var bA=ia(e=>{x._ts_query_delete(e)}),Soe=class{static{A(this,"Query")}0=0;exceededMatchLimit;textPredicates;captureNames;captureQuantifiers;predicates;setProperties;assertedProperties;refutedProperties;matchLimit;constructor(e,t){let n=x.lengthBytesUTF8(t),r=x._malloc(n+1);x.stringToUTF8(t,r,n+1);let o=x._ts_query_new(e[0],r,n,X,X+ne);if(!o){let y=x.getValue(X+ne,"i32"),w=x.getValue(X,"i32"),_=x.UTF8ToString(r,w).length,b=t.slice(_,_+100).split(`
159
- `)[0],S=b.match(TG)?.[0]??"";switch(x._free(r),y){case br.Syntax:throw new zc(br.Syntax,{suffix:`${_}: '${b}'...`},_,0);case br.NodeName:throw new zc(y,{word:S},_,S.length);case br.FieldName:throw new zc(y,{word:S},_,S.length);case br.CaptureName:throw new zc(y,{word:S},_,S.length);case br.PatternStructure:throw new zc(y,{suffix:`${_}: '${b}'...`},_,0)}}let s=x._ts_query_string_count(o),a=x._ts_query_capture_count(o),c=x._ts_query_pattern_count(o),l=new Array(a),u=new Array(c),d=new Array(s);for(let y=0;y<a;y++){let w=x._ts_query_capture_name_for_id(o,y,X),_=x.getValue(X,"i32");l[y]=x.UTF8ToString(w,_)}for(let y=0;y<c;y++){let w=new Array(a);for(let _=0;_<a;_++){let b=x._ts_query_capture_quantifier_for_id(o,y,_);w[_]=b}u[y]=w}for(let y=0;y<s;y++){let w=x._ts_query_string_value_for_id(o,y,X),_=x.getValue(X,"i32");d[y]=x.UTF8ToString(w,_)}let f=new Array(c),m=new Array(c),p=new Array(c),g=new Array(c),h=new Array(c);for(let y=0;y<c;y++){let w=x._ts_query_predicates_for_pattern(o,y,X),_=x.getValue(X,"i32");g[y]=[],h[y]=[];let b=new Array,S=w;for(let N=0;N<_;N++){let R=x.getValue(S,"i32");S+=ne;let $=x.getValue(S,"i32");S+=ne,LA(y,R,$,l,d,b,h,g,f,m,p)}Object.freeze(h[y]),Object.freeze(g[y]),Object.freeze(f[y]),Object.freeze(m[y]),Object.freeze(p[y])}x._free(r),this[0]=o,this.captureNames=l,this.captureQuantifiers=u,this.textPredicates=h,this.predicates=g,this.setProperties=f,this.assertedProperties=m,this.refutedProperties=p,this.exceededMatchLimit=!1,bA?.register(this,o,this)}delete(){bA?.unregister(this),x._ts_query_delete(this[0]),this[0]=0}matches(e,t={}){let n=t.startPosition??Rn,r=t.endPosition??Rn,o=t.startIndex??0,s=t.endIndex??0,a=t.startContainingPosition??Rn,c=t.endContainingPosition??Rn,l=t.startContainingIndex??0,u=t.endContainingIndex??0,d=t.matchLimit??4294967295,f=t.maxStartDepth??4294967295,m=t.progressCallback;if(typeof d!="number")throw new Error("Arguments must be numbers");if(this.matchLimit=d,s!==0&&o>s)throw new Error("`startIndex` cannot be greater than `endIndex`");if(r!==Rn&&(n.row>r.row||n.row===r.row&&n.column>r.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(u!==0&&l>u)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(c!==Rn&&(a.row>c.row||a.row===c.row&&a.column>c.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");m&&(x.currentQueryProgressCallback=m),me(e),x._ts_query_matches_wasm(this[0],e.tree[0],n.row,n.column,r.row,r.column,o,s,a.row,a.column,c.row,c.column,l,u,d,f);let p=x.getValue(X,"i32"),g=x.getValue(X+ne,"i32"),h=x.getValue(X+2*ne,"i32"),y=new Array(p);this.exceededMatchLimit=!!h;let w=0,_=g;for(let b=0;b<p;b++){let S=x.getValue(_,"i32");_+=ne;let N=x.getValue(_,"i32");_+=ne;let R=new Array(N);if(_=cb(this,e.tree,_,S,R),this.textPredicates[S].every($=>$(R))){y[w]={patternIndex:S,captures:R};let $=this.setProperties[S];y[w].setProperties=$;let I=this.assertedProperties[S];y[w].assertedProperties=I;let U=this.refutedProperties[S];y[w].refutedProperties=U,w++}}return y.length=w,x._free(g),x.currentQueryProgressCallback=null,y}captures(e,t={}){let n=t.startPosition??Rn,r=t.endPosition??Rn,o=t.startIndex??0,s=t.endIndex??0,a=t.startContainingPosition??Rn,c=t.endContainingPosition??Rn,l=t.startContainingIndex??0,u=t.endContainingIndex??0,d=t.matchLimit??4294967295,f=t.maxStartDepth??4294967295,m=t.progressCallback;if(typeof d!="number")throw new Error("Arguments must be numbers");if(this.matchLimit=d,s!==0&&o>s)throw new Error("`startIndex` cannot be greater than `endIndex`");if(r!==Rn&&(n.row>r.row||n.row===r.row&&n.column>r.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(u!==0&&l>u)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(c!==Rn&&(a.row>c.row||a.row===c.row&&a.column>c.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");m&&(x.currentQueryProgressCallback=m),me(e),x._ts_query_captures_wasm(this[0],e.tree[0],n.row,n.column,r.row,r.column,o,s,a.row,a.column,c.row,c.column,l,u,d,f);let p=x.getValue(X,"i32"),g=x.getValue(X+ne,"i32"),h=x.getValue(X+2*ne,"i32"),y=new Array;this.exceededMatchLimit=!!h;let w=new Array,_=g;for(let b=0;b<p;b++){let S=x.getValue(_,"i32");_+=ne;let N=x.getValue(_,"i32");_+=ne;let R=x.getValue(_,"i32");if(_+=ne,w.length=N,_=cb(this,e.tree,_,S,w),this.textPredicates[S].every($=>$(w))){let $=w[R],I=this.setProperties[S];$.setProperties=I;let U=this.assertedProperties[S];$.assertedProperties=U;let de=this.refutedProperties[S];$.refutedProperties=de,y.push($)}}return x._free(g),x.currentQueryProgressCallback=null,y}predicatesForPattern(e){return this.predicates[e]}disableCapture(e){let t=x.lengthBytesUTF8(e),n=x._malloc(t+1);x.stringToUTF8(e,n,t+1),x._ts_query_disable_capture(this[0],n,t),x._free(n)}disablePattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);x._ts_query_disable_pattern(this[0],e)}didExceedMatchLimit(){return this.exceededMatchLimit}startIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return x._ts_query_start_byte_for_pattern(this[0],e)}endIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return x._ts_query_end_byte_for_pattern(this[0],e)}patternCount(){return x._ts_query_pattern_count(this[0])}captureIndexForName(e){return this.captureNames.indexOf(e)}isPatternRooted(e){return x._ts_query_is_pattern_rooted(this[0],e)===1}isPatternNonLocal(e){return x._ts_query_is_pattern_non_local(this[0],e)===1}isPatternGuaranteedAtStep(e){return x._ts_query_is_pattern_guaranteed_at_step(this[0],e)===1}};var mb=B(require("path"),1),MA=B(require("fs"),1);var Xc=class extends Map{#n=0;#e=new Map;#t=new Map;#i;#s;#o;constructor(t={}){if(super(),!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof t.maxAge=="number"&&t.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.#i=t.maxSize,this.#s=t.maxAge||Number.POSITIVE_INFINITY,this.#o=t.onEviction}get __oldCache(){return this.#t}#a(t){if(typeof this.#o=="function")for(let[n,r]of t)this.#o(n,r.value)}#r(t,n){return typeof n.expiry=="number"&&n.expiry<=Date.now()?(typeof this.#o=="function"&&this.#o(t,n.value),this.delete(t)):!1}#f(t,n){if(this.#r(t,n)===!1)return n.value}#l(t,n){return n.expiry?this.#f(t,n):n.value}#u(t,n){let r=n.get(t);return this.#l(t,r)}#d(t,n){this.#e.set(t,n),this.#n++,this.#n>=this.#i&&(this.#n=0,this.#a(this.#t),this.#t=this.#e,this.#e=new Map)}#m(t,n){this.#t.delete(t),this.#d(t,n)}*#c(){for(let t of this.#t){let[n,r]=t;this.#e.has(n)||this.#r(n,r)===!1&&(yield t)}for(let t of this.#e){let[n,r]=t;this.#r(n,r)===!1&&(yield t)}}get(t){if(this.#e.has(t)){let n=this.#e.get(t);return this.#l(t,n)}if(this.#t.has(t)){let n=this.#t.get(t);if(this.#r(t,n)===!1)return this.#m(t,n),n.value}}set(t,n,{maxAge:r=this.#s}={}){let o=typeof r=="number"&&r!==Number.POSITIVE_INFINITY?Date.now()+r:void 0;return this.#e.has(t)?this.#e.set(t,{value:n,expiry:o}):this.#d(t,{value:n,expiry:o}),this}has(t){return this.#e.has(t)?!this.#r(t,this.#e.get(t)):this.#t.has(t)?!this.#r(t,this.#t.get(t)):!1}peek(t){if(this.#e.has(t))return this.#u(t,this.#e);if(this.#t.has(t))return this.#u(t,this.#t)}expiresIn(t){let n=this.#e.get(t)??this.#t.get(t);if(n)return n.expiry?n.expiry-Date.now():Number.POSITIVE_INFINITY}delete(t){let n=this.#e.delete(t);return n&&this.#n--,this.#t.delete(t)||n}clear(){this.#e.clear(),this.#t.clear(),this.#n=0}resize(t){if(!(t&&t>0))throw new TypeError("`maxSize` must be a number greater than 0");let n=[...this.#c()],r=n.length-t;r<0?(this.#e=new Map(n),this.#t=new Map,this.#n=n.length):(r>0&&this.#a(n.slice(0,r)),this.#t=new Map(n.slice(r)),this.#e=new Map,this.#n=0),this.#i=t}evict(t=1){let n=Number(t);if(!n||n<=0)return;let r=[...this.#c()],o=Math.trunc(Math.min(n,Math.max(r.length-1,0)));o<=0||(this.#a(r.slice(0,o)),this.#t=new Map(r.slice(o)),this.#e=new Map,this.#n=0)}*keys(){for(let[t]of this)yield t}*values(){for(let[,t]of this)yield t}*[Symbol.iterator](){for(let t of this.#e){let[n,r]=t;this.#r(n,r)===!1&&(yield[n,r.value])}for(let t of this.#t){let[n,r]=t;this.#e.has(n)||this.#r(n,r)===!1&&(yield[n,r.value])}}*entriesDescending(){let t=[...this.#e];for(let n=t.length-1;n>=0;--n){let r=t[n],[o,s]=r;this.#r(o,s)===!1&&(yield[o,s.value])}t=[...this.#t];for(let n=t.length-1;n>=0;--n){let r=t[n],[o,s]=r;this.#e.has(o)||this.#r(o,s)===!1&&(yield[o,s.value])}}*entriesAscending(){for(let[t,n]of this.#c())yield[t,n.value]}get size(){if(!this.#n)return this.#t.size;let t=0;for(let n of this.#t.keys())this.#e.has(n)||t++;return Math.min(this.#n+t,this.#i)}get maxSize(){return this.#i}get maxAge(){return this.#s}entries(){return this.entriesAscending()}forEach(t,n=this){for(let[r,o]of this.entriesAscending())t.call(n,o,r,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};var OA=!1;async function AG(){if(OA)return;let e=MA.readFileSync(mb.join(__dirname,"web-tree-sitter.wasm"));await db.init({wasmBinary:e}),OA=!0}function IG(e,t){let n=null,r=!1;return{async init(){if(r)return;await AG(),n=new db;let o=mb.join(__dirname,e),s=await ub.load(o);n.setLanguage(s),r=!0},getParser(){if(!n)throw new Error(`${t} parser not initialized. Call init() first.`);return n},isInitialized(){return r}}}var DG=64;function $A(e,t,n=DG){let r=IG(e,t),o=new Xc({maxSize:n,onEviction:(s,a)=>a.delete()});return{...r,parseWithCache(s){if(!r.isInitialized())return null;let a=o.get(s);if(a)return a;let c=r.getParser().parse(s);return c&&o.set(s,c),c},invalidateCache(s){if(s===void 0){for(let[,a]of o)a.delete();o.clear()}else o.get(s)?.delete(),o.delete(s)}}}var pb={info:e=>console.log(e),error:e=>console.error(e)};function qA(e){pb=e}var hb=class{parsers=new Map;register(t,n,r){if(this.parsers.has(t))return;let o=$A(n,r);this.parsers.set(t,{langId:t,name:r,module:o})}async initOne(t,n,r){this.register(t,n,r);let o=this.parsers.get(t);o.module.isInitialized()||await o.module.init()}async initAll(){for(let t of this.parsers.values())try{await t.module.init()}catch(n){pb.error(`Failed to initialize ${t.name} parser: ${n instanceof Error?n.message:String(n)}`)}pb.info(`ParserManager: initialized ${this.parsers.size} parsers`)}isInitialized(t){return this.parsers.get(t)?.module.isInitialized()??!1}parseWithCache(t,n){let r=this.parsers.get(t);if(!r)throw new Error(`No parser registered for language: ${t}`);return r.module.parseWithCache(n)}getParser(t){let n=this.parsers.get(t);if(!n)throw new Error(`No parser registered for language: ${t}`);return n.module.getParser()}},Me=new hb;var Tae=B(le());var Gt={found:e=>({handled:!0,hover:e}),empty:()=>({handled:!0,hover:null}),notHandled:()=>({handled:!1})};var gb=B(le());var oa=new Map;function kG(e){let t=oa.get(e),n=[];if(t)for(let r of t.values())n.push(...r);Mr().sendDiagnostics({uri:e,diagnostics:n})}function jr(e,t,n){let r=Ne(e),o=oa.get(r);n.length===0?o&&(o.delete(t),o.size===0&&oa.delete(r)):(o||(o=new Map,oa.set(r,o)),o.set(t,n)),kG(r)}function BA(e,t){return oa.get(Ne(e))?.get(t)??[]}function Jc(e){jr(e,"compiler",[])}function jA(e){let t=Ne(e);oa.delete(t),Mr().sendDiagnostics({uri:t,diagnostics:[]})}var WA=require("node:url");var FG=/file:\/\/\/[^\s)'"]+/g;function sa(e){return e.replace(FG,t=>{try{return(0,WA.fileURLToPath)(t)}catch{return t}})}function bn(e){Mr().window.showInformationMessage(sa(e))}function Sr(e){Mr().window.showWarningMessage(sa(e))}function ir(e){Mr().window.showErrorMessage(sa(e))}function UA(e,...t){return Mr().window.showErrorMessage(sa(e),...t)}function Wr(e,t,n){let r="BGforge MLS",o=new Map;function s(a,c){let l={severity:c,range:{start:{line:a.line-1,character:a.columnStart},end:{line:a.line-1,character:a.columnEnd}},message:`${a.message}`,source:r},u=a.uri===n?t:a.uri,d=o.get(u);d||(d=[],o.set(u,d)),d.push(l)}for(let a of e.errors)s(a,gb.DiagnosticSeverity.Error);for(let a of e.warnings)s(a,gb.DiagnosticSeverity.Warning);for(let[a,c]of o)jr(a,"compiler",c)}function at(e){return e instanceof Error?e.message:String(e)}function ff(e){if(e&&typeof e=="object"&&"code"in e&&typeof e.code=="string")return e.code}function mf(e,t,n,r){return{errors:[...e.errors,{uri:n,line:1,columnStart:0,columnEnd:0,message:r||t.message}],warnings:e.warnings}}function Qc(e,t,n,r){t&&(e.errors.length>0?ir(r):bn(n))}var Goe=B(le()),jo=require("path");var HA=require("node:url"),VA=require("url");function et(e){return e.startsWith("file://")?(0,VA.fileURLToPath)(e):decodeURIComponent(e.replace(/^[^:]+:/,""))}function Ye(e){return(0,HA.pathToFileURL)(e).toString()}function LG(e){return!(!e||!e.uri||e.uri==="")}function GA(e){return LG(e)?e:null}var OG=new Set([".h",".tph"]);function Wo(e){let t=(0,jo.extname)(e).toLowerCase();return OG.has(t)}function aa(e){return(0,jo.basename)(e)}function ca(e,t){let n=et(e);if(t){let r=(0,jo.relative)(t,n);if(!r.startsWith("..")&&!r.startsWith("/"))return r}return(0,jo.basename)(n)}var Zc=B(le()),zA="resref",KA="byte",YA="char",XA="dword",JA="int",QA="2da-c0",ZA="2da-c1",eI="2da-c2",tI="2da-c3",nI="2da-c4",rI="2da-c5",_b=[QA,ZA,eI,tI,nI,rI],iI=new Map([["resref",zA],["byte",KA],["char",YA],["dword",XA],["int",JA]]),yb={tokenTypes:[Zc.SemanticTokenTypes.parameter,Zc.SemanticTokenTypes.variable,zA,KA,YA,XA,JA,QA,ZA,eI,tI,nI,rI],tokenModifiers:[]},MG=new Map(yb.tokenTypes.map((e,t)=>[e,t]));function $G(e,t){return e.line!==t.line?e.line-t.line:e.startChar!==t.startChar?e.startChar-t.startChar:e.length!==t.length?e.length-t.length:e.tokenType.localeCompare(t.tokenType)}function oI(e){if(e.length===0)return{data:[]};let t=new Zc.SemanticTokensBuilder,n=e.toSorted($G);for(let o of n){let s=MG.get(o.tokenType);s===void 0||o.length<=0||t.push(o.line,o.startChar,o.length,s,o.tokenModifiers)}return{data:t.build().data}}var sI=require("node:fs/promises"),aI=require("node:path"),cI=require("node:url"),Uo=B(le());var pf=class{extensionToProvider=new Map;buildExtensionMap(t){this.extensionToProvider.clear();for(let n of t)if(n.indexExtensions)for(let r of n.indexExtensions)this.extensionToProvider.set(r.toLowerCase(),n);T(`Built extension map with ${this.extensionToProvider.size} extensions`)}getWatchPatterns(t){let n=[],r=Uo.WatchKind.Create|Uo.WatchKind.Change|Uo.WatchKind.Delete;for(let o of t)if(o.indexExtensions)for(let s of o.indexExtensions)n.push({globPattern:`**/*${s}`,kind:r});return n}async handleWatchedFileChange(t,n){let r=Ne(t),o=(0,cI.fileURLToPath)(r),s=(0,aI.extname)(o).toLowerCase(),a=this.extensionToProvider.get(s);if(a)if(n===Uo.FileChangeType.Deleted)a.onWatchedFileDeleted&&(a.onWatchedFileDeleted(r),T(`File deleted, cleared from index: ${o}`));else try{let c=await(0,sI.readFile)(o,"utf-8");a.reloadFileData&&(a.reloadFileData(r,c),T(`File ${n===Uo.FileChangeType.Created?"created":"changed"}, reloaded: ${o}`))}catch(c){T(`Failed to read file ${o}: ${at(c)}`,"warn")}}handleDocumentClosed(t,n,r){let o=Ne(n),s=r.get(t);s?.onDocumentClosed&&s.onDocumentClosed(o)}};var a0=require("node:fs/promises"),zf=require("node:path"),c0=require("node:timers/promises");var bb=class{value;next;constructor(t){this.value=t}},el=class{#n;#e;#t;constructor(){this.clear()}enqueue(t){let n=new bb(t);this.#n?(this.#e.next=n,this.#e=n):(this.#n=n,this.#e=n),this.#t++}dequeue(){let t=this.#n;if(t)return this.#n=this.#n.next,this.#t--,this.#n||(this.#e=void 0),t.value}peek(){if(this.#n)return this.#n.value}clear(){this.#n=void 0,this.#e=void 0,this.#t=0}get size(){return this.#t}*[Symbol.iterator](){let t=this.#n;for(;t;)yield t.value,t=t.next}*drain(){for(;this.#n;)yield this.dequeue()}};function Wi(e){let t=!1;if(typeof e=="object"&&({concurrency:e,rejectOnClear:t=!1}=e),lI(e),typeof t!="boolean")throw new TypeError("Expected `rejectOnClear` to be a boolean");let n=new el,r=0,o=()=>{r<e&&n.size>0&&(r++,n.dequeue().run())},s=()=>{r--,o()},a=async(u,d,f)=>{let m=(async()=>u(...f))();d(m);try{await m}catch{}s()},c=(u,d,f,m)=>{let p={reject:f};new Promise(g=>{p.run=g,n.enqueue(p)}).then(a.bind(void 0,u,d,m)),r<e&&o()},l=(u,...d)=>new Promise((f,m)=>{c(u,f,m,d)});return Object.defineProperties(l,{activeCount:{get:()=>r},pendingCount:{get:()=>n.size},clearQueue:{value(){if(!t){n.clear();return}let u=AbortSignal.abort().reason;for(;n.size>0;)n.dequeue().reject(u)}},concurrency:{get:()=>e,set(u){lI(u),e=u,queueMicrotask(()=>{for(;r<e&&n.size>0;)o()})}},map:{async value(u,d){let f=Array.from(u,(m,p)=>l(d,m,p));return Promise.all(f)}}}),l}function lI(e){if(!((Number.isInteger(e)||e===Number.POSITIVE_INFINITY)&&e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}var iw=B(t0()),zo=B(require("fs")),n0=B(require("os")),Xi=B(require("path")),Ji=Xi.join(n0.tmpdir(),"bgforge-mls");function r0(e,t){try{let n=zo.realpathSync(t),r=Xi.relative(e,n);return!r.startsWith("..")&&!Xi.isAbsolute(r)}catch{return!1}}function Uf(e,t){let n=Xi.relative(e,t);return!n.startsWith("..")&&!Xi.isAbsolute(n)}function Hf(e){try{return zo.realpathSync(e)}catch{return}}function Vf(e){return zo.existsSync(e)?zo.lstatSync(e).isDirectory():!1}var i0=["**/node_modules/**","**/.*/**"],Ko=4;async function o0(e,t){return iw.async(`**/*.${t}`,{cwd:e,caseSensitiveMatch:!1,ignore:i0,suppressErrors:!0})}async function Gf(e,t){if(t.length===0)return[];let n=t.length===1?`**/*.${t[0]}`:`**/*.{${t.join(",")}}`;return iw.async(n,{cwd:e,caseSensitiveMatch:!1,ignore:i0,suppressErrors:!0})}function s0(e){return(e.startsWith(".")?e.slice(1):e).toLowerCase()}async function l0(e,t,n){if(!n)return;let r=new Map;for(let l of e)if(!(!l.indexExtensions||!l.reloadFileData))for(let u of l.indexExtensions)r.set(s0(u),l);if(r.size===0)return;let o=await Gf(n,[...r.keys()]),s=Wi(Ko),a=new Map,c=new Map;await Promise.all(o.map(l=>s(async()=>{let u=s0((0,zf.extname)(l)),d=r.get(u);if(d){a.set(u,(a.get(u)??0)+1);try{let f=(0,zf.join)(n,l),m=Ye(f),p=await(0,a0.readFile)(f,"utf-8");t.reloadFileData(d.id,m,p)}catch{c.set(u,(c.get(u)??0)+1)}await(0,c0.setImmediate)()}})));for(let[l,u]of a){let d=r.get(l)?.id,f=c.get(l)??0;f>0&&T(`Startup scan for ${d} (.${l}) had ${f} read failures`),u>0&&T(`Scanned ${u} .${l} files for ${d}`)}}var al="bgforge.compile",Kf="bgforge.parseDialog",Yf="bgforge.saveDialogTra",Xf="bgforge.workspaceSymbols.",u0="Workspace scan complete",d0=["fallout-ssl","weidu-d","weidu-tp2"];function f0(e){return`${Xf}${e}`}var m0="extension.bgforge.compile";var ow=class{providers=new Map;context;aliases=new Map;fileWatcher=new pf;workspaceScan=Promise.resolve();register(t){this.providers.set(t.id,t),T(`Registered provider: ${t.id}`)}registerAlias(t,n){this.aliases.set(t,n),T(`Registered alias: ${t} -> ${n}`)}resolveLangId(t){return this.aliases.get(t)??t}identifierExtraChars(t){return fA[this.resolveLangId(t)]??""}async init(t){this.context=t;for(let n of this.providers.values())try{await n.init(t)}catch(r){let o=at(r);T(`Failed to initialize provider ${n.id}: ${o}`,"error"),ir(`BGforge MLS: ${n.id} failed to initialize: ${o}`)}T(`Initialized ${this.providers.size} providers`),this.fileWatcher.buildExtensionMap(this.providers.values()),this.workspaceScan=(t.scanAfter??Promise.resolve()).then(()=>l0(this.providers.values(),this,t.workspaceRoot)).catch(n=>{T(`Workspace scan failed: ${at(n)}`,"error")}).finally(()=>{T(u0)})}workspaceScanFinished(){return this.workspaceScan}updateSettings(t){this.context&&(this.context.settings=t)}getContext(){if(!this.context)throw new Error("ProviderRegistry not initialized");return this.context}get(t){return this.providers.get(this.resolveLangId(t))}has(t){return this.providers.has(this.resolveLangId(t))||this.aliases.has(t)}shouldProvideFeatures(t,n,r){let o=this.get(t);return o?.shouldProvideFeatures?o.shouldProvideFeatures(n,r):!0}format(t,n,r){let o=Ne(r),s=this.get(t);return s?.format?s.format(n,o):{edits:[]}}symbols(t,n){let r=this.get(t);return r?.symbols?r.symbols(n):[]}workspaceSymbols(t,n,r){if(n.isCancellationRequested)return[];if(r)return this.get(r)?.workspaceSymbols?.(t,n)??[];let o=[];for(let s of this.providers.values())s.workspaceSymbols&&o.push(...s.workspaceSymbols(t,n));return o}foldingRanges(t,n){let r=this.get(t);return r?.foldingRanges?r.foldingRanges(n):[]}selectionRanges(t,n,r){let o=this.get(t);return o?.selectionRanges?o.selectionRanges(n,r):[]}prepareCallHierarchy(t,n,r,o){return this.get(t)?.prepareCallHierarchy?.(n,r,Ne(o))??null}incomingCalls(t,n){return this.get(t)?.incomingCalls?.(n)??[]}outgoingCalls(t,n){return this.get(t)?.outgoingCalls?.(n)??[]}async definition(t,n,r,o){let s=Ne(o),a=this.get(t);return a?.definition?await a.definition(n,r,s):null}references(t,n,r,o,s,a){if(a.isCancellationRequested)return[];let c=Ne(o),l=this.get(t);return l?.references?l.references(n,r,c,s,a):[]}inlayHints(t,n,r,o){let s=Ne(r),a=this.get(t);return a?.inlayHints?a.inlayHints(n,s,o):[]}strRefs(t,n,r){let o=Ne(r);return this.get(t)?.strRefs?.(n,o)??[]}semanticTokens(t,n,r){let o=Ne(r),s=this.get(t);return oI(s?.semanticTokens?.(n,o)??[])}prepareRename(t,n,r){let o=this.get(t);return o?.prepareRename?o.prepareRename(n,r):null}async rename(t,n,r,o,s){let a=Ne(s),c=this.get(t);return c?.rename?await c.rename(n,r,o,a):null}completion(t,n,r,o,s){let a=Ne(r),c=this.get(t);if(!c)return[];let u=[...c.getCompletions?c.getCompletions(a):[]];return c.filterCompletions&&o&&(u=c.filterCompletions(u,n,o,a,s)),u}localHover(t,n,r,o,s){let a=Ne(o),c=this.get(t);return c?.hover?c.hover(n,r,a,s):Gt.notHandled()}hover(t,n,r,o){let s=Ne(n),a=this.get(t);if(!a)return null;if(o&&a.resolveSymbol){let c=a.resolveSymbol(r,o,s);if(c?.hover)return c.hover}return null}signature(t,n,r,o,s){let a=Ne(r),c=this.get(t);if(!c)return null;if(c.localSignature){let l=c.localSignature(n,o,s);if(l)return l}return c.getSignature?c.getSignature(a,o,s):null}symbolDefinition(t,n){let r=this.get(t);return r?.getSymbolDefinition?GA(r.getSymbolDefinition(n)):null}isPositionInString(t,n,r){return this.get(t)?.isPositionInString?.(n,r)??!1}reloadFileData(t,n,r){let o=Ne(n),s=this.get(t);s?.reloadFileData&&s.reloadFileData(o,r)}async compile(t,n,r,o){let s=Ne(n),a=this.get(t);return a?.compile?(await a.compile(s,r,o),!0):!1}getWatchPatterns(){return this.fileWatcher.getWatchPatterns(this.providers.values())}handleWatchedFileChange(t,n){return this.fileWatcher.handleWatchedFileChange(t,n)}handleDocumentClosed(t,n){this.fileWatcher.handleDocumentClosed(t,n,this)}},Y=new ow;var nO=B(require("fs")),rO=B(require("path")),iO=B(Bx());var Fn={falloutSSL:{compilePath:"",compileOptions:"-q -p -l -O2 -d -s -n",outputDirectory:"",headersDirectory:"",compileOnValidate:!0,compiler:"wasm"},tssl:{emitSsl:!1},weidu:{path:"weidu",gamePath:"",tlkEncoding:"",compiler:"weidu"},validate:"saveAndType",diagnostics:!0,debug:!1};function ts(e){let t=e??{};return{falloutSSL:{...Fn.falloutSSL,...t.falloutSSL},tssl:{...Fn.tssl,...t.tssl},weidu:{...Fn.weidu,...t.weidu,compiler:t.weidu?.compiler==="built-in"?"built-in":Fn.weidu.compiler},validate:t.validate??Fn.validate,diagnostics:t.diagnostics??Fn.diagnostics,debug:t.debug??Fn.debug}}function oO(e){return e==="save"||e==="saveAndType"}function sO(e){return e==="type"||e==="saveAndType"}var vJ={translation:{directory:"tra",auto_tra:!0}};function aO(e){let t=structuredClone(vJ);if(e===void 0)return t;try{let n=nO.readFileSync(rO.join(e,".bgforge.yml"),"utf8"),s=iO.parse(n)?.mls?.translation;s!==void 0&&(typeof s.directory=="string"&&(t.translation.directory=s.directory),typeof s.auto_tra=="boolean"&&(t.translation.auto_tra=s.auto_tra))}catch(n){T(`Failed to load .bgforge.yml from ${e}: ${at(n)}`,"warn")}return t}var Ip=require("node:fs"),Gv=require("node:url"),Upe=B(le());var Ln=B(le()),K={Function:"function",Procedure:"procedure",Macro:"macro",Action:"action",Trigger:"trigger",Variable:"variable",Constant:"constant",Parameter:"parameter",LoopVariable:"loop_variable",State:"state",Component:"component"},kt={Global:"global",Workspace:"workspace",File:"file",Function:"function",Loop:"loop"},Ee={Static:"static",Workspace:"workspace",External:"external",Document:"document",Navigation:"navigation"};var jx=new Set([K.Function,K.Procedure,K.Macro,K.Action,K.Trigger]),PJ=new Set([K.Variable,K.Parameter,K.LoopVariable]);function Ea(e){return jx.has(e.kind)}function cO(e){return PJ.has(e.kind)}function Ym(e,t){return t===void 0||t===Ee.Workspace?e:e.map(n=>({...n,source:{...n.source,type:t}}))}function lO(e){switch(e){case K.Function:case K.Procedure:case K.Action:case K.Trigger:return Ln.CompletionItemKind.Function;case K.Macro:return Ln.CompletionItemKind.Snippet;case K.Variable:case K.Parameter:case K.LoopVariable:return Ln.CompletionItemKind.Variable;case K.Constant:return Ln.CompletionItemKind.Constant;case K.State:case K.Component:return Ln.CompletionItemKind.Class;default:return Ln.CompletionItemKind.Text}}function uO(e){switch(e){case K.Function:case K.Procedure:case K.Macro:case K.Action:case K.Trigger:return Ln.SymbolKind.Function;case K.Variable:case K.Parameter:case K.LoopVariable:return Ln.SymbolKind.Variable;case K.Constant:return Ln.SymbolKind.Constant;case K.State:return Ln.SymbolKind.Class;case K.Component:return Ln.SymbolKind.Module;default:return Ln.SymbolKind.Variable}}var NJ=["Reply","NOption","GOption","BOption","mstr","display_mstr","floater","floater_rand","NLowOption","BLowOption","GLowOption","GMessage","NMessage","BMessage","CompOption"],Wx=NJ.join("|"),Ra=new RegExp(`^(${Wx})\\((\\d+)$`),Xm=new RegExp(`\\b(${Wx})\\((\\d+)`,"g"),Jm=/\bfloater_rand\((\d+)\s*,\s*(\d+)/g,dO=/^@[0-9]+$/,fO=/@(\d+)/g,$l=/^tra\((\d+)\)$/,mO=/\btra\((\d+)\)/g,EJ=/^\d+$/;function pO(e){if(!EJ.test(e))throw new Error(`entryNum must be digits only, got: ${JSON.stringify(e)}`)}function hO(e){return pO(e),new RegExp(`(?:@${e}(?!\\d)|\\btra\\(${e}\\))`,"g")}function gO(e){return pO(e),new RegExp(`\\b(?:${Wx})\\(${e}(?!\\d)|\\bfloater_rand\\(\\d+\\s*,\\s*${e}(?!\\d)`,"g")}var Qm=/^\/\*\* @tra ((\w+)\.(tra|msg)) \*\//,_O=/^\/\*\* @tra \w+\.(tra|msg) \*\//;function RJ(e){return e.replaceAll(/[\\\]^-]/g,"\\$&")}function Pr(e,t){return e.split(`
160
- `)[t.line]?.substring(0,t.character)??""}function Zm(e,t,n=""){let o=e.split(/\r?\n/g)[t.line];if(!o)return"";let s=t.character,a=TJ(o,s);if(a)return a;let c=AJ(o,s);if(c)return c;let l=RJ(n),u=o.slice(0,s+1).search(new RegExp(`[\\w${l}]+$`)),d=o.slice(s).search(new RegExp(`[^\\w${l}]`)),f;return d<0?f=o.slice(u):f=o.slice(u,d+s),yO(f)&&yO(f)&&(u=o.slice(0,s+1).search(/[^\s(]+\(?\d+$/),d=o.slice(s).search(/\W/),d<0?f=o.slice(u):f=o.slice(u,d+s)),f}function TJ(e,t){let n=/\btra\((\d+)\)/g;for(let r of e.matchAll(n)){if(!r[1])continue;let o=r.index+r[0].length;if(t>=r.index&&t<o)return r[0]}return null}function AJ(e,t){for(let n of e.matchAll(Xm)){let r=n[1],o=n[2];if(!r||!o)continue;let s=n.index+n[0].lastIndexOf(o),a=s+o.length;if(t>=s&&t<a)return`${r}(${o}`}for(let n of e.matchAll(Jm)){let r=n[1],o=n[2];if(!r||!o)continue;let s=n.index+n[0].indexOf(r),a=s+r.length;if(t>=s&&t<a)return`floater_rand(${r}`;let c=n.index+n[0].lastIndexOf(o),l=c+o.length;if(t>=c&&t<l)return`floater_rand(${o}`}return null}function yO(e){return/^\d+$/.test(e)}var ple=B(le());var IJ={[mt]:"fold",[At]:"exact",[_n]:"exact"};function bO(e){return IJ[e]??"exact"}function ql(e,t){return t==="fold"?e.toLowerCase():e}var DJ=2e3,Yr=class{files=new Map;maxFiles;staticSymbols=[];byName=new Map;nameCase;allSymbolsCache=null;allSymbolsWithNavCache=null;invalidateAllSymbolsCache(){this.allSymbolsCache=null,this.allSymbolsWithNavCache=null}getAllSymbolsNoNav(){if(this.allSymbolsCache===null){let t=[];for(let n of this.files.values())for(let r of n)r.source.type!==Ee.Navigation&&t.push(r);t.push(...this.staticSymbols),this.allSymbolsCache=t}return this.allSymbolsCache}getAllSymbolsWithNav(){if(this.allSymbolsWithNavCache===null){let t=[];for(let n of this.files.values())for(let r of n)t.push(r);this.allSymbolsWithNavCache=t}return this.allSymbolsWithNavCache}constructor(t){this.maxFiles=t?.maxFiles??DJ,this.nameCase=t?.nameCase??"exact"}updateFile(t,n){this.removeFileFromIndices(t),this.files.delete(t),this.files.set(t,n);for(let r of n)this.addToNameIndex(r);if(this.files.size>this.maxFiles){let r=this.files.keys().next().value;r!==void 0&&(this.removeFileFromIndices(r),this.files.delete(r))}this.invalidateAllSymbolsCache()}clearFile(t){this.removeFileFromIndices(t),this.files.delete(t),this.invalidateAllSymbolsCache()}getFileSymbols(t){return this.files.get(t)??[]}loadStatic(t){for(let n of this.staticSymbols)this.removeFromNameIndex(n);this.staticSymbols=t;for(let n of t)this.addToNameIndex(n);this.invalidateAllSymbolsCache()}lookup(t,n){return this.lookupAll(t,n)[0]}nameCaseOf(t){return this.lookup(t)?.nameCase}lookupDefinition(t,n){return this.lookup(t,n)?.location??null}lookupAll(t,n){let r=this.byName.get(this.key(t))?.filter(o=>o.nameCase!=="exact"||o.name===t);return!r||r.length===0?[]:r.toSorted((o,s)=>this.compareScopePrecedence(o,s,n?.uri))}query(t){let n;if(t.excludeUri){n=[];for(let[r,o]of this.files)if(r!==t.excludeUri)for(let s of o)s.source.type!==Ee.Navigation&&n.push(s);n.push(...this.staticSymbols)}else n=[...this.getAllSymbolsNoNav()];if(t.prefix){let r=t.prefix.toLowerCase();n=n.filter(o=>o.name.toLowerCase().startsWith(r))}if(t.kinds&&t.kinds.length>0){let r=new Set(t.kinds);n=n.filter(o=>r.has(o.kind))}return t.uri&&(n=n.filter(r=>r.source.uri===t.uri||r.source.type===Ee.Static)),t.limit&&n.length>t.limit&&(n=n.slice(0,t.limit)),n}getVisibleSymbols(t,n){let r=[],o=new Set,s=this.files.get(t);if(s)for(let a of s)this.isVisibleInContext(a,t,n)&&(o.has(a.name)||(r.push(a),o.add(a.name)));for(let[a,c]of this.files)if(a!==t)for(let l of c)l.scope.level===kt.Workspace&&(o.has(l.name)||(r.push(l),o.add(l.name)));for(let a of this.staticSymbols)o.has(a.name)||(r.push(a),o.add(a.name));return r}searchWorkspaceSymbols(t,n=500,r){if(r?.isCancellationRequested)return[];let o=t.toLowerCase(),s=[],a=0,c=16;for(let l of this.getAllSymbolsWithNav()){if(++a%c===0&&r?.isCancellationRequested)return s;if(!(o&&!l.name.toLowerCase().includes(o))&&l.location&&(s.push({name:l.name,kind:uO(l.kind),containerName:l.source.displayPath,location:{uri:l.location.uri,range:l.location.range}}),s.length>=n))return s}return s}key(t){return ql(t,this.nameCase)}addToNameIndex(t){let n=this.key(t.name),r=this.byName.get(n);r?r.push(t):this.byName.set(n,[t])}removeFromNameIndex(t){let n=this.key(t.name),r=this.byName.get(n);if(!r)return;let o=r.indexOf(t);o!==-1&&(r.splice(o,1),r.length===0&&this.byName.delete(n))}removeFileFromIndices(t){let n=this.files.get(t);if(n)for(let r of n)this.removeFromNameIndex(r)}compareScopePrecedence(t,n,r){let o=this.getScopePrecedenceScore(t,r),a=this.getScopePrecedenceScore(n,r)-o;if(a===0){let c=t.source.uri??"",l=n.source.uri??"";return c.localeCompare(l)}return a}getScopePrecedenceScore(t,n){let r=0;switch(t.source.type){case Ee.Document:r+=1e3;break;case Ee.Static:r+=200;break;case Ee.Workspace:r+=100;break;case Ee.External:r+=10;break}return t.source.uri===n&&(r+=500),r}isVisibleInContext(t,n,r){return t.scope.level===kt.Global||t.scope.level===kt.Workspace?!0:t.scope.level===kt.File?t.source.uri===n:t.scope.level===kt.Function?!r?.containerName||!t.scope.containerId?t.source.uri===n:t.scope.containerId===`${n}#${r.containerName}`:!r?.containerName||!t.scope.containerId?t.source.uri===n:t.scope.containerId===`${n}#${r.containerName}`}};var SO=[],ep=class{files=new Map;nameCase;constructor(t){this.nameCase=t?.nameCase??"exact"}updateFile(t,n){this.files.set(t,{byName:n,spellings:this.nameCase==="fold"?kJ(n):void 0})}removeFile(t){this.files.delete(t)}lookupUris(t,n=this.nameCase){let r=new Set;for(let[o,s]of this.files)wO(s,t,n).length>0&&r.add(o);return r}lookup(t,n=this.nameCase){let r=[];for(let o of this.files.values())for(let s of wO(o,t,n)){let a=o.byName.get(s);if(a)for(let c of a)r.push(c)}return r}};function wO(e,t,n){return n==="fold"&&e.spellings?e.spellings.get(ql(t,"fold"))??SO:e.byName.has(t)?[t]:SO}function kJ(e){let t=new Map;for(let n of e.keys()){let r=ql(n,"fold"),o=t.get(r);o?o.push(n):t.set(r,[n])}return t}var co=class{symbols;refs;constructor(t){let n=bO(t);this.symbols=new Yr({nameCase:n}),this.refs=new ep({nameCase:n})}updateFile(t,n){this.symbols.updateFile(t,n.symbols),this.refs.updateFile(t,n.refs)}refsOf(t){return this.refs.lookup(t,this.symbols.nameCaseOf(t))}removeFile(t){this.symbols.clearFile(t),this.refs.removeFile(t)}loadStatic(t){this.symbols.loadStatic(t)}};var vO=require("fs"),CO=B(require("path")),lo=B(le());var Ta={base_functions:"base_functions",engine_procedures:"engine_procedures",hooks:"hooks",key_functions:"key_functions",movie_functions:"movie_functions",preprocessor_directives:"preprocessor_directives",say_functions:"say_functions",sfall_functions:"sfall_functions",sound_functions:"sound_functions",window_functions:"window_functions"},Cle=[Ta.base_functions,Ta.key_functions,Ta.movie_functions,Ta.say_functions,Ta.sound_functions,Ta.window_functions],je={action_functions:"action_functions",action_macros:"action_macros",array_sort_type:"array_sort_type",component:"component",component_flag:"component_flag",dimorphic_functions:"dimorphic_functions",func_var_keyword:"func_var_keyword",opt_case:"opt_case",opt_exact:"opt_exact",opt_glob:"opt_glob",patch_functions:"patch_functions",patch_macros:"patch_macros"},Ple={[je.action_functions]:"action function ",[je.patch_functions]:"patch function ",[je.dimorphic_functions]:"dimorphic function ",[je.action_macros]:"action macro ",[je.patch_macros]:"patch macro "};var LJ={actions:K.Action,triggers:K.Trigger,keywords:K.Constant,functions:K.Function,procedures:K.Procedure,macros:K.Macro,variables:K.Variable,constants:K.Constant,[je.action_functions]:K.Function,[je.patch_functions]:K.Function,[je.dimorphic_functions]:K.Function,[je.action_macros]:K.Macro,[je.patch_macros]:K.Macro},OJ={[je.action_functions]:{context:"action",dtype:"function"},[je.patch_functions]:{context:"patch",dtype:"function"},[je.dimorphic_functions]:{context:"dimorphic",dtype:"function"},[je.action_macros]:{context:"action",dtype:"macro"},[je.patch_macros]:{context:"patch",dtype:"macro"}};function MJ(e){switch(e){case lo.CompletionItemKind.Function:case lo.CompletionItemKind.Method:return K.Function;case lo.CompletionItemKind.Variable:return K.Variable;case lo.CompletionItemKind.Constant:return K.Constant;case lo.CompletionItemKind.Keyword:return K.Constant;case lo.CompletionItemKind.Snippet:return K.Macro;default:return K.Variable}}function On(e){let t=$J(e);return!t||t.length===0?[]:t.map(n=>qJ(n))}function $J(e){try{let t=CO.join(__dirname,`completion.${e}.json`);return JSON.parse((0,vO.readFileSync)(t,"utf-8"))}catch(t){T(`Failed to load static completion data for ${e}: ${t}`);return}}function qJ(e){let t=e.label,n=BJ(e),r=null,o=jJ(e),s={label:t,kind:lO(n),documentation:o.contents,category:e.category};e.detail&&(s.detail=e.detail),e.tags&&(s.tags=e.tags);let a={name:t,location:r,scope:{level:kt.Global},source:{type:Ee.Static,uri:null},completion:s,hover:o,signature:void 0};if(jx.has(n)){let c=e.category?OJ[e.category]:void 0,l=c&&e.kind===lo.CompletionItemKind.Function?{context:c.context,dtype:c.dtype}:{},u=e.params?{...l,params:e.params}:l;return{...a,kind:n,callable:u}}return n===K.Variable||n===K.Parameter||n===K.LoopVariable?{...a,kind:n,variable:{}}:n===K.State?{...a,kind:n}:n===K.Component?{...a,kind:n}:{...a,kind:K.Constant,constant:{value:""}}}function BJ(e){if(e.category){let t=LJ[e.category];if(t!==void 0)return t}return e.kind!==void 0?MJ(e.kind):K.Variable}function jJ(e){return e.documentation!==void 0?typeof e.documentation=="string"?{contents:{kind:"markdown",value:e.documentation}}:{contents:e.documentation}:{contents:{kind:"markdown",value:e.label}}}var GO=B(require("child_process")),sp=B(require("os")),Nr=B(require("path"));var WJ={q:"this compiler never waits for input",p:"this compiler always preprocesses",F:"this compiler's preprocessor emits no #line directives",w:"it has no effect in the reference either"};function PO(e){let t=Number.parseInt(e,10);return Number.isNaN(t)?0:t}function tp(e){let t={},n=[],r=[],o=[],s=1,a=!1,c=!1,l=!1,u=!1,d=!1,f=!1,m=!1,p=!1,g=!1,h=0,y=!1,w=[...e];for(let b=w[0];b!==void 0&&b.startsWith("-");b=w[0]){if(w.shift(),b==="--help"||b==="-h"){m=!0;continue}if(b==="--decompile"){p=!0;continue}if(b==="--listing"){g=!0;continue}let S=b.slice(2);switch(b[1]){case"-":break;case"n":u=!0;break;case"w":case"q":case"p":case"F":{o.push({fatal:!1,noop:!0,message:`${b} does nothing here: ${WJ[b[1]]}.`});break}case"l":l=!0;break;case"d":d=!0;break;case"D":f=!0;break;case"s":a=!0;break;case"P":c=!0;break;case"x":p=!0;break;case"X":g=!0;break;case"j":h=Math.max(0,PO(S));break;case"O":s=S===""?2:PO(S),y=!0;break;case"b":o.push({fatal:!0,unsupported:"-b",message:"-b (backward compatibility) is not supported: it removes later keywords - switch, for, foreach, break, continue, pure, inline, tokenize - from the language so that old scripts may use them as names, which this compiler's grammar cannot express."});break;case"m":UJ(S,t,o);break;case"I":S!==""&&n.push(S);break;default:o.push({fatal:!1,message:`Unknown option ${b}`})}}p&&g&&o.push({fatal:!0,message:"-x and -X ask for different renderings of the same file; pass one or the other."});let _=p?"decompiling":g?"listing":"";if(_!==""){let b=[y&&"-O",n.length>0&&"-I",Object.keys(t).length>0&&"-m",a&&"-s",c&&"-P",f&&"-D"].filter(S=>S!==!1);b.length>0&&o.push({fatal:!0,message:`${b.join(", ")} ${b.length>1?"shape":"shapes"} a compile, which ${_} does not do.`})}s>2&&o.push({fatal:!1,message:`-O${s} is honoured as -O2: the passes above that level rename identifiers and share variable slots, which the reference compiler's own source marks as known to break code.`});for(let b=w.shift();b!==void 0;b=w.shift()){let S={file:b};if(w[0]==="-o"){w.shift();let N=w.shift();N===void 0?o.push({fatal:!0,message:`-o after ${b} needs an output path.`}):S.output=N}r.push(S)}return{level:s<1?0:s<2?1:2,shortCircuit:a,preprocessOnly:c,noLogo:l,noWarnings:u,debug:d,dumpTree:f,decompile:p,listing:g,help:m,defines:t,includeDirs:n,inputs:r,notices:o,jobs:h}}function UJ(e,t,n){if(e===""){n.push({fatal:!0,message:"-m needs a macro name, as in -mDEBUG or -mDEBUG=1."});return}let r=e.indexOf("="),o=r===-1?e:e.slice(0,r);if(o.includes("(")){n.push({fatal:!0,message:`-m${e} defines a macro that takes parameters, which is not supported on the command line.`});return}t[o]=r===-1?"1":e.slice(r+1)}var NO=B(require("child_process")),EO=B(require("fs")),RO=B(require("os")),np=B(require("path"));function Ux(e){return e.startsWith("~/")||e==="~"?np.join(RO.homedir(),e.slice(1)):e}var HJ=new Set(["wine","wine64","mono","dotnet","flatpak"]);function Hx(e){let t=np.extname(e).toLowerCase();return t===".cmd"||t===".bat"}function Bl(e){let t=e.trim();if(t==="")return{executable:e,prefixArgs:[]};let n=t.indexOf(" ");if(n===-1)return{executable:Ux(t),prefixArgs:[]};let r=t.slice(0,n);if(HJ.has(r.toLowerCase())){let o=t.slice(n+1).trim();return{executable:r,prefixArgs:o?[Ux(o)]:[]}}return{executable:Ux(t),prefixArgs:[]}}function rp(e,t,n,r,o=6e4){let s=Hx(e);return T(`${e} ${t.join(" ")}`),new Promise(a=>{NO.execFile(e,[...t],{cwd:n,shell:s,signal:r,timeout:o},(c,l,u)=>{T("stdout: "+l),u&&T("stderr: "+u),c&&T("error: "+c.message),a({err:c,stdout:l})})})}async function TO(e){try{await EO.promises.unlink(e)}catch(t){ff(t)!=="ENOENT"&&T(`Failed to clean up ${e}: ${at(t)}`,"warn")}}var Vx=B(require("fs"));function Aa(e){for(let t of e.values())t.abort();e.clear()}async function jl(e){let{uri:t,activeCompiles:n,cleanupPaths:r,run:o}=e;n.get(t)?.abort();let s=new AbortController;n.set(t,s);try{await o(s.signal)}finally{n.delete(t),r&&await Promise.all(r.map(a=>TO(a)))}}async function Gx(e,t){await Vx.promises.unlink(e).catch(()=>{}),await Vx.promises.writeFile(e,t,{flag:"wx",mode:384})}async function AO(e){let{uri:t,tmpPath:n,text:r,activeCompiles:o,extraCleanupPaths:s,run:a}=e;return jl({uri:t,activeCompiles:o,cleanupPaths:[n,...s??[]],run:async c=>{await Gx(n,r),await a(c)}})}var IO=B(require("path")),ip=new Map;function DO(e,t){let n=IO.resolve(e),o=(ip.get(n)??Promise.resolve()).then(t),s=o.then(()=>{},()=>{});return ip.set(n,s),s.then(()=>{ip.get(n)===s&&ip.delete(n)}),o}var kO=B(require("crypto")),Ia=B(require("path"));function op(e,t,n,r){let o=Ia.parse(e);if(!r){let s=kO.createHash("md5").update(n).digest("hex").slice(0,8);return Ia.join(Ji,`tmp-${s}-${o.name}.int`)}return Ia.resolve(t||o.dir,o.name+".int")}var FO=B(require("path")),LO=require("worker_threads");function Da(e){let{fileName:t,label:n,timeoutMs:r}=e,o=FO.join(__dirname,t),s={instance:null},a=new Map,c=0;function l(f){for(let[,m]of a)m.settle(),m.reject(new Error(f));a.clear()}function u(){if(s.instance)return s.instance;let f=new LO.Worker(o);return f.on("message",m=>{let p=a.get(m.id);a.delete(m.id),p&&(p.settle(),p.resolve(m))}),f.on("error",m=>{T(`${n} worker error: ${m.message}`),s.instance=null,l(`The ${n} failed to run: ${m.message}`)}),f.on("exit",m=>{s.instance=null,a.size>0&&l(`The ${n} stopped unexpectedly (exit ${m}).`)}),f.unref(),s.instance=f,f}function d(f,m){let p=c++;return new Promise((g,h)=>{if(m?.aborted){g(null);return}let y=setTimeout(()=>{a.delete(p),m?.removeEventListener("abort",w),h(new Error(`The ${n} did not answer within ${r/1e3}s.`))},r);y.unref?.();function w(){a.delete(p),clearTimeout(y),g(null)}m?.addEventListener("abort",w,{once:!0});let _=()=>{clearTimeout(y),m?.removeEventListener("abort",w)};a.set(p,{resolve:g,reject:h,settle:_});try{u().postMessage({...f,id:p})}catch(b){a.delete(p),_(),h(b instanceof Error?b:new Error(String(b)))}})}return{send:d,start:()=>{u()},stop:async()=>{let f=s.instance;s.instance=null,l(`The ${n} was shut down.`),f&&await f.terminate()}}}var VJ=6e4,OO=Da({fileName:"compile-worker.js",label:"SSL compiler",timeoutMs:VJ});async function MO(e){let t=await OO.send(e);if(t===null)throw new Error("The SSL compiler request was cancelled.");return{errors:t.errors,warnings:t.warnings}}async function $O(){await OO.stop()}var Wl=B(require("node:path")),zx=B(require("node:fs"));var BO=require("child_process"),qO=Wl.default.join(__dirname,"sslc-wrapper.mjs"),GJ=[Wl.default.join(__dirname,"sslc-emscripten-noderawfs/sslc.mjs"),Wl.default.join(__dirname,"../../node_modules/sslc-emscripten-noderawfs/sslc.mjs")],zJ="BGFORGE_SSLC_ENTRY";function KJ(){return GJ.find(e=>zx.default.existsSync(e))}async function jO(e){let t=KJ();if(!zx.default.existsSync(qO)||t===void 0){let c="The WebAssembly compiler is missing from this installation. Reinstall the server or configure an external compiler path in settings.";return T(c),{returnCode:1,stdout:"",stderr:c}}let n=e.options.split(" ").map(c=>c.trim()).filter(Boolean);e.headersDir&&(n.some(c=>c.startsWith("-I"))&&(e.interactive&&Sr("Warning: -I switch is used but it will be ignored"),n=n.filter(c=>!c.startsWith("-I"))),n.push("-I"+Wl.default.resolve(e.headersDir))),n.push(e.inputFileName,"-o",e.outputFileName);let r;try{r=(0,BO.fork)(qO,n,{execArgv:[],cwd:e.cwd,env:{...process.env,[zJ]:t},silent:!0})}catch(c){let l=c instanceof Error?c.message:String(c);return T(`WebAssembly compiler fork failed: ${l}`),{returnCode:1,stdout:"",stderr:l}}r.stdin?.end();let o=[],s=[];r.stdout?.on("data",c=>{let l=c.toString();o.push(l)}),r.stderr?.on("data",c=>{let l=c.toString();s.push(l)});let a=e.timeoutMs??6e4;return new Promise(c=>{let l=!1;function u(f){l||(l=!0,clearTimeout(d),c(f))}let d=setTimeout(()=>{let f=`WebAssembly compiler timed out after ${a}ms`;r.killed||r.kill(),u({returnCode:1,stdout:o.join(""),stderr:f}),T(f)},a);r.on("error",f=>{T(`WebAssembly compiler fork error: ${f.message}`),s.push(f.message)}),r.on("close",f=>{e.debug&&T(`WebAssembly compiler:
157
+ ${a}`)}let s=o.clone();try{n=await WebAssembly.compileStreaming(o)}catch(a){console.error("wasm streaming compile failed:",a),console.error("falling back to ArrayBuffer instantiation"),n=new Uint8Array(await s.arrayBuffer())}}let r=await x.loadWebAssemblyModule(n,{loadAsync:!0});return df.loadFromWasmExports(r,{sync:!1})}static loadFromWasmExports(t,{sync:n}){let r=Object.keys(t),o=r.find(a=>NG.test(a)&&!a.includes("external_scanner_"));if(!o)throw console.log(`Couldn't find language function in Wasm file. Symbols:
158
+ ${JSON.stringify(r,null,2)}`),new Error(`Language.${n?"loadSync":"load"} failed: no language function found in Wasm file`);let s=t[o]();return new df(ji,s)}static loadSync(t){let n=x.loadWebAssemblyModule(t,{loadAsync:!1});return df.loadFromWasmExports(n,{sync:!0})}};async function PA(moduleArg={}){var moduleRtn,Module=moduleArg,ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope<"u",ENVIRONMENT_IS_NODE=typeof process=="object"&&process.versions?.node&&process.type!="renderer";if(ENVIRONMENT_IS_NODE){let{createRequire:e}=await import("module");var require=e(__imu)}Module.currentQueryProgressCallback=null,Module.currentProgressCallback=null,Module.currentLogCallback=null,Module.currentParseCallback=null;var arguments_=[],thisProgram="./this.program",quit_=A((e,t)=>{throw t},"quit_"),_scriptName=__imu,scriptDirectory="";function locateFile(e){return Module.locateFile?Module.locateFile(e,scriptDirectory):scriptDirectory+e}A(locateFile,"locateFile");var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");_scriptName.startsWith("file:")&&(scriptDirectory=require("path").dirname(require("url").fileURLToPath(_scriptName))+"/"),readBinary=A(e=>{e=isFileURI(e)?new URL(e):e;var t=fs.readFileSync(e);return t},"readBinary"),readAsync=A(async(e,t=!0)=>{e=isFileURI(e)?new URL(e):e;var n=fs.readFileSync(e,t?void 0:"utf8");return n},"readAsync"),process.argv.length>1&&(thisProgram=process.argv[1].replace(/\\/g,"/")),arguments_=process.argv.slice(2),quit_=A((e,t)=>{throw process.exitCode=e,t},"quit_")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}ENVIRONMENT_IS_WORKER&&(readBinary=A(e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)},"readBinary")),readAsync=A(async e=>{if(isFileURI(e))return new Promise((n,r)=>{var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="arraybuffer",o.onload=()=>{if(o.status==200||o.status==0&&o.response){n(o.response);return}r(o.status)},o.onerror=r,o.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)},"readAsync")}var out=console.log.bind(console),err=console.error.bind(console),dynamicLibraries=[],wasmBinary,ABORT=!1,EXITSTATUS,isFileURI=A(e=>e.startsWith("file://"),"isFileURI"),readyPromiseResolve,readyPromiseReject,wasmMemory,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP64,HEAPU64,HEAP_DATA_VIEW,runtimeInitialized=!1;function updateMemoryViews(){var e=wasmMemory.buffer;Module.HEAP8=HEAP8=new Int8Array(e),Module.HEAP16=HEAP16=new Int16Array(e),Module.HEAPU8=HEAPU8=new Uint8Array(e),Module.HEAPU16=HEAPU16=new Uint16Array(e),Module.HEAP32=HEAP32=new Int32Array(e),Module.HEAPU32=HEAPU32=new Uint32Array(e),Module.HEAPF32=HEAPF32=new Float32Array(e),Module.HEAPF64=HEAPF64=new Float64Array(e),Module.HEAP64=HEAP64=new BigInt64Array(e),Module.HEAPU64=HEAPU64=new BigUint64Array(e),Module.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(e),LE_HEAP_UPDATE()}A(updateMemoryViews,"updateMemoryViews");function initMemory(){if(Module.wasmMemory)wasmMemory=Module.wasmMemory;else{var e=Module.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:e/65536,maximum:32768})}updateMemoryViews()}A(initMemory,"initMemory");var __RELOC_FUNCS__=[];function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(onPreRuns)}A(preRun,"preRun");function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),wasmExports.__wasm_call_ctors(),callRuntimeCallbacks(onPostCtors)}A(initRuntime,"initRuntime");function preMain(){}A(preMain,"preMain");function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(onPostRuns)}A(postRun,"postRun");function abort(e){Module.onAbort?.(e),e="Aborted("+e+")",err(e),ABORT=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw readyPromiseReject?.(t),t}A(abort,"abort");var wasmBinaryFile;function findWasmBinary(){return Module.locateFile?locateFile("web-tree-sitter.wasm"):new URL("web-tree-sitter.wasm",__imu).href}A(findWasmBinary,"findWasmBinary");function getBinarySync(e){if(e==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(e);throw"both async and sync fetching of the wasm failed"}A(getBinarySync,"getBinarySync");async function getWasmBinary(e){if(!wasmBinary)try{var t=await readAsync(e);return new Uint8Array(t)}catch{}return getBinarySync(e)}A(getWasmBinary,"getWasmBinary");async function instantiateArrayBuffer(e,t){try{var n=await getWasmBinary(e),r=await WebAssembly.instantiate(n,t);return r}catch(o){err(`failed to asynchronously prepare wasm: ${o}`),abort(o)}}A(instantiateArrayBuffer,"instantiateArrayBuffer");async function instantiateAsync(e,t,n){if(!e&&!isFileURI(t)&&!ENVIRONMENT_IS_NODE)try{var r=fetch(t,{credentials:"same-origin"}),o=await WebAssembly.instantiateStreaming(r,n);return o}catch(s){err(`wasm streaming compile failed: ${s}`),err("falling back to ArrayBuffer instantiation")}return instantiateArrayBuffer(t,n)}A(instantiateAsync,"instantiateAsync");function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}A(getWasmImports,"getWasmImports");async function createWasm(){function e(s,a){wasmExports=s.exports,wasmExports=relocateExports(wasmExports,1024);var c=getDylinkMetadata(a);return c.neededDynlibs&&(dynamicLibraries=c.neededDynlibs.concat(dynamicLibraries)),mergeLibSymbols(wasmExports,"main"),LDSO.init(),loadDylibs(),__RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs),assignWasmExports(wasmExports),wasmExports}A(e,"receiveInstance");function t(s){return e(s.instance,s.module)}A(t,"receiveInstantiationResult");var n=getWasmImports();if(Module.instantiateWasm)return new Promise((s,a)=>{Module.instantiateWasm(n,(c,l)=>{s(e(c,l))})});wasmBinaryFile??=findWasmBinary();var r=await instantiateAsync(wasmBinary,wasmBinaryFile,n),o=t(r);return o}A(createWasm,"createWasm");class ExitStatus{static{A(this,"ExitStatus")}name="ExitStatus";constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(e,t){var n=GOT[t];return n||(n=GOT[t]=new WebAssembly.Global({value:"i32",mutable:!0})),currentModuleWeakSymbols.has(t)||(n.required=!0),n}},LE_ATOMICS_NATIVE_BYTE_ORDER=[],LE_HEAP_LOAD_F32=A(e=>HEAP_DATA_VIEW.getFloat32(e,!0),"LE_HEAP_LOAD_F32"),LE_HEAP_LOAD_F64=A(e=>HEAP_DATA_VIEW.getFloat64(e,!0),"LE_HEAP_LOAD_F64"),LE_HEAP_LOAD_I16=A(e=>HEAP_DATA_VIEW.getInt16(e,!0),"LE_HEAP_LOAD_I16"),LE_HEAP_LOAD_I32=A(e=>HEAP_DATA_VIEW.getInt32(e,!0),"LE_HEAP_LOAD_I32"),LE_HEAP_LOAD_I64=A(e=>HEAP_DATA_VIEW.getBigInt64(e,!0),"LE_HEAP_LOAD_I64"),LE_HEAP_LOAD_U32=A(e=>HEAP_DATA_VIEW.getUint32(e,!0),"LE_HEAP_LOAD_U32"),LE_HEAP_STORE_F32=A((e,t)=>HEAP_DATA_VIEW.setFloat32(e,t,!0),"LE_HEAP_STORE_F32"),LE_HEAP_STORE_F64=A((e,t)=>HEAP_DATA_VIEW.setFloat64(e,t,!0),"LE_HEAP_STORE_F64"),LE_HEAP_STORE_I16=A((e,t)=>HEAP_DATA_VIEW.setInt16(e,t,!0),"LE_HEAP_STORE_I16"),LE_HEAP_STORE_I32=A((e,t)=>HEAP_DATA_VIEW.setInt32(e,t,!0),"LE_HEAP_STORE_I32"),LE_HEAP_STORE_I64=A((e,t)=>HEAP_DATA_VIEW.setBigInt64(e,t,!0),"LE_HEAP_STORE_I64"),LE_HEAP_STORE_U32=A((e,t)=>HEAP_DATA_VIEW.setUint32(e,t,!0),"LE_HEAP_STORE_U32"),callRuntimeCallbacks=A(e=>{for(;e.length>0;)e.shift()(Module)},"callRuntimeCallbacks"),onPostRuns=[],addOnPostRun=A(e=>onPostRuns.push(e),"addOnPostRun"),onPreRuns=[],addOnPreRun=A(e=>onPreRuns.push(e),"addOnPreRun"),UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder:void 0,findStringEnd=A((e,t,n,r)=>{var o=t+n;if(r)return o;for(;e[t]&&!(t>=o);)++t;return t},"findStringEnd"),UTF8ArrayToString=A((e,t=0,n,r)=>{var o=findStringEnd(e,t,n,r);if(o-t>16&&e.buffer&&UTF8Decoder)return UTF8Decoder.decode(e.subarray(t,o));for(var s="";t<o;){var a=e[t++];if(!(a&128)){s+=String.fromCharCode(a);continue}var c=e[t++]&63;if((a&224)==192){s+=String.fromCharCode((a&31)<<6|c);continue}var l=e[t++]&63;if((a&240)==224?a=(a&15)<<12|c<<6|l:a=(a&7)<<18|c<<12|l<<6|e[t++]&63,a<65536)s+=String.fromCharCode(a);else{var u=a-65536;s+=String.fromCharCode(55296|u>>10,56320|u&1023)}}return s},"UTF8ArrayToString"),getDylinkMetadata=A(e=>{var t=0,n=0;function r(){return e[t++]}A(r,"getU8");function o(){for(var Q=0,pe=1;;){var ot=e[t++];if(Q+=(ot&127)*pe,pe*=128,!(ot&128))break}return Q}A(o,"getLEB");function s(){var Q=o();return t+=Q,UTF8ArrayToString(e,t-Q,Q)}A(s,"getString");function a(){for(var Q=o(),pe=[];Q--;)pe.push(s());return pe}A(a,"getStringList");function c(Q,pe){if(Q)throw new Error(pe)}if(A(c,"failIf"),e instanceof WebAssembly.Module){var l=WebAssembly.Module.customSections(e,"dylink.0");c(l.length===0,"need dylink section"),e=new Uint8Array(l[0]),n=e.length}else{var u=new Uint32Array(new Uint8Array(e.subarray(0,24)).buffer),d=u[0]==1836278016||u[0]==6386541;c(!d,"need to see wasm magic number"),c(e[8]!==0,"need the dylink section to be first"),t=9;var f=o();n=t+f;var m=s();c(m!=="dylink.0")}for(var p={neededDynlibs:[],tlsExports:new Set,weakImports:new Set,runtimePaths:[]},g=1,h=2,y=3,w=4,_=5,b=256,S=3,N=1;t<n;){var R=r(),$=o();if(R===g)p.memorySize=o(),p.memoryAlign=o(),p.tableSize=o(),p.tableAlign=o();else if(R===h)p.neededDynlibs=a();else if(R===y)for(var I=o();I--;){var U=s(),de=o();de&b&&p.tlsExports.add(U)}else if(R===w)for(var I=o();I--;){var F=s(),U=s(),de=o();(de&S)==N&&p.weakImports.add(U)}else R===_?p.runtimePaths=a():t+=$}return p},"getDylinkMetadata");function getValue(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":return HEAP8[e];case"i8":return HEAP8[e];case"i16":return LE_HEAP_LOAD_I16((e>>1)*2);case"i32":return LE_HEAP_LOAD_I32((e>>2)*4);case"i64":return LE_HEAP_LOAD_I64((e>>3)*8);case"float":return LE_HEAP_LOAD_F32((e>>2)*4);case"double":return LE_HEAP_LOAD_F64((e>>3)*8);case"*":return LE_HEAP_LOAD_U32((e>>2)*4);default:abort(`invalid type for getValue: ${t}`)}}A(getValue,"getValue");var newDSO=A((e,t,n)=>{var r={refcount:1/0,name:e,exports:n,global:!0};return LDSO.loadedLibsByName[e]=r,t!=null&&(LDSO.loadedLibsByHandle[t]=r),r},"newDSO"),LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=82240,alignMemory=A((e,t)=>Math.ceil(e/t)*t,"alignMemory"),getMemory=A(e=>{if(runtimeInitialized)return _calloc(e,1);var t=___heap_base,n=t+alignMemory(e,16);return ___heap_base=n,GOT.__heap_base.value=n,t},"getMemory"),isInternalSym=A(e=>["__cpp_exception","__c_longjmp","__wasm_apply_data_relocs","__dso_handle","__tls_size","__tls_align","__set_stack_limits","_emscripten_tls_init","__wasm_init_tls","__wasm_call_ctors","__start_em_asm","__stop_em_asm","__start_em_js","__stop_em_js"].includes(e)||e.startsWith("__em_js__"),"isInternalSym"),uleb128EncodeWithLen=A(e=>{let t=e.length;return[t%128|128,t>>7,...e]},"uleb128EncodeWithLen"),wasmTypeCodes={i:127,p:127,j:126,f:125,d:124,e:111},generateTypePack=A(e=>uleb128EncodeWithLen(Array.from(e,t=>{var n=wasmTypeCodes[t];return n})),"generateTypePack"),convertJsFunctionToWasm=A((e,t)=>{var n=Uint8Array.of(0,97,115,109,1,0,0,0,1,...uleb128EncodeWithLen([1,96,...generateTypePack(t.slice(1)),...generateTypePack(t[0]==="v"?"":t[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),r=new WebAssembly.Module(n),o=new WebAssembly.Instance(r,{e:{f:e}}),s=o.exports.f;return s},"convertJsFunctionToWasm"),wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:31,element:"anyfunc"}),getWasmTableEntry=A(e=>{var t=wasmTableMirror[e];return t||(wasmTableMirror[e]=t=wasmTable.get(e)),t},"getWasmTableEntry"),updateTableMap=A((e,t)=>{if(functionsInTableMap)for(var n=e;n<e+t;n++){var r=getWasmTableEntry(n);r&&functionsInTableMap.set(r,n)}},"updateTableMap"),functionsInTableMap,getFunctionAddress=A(e=>(functionsInTableMap||(functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length)),functionsInTableMap.get(e)||0),"getFunctionAddress"),freeTableIndexes=[],getEmptyTableSlot=A(()=>freeTableIndexes.length?freeTableIndexes.pop():wasmTable.grow(1),"getEmptyTableSlot"),setWasmTableEntry=A((e,t)=>{wasmTable.set(e,t),wasmTableMirror[e]=wasmTable.get(e)},"setWasmTableEntry"),addFunction=A((e,t)=>{var n=getFunctionAddress(e);if(n)return n;var r=getEmptyTableSlot();try{setWasmTableEntry(r,e)}catch(s){if(!(s instanceof TypeError))throw s;var o=convertJsFunctionToWasm(e,t);setWasmTableEntry(r,o)}return functionsInTableMap.set(e,r),r},"addFunction"),updateGOT=A((e,t)=>{for(var n in e)if(!isInternalSym(n)){var r=e[n];GOT[n]||=new WebAssembly.Global({value:"i32",mutable:!0}),(t||GOT[n].value==0)&&(typeof r=="function"?GOT[n].value=addFunction(r):typeof r=="number"?GOT[n].value=r:err(`unhandled export type for '${n}': ${typeof r}`))}},"updateGOT"),relocateExports=A((e,t,n)=>{var r={};for(var o in e){var s=e[o];typeof s=="object"&&(s=s.value),typeof s=="number"&&(s+=t),r[o]=s}return updateGOT(r,n),r},"relocateExports"),isSymbolDefined=A(e=>{var t=wasmImports[e];return!(!t||t.stub)},"isSymbolDefined"),dynCall=A((e,t,n=[],r=!1)=>{var o=getWasmTableEntry(t),s=o(...n);function a(c){return c}return A(a,"convert"),s},"dynCall"),stackSave=A(()=>_emscripten_stack_get_current(),"stackSave"),stackRestore=A(e=>__emscripten_stack_restore(e),"stackRestore"),createInvokeFunction=A(e=>(t,...n)=>{var r=stackSave();try{return dynCall(e,t,n)}catch(o){if(stackRestore(r),o!==o+0)throw o;if(_setThrew(1,0),e[0]=="j")return 0n}},"createInvokeFunction"),resolveGlobalSymbol=A((e,t=!1)=>{var n;return isSymbolDefined(e)?n=wasmImports[e]:e.startsWith("invoke_")&&(n=wasmImports[e]=createInvokeFunction(e.split("_")[1])),{sym:n,name:e}},"resolveGlobalSymbol"),onPostCtors=[],addOnPostCtor=A(e=>onPostCtors.push(e),"addOnPostCtor"),UTF8ToString=A((e,t,n)=>e?UTF8ArrayToString(HEAPU8,e,t,n):"","UTF8ToString"),loadWebAssemblyModule=A((binary,flags,libName,localScope,handle)=>{var metadata=getDylinkMetadata(binary);function loadModule(){var memAlign=Math.pow(2,metadata.memoryAlign),memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0,tableBase=metadata.tableSize?wasmTable.length:0;handle&&(HEAP8[handle+8]=1,LE_HEAP_STORE_U32((handle+12>>2)*4,memoryBase),LE_HEAP_STORE_I32((handle+16>>2)*4,metadata.memorySize),LE_HEAP_STORE_U32((handle+20>>2)*4,tableBase),LE_HEAP_STORE_I32((handle+24>>2)*4,metadata.tableSize)),metadata.tableSize&&wasmTable.grow(metadata.tableSize);var moduleExports;function resolveSymbol(e){var t=resolveGlobalSymbol(e).sym;return!t&&localScope&&(t=localScope[e]),t||(t=moduleExports[e]),t}A(resolveSymbol,"resolveSymbol");var proxyHandler={get(e,t){switch(t){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(t in wasmImports&&!wasmImports[t].stub){var n=wasmImports[t];return n}if(!(t in e)){var r;e[t]=(...o)=>(r||=resolveSymbol(t),r(...o))}return e[t]}},proxy=new Proxy({},proxyHandler);currentModuleWeakSymbols=metadata.weakImports;var info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),env:proxy,wasi_snapshot_preview1:proxy};function postInstantiation(module,instance){updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),flags.allowUndefined||reportUndefinedSymbols();function addEmAsm(addr,body){for(var args=[],arity=0;arity<16&&body.indexOf("$"+arity)!=-1;arity++)args.push("$"+arity);args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if(A(addEmAsm,"addEmAsm"),"__start_em_asm"in moduleExports)for(var start=moduleExports.__start_em_asm,stop=moduleExports.__stop_em_asm;start<stop;){var jsString=UTF8ToString(start);addEmAsm(start,jsString),start=HEAPU8.indexOf(0,start)+1}function addEmJs(name,cSig,body){var jsArgs=[];if(cSig=cSig.slice(1,-1),cSig!="void"){cSig=cSig.split(",");for(var i in cSig){var jsArg=cSig[i].split(" ").pop();jsArgs.push(jsArg.replace("*",""))}}var func=`(${jsArgs}) => ${body};`;moduleExports[name]=eval(func)}A(addEmJs,"addEmJs");for(var name in moduleExports)if(name.startsWith("__em_js__")){var start=moduleExports[name],jsString=UTF8ToString(start),parts=jsString.split("<::>");addEmJs(name.replace("__em_js__",""),parts[0],parts[1]),delete moduleExports[name]}var applyRelocs=moduleExports.__wasm_apply_data_relocs;applyRelocs&&(runtimeInitialized?applyRelocs():__RELOC_FUNCS__.push(applyRelocs));var init=moduleExports.__wasm_call_ctors;return init&&(runtimeInitialized?init():addOnPostCtor(init)),moduleExports}if(A(postInstantiation,"postInstantiation"),flags.loadAsync)return(async()=>{var e;return binary instanceof WebAssembly.Module?e=new WebAssembly.Instance(binary,info):{module:binary,instance:e}=await WebAssembly.instantiate(binary,info),postInstantiation(binary,e)})();var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}return A(loadModule,"loadModule"),flags={...flags,rpath:{parentLibPath:libName,paths:metadata.runtimePaths}},flags.loadAsync?metadata.neededDynlibs.reduce((e,t)=>e.then(()=>loadDynamicLibrary(t,flags,localScope)),Promise.resolve()).then(loadModule):(metadata.neededDynlibs.forEach(e=>loadDynamicLibrary(e,flags,localScope)),loadModule())},"loadWebAssemblyModule"),mergeLibSymbols=A((e,t)=>{for(var[n,r]of Object.entries(e)){let o=A(a=>{isSymbolDefined(a)||(wasmImports[a]=r)},"setImport");o(n);let s="__main_argc_argv";n=="main"&&o(s),n==s&&o("main")}},"mergeLibSymbols"),asyncLoad=A(async e=>{var t=await readAsync(e);return new Uint8Array(t)},"asyncLoad");function loadDynamicLibrary(e,t={global:!0,nodelete:!0},n,r){var o=LDSO.loadedLibsByName[e];if(o)return t.global?o.global||(o.global=!0,mergeLibSymbols(o.exports,e)):n&&Object.assign(n,o.exports),t.nodelete&&o.refcount!==1/0&&(o.refcount=1/0),o.refcount++,r&&(LDSO.loadedLibsByHandle[r]=o),t.loadAsync?Promise.resolve(!0):!0;o=newDSO(e,r,"loading"),o.refcount=t.nodelete?1/0:1,o.global=t.global;function s(){if(r){var l=LE_HEAP_LOAD_U32((r+28>>2)*4),u=LE_HEAP_LOAD_U32((r+32>>2)*4);if(l&&u){var d=HEAP8.slice(l,l+u);return t.loadAsync?Promise.resolve(d):d}}var f=locateFile(e);if(t.loadAsync)return asyncLoad(f);if(!readBinary)throw new Error(`${f}: file not found, and synchronous loading of external files is not available`);return readBinary(f)}A(s,"loadLibData");function a(){return t.loadAsync?s().then(l=>loadWebAssemblyModule(l,t,e,n,r)):loadWebAssemblyModule(s(),t,e,n,r)}A(a,"getExports");function c(l){o.global?mergeLibSymbols(l,e):n&&Object.assign(n,l),o.exports=l}return A(c,"moduleLoaded"),t.loadAsync?a().then(l=>(c(l),!0)):(c(a()),!0)}A(loadDynamicLibrary,"loadDynamicLibrary");var reportUndefinedSymbols=A(()=>{for(var[e,t]of Object.entries(GOT))if(t.value==0){var n=resolveGlobalSymbol(e,!0).sym;if(!n&&!t.required)continue;if(typeof n=="function")t.value=addFunction(n,n.sig);else if(typeof n=="number")t.value=n;else throw new Error(`bad export type for '${e}': ${typeof n}`)}},"reportUndefinedSymbols"),runDependencies=0,dependenciesFulfilled=null,removeRunDependency=A(e=>{if(runDependencies--,Module.monitorRunDependencies?.(runDependencies),runDependencies==0&&dependenciesFulfilled){var t=dependenciesFulfilled;dependenciesFulfilled=null,t()}},"removeRunDependency"),addRunDependency=A(e=>{runDependencies++,Module.monitorRunDependencies?.(runDependencies)},"addRunDependency"),loadDylibs=A(async()=>{if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("loadDylibs");for(var e of dynamicLibraries)await loadDynamicLibrary(e,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0});reportUndefinedSymbols(),removeRunDependency("loadDylibs")},"loadDylibs"),noExitRuntime=!0;function setValue(e,t,n="i8"){switch(n.endsWith("*")&&(n="*"),n){case"i1":HEAP8[e]=t;break;case"i8":HEAP8[e]=t;break;case"i16":LE_HEAP_STORE_I16((e>>1)*2,t);break;case"i32":LE_HEAP_STORE_I32((e>>2)*4,t);break;case"i64":LE_HEAP_STORE_I64((e>>3)*8,BigInt(t));break;case"float":LE_HEAP_STORE_F32((e>>2)*4,t);break;case"double":LE_HEAP_STORE_F64((e>>3)*8,t);break;case"*":LE_HEAP_STORE_U32((e>>2)*4,t);break;default:abort(`invalid type for setValue: ${n}`)}}A(setValue,"setValue");var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_high=82240,___stack_low=16704,___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},82240),___table_base=new WebAssembly.Global({value:"i32",mutable:!1},1),__abort_js=A(()=>abort(""),"__abort_js");__abort_js.sig="v";var getHeapMax=A(()=>2147483648,"getHeapMax"),growMemory=A(e=>{var t=wasmMemory.buffer.byteLength,n=(e-t+65535)/65536|0;try{return wasmMemory.grow(n),updateMemoryViews(),1}catch{}},"growMemory"),_emscripten_resize_heap=A(e=>{var t=HEAPU8.length;e>>>=0;var n=getHeapMax();if(e>n)return!1;for(var r=1;r<=4;r*=2){var o=t*(1+.2/r);o=Math.min(o,e+100663296);var s=Math.min(n,alignMemory(Math.max(e,o),65536)),a=growMemory(s);if(a)return!0}return!1},"_emscripten_resize_heap");_emscripten_resize_heap.sig="ip";var _fd_close=A(e=>52,"_fd_close");_fd_close.sig="ii";var INT53_MAX=9007199254740992,INT53_MIN=-9007199254740992,bigintToI53Checked=A(e=>e<INT53_MIN||e>INT53_MAX?NaN:Number(e),"bigintToI53Checked");function _fd_seek(e,t,n,r){return t=bigintToI53Checked(t),70}A(_fd_seek,"_fd_seek"),_fd_seek.sig="iijip";var printCharBuffers=[null,[],[]],printChar=A((e,t)=>{var n=printCharBuffers[e];t===0||t===10?((e===1?out:err)(UTF8ArrayToString(n)),n.length=0):n.push(t)},"printChar"),_fd_write=A((e,t,n,r)=>{for(var o=0,s=0;s<n;s++){var a=LE_HEAP_LOAD_U32((t>>2)*4),c=LE_HEAP_LOAD_U32((t+4>>2)*4);t+=8;for(var l=0;l<c;l++)printChar(e,HEAPU8[a+l]);o+=c}return LE_HEAP_STORE_U32((r>>2)*4,o),0},"_fd_write");_fd_write.sig="iippp";function _tree_sitter_log_callback(e,t){if(Module.currentLogCallback){let n=UTF8ToString(t);Module.currentLogCallback(n,e!==0)}}A(_tree_sitter_log_callback,"_tree_sitter_log_callback");function _tree_sitter_parse_callback(e,t,n,r,o){let a=Module.currentParseCallback(t,{row:n,column:r});typeof a=="string"?(setValue(o,a.length,"i32"),stringToUTF16(a,e,10240)):setValue(o,0,"i32")}A(_tree_sitter_parse_callback,"_tree_sitter_parse_callback");function _tree_sitter_progress_callback(e,t){return Module.currentProgressCallback?Module.currentProgressCallback({currentOffset:e,hasError:t}):!1}A(_tree_sitter_progress_callback,"_tree_sitter_progress_callback");function _tree_sitter_query_progress_callback(e){return Module.currentQueryProgressCallback?Module.currentQueryProgressCallback({currentOffset:e}):!1}A(_tree_sitter_query_progress_callback,"_tree_sitter_query_progress_callback");var runtimeKeepaliveCounter=0,keepRuntimeAlive=A(()=>noExitRuntime||runtimeKeepaliveCounter>0,"keepRuntimeAlive"),_proc_exit=A(e=>{EXITSTATUS=e,keepRuntimeAlive()||(Module.onExit?.(e),ABORT=!0),quit_(e,new ExitStatus(e))},"_proc_exit");_proc_exit.sig="vi";var exitJS=A((e,t)=>{EXITSTATUS=e,_proc_exit(e)},"exitJS"),handleException=A(e=>{if(e instanceof ExitStatus||e=="unwind")return EXITSTATUS;quit_(1,e)},"handleException"),lengthBytesUTF8=A(e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},"lengthBytesUTF8"),stringToUTF8Array=A((e,t,n,r)=>{if(!(r>0))return 0;for(var o=n,s=n+r-1,a=0;a<e.length;++a){var c=e.codePointAt(a);if(c<=127){if(n>=s)break;t[n++]=c}else if(c<=2047){if(n+1>=s)break;t[n++]=192|c>>6,t[n++]=128|c&63}else if(c<=65535){if(n+2>=s)break;t[n++]=224|c>>12,t[n++]=128|c>>6&63,t[n++]=128|c&63}else{if(n+3>=s)break;t[n++]=240|c>>18,t[n++]=128|c>>12&63,t[n++]=128|c>>6&63,t[n++]=128|c&63,a++}}return t[n]=0,n-o},"stringToUTF8Array"),stringToUTF8=A((e,t,n)=>stringToUTF8Array(e,HEAPU8,t,n),"stringToUTF8"),stackAlloc=A(e=>__emscripten_stack_alloc(e),"stackAlloc"),stringToUTF8OnStack=A(e=>{var t=lengthBytesUTF8(e)+1,n=stackAlloc(t);return stringToUTF8(e,n,t),n},"stringToUTF8OnStack"),AsciiToString=A(e=>{for(var t="";;){var n=HEAPU8[e++];if(!n)return t;t+=String.fromCharCode(n)}},"AsciiToString"),stringToUTF16=A((e,t,n)=>{if(n??=2147483647,n<2)return 0;n-=2;for(var r=t,o=n<e.length*2?n/2:e.length,s=0;s<o;++s){var a=e.charCodeAt(s);LE_HEAP_STORE_I16((t>>1)*2,a),t+=2}return LE_HEAP_STORE_I16((t>>1)*2,0),t-r},"stringToUTF16");LE_ATOMICS_NATIVE_BYTE_ORDER=new Int8Array(new Int16Array([1]).buffer)[0]===1?[(e=>e),(e=>e),void 0,(e=>e)]:[(e=>e),(e=>((e&65280)<<8|(e&255)<<24)>>16),void 0,(e=>e>>24&255|e>>8&65280|(e&65280)<<8|(e&255)<<24)];function LE_HEAP_UPDATE(){HEAPU16.unsigned=(e=>e&65535),HEAPU32.unsigned=(e=>e>>>0)}if(A(LE_HEAP_UPDATE,"LE_HEAP_UPDATE"),initMemory(),Module.noExitRuntime&&(noExitRuntime=Module.noExitRuntime),Module.print&&(out=Module.print),Module.printErr&&(err=Module.printErr),Module.dynamicLibraries&&(dynamicLibraries=Module.dynamicLibraries),Module.wasmBinary&&(wasmBinary=Module.wasmBinary),Module.arguments&&(arguments_=Module.arguments),Module.thisProgram&&(thisProgram=Module.thisProgram),Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.shift()();Module.setValue=setValue,Module.getValue=getValue,Module.UTF8ToString=UTF8ToString,Module.stringToUTF8=stringToUTF8,Module.lengthBytesUTF8=lengthBytesUTF8,Module.AsciiToString=AsciiToString,Module.stringToUTF16=stringToUTF16,Module.loadWebAssemblyModule=loadWebAssemblyModule,Module.LE_HEAP_STORE_I64=LE_HEAP_STORE_I64;var ASM_CONSTS={},_malloc,_calloc,_realloc,_free,_ts_range_edit,_memcmp,_ts_language_symbol_count,_ts_language_state_count,_ts_language_abi_version,_ts_language_name,_ts_language_field_count,_ts_language_next_state,_ts_language_symbol_name,_ts_language_symbol_for_name,_strncmp,_ts_language_symbol_type,_ts_language_field_name_for_id,_ts_lookahead_iterator_new,_ts_lookahead_iterator_delete,_ts_lookahead_iterator_reset_state,_ts_lookahead_iterator_reset,_ts_lookahead_iterator_next,_ts_lookahead_iterator_current_symbol,_ts_point_edit,_ts_parser_delete,_ts_parser_reset,_ts_parser_set_language,_ts_parser_set_included_ranges,_ts_query_new,_ts_query_delete,_iswspace,_iswalnum,_ts_query_copy,_ts_query_pattern_count,_ts_query_capture_count,_ts_query_string_count,_ts_query_capture_name_for_id,_ts_query_capture_quantifier_for_id,_ts_query_string_value_for_id,_ts_query_predicates_for_pattern,_ts_query_start_byte_for_pattern,_ts_query_end_byte_for_pattern,_ts_query_is_pattern_rooted,_ts_query_is_pattern_non_local,_ts_query_is_pattern_guaranteed_at_step,_ts_query_disable_capture,_ts_query_disable_pattern,_ts_tree_copy,_ts_tree_delete,_ts_init,_ts_parser_new_wasm,_ts_parser_enable_logger_wasm,_ts_parser_parse_wasm,_ts_parser_included_ranges_wasm,_ts_language_type_is_named_wasm,_ts_language_type_is_visible_wasm,_ts_language_metadata_wasm,_ts_language_supertypes_wasm,_ts_language_subtypes_wasm,_ts_tree_root_node_wasm,_ts_tree_root_node_with_offset_wasm,_ts_tree_edit_wasm,_ts_tree_included_ranges_wasm,_ts_tree_get_changed_ranges_wasm,_ts_tree_cursor_new_wasm,_ts_tree_cursor_copy_wasm,_ts_tree_cursor_delete_wasm,_ts_tree_cursor_reset_wasm,_ts_tree_cursor_reset_to_wasm,_ts_tree_cursor_goto_first_child_wasm,_ts_tree_cursor_goto_last_child_wasm,_ts_tree_cursor_goto_first_child_for_index_wasm,_ts_tree_cursor_goto_first_child_for_position_wasm,_ts_tree_cursor_goto_next_sibling_wasm,_ts_tree_cursor_goto_previous_sibling_wasm,_ts_tree_cursor_goto_descendant_wasm,_ts_tree_cursor_goto_parent_wasm,_ts_tree_cursor_current_node_type_id_wasm,_ts_tree_cursor_current_node_state_id_wasm,_ts_tree_cursor_current_node_is_named_wasm,_ts_tree_cursor_current_node_is_missing_wasm,_ts_tree_cursor_current_node_id_wasm,_ts_tree_cursor_start_position_wasm,_ts_tree_cursor_end_position_wasm,_ts_tree_cursor_start_index_wasm,_ts_tree_cursor_end_index_wasm,_ts_tree_cursor_current_field_id_wasm,_ts_tree_cursor_current_depth_wasm,_ts_tree_cursor_current_descendant_index_wasm,_ts_tree_cursor_current_node_wasm,_ts_node_symbol_wasm,_ts_node_field_name_for_child_wasm,_ts_node_field_name_for_named_child_wasm,_ts_node_children_by_field_id_wasm,_ts_node_first_child_for_byte_wasm,_ts_node_first_named_child_for_byte_wasm,_ts_node_grammar_symbol_wasm,_ts_node_child_count_wasm,_ts_node_named_child_count_wasm,_ts_node_child_wasm,_ts_node_named_child_wasm,_ts_node_child_by_field_id_wasm,_ts_node_next_sibling_wasm,_ts_node_prev_sibling_wasm,_ts_node_next_named_sibling_wasm,_ts_node_prev_named_sibling_wasm,_ts_node_descendant_count_wasm,_ts_node_parent_wasm,_ts_node_child_with_descendant_wasm,_ts_node_descendant_for_index_wasm,_ts_node_named_descendant_for_index_wasm,_ts_node_descendant_for_position_wasm,_ts_node_named_descendant_for_position_wasm,_ts_node_start_point_wasm,_ts_node_end_point_wasm,_ts_node_start_index_wasm,_ts_node_end_index_wasm,_ts_node_to_string_wasm,_ts_node_children_wasm,_ts_node_named_children_wasm,_ts_node_descendants_of_type_wasm,_ts_node_is_named_wasm,_ts_node_has_changes_wasm,_ts_node_has_error_wasm,_ts_node_is_error_wasm,_ts_node_is_missing_wasm,_ts_node_is_extra_wasm,_ts_node_parse_state_wasm,_ts_node_next_parse_state_wasm,_ts_query_matches_wasm,_ts_query_captures_wasm,_memset,_memcpy,_memmove,_iswalpha,_iswblank,_iswdigit,_iswlower,_iswpunct,_iswupper,_iswxdigit,_memchr,_strlen,_strcmp,_strncat,_strncpy,_towlower,_towupper,_setThrew,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___wasm_apply_data_relocs;function assignWasmExports(e){Module._malloc=_malloc=e.malloc,Module._calloc=_calloc=e.calloc,Module._realloc=_realloc=e.realloc,Module._free=_free=e.free,Module._ts_range_edit=_ts_range_edit=e.ts_range_edit,Module._memcmp=_memcmp=e.memcmp,Module._ts_language_symbol_count=_ts_language_symbol_count=e.ts_language_symbol_count,Module._ts_language_state_count=_ts_language_state_count=e.ts_language_state_count,Module._ts_language_abi_version=_ts_language_abi_version=e.ts_language_abi_version,Module._ts_language_name=_ts_language_name=e.ts_language_name,Module._ts_language_field_count=_ts_language_field_count=e.ts_language_field_count,Module._ts_language_next_state=_ts_language_next_state=e.ts_language_next_state,Module._ts_language_symbol_name=_ts_language_symbol_name=e.ts_language_symbol_name,Module._ts_language_symbol_for_name=_ts_language_symbol_for_name=e.ts_language_symbol_for_name,Module._strncmp=_strncmp=e.strncmp,Module._ts_language_symbol_type=_ts_language_symbol_type=e.ts_language_symbol_type,Module._ts_language_field_name_for_id=_ts_language_field_name_for_id=e.ts_language_field_name_for_id,Module._ts_lookahead_iterator_new=_ts_lookahead_iterator_new=e.ts_lookahead_iterator_new,Module._ts_lookahead_iterator_delete=_ts_lookahead_iterator_delete=e.ts_lookahead_iterator_delete,Module._ts_lookahead_iterator_reset_state=_ts_lookahead_iterator_reset_state=e.ts_lookahead_iterator_reset_state,Module._ts_lookahead_iterator_reset=_ts_lookahead_iterator_reset=e.ts_lookahead_iterator_reset,Module._ts_lookahead_iterator_next=_ts_lookahead_iterator_next=e.ts_lookahead_iterator_next,Module._ts_lookahead_iterator_current_symbol=_ts_lookahead_iterator_current_symbol=e.ts_lookahead_iterator_current_symbol,Module._ts_point_edit=_ts_point_edit=e.ts_point_edit,Module._ts_parser_delete=_ts_parser_delete=e.ts_parser_delete,Module._ts_parser_reset=_ts_parser_reset=e.ts_parser_reset,Module._ts_parser_set_language=_ts_parser_set_language=e.ts_parser_set_language,Module._ts_parser_set_included_ranges=_ts_parser_set_included_ranges=e.ts_parser_set_included_ranges,Module._ts_query_new=_ts_query_new=e.ts_query_new,Module._ts_query_delete=_ts_query_delete=e.ts_query_delete,Module._iswspace=_iswspace=e.iswspace,Module._iswalnum=_iswalnum=e.iswalnum,Module._ts_query_copy=_ts_query_copy=e.ts_query_copy,Module._ts_query_pattern_count=_ts_query_pattern_count=e.ts_query_pattern_count,Module._ts_query_capture_count=_ts_query_capture_count=e.ts_query_capture_count,Module._ts_query_string_count=_ts_query_string_count=e.ts_query_string_count,Module._ts_query_capture_name_for_id=_ts_query_capture_name_for_id=e.ts_query_capture_name_for_id,Module._ts_query_capture_quantifier_for_id=_ts_query_capture_quantifier_for_id=e.ts_query_capture_quantifier_for_id,Module._ts_query_string_value_for_id=_ts_query_string_value_for_id=e.ts_query_string_value_for_id,Module._ts_query_predicates_for_pattern=_ts_query_predicates_for_pattern=e.ts_query_predicates_for_pattern,Module._ts_query_start_byte_for_pattern=_ts_query_start_byte_for_pattern=e.ts_query_start_byte_for_pattern,Module._ts_query_end_byte_for_pattern=_ts_query_end_byte_for_pattern=e.ts_query_end_byte_for_pattern,Module._ts_query_is_pattern_rooted=_ts_query_is_pattern_rooted=e.ts_query_is_pattern_rooted,Module._ts_query_is_pattern_non_local=_ts_query_is_pattern_non_local=e.ts_query_is_pattern_non_local,Module._ts_query_is_pattern_guaranteed_at_step=_ts_query_is_pattern_guaranteed_at_step=e.ts_query_is_pattern_guaranteed_at_step,Module._ts_query_disable_capture=_ts_query_disable_capture=e.ts_query_disable_capture,Module._ts_query_disable_pattern=_ts_query_disable_pattern=e.ts_query_disable_pattern,Module._ts_tree_copy=_ts_tree_copy=e.ts_tree_copy,Module._ts_tree_delete=_ts_tree_delete=e.ts_tree_delete,Module._ts_init=_ts_init=e.ts_init,Module._ts_parser_new_wasm=_ts_parser_new_wasm=e.ts_parser_new_wasm,Module._ts_parser_enable_logger_wasm=_ts_parser_enable_logger_wasm=e.ts_parser_enable_logger_wasm,Module._ts_parser_parse_wasm=_ts_parser_parse_wasm=e.ts_parser_parse_wasm,Module._ts_parser_included_ranges_wasm=_ts_parser_included_ranges_wasm=e.ts_parser_included_ranges_wasm,Module._ts_language_type_is_named_wasm=_ts_language_type_is_named_wasm=e.ts_language_type_is_named_wasm,Module._ts_language_type_is_visible_wasm=_ts_language_type_is_visible_wasm=e.ts_language_type_is_visible_wasm,Module._ts_language_metadata_wasm=_ts_language_metadata_wasm=e.ts_language_metadata_wasm,Module._ts_language_supertypes_wasm=_ts_language_supertypes_wasm=e.ts_language_supertypes_wasm,Module._ts_language_subtypes_wasm=_ts_language_subtypes_wasm=e.ts_language_subtypes_wasm,Module._ts_tree_root_node_wasm=_ts_tree_root_node_wasm=e.ts_tree_root_node_wasm,Module._ts_tree_root_node_with_offset_wasm=_ts_tree_root_node_with_offset_wasm=e.ts_tree_root_node_with_offset_wasm,Module._ts_tree_edit_wasm=_ts_tree_edit_wasm=e.ts_tree_edit_wasm,Module._ts_tree_included_ranges_wasm=_ts_tree_included_ranges_wasm=e.ts_tree_included_ranges_wasm,Module._ts_tree_get_changed_ranges_wasm=_ts_tree_get_changed_ranges_wasm=e.ts_tree_get_changed_ranges_wasm,Module._ts_tree_cursor_new_wasm=_ts_tree_cursor_new_wasm=e.ts_tree_cursor_new_wasm,Module._ts_tree_cursor_copy_wasm=_ts_tree_cursor_copy_wasm=e.ts_tree_cursor_copy_wasm,Module._ts_tree_cursor_delete_wasm=_ts_tree_cursor_delete_wasm=e.ts_tree_cursor_delete_wasm,Module._ts_tree_cursor_reset_wasm=_ts_tree_cursor_reset_wasm=e.ts_tree_cursor_reset_wasm,Module._ts_tree_cursor_reset_to_wasm=_ts_tree_cursor_reset_to_wasm=e.ts_tree_cursor_reset_to_wasm,Module._ts_tree_cursor_goto_first_child_wasm=_ts_tree_cursor_goto_first_child_wasm=e.ts_tree_cursor_goto_first_child_wasm,Module._ts_tree_cursor_goto_last_child_wasm=_ts_tree_cursor_goto_last_child_wasm=e.ts_tree_cursor_goto_last_child_wasm,Module._ts_tree_cursor_goto_first_child_for_index_wasm=_ts_tree_cursor_goto_first_child_for_index_wasm=e.ts_tree_cursor_goto_first_child_for_index_wasm,Module._ts_tree_cursor_goto_first_child_for_position_wasm=_ts_tree_cursor_goto_first_child_for_position_wasm=e.ts_tree_cursor_goto_first_child_for_position_wasm,Module._ts_tree_cursor_goto_next_sibling_wasm=_ts_tree_cursor_goto_next_sibling_wasm=e.ts_tree_cursor_goto_next_sibling_wasm,Module._ts_tree_cursor_goto_previous_sibling_wasm=_ts_tree_cursor_goto_previous_sibling_wasm=e.ts_tree_cursor_goto_previous_sibling_wasm,Module._ts_tree_cursor_goto_descendant_wasm=_ts_tree_cursor_goto_descendant_wasm=e.ts_tree_cursor_goto_descendant_wasm,Module._ts_tree_cursor_goto_parent_wasm=_ts_tree_cursor_goto_parent_wasm=e.ts_tree_cursor_goto_parent_wasm,Module._ts_tree_cursor_current_node_type_id_wasm=_ts_tree_cursor_current_node_type_id_wasm=e.ts_tree_cursor_current_node_type_id_wasm,Module._ts_tree_cursor_current_node_state_id_wasm=_ts_tree_cursor_current_node_state_id_wasm=e.ts_tree_cursor_current_node_state_id_wasm,Module._ts_tree_cursor_current_node_is_named_wasm=_ts_tree_cursor_current_node_is_named_wasm=e.ts_tree_cursor_current_node_is_named_wasm,Module._ts_tree_cursor_current_node_is_missing_wasm=_ts_tree_cursor_current_node_is_missing_wasm=e.ts_tree_cursor_current_node_is_missing_wasm,Module._ts_tree_cursor_current_node_id_wasm=_ts_tree_cursor_current_node_id_wasm=e.ts_tree_cursor_current_node_id_wasm,Module._ts_tree_cursor_start_position_wasm=_ts_tree_cursor_start_position_wasm=e.ts_tree_cursor_start_position_wasm,Module._ts_tree_cursor_end_position_wasm=_ts_tree_cursor_end_position_wasm=e.ts_tree_cursor_end_position_wasm,Module._ts_tree_cursor_start_index_wasm=_ts_tree_cursor_start_index_wasm=e.ts_tree_cursor_start_index_wasm,Module._ts_tree_cursor_end_index_wasm=_ts_tree_cursor_end_index_wasm=e.ts_tree_cursor_end_index_wasm,Module._ts_tree_cursor_current_field_id_wasm=_ts_tree_cursor_current_field_id_wasm=e.ts_tree_cursor_current_field_id_wasm,Module._ts_tree_cursor_current_depth_wasm=_ts_tree_cursor_current_depth_wasm=e.ts_tree_cursor_current_depth_wasm,Module._ts_tree_cursor_current_descendant_index_wasm=_ts_tree_cursor_current_descendant_index_wasm=e.ts_tree_cursor_current_descendant_index_wasm,Module._ts_tree_cursor_current_node_wasm=_ts_tree_cursor_current_node_wasm=e.ts_tree_cursor_current_node_wasm,Module._ts_node_symbol_wasm=_ts_node_symbol_wasm=e.ts_node_symbol_wasm,Module._ts_node_field_name_for_child_wasm=_ts_node_field_name_for_child_wasm=e.ts_node_field_name_for_child_wasm,Module._ts_node_field_name_for_named_child_wasm=_ts_node_field_name_for_named_child_wasm=e.ts_node_field_name_for_named_child_wasm,Module._ts_node_children_by_field_id_wasm=_ts_node_children_by_field_id_wasm=e.ts_node_children_by_field_id_wasm,Module._ts_node_first_child_for_byte_wasm=_ts_node_first_child_for_byte_wasm=e.ts_node_first_child_for_byte_wasm,Module._ts_node_first_named_child_for_byte_wasm=_ts_node_first_named_child_for_byte_wasm=e.ts_node_first_named_child_for_byte_wasm,Module._ts_node_grammar_symbol_wasm=_ts_node_grammar_symbol_wasm=e.ts_node_grammar_symbol_wasm,Module._ts_node_child_count_wasm=_ts_node_child_count_wasm=e.ts_node_child_count_wasm,Module._ts_node_named_child_count_wasm=_ts_node_named_child_count_wasm=e.ts_node_named_child_count_wasm,Module._ts_node_child_wasm=_ts_node_child_wasm=e.ts_node_child_wasm,Module._ts_node_named_child_wasm=_ts_node_named_child_wasm=e.ts_node_named_child_wasm,Module._ts_node_child_by_field_id_wasm=_ts_node_child_by_field_id_wasm=e.ts_node_child_by_field_id_wasm,Module._ts_node_next_sibling_wasm=_ts_node_next_sibling_wasm=e.ts_node_next_sibling_wasm,Module._ts_node_prev_sibling_wasm=_ts_node_prev_sibling_wasm=e.ts_node_prev_sibling_wasm,Module._ts_node_next_named_sibling_wasm=_ts_node_next_named_sibling_wasm=e.ts_node_next_named_sibling_wasm,Module._ts_node_prev_named_sibling_wasm=_ts_node_prev_named_sibling_wasm=e.ts_node_prev_named_sibling_wasm,Module._ts_node_descendant_count_wasm=_ts_node_descendant_count_wasm=e.ts_node_descendant_count_wasm,Module._ts_node_parent_wasm=_ts_node_parent_wasm=e.ts_node_parent_wasm,Module._ts_node_child_with_descendant_wasm=_ts_node_child_with_descendant_wasm=e.ts_node_child_with_descendant_wasm,Module._ts_node_descendant_for_index_wasm=_ts_node_descendant_for_index_wasm=e.ts_node_descendant_for_index_wasm,Module._ts_node_named_descendant_for_index_wasm=_ts_node_named_descendant_for_index_wasm=e.ts_node_named_descendant_for_index_wasm,Module._ts_node_descendant_for_position_wasm=_ts_node_descendant_for_position_wasm=e.ts_node_descendant_for_position_wasm,Module._ts_node_named_descendant_for_position_wasm=_ts_node_named_descendant_for_position_wasm=e.ts_node_named_descendant_for_position_wasm,Module._ts_node_start_point_wasm=_ts_node_start_point_wasm=e.ts_node_start_point_wasm,Module._ts_node_end_point_wasm=_ts_node_end_point_wasm=e.ts_node_end_point_wasm,Module._ts_node_start_index_wasm=_ts_node_start_index_wasm=e.ts_node_start_index_wasm,Module._ts_node_end_index_wasm=_ts_node_end_index_wasm=e.ts_node_end_index_wasm,Module._ts_node_to_string_wasm=_ts_node_to_string_wasm=e.ts_node_to_string_wasm,Module._ts_node_children_wasm=_ts_node_children_wasm=e.ts_node_children_wasm,Module._ts_node_named_children_wasm=_ts_node_named_children_wasm=e.ts_node_named_children_wasm,Module._ts_node_descendants_of_type_wasm=_ts_node_descendants_of_type_wasm=e.ts_node_descendants_of_type_wasm,Module._ts_node_is_named_wasm=_ts_node_is_named_wasm=e.ts_node_is_named_wasm,Module._ts_node_has_changes_wasm=_ts_node_has_changes_wasm=e.ts_node_has_changes_wasm,Module._ts_node_has_error_wasm=_ts_node_has_error_wasm=e.ts_node_has_error_wasm,Module._ts_node_is_error_wasm=_ts_node_is_error_wasm=e.ts_node_is_error_wasm,Module._ts_node_is_missing_wasm=_ts_node_is_missing_wasm=e.ts_node_is_missing_wasm,Module._ts_node_is_extra_wasm=_ts_node_is_extra_wasm=e.ts_node_is_extra_wasm,Module._ts_node_parse_state_wasm=_ts_node_parse_state_wasm=e.ts_node_parse_state_wasm,Module._ts_node_next_parse_state_wasm=_ts_node_next_parse_state_wasm=e.ts_node_next_parse_state_wasm,Module._ts_query_matches_wasm=_ts_query_matches_wasm=e.ts_query_matches_wasm,Module._ts_query_captures_wasm=_ts_query_captures_wasm=e.ts_query_captures_wasm,Module._memset=_memset=e.memset,Module._memcpy=_memcpy=e.memcpy,Module._memmove=_memmove=e.memmove,Module._iswalpha=_iswalpha=e.iswalpha,Module._iswblank=_iswblank=e.iswblank,Module._iswdigit=_iswdigit=e.iswdigit,Module._iswlower=_iswlower=e.iswlower,Module._iswpunct=_iswpunct=e.iswpunct,Module._iswupper=_iswupper=e.iswupper,Module._iswxdigit=_iswxdigit=e.iswxdigit,Module._memchr=_memchr=e.memchr,Module._strlen=_strlen=e.strlen,Module._strcmp=_strcmp=e.strcmp,Module._strncat=_strncat=e.strncat,Module._strncpy=_strncpy=e.strncpy,Module._towlower=_towlower=e.towlower,Module._towupper=_towupper=e.towupper,_setThrew=e.setThrew,__emscripten_stack_restore=e._emscripten_stack_restore,__emscripten_stack_alloc=e._emscripten_stack_alloc,_emscripten_stack_get_current=e.emscripten_stack_get_current,___wasm_apply_data_relocs=e.__wasm_apply_data_relocs}A(assignWasmExports,"assignWasmExports");var wasmImports={__heap_base:___heap_base,__indirect_function_table:wasmTable,__memory_base:___memory_base,__stack_high:___stack_high,__stack_low:___stack_low,__stack_pointer:___stack_pointer,__table_base:___table_base,_abort_js:__abort_js,emscripten_resize_heap:_emscripten_resize_heap,fd_close:_fd_close,fd_seek:_fd_seek,fd_write:_fd_write,memory:wasmMemory,tree_sitter_log_callback:_tree_sitter_log_callback,tree_sitter_parse_callback:_tree_sitter_parse_callback,tree_sitter_progress_callback:_tree_sitter_progress_callback,tree_sitter_query_progress_callback:_tree_sitter_query_progress_callback};function callMain(e=[]){var t=resolveGlobalSymbol("main").sym;if(t){e.unshift(thisProgram);var n=e.length,r=stackAlloc((n+1)*4),o=r;e.forEach(a=>{LE_HEAP_STORE_U32((o>>2)*4,stringToUTF8OnStack(a)),o+=4}),LE_HEAP_STORE_U32((o>>2)*4,0);try{var s=t(n,r);return exitJS(s,!0),s}catch(a){return handleException(a)}}}A(callMain,"callMain");function run(e=arguments_){if(runDependencies>0){dependenciesFulfilled=run;return}if(preRun(),runDependencies>0){dependenciesFulfilled=run;return}function t(){if(Module.calledRun=!0,!ABORT){initRuntime(),readyPromiseResolve?.(Module),Module.onRuntimeInitialized?.();var n=Module.noInitialRun||!1;n||callMain(e),postRun()}}A(t,"doRun"),Module.setStatus?(Module.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>Module.setStatus(""),1),t()},1)):t()}A(run,"run");var wasmExports;return wasmExports=await createWasm(),run(),runtimeInitialized?moduleRtn=Module:moduleRtn=new Promise((e,t)=>{readyPromiseResolve=e,readyPromiseReject=t}),moduleRtn}A(PA,"Module");var EG=PA,NA=null;async function EA(e){return NA??=await EG(e)}A(EA,"initializeBinding");function RA(){return!!NA}A(RA,"checkModule");var X,ib,ob,_A=ia(e=>{x._ts_parser_delete(e[0]),x._free(e[1])}),ub=class{static{A(this,"Parser")}0=0;1=0;logCallback=null;language=null;static async init(e){SA(await EA(e)),X=x._ts_init(),ib=x.getValue(X,"i32"),ob=x.getValue(X+ne,"i32")}constructor(){this.initialize(),_A?.register(this,[this[0],this[1]],this)}initialize(){if(!RA())throw new Error("cannot construct a Parser before calling `init()`");x._ts_parser_new_wasm(),this[0]=x.getValue(X,"i32"),this[1]=x.getValue(X+ne,"i32")}delete(){_A?.unregister(this),x._ts_parser_delete(this[0]),x._free(this[1]),this[0]=0,this[1]=0}setLanguage(e){let t;if(!e)t=0,this.language=null;else if(e.constructor===lb){t=e[0];let n=x._ts_language_abi_version(t);if(n<ob||ib<n)throw new Error(`Incompatible language version ${n}. Compatibility range ${ob} through ${ib}.`);this.language=e}else throw new Error("Argument must be a Language");return x._ts_parser_set_language(this[0],t),this}parse(e,t,n){if(typeof e=="string")x.currentParseCallback=c=>e.slice(c);else if(typeof e=="function")x.currentParseCallback=e;else throw new Error("Argument must be a string or a function");n?.progressCallback?x.currentProgressCallback=n.progressCallback:x.currentProgressCallback=null,this.logCallback?(x.currentLogCallback=this.logCallback,x._ts_parser_enable_logger_wasm(this[0],1)):(x.currentLogCallback=null,x._ts_parser_enable_logger_wasm(this[0],0));let r=0,o=0;if(n?.includedRanges){r=n.includedRanges.length,o=x._calloc(r,Xc);let c=o;for(let l=0;l<r;l++)xA(c,n.includedRanges[l]),c+=Xc}let s=x._ts_parser_parse_wasm(this[0],this[1],t?t[0]:0,o,r);if(!s)return x.currentParseCallback=null,x.currentLogCallback=null,x.currentProgressCallback=null,null;if(!this.language)throw new Error("Parser must have a language to parse");let a=new vG(ji,s,this.language,x.currentParseCallback);return x.currentParseCallback=null,x.currentLogCallback=null,x.currentProgressCallback=null,a}reset(){x._ts_parser_reset(this[0])}getIncludedRanges(){x._ts_parser_included_ranges_wasm(this[0]);let e=x.getValue(X,"i32"),t=x.getValue(X+ne,"i32"),n=new Array(e);if(e>0){let r=t;for(let o=0;o<e;o++)n[o]=ff(r),r+=Xc;x._free(t)}return n}setLogger(e){if(!e)this.logCallback=null;else{if(typeof e!="function")throw new Error("Logger callback must be a function");this.logCallback=e}return this}getLogger(){return this.logCallback}},RG=1,TG=2,AG=/[\w-]+/g,Soe={Zero:0,ZeroOrOne:1,ZeroOrMore:2,One:3,OneOrMore:4},yA=A(e=>e.type==="capture","isCaptureStep"),db=A(e=>e.type==="string","isStringStep"),br={Syntax:1,NodeName:2,FieldName:3,CaptureName:4,PatternStructure:5},Kc=class TA extends Error{constructor(t,n,r,o){super(TA.formatMessage(t,n)),this.kind=t,this.info=n,this.index=r,this.length=o,this.name="QueryError"}kind;info;index;length;static{A(this,"QueryError")}static formatMessage(t,n){switch(t){case br.NodeName:return`Bad node name '${n.word}'`;case br.FieldName:return`Bad field name '${n.word}'`;case br.CaptureName:return`Bad capture name @${n.word}`;case br.PatternStructure:return`Bad pattern structure at offset ${n.suffix}`;case br.Syntax:return`Bad syntax at offset ${n.suffix}`}}};function AA(e,t,n,r){if(e.length!==3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 2, got ${e.length-1}`);if(!yA(e[1]))throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}"`);let o=n==="eq?"||n==="any-eq?",s=!n.startsWith("any-");if(yA(e[2])){let a=e[1].name,c=e[2].name;r[t].push(l=>{let u=[],d=[];for(let m of l)m.name===a&&u.push(m.node),m.name===c&&d.push(m.node);let f=A((m,p,g)=>g?m.text===p.text:m.text!==p.text,"compare");return s?u.every(m=>d.some(p=>f(m,p,o))):u.some(m=>d.some(p=>f(m,p,o)))})}else{let a=e[1].name,c=e[2].value,l=A(d=>d.text===c,"matches"),u=A(d=>d.text!==c,"doesNotMatch");r[t].push(d=>{let f=[];for(let p of d)p.name===a&&f.push(p.node);let m=o?l:u;return s?f.every(m):f.some(m)})}}A(AA,"parseAnyPredicate");function IA(e,t,n,r){if(e.length!==3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 2, got ${e.length-1}.`);if(e[1].type!=="capture")throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}".`);if(e[2].type!=="string")throw new Error(`Second argument of \`#${n}\` predicate must be a string. Got @${e[2].name}.`);let o=n==="match?"||n==="any-match?",s=!n.startsWith("any-"),a=e[1].name,c=new RegExp(e[2].value);r[t].push(l=>{let u=[];for(let f of l)f.name===a&&u.push(f.node.text);let d=A((f,m)=>m?c.test(f):!c.test(f),"test");return u.length===0?!o:s?u.every(f=>d(f,o)):u.some(f=>d(f,o))})}A(IA,"parseMatchPredicate");function DA(e,t,n,r){if(e.length<2)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected at least 1. Got ${e.length-1}.`);if(e[1].type!=="capture")throw new Error(`First argument of \`#${n}\` predicate must be a capture. Got "${e[1].value}".`);let o=n==="any-of?",s=e[1].name,a=e.slice(2);if(!a.every(db))throw new Error(`Arguments to \`#${n}\` predicate must be strings.".`);let c=a.map(l=>l.value);r[t].push(l=>{let u=[];for(let d of l)d.name===s&&u.push(d.node.text);return u.length===0?!o:u.every(d=>c.includes(d))===o})}A(DA,"parseAnyOfPredicate");function kA(e,t,n,r,o){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#${n}\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(db))throw new Error(`Arguments to \`#${n}\` predicate must be strings.".`);let s=n==="is?"?r:o;s[t]||(s[t]={}),s[t][e[1].value]=e[2]?.value??null}A(kA,"parseIsPredicate");function FA(e,t,n){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(db))throw new Error('Arguments to `#set!` predicate must be strings.".');n[t]||(n[t]={}),n[t][e[1].value]=e[2]?.value??null}A(FA,"parseSetDirective");function LA(e,t,n,r,o,s,a,c,l,u,d){if(t===RG){let f=r[n];s.push({type:"capture",name:f})}else if(t===TG)s.push({type:"string",value:o[n]});else if(s.length>0){if(s[0].type!=="string")throw new Error("Predicates must begin with a literal value");let f=s[0].value;switch(f){case"any-not-eq?":case"not-eq?":case"any-eq?":case"eq?":AA(s,e,f,a);break;case"any-not-match?":case"not-match?":case"any-match?":case"match?":IA(s,e,f,a);break;case"not-any-of?":case"any-of?":DA(s,e,f,a);break;case"is?":case"is-not?":kA(s,e,f,u,d);break;case"set!":FA(s,e,l);break;default:c[e].push({operator:f,operands:s.slice(1)})}s.length=0}}A(LA,"parsePattern");var bA=ia(e=>{x._ts_query_delete(e)}),woe=class{static{A(this,"Query")}0=0;exceededMatchLimit;textPredicates;captureNames;captureQuantifiers;predicates;setProperties;assertedProperties;refutedProperties;matchLimit;constructor(e,t){let n=x.lengthBytesUTF8(t),r=x._malloc(n+1);x.stringToUTF8(t,r,n+1);let o=x._ts_query_new(e[0],r,n,X,X+ne);if(!o){let y=x.getValue(X+ne,"i32"),w=x.getValue(X,"i32"),_=x.UTF8ToString(r,w).length,b=t.slice(_,_+100).split(`
159
+ `)[0],S=b.match(AG)?.[0]??"";switch(x._free(r),y){case br.Syntax:throw new Kc(br.Syntax,{suffix:`${_}: '${b}'...`},_,0);case br.NodeName:throw new Kc(y,{word:S},_,S.length);case br.FieldName:throw new Kc(y,{word:S},_,S.length);case br.CaptureName:throw new Kc(y,{word:S},_,S.length);case br.PatternStructure:throw new Kc(y,{suffix:`${_}: '${b}'...`},_,0)}}let s=x._ts_query_string_count(o),a=x._ts_query_capture_count(o),c=x._ts_query_pattern_count(o),l=new Array(a),u=new Array(c),d=new Array(s);for(let y=0;y<a;y++){let w=x._ts_query_capture_name_for_id(o,y,X),_=x.getValue(X,"i32");l[y]=x.UTF8ToString(w,_)}for(let y=0;y<c;y++){let w=new Array(a);for(let _=0;_<a;_++){let b=x._ts_query_capture_quantifier_for_id(o,y,_);w[_]=b}u[y]=w}for(let y=0;y<s;y++){let w=x._ts_query_string_value_for_id(o,y,X),_=x.getValue(X,"i32");d[y]=x.UTF8ToString(w,_)}let f=new Array(c),m=new Array(c),p=new Array(c),g=new Array(c),h=new Array(c);for(let y=0;y<c;y++){let w=x._ts_query_predicates_for_pattern(o,y,X),_=x.getValue(X,"i32");g[y]=[],h[y]=[];let b=new Array,S=w;for(let N=0;N<_;N++){let R=x.getValue(S,"i32");S+=ne;let $=x.getValue(S,"i32");S+=ne,LA(y,R,$,l,d,b,h,g,f,m,p)}Object.freeze(h[y]),Object.freeze(g[y]),Object.freeze(f[y]),Object.freeze(m[y]),Object.freeze(p[y])}x._free(r),this[0]=o,this.captureNames=l,this.captureQuantifiers=u,this.textPredicates=h,this.predicates=g,this.setProperties=f,this.assertedProperties=m,this.refutedProperties=p,this.exceededMatchLimit=!1,bA?.register(this,o,this)}delete(){bA?.unregister(this),x._ts_query_delete(this[0]),this[0]=0}matches(e,t={}){let n=t.startPosition??Rn,r=t.endPosition??Rn,o=t.startIndex??0,s=t.endIndex??0,a=t.startContainingPosition??Rn,c=t.endContainingPosition??Rn,l=t.startContainingIndex??0,u=t.endContainingIndex??0,d=t.matchLimit??4294967295,f=t.maxStartDepth??4294967295,m=t.progressCallback;if(typeof d!="number")throw new Error("Arguments must be numbers");if(this.matchLimit=d,s!==0&&o>s)throw new Error("`startIndex` cannot be greater than `endIndex`");if(r!==Rn&&(n.row>r.row||n.row===r.row&&n.column>r.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(u!==0&&l>u)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(c!==Rn&&(a.row>c.row||a.row===c.row&&a.column>c.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");m&&(x.currentQueryProgressCallback=m),me(e),x._ts_query_matches_wasm(this[0],e.tree[0],n.row,n.column,r.row,r.column,o,s,a.row,a.column,c.row,c.column,l,u,d,f);let p=x.getValue(X,"i32"),g=x.getValue(X+ne,"i32"),h=x.getValue(X+2*ne,"i32"),y=new Array(p);this.exceededMatchLimit=!!h;let w=0,_=g;for(let b=0;b<p;b++){let S=x.getValue(_,"i32");_+=ne;let N=x.getValue(_,"i32");_+=ne;let R=new Array(N);if(_=ab(this,e.tree,_,S,R),this.textPredicates[S].every($=>$(R))){y[w]={patternIndex:S,captures:R};let $=this.setProperties[S];y[w].setProperties=$;let I=this.assertedProperties[S];y[w].assertedProperties=I;let U=this.refutedProperties[S];y[w].refutedProperties=U,w++}}return y.length=w,x._free(g),x.currentQueryProgressCallback=null,y}captures(e,t={}){let n=t.startPosition??Rn,r=t.endPosition??Rn,o=t.startIndex??0,s=t.endIndex??0,a=t.startContainingPosition??Rn,c=t.endContainingPosition??Rn,l=t.startContainingIndex??0,u=t.endContainingIndex??0,d=t.matchLimit??4294967295,f=t.maxStartDepth??4294967295,m=t.progressCallback;if(typeof d!="number")throw new Error("Arguments must be numbers");if(this.matchLimit=d,s!==0&&o>s)throw new Error("`startIndex` cannot be greater than `endIndex`");if(r!==Rn&&(n.row>r.row||n.row===r.row&&n.column>r.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(u!==0&&l>u)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(c!==Rn&&(a.row>c.row||a.row===c.row&&a.column>c.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");m&&(x.currentQueryProgressCallback=m),me(e),x._ts_query_captures_wasm(this[0],e.tree[0],n.row,n.column,r.row,r.column,o,s,a.row,a.column,c.row,c.column,l,u,d,f);let p=x.getValue(X,"i32"),g=x.getValue(X+ne,"i32"),h=x.getValue(X+2*ne,"i32"),y=new Array;this.exceededMatchLimit=!!h;let w=new Array,_=g;for(let b=0;b<p;b++){let S=x.getValue(_,"i32");_+=ne;let N=x.getValue(_,"i32");_+=ne;let R=x.getValue(_,"i32");if(_+=ne,w.length=N,_=ab(this,e.tree,_,S,w),this.textPredicates[S].every($=>$(w))){let $=w[R],I=this.setProperties[S];$.setProperties=I;let U=this.assertedProperties[S];$.assertedProperties=U;let de=this.refutedProperties[S];$.refutedProperties=de,y.push($)}}return x._free(g),x.currentQueryProgressCallback=null,y}predicatesForPattern(e){return this.predicates[e]}disableCapture(e){let t=x.lengthBytesUTF8(e),n=x._malloc(t+1);x.stringToUTF8(e,n,t+1),x._ts_query_disable_capture(this[0],n,t),x._free(n)}disablePattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);x._ts_query_disable_pattern(this[0],e)}didExceedMatchLimit(){return this.exceededMatchLimit}startIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return x._ts_query_start_byte_for_pattern(this[0],e)}endIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return x._ts_query_end_byte_for_pattern(this[0],e)}patternCount(){return x._ts_query_pattern_count(this[0])}captureIndexForName(e){return this.captureNames.indexOf(e)}isPatternRooted(e){return x._ts_query_is_pattern_rooted(this[0],e)===1}isPatternNonLocal(e){return x._ts_query_is_pattern_non_local(this[0],e)===1}isPatternGuaranteedAtStep(e){return x._ts_query_is_pattern_guaranteed_at_step(this[0],e)===1}};var fb=B(require("path"),1),MA=B(require("fs"),1);var Jc=class extends Map{#n=0;#e=new Map;#t=new Map;#i;#s;#o;constructor(t={}){if(super(),!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof t.maxAge=="number"&&t.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.#i=t.maxSize,this.#s=t.maxAge||Number.POSITIVE_INFINITY,this.#o=t.onEviction}get __oldCache(){return this.#t}#a(t){if(typeof this.#o=="function")for(let[n,r]of t)this.#o(n,r.value)}#r(t,n){return typeof n.expiry=="number"&&n.expiry<=Date.now()?(typeof this.#o=="function"&&this.#o(t,n.value),this.delete(t)):!1}#f(t,n){if(this.#r(t,n)===!1)return n.value}#l(t,n){return n.expiry?this.#f(t,n):n.value}#u(t,n){let r=n.get(t);return this.#l(t,r)}#d(t,n){this.#e.set(t,n),this.#n++,this.#n>=this.#i&&(this.#n=0,this.#a(this.#t),this.#t=this.#e,this.#e=new Map)}#m(t,n){this.#t.delete(t),this.#d(t,n)}*#c(){for(let t of this.#t){let[n,r]=t;this.#e.has(n)||this.#r(n,r)===!1&&(yield t)}for(let t of this.#e){let[n,r]=t;this.#r(n,r)===!1&&(yield t)}}get(t){if(this.#e.has(t)){let n=this.#e.get(t);return this.#l(t,n)}if(this.#t.has(t)){let n=this.#t.get(t);if(this.#r(t,n)===!1)return this.#m(t,n),n.value}}set(t,n,{maxAge:r=this.#s}={}){let o=typeof r=="number"&&r!==Number.POSITIVE_INFINITY?Date.now()+r:void 0;return this.#e.has(t)?this.#e.set(t,{value:n,expiry:o}):this.#d(t,{value:n,expiry:o}),this}has(t){return this.#e.has(t)?!this.#r(t,this.#e.get(t)):this.#t.has(t)?!this.#r(t,this.#t.get(t)):!1}peek(t){if(this.#e.has(t))return this.#u(t,this.#e);if(this.#t.has(t))return this.#u(t,this.#t)}expiresIn(t){let n=this.#e.get(t)??this.#t.get(t);if(n)return n.expiry?n.expiry-Date.now():Number.POSITIVE_INFINITY}delete(t){let n=this.#e.delete(t);return n&&this.#n--,this.#t.delete(t)||n}clear(){this.#e.clear(),this.#t.clear(),this.#n=0}resize(t){if(!(t&&t>0))throw new TypeError("`maxSize` must be a number greater than 0");let n=[...this.#c()],r=n.length-t;r<0?(this.#e=new Map(n),this.#t=new Map,this.#n=n.length):(r>0&&this.#a(n.slice(0,r)),this.#t=new Map(n.slice(r)),this.#e=new Map,this.#n=0),this.#i=t}evict(t=1){let n=Number(t);if(!n||n<=0)return;let r=[...this.#c()],o=Math.trunc(Math.min(n,Math.max(r.length-1,0)));o<=0||(this.#a(r.slice(0,o)),this.#t=new Map(r.slice(o)),this.#e=new Map,this.#n=0)}*keys(){for(let[t]of this)yield t}*values(){for(let[,t]of this)yield t}*[Symbol.iterator](){for(let t of this.#e){let[n,r]=t;this.#r(n,r)===!1&&(yield[n,r.value])}for(let t of this.#t){let[n,r]=t;this.#e.has(n)||this.#r(n,r)===!1&&(yield[n,r.value])}}*entriesDescending(){let t=[...this.#e];for(let n=t.length-1;n>=0;--n){let r=t[n],[o,s]=r;this.#r(o,s)===!1&&(yield[o,s.value])}t=[...this.#t];for(let n=t.length-1;n>=0;--n){let r=t[n],[o,s]=r;this.#e.has(o)||this.#r(o,s)===!1&&(yield[o,s.value])}}*entriesAscending(){for(let[t,n]of this.#c())yield[t,n.value]}get size(){if(!this.#n)return this.#t.size;let t=0;for(let n of this.#t.keys())this.#e.has(n)||t++;return Math.min(this.#n+t,this.#i)}get maxSize(){return this.#i}get maxAge(){return this.#s}entries(){return this.entriesAscending()}forEach(t,n=this){for(let[r,o]of this.entriesAscending())t.call(n,o,r,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};var OA=!1;async function IG(){if(OA)return;let e=MA.readFileSync(fb.join(__dirname,"web-tree-sitter.wasm"));await ub.init({wasmBinary:e}),OA=!0}function DG(e,t){let n=null,r=!1;return{async init(){if(r)return;await IG(),n=new ub;let o=fb.join(__dirname,e),s=await lb.load(o);n.setLanguage(s),r=!0},getParser(){if(!n)throw new Error(`${t} parser not initialized. Call init() first.`);return n},isInitialized(){return r}}}var kG=64;function $A(e,t,n=kG){let r=DG(e,t),o=new Jc({maxSize:n,onEviction:(s,a)=>a.delete()});return{...r,parseWithCache(s){if(!r.isInitialized())return null;let a=o.get(s);if(a)return a;let c=r.getParser().parse(s);return c&&o.set(s,c),c},invalidateCache(s){if(s===void 0){for(let[,a]of o)a.delete();o.clear()}else o.get(s)?.delete(),o.delete(s)}}}var mb={info:e=>console.log(e),error:e=>console.error(e)};function qA(e){mb=e}var pb=class{parsers=new Map;register(t,n,r){if(this.parsers.has(t))return;let o=$A(n,r);this.parsers.set(t,{langId:t,name:r,module:o})}async initOne(t,n,r){this.register(t,n,r);let o=this.parsers.get(t);o.module.isInitialized()||await o.module.init()}async initAll(){for(let t of this.parsers.values())try{await t.module.init()}catch(n){mb.error(`Failed to initialize ${t.name} parser: ${n instanceof Error?n.message:String(n)}`)}mb.info(`ParserManager: initialized ${this.parsers.size} parsers`)}isInitialized(t){return this.parsers.get(t)?.module.isInitialized()??!1}parseWithCache(t,n){let r=this.parsers.get(t);if(!r)throw new Error(`No parser registered for language: ${t}`);return r.module.parseWithCache(n)}getParser(t){let n=this.parsers.get(t);if(!n)throw new Error(`No parser registered for language: ${t}`);return n.module.getParser()}},Me=new pb;var Aae=B(le());var Gt={found:e=>({handled:!0,hover:e}),empty:()=>({handled:!0,hover:null}),notHandled:()=>({handled:!1})};var hb=B(le());var oa=new Map;function FG(e){let t=oa.get(e),n=[];if(t)for(let r of t.values())n.push(...r);Mr().sendDiagnostics({uri:e,diagnostics:n})}function jr(e,t,n){let r=Ne(e),o=oa.get(r);n.length===0?o&&(o.delete(t),o.size===0&&oa.delete(r)):(o||(o=new Map,oa.set(r,o)),o.set(t,n)),FG(r)}function BA(e,t){return oa.get(Ne(e))?.get(t)??[]}function Qc(e){jr(e,"compiler",[])}function jA(e){let t=Ne(e);oa.delete(t),Mr().sendDiagnostics({uri:t,diagnostics:[]})}var WA=require("node:url");var LG=/file:\/\/\/[^\s)'"]+/g;function sa(e){return e.replace(LG,t=>{try{return(0,WA.fileURLToPath)(t)}catch{return t}})}function bn(e){Mr().window.showInformationMessage(sa(e))}function Sr(e){Mr().window.showWarningMessage(sa(e))}function ir(e){Mr().window.showErrorMessage(sa(e))}function UA(e,...t){return Mr().window.showErrorMessage(sa(e),...t)}function Wr(e,t,n){let r="BGforge MLS",o=new Map;function s(a,c){let l={severity:c,range:{start:{line:a.line-1,character:a.columnStart},end:{line:a.line-1,character:a.columnEnd}},message:`${a.message}`,source:r},u=a.uri===n?t:a.uri,d=o.get(u);d||(d=[],o.set(u,d)),d.push(l)}for(let a of e.errors)s(a,hb.DiagnosticSeverity.Error);for(let a of e.warnings)s(a,hb.DiagnosticSeverity.Warning);for(let[a,c]of o)jr(a,"compiler",c)}function at(e){return e instanceof Error?e.message:String(e)}function mf(e){if(e&&typeof e=="object"&&"code"in e&&typeof e.code=="string")return e.code}function pf(e,t,n,r){return{errors:[...e.errors,{uri:n,line:1,columnStart:0,columnEnd:0,message:r||t.message}],warnings:e.warnings}}function Zc(e,t,n,r){t&&(e.errors.length>0?ir(r):bn(n))}var zoe=B(le()),jo=require("path");var HA=require("node:url"),VA=require("url");function et(e){return e.startsWith("file://")?(0,VA.fileURLToPath)(e):decodeURIComponent(e.replace(/^[^:]+:/,""))}function Ye(e){return(0,HA.pathToFileURL)(e).toString()}function OG(e){return!(!e||!e.uri||e.uri==="")}function GA(e){return OG(e)?e:null}var MG=new Set([".h",".tph"]);function Wo(e){let t=(0,jo.extname)(e).toLowerCase();return MG.has(t)}function aa(e){return(0,jo.basename)(e)}function ca(e,t){let n=et(e);if(t){let r=(0,jo.relative)(t,n);if(!r.startsWith("..")&&!r.startsWith("/"))return r}return(0,jo.basename)(n)}var el=B(le()),zA="resref",KA="byte",YA="char",XA="dword",JA="int",QA="2da-c0",ZA="2da-c1",eI="2da-c2",tI="2da-c3",nI="2da-c4",rI="2da-c5",gb=[QA,ZA,eI,tI,nI,rI],iI=new Map([["resref",zA],["byte",KA],["char",YA],["dword",XA],["int",JA]]),_b={tokenTypes:[el.SemanticTokenTypes.parameter,el.SemanticTokenTypes.variable,zA,KA,YA,XA,JA,QA,ZA,eI,tI,nI,rI],tokenModifiers:[]},$G=new Map(_b.tokenTypes.map((e,t)=>[e,t]));function qG(e,t){return e.line!==t.line?e.line-t.line:e.startChar!==t.startChar?e.startChar-t.startChar:e.length!==t.length?e.length-t.length:e.tokenType.localeCompare(t.tokenType)}function oI(e){if(e.length===0)return{data:[]};let t=new el.SemanticTokensBuilder,n=e.toSorted(qG);for(let o of n){let s=$G.get(o.tokenType);s===void 0||o.length<=0||t.push(o.line,o.startChar,o.length,s,o.tokenModifiers)}return{data:t.build().data}}var sI=require("node:fs/promises"),aI=require("node:path"),cI=require("node:url"),Uo=B(le());var hf=class{extensionToProvider=new Map;buildExtensionMap(t){this.extensionToProvider.clear();for(let n of t)if(n.indexExtensions)for(let r of n.indexExtensions)this.extensionToProvider.set(r.toLowerCase(),n);T(`Built extension map with ${this.extensionToProvider.size} extensions`)}getWatchPatterns(t){let n=[],r=Uo.WatchKind.Create|Uo.WatchKind.Change|Uo.WatchKind.Delete;for(let o of t)if(o.indexExtensions)for(let s of o.indexExtensions)n.push({globPattern:`**/*${s}`,kind:r});return n}async handleWatchedFileChange(t,n){let r=Ne(t),o=(0,cI.fileURLToPath)(r),s=(0,aI.extname)(o).toLowerCase(),a=this.extensionToProvider.get(s);if(a)if(n===Uo.FileChangeType.Deleted)a.onWatchedFileDeleted&&(a.onWatchedFileDeleted(r),T(`File deleted, cleared from index: ${o}`));else try{let c=await(0,sI.readFile)(o,"utf-8");a.reloadFileData&&(a.reloadFileData(r,c),T(`File ${n===Uo.FileChangeType.Created?"created":"changed"}, reloaded: ${o}`))}catch(c){T(`Failed to read file ${o}: ${at(c)}`,"warn")}}handleDocumentClosed(t,n,r){let o=Ne(n),s=r.get(t);s?.onDocumentClosed&&s.onDocumentClosed(o)}};var a0=require("node:fs/promises"),Kf=require("node:path"),c0=require("node:timers/promises");var yb=class{value;next;constructor(t){this.value=t}},tl=class{#n;#e;#t;constructor(){this.clear()}enqueue(t){let n=new yb(t);this.#n?(this.#e.next=n,this.#e=n):(this.#n=n,this.#e=n),this.#t++}dequeue(){let t=this.#n;if(t)return this.#n=this.#n.next,this.#t--,this.#n||(this.#e=void 0),t.value}peek(){if(this.#n)return this.#n.value}clear(){this.#n=void 0,this.#e=void 0,this.#t=0}get size(){return this.#t}*[Symbol.iterator](){let t=this.#n;for(;t;)yield t.value,t=t.next}*drain(){for(;this.#n;)yield this.dequeue()}};function Wi(e){let t=!1;if(typeof e=="object"&&({concurrency:e,rejectOnClear:t=!1}=e),lI(e),typeof t!="boolean")throw new TypeError("Expected `rejectOnClear` to be a boolean");let n=new tl,r=0,o=()=>{r<e&&n.size>0&&(r++,n.dequeue().run())},s=()=>{r--,o()},a=async(u,d,f)=>{let m=(async()=>u(...f))();d(m);try{await m}catch{}s()},c=(u,d,f,m)=>{let p={reject:f};new Promise(g=>{p.run=g,n.enqueue(p)}).then(a.bind(void 0,u,d,m)),r<e&&o()},l=(u,...d)=>new Promise((f,m)=>{c(u,f,m,d)});return Object.defineProperties(l,{activeCount:{get:()=>r},pendingCount:{get:()=>n.size},clearQueue:{value(){if(!t){n.clear();return}let u=AbortSignal.abort().reason;for(;n.size>0;)n.dequeue().reject(u)}},concurrency:{get:()=>e,set(u){lI(u),e=u,queueMicrotask(()=>{for(;r<e&&n.size>0;)o()})}},map:{async value(u,d){let f=Array.from(u,(m,p)=>l(d,m,p));return Promise.all(f)}}}),l}function lI(e){if(!((Number.isInteger(e)||e===Number.POSITIVE_INFINITY)&&e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}var rw=B(t0()),zo=B(require("fs")),n0=B(require("os")),Xi=B(require("path")),Ji=Xi.join(n0.tmpdir(),"bgforge-mls");function r0(e,t){try{let n=zo.realpathSync(t),r=Xi.relative(e,n);return!r.startsWith("..")&&!Xi.isAbsolute(r)}catch{return!1}}function Hf(e,t){let n=Xi.relative(e,t);return!n.startsWith("..")&&!Xi.isAbsolute(n)}function Vf(e){try{return zo.realpathSync(e)}catch{return}}function Gf(e){return zo.existsSync(e)?zo.lstatSync(e).isDirectory():!1}var i0=["**/node_modules/**","**/.*/**"],Ko=4;async function o0(e,t){return rw.async(`**/*.${t}`,{cwd:e,caseSensitiveMatch:!1,ignore:i0,suppressErrors:!0})}async function zf(e,t){if(t.length===0)return[];let n=t.length===1?`**/*.${t[0]}`:`**/*.{${t.join(",")}}`;return rw.async(n,{cwd:e,caseSensitiveMatch:!1,ignore:i0,suppressErrors:!0})}function s0(e){return(e.startsWith(".")?e.slice(1):e).toLowerCase()}async function l0(e,t,n){if(!n)return;let r=new Map;for(let l of e)if(!(!l.indexExtensions||!l.reloadFileData))for(let u of l.indexExtensions)r.set(s0(u),l);if(r.size===0)return;let o=await zf(n,[...r.keys()]),s=Wi(Ko),a=new Map,c=new Map;await Promise.all(o.map(l=>s(async()=>{let u=s0((0,Kf.extname)(l)),d=r.get(u);if(d){a.set(u,(a.get(u)??0)+1);try{let f=(0,Kf.join)(n,l),m=Ye(f),p=await(0,a0.readFile)(f,"utf-8");t.reloadFileData(d.id,m,p)}catch{c.set(u,(c.get(u)??0)+1)}await(0,c0.setImmediate)()}})));for(let[l,u]of a){let d=r.get(l)?.id,f=c.get(l)??0;f>0&&T(`Startup scan for ${d} (.${l}) had ${f} read failures`),u>0&&T(`Scanned ${u} .${l} files for ${d}`)}}var cl="bgforge.compile",Yf="bgforge.parseDialog",Xf="bgforge.saveDialogTra",Jf="bgforge.workspaceSymbols.",u0="Workspace scan complete",d0=["fallout-ssl","weidu-d","weidu-tp2"];function f0(e){return`${Jf}${e}`}var m0="extension.bgforge.compile";var iw=class{providers=new Map;context;aliases=new Map;fileWatcher=new hf;workspaceScan=Promise.resolve();register(t){this.providers.set(t.id,t),T(`Registered provider: ${t.id}`)}registerAlias(t,n){this.aliases.set(t,n),T(`Registered alias: ${t} -> ${n}`)}resolveLangId(t){return this.aliases.get(t)??t}identifierExtraChars(t){return fA[this.resolveLangId(t)]??""}async init(t){this.context=t;for(let n of this.providers.values())try{await n.init(t)}catch(r){let o=at(r);T(`Failed to initialize provider ${n.id}: ${o}`,"error"),ir(`BGforge MLS: ${n.id} failed to initialize: ${o}`)}T(`Initialized ${this.providers.size} providers`),this.fileWatcher.buildExtensionMap(this.providers.values()),this.workspaceScan=(t.scanAfter??Promise.resolve()).then(()=>l0(this.providers.values(),this,t.workspaceRoot)).catch(n=>{T(`Workspace scan failed: ${at(n)}`,"error")}).finally(()=>{T(u0)})}workspaceScanFinished(){return this.workspaceScan}updateSettings(t){this.context&&(this.context.settings=t)}getContext(){if(!this.context)throw new Error("ProviderRegistry not initialized");return this.context}get(t){return this.providers.get(this.resolveLangId(t))}has(t){return this.providers.has(this.resolveLangId(t))||this.aliases.has(t)}shouldProvideFeatures(t,n,r){let o=this.get(t);return o?.shouldProvideFeatures?o.shouldProvideFeatures(n,r):!0}format(t,n,r){let o=Ne(r),s=this.get(t);return s?.format?s.format(n,o):{edits:[]}}symbols(t,n){let r=this.get(t);return r?.symbols?r.symbols(n):[]}workspaceSymbols(t,n,r){if(n.isCancellationRequested)return[];if(r)return this.get(r)?.workspaceSymbols?.(t,n)??[];let o=[];for(let s of this.providers.values())s.workspaceSymbols&&o.push(...s.workspaceSymbols(t,n));return o}foldingRanges(t,n){let r=this.get(t);return r?.foldingRanges?r.foldingRanges(n):[]}selectionRanges(t,n,r){let o=this.get(t);return o?.selectionRanges?o.selectionRanges(n,r):[]}prepareCallHierarchy(t,n,r,o){return this.get(t)?.prepareCallHierarchy?.(n,r,Ne(o))??null}incomingCalls(t,n){return this.get(t)?.incomingCalls?.(n)??[]}outgoingCalls(t,n){return this.get(t)?.outgoingCalls?.(n)??[]}async definition(t,n,r,o){let s=Ne(o),a=this.get(t);return a?.definition?await a.definition(n,r,s):null}references(t,n,r,o,s,a){if(a.isCancellationRequested)return[];let c=Ne(o),l=this.get(t);return l?.references?l.references(n,r,c,s,a):[]}inlayHints(t,n,r,o){let s=Ne(r),a=this.get(t);return a?.inlayHints?a.inlayHints(n,s,o):[]}strRefs(t,n,r){let o=Ne(r);return this.get(t)?.strRefs?.(n,o)??[]}semanticTokens(t,n,r){let o=Ne(r),s=this.get(t);return oI(s?.semanticTokens?.(n,o)??[])}prepareRename(t,n,r){let o=this.get(t);return o?.prepareRename?o.prepareRename(n,r):null}async rename(t,n,r,o,s){let a=Ne(s),c=this.get(t);return c?.rename?await c.rename(n,r,o,a):null}completion(t,n,r,o,s){let a=Ne(r),c=this.get(t);if(!c)return[];let u=[...c.getCompletions?c.getCompletions(a):[]];return c.filterCompletions&&o&&(u=c.filterCompletions(u,n,o,a,s)),u}localHover(t,n,r,o,s){let a=Ne(o),c=this.get(t);return c?.hover?c.hover(n,r,a,s):Gt.notHandled()}hover(t,n,r,o){let s=Ne(n),a=this.get(t);if(!a)return null;if(o&&a.resolveSymbol){let c=a.resolveSymbol(r,o,s);if(c?.hover)return c.hover}return null}signature(t,n,r,o,s){let a=Ne(r),c=this.get(t);if(!c)return null;if(c.localSignature){let l=c.localSignature(n,o,s);if(l)return l}return c.getSignature?c.getSignature(a,o,s):null}symbolDefinition(t,n){let r=this.get(t);return r?.getSymbolDefinition?GA(r.getSymbolDefinition(n)):null}isPositionInString(t,n,r){return this.get(t)?.isPositionInString?.(n,r)??!1}reloadFileData(t,n,r){let o=Ne(n),s=this.get(t);s?.reloadFileData&&s.reloadFileData(o,r)}async compile(t,n,r,o){let s=Ne(n),a=this.get(t);return a?.compile?(await a.compile(s,r,o),!0):!1}getWatchPatterns(){return this.fileWatcher.getWatchPatterns(this.providers.values())}handleWatchedFileChange(t,n){return this.fileWatcher.handleWatchedFileChange(t,n)}handleDocumentClosed(t,n){this.fileWatcher.handleDocumentClosed(t,n,this)}},Y=new iw;var nO=B(require("fs")),rO=B(require("path")),iO=B(qx());var Fn={falloutSSL:{compilePath:"",compileOptions:"-q -p -l -O2 -d -s -n",outputDirectory:"",headersDirectory:"",compileOnValidate:!0,compiler:"wasm"},tssl:{emitSsl:!1},weidu:{path:"weidu",gamePath:"",tlkEncoding:"",compiler:"weidu"},validate:"saveAndType",diagnostics:!0,debug:!1};function ts(e){let t=e??{};return{falloutSSL:{...Fn.falloutSSL,...t.falloutSSL},tssl:{...Fn.tssl,...t.tssl},weidu:{...Fn.weidu,...t.weidu,compiler:t.weidu?.compiler==="built-in"?"built-in":Fn.weidu.compiler},validate:t.validate??Fn.validate,diagnostics:t.diagnostics??Fn.diagnostics,debug:t.debug??Fn.debug}}function oO(e){return e==="save"||e==="saveAndType"}function sO(e){return e==="type"||e==="saveAndType"}var CJ={translation:{directory:"tra",auto_tra:!0}};function aO(e){let t=structuredClone(CJ);if(e===void 0)return t;try{let n=nO.readFileSync(rO.join(e,".bgforge.yml"),"utf8"),s=iO.parse(n)?.mls?.translation;s!==void 0&&(typeof s.directory=="string"&&(t.translation.directory=s.directory),typeof s.auto_tra=="boolean"&&(t.translation.auto_tra=s.auto_tra))}catch(n){T(`Failed to load .bgforge.yml from ${e}: ${at(n)}`,"warn")}return t}var Dp=require("node:fs"),Vv=require("node:url"),Hpe=B(le());var Ln=B(le()),K={Function:"function",Procedure:"procedure",Macro:"macro",Action:"action",Trigger:"trigger",Variable:"variable",Constant:"constant",Parameter:"parameter",LoopVariable:"loop_variable",State:"state",Component:"component"},kt={Global:"global",Workspace:"workspace",File:"file",Function:"function",Loop:"loop"},Ee={Static:"static",Workspace:"workspace",External:"external",Document:"document",Navigation:"navigation"};var Bx=new Set([K.Function,K.Procedure,K.Macro,K.Action,K.Trigger]),NJ=new Set([K.Variable,K.Parameter,K.LoopVariable]);function Ea(e){return Bx.has(e.kind)}function cO(e){return NJ.has(e.kind)}function Xm(e,t){return t===void 0||t===Ee.Workspace?e:e.map(n=>({...n,source:{...n.source,type:t}}))}function lO(e){switch(e){case K.Function:case K.Procedure:case K.Action:case K.Trigger:return Ln.CompletionItemKind.Function;case K.Macro:return Ln.CompletionItemKind.Snippet;case K.Variable:case K.Parameter:case K.LoopVariable:return Ln.CompletionItemKind.Variable;case K.Constant:return Ln.CompletionItemKind.Constant;case K.State:case K.Component:return Ln.CompletionItemKind.Class;default:return Ln.CompletionItemKind.Text}}function uO(e){switch(e){case K.Function:case K.Procedure:case K.Macro:case K.Action:case K.Trigger:return Ln.SymbolKind.Function;case K.Variable:case K.Parameter:case K.LoopVariable:return Ln.SymbolKind.Variable;case K.Constant:return Ln.SymbolKind.Constant;case K.State:return Ln.SymbolKind.Class;case K.Component:return Ln.SymbolKind.Module;default:return Ln.SymbolKind.Variable}}var EJ=["Reply","NOption","GOption","BOption","mstr","display_mstr","floater","floater_rand","NLowOption","BLowOption","GLowOption","GMessage","NMessage","BMessage","CompOption"],jx=EJ.join("|"),Ra=new RegExp(`^(${jx})\\((\\d+)$`),Jm=new RegExp(`\\b(${jx})\\((\\d+)`,"g"),Qm=/\bfloater_rand\((\d+)\s*,\s*(\d+)/g,dO=/^@[0-9]+$/,fO=/@(\d+)/g,ql=/^tra\((\d+)\)$/,mO=/\btra\((\d+)\)/g,RJ=/^\d+$/;function pO(e){if(!RJ.test(e))throw new Error(`entryNum must be digits only, got: ${JSON.stringify(e)}`)}function hO(e){return pO(e),new RegExp(`(?:@${e}(?!\\d)|\\btra\\(${e}\\))`,"g")}function gO(e){return pO(e),new RegExp(`\\b(?:${jx})\\(${e}(?!\\d)|\\bfloater_rand\\(\\d+\\s*,\\s*${e}(?!\\d)`,"g")}var Zm=/^\/\*\* @tra ((\w+)\.(tra|msg)) \*\//,_O=/^\/\*\* @tra \w+\.(tra|msg) \*\//;function TJ(e){return e.replaceAll(/[\\\]^-]/g,"\\$&")}function Pr(e,t){return e.split(`
160
+ `)[t.line]?.substring(0,t.character)??""}function ep(e,t,n=""){let o=e.split(/\r?\n/g)[t.line];if(!o)return"";let s=t.character,a=AJ(o,s);if(a)return a;let c=IJ(o,s);if(c)return c;let l=TJ(n),u=o.slice(0,s+1).search(new RegExp(`[\\w${l}]+$`)),d=o.slice(s).search(new RegExp(`[^\\w${l}]`)),f;return d<0?f=o.slice(u):f=o.slice(u,d+s),yO(f)&&yO(f)&&(u=o.slice(0,s+1).search(/[^\s(]+\(?\d+$/),d=o.slice(s).search(/\W/),d<0?f=o.slice(u):f=o.slice(u,d+s)),f}function AJ(e,t){let n=/\btra\((\d+)\)/g;for(let r of e.matchAll(n)){if(!r[1])continue;let o=r.index+r[0].length;if(t>=r.index&&t<o)return r[0]}return null}function IJ(e,t){for(let n of e.matchAll(Jm)){let r=n[1],o=n[2];if(!r||!o)continue;let s=n.index+n[0].lastIndexOf(o),a=s+o.length;if(t>=s&&t<a)return`${r}(${o}`}for(let n of e.matchAll(Qm)){let r=n[1],o=n[2];if(!r||!o)continue;let s=n.index+n[0].indexOf(r),a=s+r.length;if(t>=s&&t<a)return`floater_rand(${r}`;let c=n.index+n[0].lastIndexOf(o),l=c+o.length;if(t>=c&&t<l)return`floater_rand(${o}`}return null}function yO(e){return/^\d+$/.test(e)}var hle=B(le());var DJ={[mt]:"fold",[At]:"exact",[_n]:"exact"};function bO(e){return DJ[e]??"exact"}function Bl(e,t){return t==="fold"?e.toLowerCase():e}var kJ=2e3,Yr=class{files=new Map;maxFiles;staticSymbols=[];byName=new Map;nameCase;allSymbolsCache=null;allSymbolsWithNavCache=null;invalidateAllSymbolsCache(){this.allSymbolsCache=null,this.allSymbolsWithNavCache=null}getAllSymbolsNoNav(){if(this.allSymbolsCache===null){let t=[];for(let n of this.files.values())for(let r of n)r.source.type!==Ee.Navigation&&t.push(r);t.push(...this.staticSymbols),this.allSymbolsCache=t}return this.allSymbolsCache}getAllSymbolsWithNav(){if(this.allSymbolsWithNavCache===null){let t=[];for(let n of this.files.values())for(let r of n)t.push(r);this.allSymbolsWithNavCache=t}return this.allSymbolsWithNavCache}constructor(t){this.maxFiles=t?.maxFiles??kJ,this.nameCase=t?.nameCase??"exact"}updateFile(t,n){this.removeFileFromIndices(t),this.files.delete(t),this.files.set(t,n);for(let r of n)this.addToNameIndex(r);if(this.files.size>this.maxFiles){let r=this.files.keys().next().value;r!==void 0&&(this.removeFileFromIndices(r),this.files.delete(r))}this.invalidateAllSymbolsCache()}clearFile(t){this.removeFileFromIndices(t),this.files.delete(t),this.invalidateAllSymbolsCache()}getFileSymbols(t){return this.files.get(t)??[]}loadStatic(t){for(let n of this.staticSymbols)this.removeFromNameIndex(n);this.staticSymbols=t;for(let n of t)this.addToNameIndex(n);this.invalidateAllSymbolsCache()}lookup(t,n){return this.lookupAll(t,n)[0]}nameCaseOf(t){return this.lookup(t)?.nameCase}lookupDefinition(t,n){return this.lookup(t,n)?.location??null}lookupAll(t,n){let r=this.byName.get(this.key(t))?.filter(o=>o.nameCase!=="exact"||o.name===t);return!r||r.length===0?[]:r.toSorted((o,s)=>this.compareScopePrecedence(o,s,n?.uri))}query(t){let n;if(t.excludeUri){n=[];for(let[r,o]of this.files)if(r!==t.excludeUri)for(let s of o)s.source.type!==Ee.Navigation&&n.push(s);n.push(...this.staticSymbols)}else n=[...this.getAllSymbolsNoNav()];if(t.prefix){let r=t.prefix.toLowerCase();n=n.filter(o=>o.name.toLowerCase().startsWith(r))}if(t.kinds&&t.kinds.length>0){let r=new Set(t.kinds);n=n.filter(o=>r.has(o.kind))}return t.uri&&(n=n.filter(r=>r.source.uri===t.uri||r.source.type===Ee.Static)),t.limit&&n.length>t.limit&&(n=n.slice(0,t.limit)),n}getVisibleSymbols(t,n){let r=[],o=new Set,s=this.files.get(t);if(s)for(let a of s)this.isVisibleInContext(a,t,n)&&(o.has(a.name)||(r.push(a),o.add(a.name)));for(let[a,c]of this.files)if(a!==t)for(let l of c)l.scope.level===kt.Workspace&&(o.has(l.name)||(r.push(l),o.add(l.name)));for(let a of this.staticSymbols)o.has(a.name)||(r.push(a),o.add(a.name));return r}searchWorkspaceSymbols(t,n=500,r){if(r?.isCancellationRequested)return[];let o=t.toLowerCase(),s=[],a=0,c=16;for(let l of this.getAllSymbolsWithNav()){if(++a%c===0&&r?.isCancellationRequested)return s;if(!(o&&!l.name.toLowerCase().includes(o))&&l.location&&(s.push({name:l.name,kind:uO(l.kind),containerName:l.source.displayPath,location:{uri:l.location.uri,range:l.location.range}}),s.length>=n))return s}return s}key(t){return Bl(t,this.nameCase)}addToNameIndex(t){let n=this.key(t.name),r=this.byName.get(n);r?r.push(t):this.byName.set(n,[t])}removeFromNameIndex(t){let n=this.key(t.name),r=this.byName.get(n);if(!r)return;let o=r.indexOf(t);o!==-1&&(r.splice(o,1),r.length===0&&this.byName.delete(n))}removeFileFromIndices(t){let n=this.files.get(t);if(n)for(let r of n)this.removeFromNameIndex(r)}compareScopePrecedence(t,n,r){let o=this.getScopePrecedenceScore(t,r),a=this.getScopePrecedenceScore(n,r)-o;if(a===0){let c=t.source.uri??"",l=n.source.uri??"";return c.localeCompare(l)}return a}getScopePrecedenceScore(t,n){let r=0;switch(t.source.type){case Ee.Document:r+=1e3;break;case Ee.Static:r+=200;break;case Ee.Workspace:r+=100;break;case Ee.External:r+=10;break}return t.source.uri===n&&(r+=500),r}isVisibleInContext(t,n,r){return t.scope.level===kt.Global||t.scope.level===kt.Workspace?!0:t.scope.level===kt.File?t.source.uri===n:t.scope.level===kt.Function?!r?.containerName||!t.scope.containerId?t.source.uri===n:t.scope.containerId===`${n}#${r.containerName}`:!r?.containerName||!t.scope.containerId?t.source.uri===n:t.scope.containerId===`${n}#${r.containerName}`}};var SO=[],tp=class{files=new Map;nameCase;constructor(t){this.nameCase=t?.nameCase??"exact"}updateFile(t,n){this.files.set(t,{byName:n,spellings:this.nameCase==="fold"?FJ(n):void 0})}removeFile(t){this.files.delete(t)}lookupUris(t,n=this.nameCase){let r=new Set;for(let[o,s]of this.files)wO(s,t,n).length>0&&r.add(o);return r}lookup(t,n=this.nameCase){let r=[];for(let o of this.files.values())for(let s of wO(o,t,n)){let a=o.byName.get(s);if(a)for(let c of a)r.push(c)}return r}};function wO(e,t,n){return n==="fold"&&e.spellings?e.spellings.get(Bl(t,"fold"))??SO:e.byName.has(t)?[t]:SO}function FJ(e){let t=new Map;for(let n of e.keys()){let r=Bl(n,"fold"),o=t.get(r);o?o.push(n):t.set(r,[n])}return t}var co=class{symbols;refs;constructor(t){let n=bO(t);this.symbols=new Yr({nameCase:n}),this.refs=new tp({nameCase:n})}updateFile(t,n){this.symbols.updateFile(t,n.symbols),this.refs.updateFile(t,n.refs)}refsOf(t){return this.refs.lookup(t,this.symbols.nameCaseOf(t))}removeFile(t){this.symbols.clearFile(t),this.refs.removeFile(t)}loadStatic(t){this.symbols.loadStatic(t)}};var vO=require("fs"),CO=B(require("path")),lo=B(le());var Ta={base_functions:"base_functions",engine_procedures:"engine_procedures",hooks:"hooks",key_functions:"key_functions",movie_functions:"movie_functions",preprocessor_directives:"preprocessor_directives",say_functions:"say_functions",sfall_functions:"sfall_functions",sound_functions:"sound_functions",window_functions:"window_functions"},Ple=[Ta.base_functions,Ta.key_functions,Ta.movie_functions,Ta.say_functions,Ta.sound_functions,Ta.window_functions],je={action_functions:"action_functions",action_macros:"action_macros",array_sort_type:"array_sort_type",component:"component",component_flag:"component_flag",dimorphic_functions:"dimorphic_functions",func_var_keyword:"func_var_keyword",opt_case:"opt_case",opt_exact:"opt_exact",opt_glob:"opt_glob",patch_functions:"patch_functions",patch_macros:"patch_macros"},Nle={[je.action_functions]:"action function ",[je.patch_functions]:"patch function ",[je.dimorphic_functions]:"dimorphic function ",[je.action_macros]:"action macro ",[je.patch_macros]:"patch macro "};var OJ={actions:K.Action,triggers:K.Trigger,keywords:K.Constant,functions:K.Function,procedures:K.Procedure,macros:K.Macro,variables:K.Variable,constants:K.Constant,[je.action_functions]:K.Function,[je.patch_functions]:K.Function,[je.dimorphic_functions]:K.Function,[je.action_macros]:K.Macro,[je.patch_macros]:K.Macro},MJ={[je.action_functions]:{context:"action",dtype:"function"},[je.patch_functions]:{context:"patch",dtype:"function"},[je.dimorphic_functions]:{context:"dimorphic",dtype:"function"},[je.action_macros]:{context:"action",dtype:"macro"},[je.patch_macros]:{context:"patch",dtype:"macro"}};function $J(e){switch(e){case lo.CompletionItemKind.Function:case lo.CompletionItemKind.Method:return K.Function;case lo.CompletionItemKind.Variable:return K.Variable;case lo.CompletionItemKind.Constant:return K.Constant;case lo.CompletionItemKind.Keyword:return K.Constant;case lo.CompletionItemKind.Snippet:return K.Macro;default:return K.Variable}}function On(e){let t=qJ(e);return!t||t.length===0?[]:t.map(n=>BJ(n))}function qJ(e){try{let t=CO.join(__dirname,`completion.${e}.json`);return JSON.parse((0,vO.readFileSync)(t,"utf-8"))}catch(t){T(`Failed to load static completion data for ${e}: ${t}`);return}}function BJ(e){let t=e.label,n=jJ(e),r=null,o=WJ(e),s={label:t,kind:lO(n),documentation:o.contents,category:e.category};e.detail&&(s.detail=e.detail),e.tags&&(s.tags=e.tags);let a={name:t,location:r,scope:{level:kt.Global},source:{type:Ee.Static,uri:null},completion:s,hover:o,signature:void 0};if(Bx.has(n)){let c=e.category?MJ[e.category]:void 0,l=c&&e.kind===lo.CompletionItemKind.Function?{context:c.context,dtype:c.dtype}:{},u=e.params?{...l,params:e.params}:l;return{...a,kind:n,callable:u}}return n===K.Variable||n===K.Parameter||n===K.LoopVariable?{...a,kind:n,variable:{}}:n===K.State?{...a,kind:n}:n===K.Component?{...a,kind:n}:{...a,kind:K.Constant,constant:{value:""}}}function jJ(e){if(e.category){let t=OJ[e.category];if(t!==void 0)return t}return e.kind!==void 0?$J(e.kind):K.Variable}function WJ(e){return e.documentation!==void 0?typeof e.documentation=="string"?{contents:{kind:"markdown",value:e.documentation}}:{contents:e.documentation}:{contents:{kind:"markdown",value:e.label}}}var GO=B(require("child_process")),ap=B(require("os")),Nr=B(require("path"));var UJ={q:"this compiler never waits for input",p:"this compiler always preprocesses",F:"this compiler's preprocessor emits no #line directives",w:"it has no effect in the reference either"};function PO(e){let t=Number.parseInt(e,10);return Number.isNaN(t)?0:t}function np(e){let t={},n=[],r=[],o=[],s=1,a=!1,c=!1,l=!1,u=!1,d=!1,f=!1,m=!1,p=!1,g=!1,h=0,y=!1,w=[...e];for(let b=w[0];b!==void 0&&b.startsWith("-");b=w[0]){if(w.shift(),b==="--help"||b==="-h"){m=!0;continue}if(b==="--decompile"){p=!0;continue}if(b==="--listing"){g=!0;continue}let S=b.slice(2);switch(b[1]){case"-":break;case"n":u=!0;break;case"w":case"q":case"p":case"F":{o.push({fatal:!1,noop:!0,message:`${b} does nothing here: ${UJ[b[1]]}.`});break}case"l":l=!0;break;case"d":d=!0;break;case"D":f=!0;break;case"s":a=!0;break;case"P":c=!0;break;case"x":p=!0;break;case"X":g=!0;break;case"j":h=Math.max(0,PO(S));break;case"O":s=S===""?2:PO(S),y=!0;break;case"b":o.push({fatal:!0,unsupported:"-b",message:"-b (backward compatibility) is not supported: it removes later keywords - switch, for, foreach, break, continue, pure, inline, tokenize - from the language so that old scripts may use them as names, which this compiler's grammar cannot express."});break;case"m":HJ(S,t,o);break;case"I":S!==""&&n.push(S);break;default:o.push({fatal:!1,message:`Unknown option ${b}`})}}p&&g&&o.push({fatal:!0,message:"-x and -X ask for different renderings of the same file; pass one or the other."});let _=p?"decompiling":g?"listing":"";if(_!==""){let b=[y&&"-O",n.length>0&&"-I",Object.keys(t).length>0&&"-m",a&&"-s",c&&"-P",f&&"-D"].filter(S=>S!==!1);b.length>0&&o.push({fatal:!0,message:`${b.join(", ")} ${b.length>1?"shape":"shapes"} a compile, which ${_} does not do.`})}s>2&&o.push({fatal:!1,message:`-O${s} is honoured as -O2: the passes above that level rename identifiers and share variable slots, which the reference compiler's own source marks as known to break code.`});for(let b=w.shift();b!==void 0;b=w.shift()){let S={file:b};if(w[0]==="-o"){w.shift();let N=w.shift();N===void 0?o.push({fatal:!0,message:`-o after ${b} needs an output path.`}):S.output=N}r.push(S)}return{level:s<1?0:s<2?1:2,shortCircuit:a,preprocessOnly:c,noLogo:l,noWarnings:u,debug:d,dumpTree:f,decompile:p,listing:g,help:m,defines:t,includeDirs:n,inputs:r,notices:o,jobs:h}}function HJ(e,t,n){if(e===""){n.push({fatal:!0,message:"-m needs a macro name, as in -mDEBUG or -mDEBUG=1."});return}let r=e.indexOf("="),o=r===-1?e:e.slice(0,r);if(o.includes("(")){n.push({fatal:!0,message:`-m${e} defines a macro that takes parameters, which is not supported on the command line.`});return}t[o]=r===-1?"1":e.slice(r+1)}var NO=B(require("child_process")),EO=B(require("fs")),RO=B(require("os")),rp=B(require("path"));function Wx(e){return e.startsWith("~/")||e==="~"?rp.join(RO.homedir(),e.slice(1)):e}var VJ=new Set(["wine","wine64","mono","dotnet","flatpak"]);function Ux(e){let t=rp.extname(e).toLowerCase();return t===".cmd"||t===".bat"}function jl(e){let t=e.trim();if(t==="")return{executable:e,prefixArgs:[]};let n=t.indexOf(" ");if(n===-1)return{executable:Wx(t),prefixArgs:[]};let r=t.slice(0,n);if(VJ.has(r.toLowerCase())){let o=t.slice(n+1).trim();return{executable:r,prefixArgs:o?[Wx(o)]:[]}}return{executable:Wx(t),prefixArgs:[]}}function ip(e,t,n,r,o=6e4){let s=Ux(e);return T(`${e} ${t.join(" ")}`),new Promise(a=>{NO.execFile(e,[...t],{cwd:n,shell:s,signal:r,timeout:o},(c,l,u)=>{T("stdout: "+l),u&&T("stderr: "+u),c&&T("error: "+c.message),a({err:c,stdout:l})})})}async function TO(e){try{await EO.promises.unlink(e)}catch(t){mf(t)!=="ENOENT"&&T(`Failed to clean up ${e}: ${at(t)}`,"warn")}}var Hx=B(require("fs"));function Aa(e){for(let t of e.values())t.abort();e.clear()}async function Wl(e){let{uri:t,activeCompiles:n,cleanupPaths:r,run:o}=e;n.get(t)?.abort();let s=new AbortController;n.set(t,s);try{await o(s.signal)}finally{n.delete(t),r&&await Promise.all(r.map(a=>TO(a)))}}async function Vx(e,t){await Hx.promises.unlink(e).catch(()=>{}),await Hx.promises.writeFile(e,t,{flag:"wx",mode:384})}async function AO(e){let{uri:t,tmpPath:n,text:r,activeCompiles:o,extraCleanupPaths:s,run:a}=e;return Wl({uri:t,activeCompiles:o,cleanupPaths:[n,...s??[]],run:async c=>{await Vx(n,r),await a(c)}})}var IO=B(require("path")),op=new Map;function DO(e,t){let n=IO.resolve(e),o=(op.get(n)??Promise.resolve()).then(t),s=o.then(()=>{},()=>{});return op.set(n,s),s.then(()=>{op.get(n)===s&&op.delete(n)}),o}var kO=B(require("crypto")),Ia=B(require("path"));function sp(e,t,n,r){let o=Ia.parse(e);if(!r){let s=kO.createHash("md5").update(n).digest("hex").slice(0,8);return Ia.join(Ji,`tmp-${s}-${o.name}.int`)}return Ia.resolve(t||o.dir,o.name+".int")}var FO=B(require("path")),LO=require("worker_threads");function Da(e){let{fileName:t,label:n,timeoutMs:r}=e,o=FO.join(__dirname,t),s={instance:null},a=new Map,c=0;function l(f){for(let[,m]of a)m.settle(),m.reject(new Error(f));a.clear()}function u(){if(s.instance)return s.instance;let f=new LO.Worker(o);return f.on("message",m=>{let p=a.get(m.id);a.delete(m.id),p&&(p.settle(),p.resolve(m))}),f.on("error",m=>{T(`${n} worker error: ${m.message}`),s.instance=null,l(`The ${n} failed to run: ${m.message}`)}),f.on("exit",m=>{s.instance=null,a.size>0&&l(`The ${n} stopped unexpectedly (exit ${m}).`)}),f.unref(),s.instance=f,f}function d(f,m){let p=c++;return new Promise((g,h)=>{if(m?.aborted){g(null);return}let y=setTimeout(()=>{a.delete(p),m?.removeEventListener("abort",w),h(new Error(`The ${n} did not answer within ${r/1e3}s.`))},r);y.unref?.();function w(){a.delete(p),clearTimeout(y),g(null)}m?.addEventListener("abort",w,{once:!0});let _=()=>{clearTimeout(y),m?.removeEventListener("abort",w)};a.set(p,{resolve:g,reject:h,settle:_});try{u().postMessage({...f,id:p})}catch(b){a.delete(p),_(),h(b instanceof Error?b:new Error(String(b)))}})}return{send:d,start:()=>{u()},stop:async()=>{let f=s.instance;s.instance=null,l(`The ${n} was shut down.`),f&&await f.terminate()}}}var GJ=6e4,OO=Da({fileName:"compile-worker.js",label:"SSL compiler",timeoutMs:GJ});async function MO(e){let t=await OO.send(e);if(t===null)throw new Error("The SSL compiler request was cancelled.");return{errors:t.errors,warnings:t.warnings}}async function $O(){await OO.stop()}var Ul=B(require("node:path")),Gx=B(require("node:fs"));var BO=require("child_process"),qO=Ul.default.join(__dirname,"sslc-wrapper.mjs"),zJ=[Ul.default.join(__dirname,"sslc-emscripten-noderawfs/sslc.mjs"),Ul.default.join(__dirname,"../../node_modules/sslc-emscripten-noderawfs/sslc.mjs")],KJ="BGFORGE_SSLC_ENTRY";function YJ(){return zJ.find(e=>Gx.default.existsSync(e))}async function jO(e){let t=YJ();if(!Gx.default.existsSync(qO)||t===void 0){let c="The WebAssembly compiler is missing from this installation. Reinstall the server or configure an external compiler path in settings.";return T(c),{returnCode:1,stdout:"",stderr:c}}let n=e.options.split(" ").map(c=>c.trim()).filter(Boolean);e.headersDir&&(n.some(c=>c.startsWith("-I"))&&(e.interactive&&Sr("Warning: -I switch is used but it will be ignored"),n=n.filter(c=>!c.startsWith("-I"))),n.push("-I"+Ul.default.resolve(e.headersDir))),n.push(e.inputFileName,"-o",e.outputFileName);let r;try{r=(0,BO.fork)(qO,n,{execArgv:[],cwd:e.cwd,env:{...process.env,[KJ]:t},silent:!0})}catch(c){let l=c instanceof Error?c.message:String(c);return T(`WebAssembly compiler fork failed: ${l}`),{returnCode:1,stdout:"",stderr:l}}r.stdin?.end();let o=[],s=[];r.stdout?.on("data",c=>{let l=c.toString();o.push(l)}),r.stderr?.on("data",c=>{let l=c.toString();s.push(l)});let a=e.timeoutMs??6e4;return new Promise(c=>{let l=!1;function u(f){l||(l=!0,clearTimeout(d),c(f))}let d=setTimeout(()=>{let f=`WebAssembly compiler timed out after ${a}ms`;r.killed||r.kill(),u({returnCode:1,stdout:o.join(""),stderr:f}),T(f)},a);r.on("error",f=>{T(`WebAssembly compiler fork error: ${f.message}`),s.push(f.message)}),r.on("close",f=>{e.debug&&T(`WebAssembly compiler:
161
161
  opts=`+JSON.stringify(e)+`
162
162
  cmdArgs=`+JSON.stringify(n)+`
163
163
  returnCode=`+f+`
164
164
  `+o.join("")+`
165
165
  `+s.join("")+`
166
- `),u({returnCode:f!==null?f:1,stdout:o.join(""),stderr:s.join("")})}),e.signal&&(e.signal.aborted?r.kill():e.signal.addEventListener("abort",()=>{r.killed||r.kill()},{once:!0}))})}var YJ=".ssl",Kx=".tmp.ssl";function XJ(e){if(sp.platform()==="win32"||!e.startsWith("Z:/"))return e;let t=sp.homedir(),n=e.replace("Z:/","");return Nr.join(t,n)}function WO(e,t){let n=XJ(e);return Nr.isAbsolute(n)?n:Nr.join(t,n)}function*UO(e,t){let n=e.exec(t);for(;n!==null;)n.index===e.lastIndex&&e.lastIndex++,yield n,n=e.exec(t)}function zO(e,t){let n=aA().get(t);if(!n)return{errors:[],warnings:[]};let r=/\[Error\]( <Semantic>)? <(.+)>:([\d]*):([\d]*):? (.*)/g,o=/\[Warning\] <(.+)>:([\d]*):([\d]*):? (.*)/g,s=[],a=[],c=et(t),l=Nr.dirname(c);try{for(let u of UO(r,e)){let d=u[2],f=u[3],m=u[4],p=u[5];!d||!f||!p||s.push({uri:Ye(WO(d,l)),line:parseInt(f,10),columnStart:0,columnEnd:parseInt(m||"1",10)-1,message:p})}for(let u of UO(o,e)){let d=u[1],f=u[2],m=u[3],p=u[4];if(!d||!f||!p)continue;let g=parseInt(f,10),h=g-1,y=n.offsetAt({line:h+1,character:0})-1,w=n.positionAt(y).character;a.push({uri:Ye(WO(d,l)),line:g,columnStart:parseInt(m||"0",10),columnEnd:w,message:p})}}catch(u){T(`fallout-ssl parse output failed: ${at(u)}`,"error")}return{errors:s,warnings:a}}async function JJ(e,t,n,r){let o=tp(r.compileOptions.split(/\s+/).filter(Boolean)),s=o.decompile?"-x":o.listing?"-X":"",c=(s===""?o.notices:[...o.notices,{fatal:!0,message:`${s} reads a compiled script, which this setting cannot do.`}]).filter(u=>u.fatal);if(c.length>0)return{errors:c.map(u=>({uri:Ye(t),line:1,columnStart:0,columnEnd:0,message:(u.unsupported?`bgforge.falloutSSL.compileOptions: remove ${u.unsupported}, or set bgforge.falloutSSL.compiler to "wasm", which supports it. `:"bgforge.falloutSSL.compileOptions: ")+u.message})),warnings:[]};let l=r.headersDirectory?[r.headersDirectory]:[];try{return await MO({text:e,filepath:t,dstPath:n,includeDirs:[...l,...o.includeDirs],defines:o.defines,level:o.level,shortCircuit:o.shortCircuit,noWarnings:o.noWarnings})}catch(u){let d=u instanceof Error?u.message:String(u);return{errors:[{uri:Ye(t),line:1,columnStart:0,columnEnd:0,message:d}],warnings:[]}}}function QJ(e,t,n){let r=zO(t,e);Wr(r,e,n)}var HO={path:null},VO=new Set,KO=new Map;function YO(){Aa(KO),$O()}async function ZJ(e){return e===HO.path?!0:new Promise(t=>{let{executable:n,prefixArgs:r}=Bl(e),o=Hx(n);GO.execFile(n,[...r,"--version"],{shell:o},s=>{T(`Compiler check '${e} --version' err=${s}`),s?t(!1):(HO.path=e,t(!0))})})}function e9(e,t,n,r,o){let{executable:s,prefixArgs:a}=Bl(e),c=[...a,...t,Kx,"-o",r];return rp(s,c,n,o)}async function XO(e,t,n=!1,r,o=!1){let s=et(e),a=Nr.dirname(s),c=Nr.join(a,Kx),l=Ye(c),u=Nr.parse(s),d=u.base,f=t.compileOptions.split(/\s+/).filter(Boolean),m=n||t.compileOnValidate,p=op(s,t.outputDirectory,e,m);if(u.ext.toLowerCase()!==YJ){T("Not a Fallout SSL file! Please focus a Fallout SSL file to compile."),n&&bn("Please focus a Fallout SSL file to compile!");return}T(`compiling ${d}...`),await jl({uri:e,activeCompiles:KO,cleanupPaths:m?[c]:[c,p],run:async g=>{let h=!t.compilePath||VO.has(t.compilePath);if(!h&&!await ZJ(t.compilePath))if(!n)h=!0;else if((await UA(`Failed to run '${t.compilePath}'! Switch to the extension's own compiler?`,{title:"Switch",id:"switch"},{title:"Cancel",id:"cancel"}))?.id==="switch")h=!0,VO.add(t.compilePath),bn("Using the extension's own compiler. To make this permanent, clear the bgforge.falloutSSL.compilePath setting.");else return;if(h&&t.compiler==="built-in"){let y=await JJ(r,s,p,t);if(g.aborted)return;Qc(y,n,`Compiled ${d}.`,`Failed to compile ${d}!`),Wr(y,e,Ye(s));return}await DO(a,async()=>{if(g.aborted)return;if(await Gx(c,r),h){let{stdout:b,returnCode:S}=await jO({interactive:n,cwd:a,inputFileName:Kx,outputFileName:p,options:t.compileOptions,headersDir:t.headersDirectory,signal:g,debug:o});if(g.aborted)return;S===0?n&&bn(`Compiled ${d}.`):n&&ir(`Failed to compile ${d}!`),QJ(e,b,l);return}let{err:y,stdout:w}=await e9(t.compilePath,f,a,p,g);if(g.aborted)return;let _=zO(w,e);y&&_.errors.length===0&&(_=mf(_,y,Ye(s),w)),Qc(_,n,`Compiled ${d}.`,`Failed to compile ${d}!`),Wr(_,e,l)})}})}var JO=B(le());function ka(e,t){let n=e.split(`
167
- `),r=n[n.length-1]??"";return[JO.TextEdit.replace({start:{line:0,character:0},end:{line:n.length-1,character:r.length}},t)]}function QO(e){return e.type==="ERROR"||e.isError||e.isMissing}function Yx(e){if(QO(e))return e;if(!e.hasError)return null;for(let t of e.children){if(!t)continue;let n=Yx(t);if(n)return n}return null}function ap(e){let t=[];return ZO(e,t),t}function ZO(e,t){if(QO(e)){t.push(e);return}if(e.hasError)for(let n of e.children)n&&ZO(n,t)}function Er(e){return e.startsWith("\uFEFF")?e.slice(1):e}function pi(e){let t=Yx(e);if(t){let{row:n,column:r}=t.startPosition,o=t.isMissing?"MISSING":"ERROR";throw new Error(`${n+1}:${r+1}: Parse ${o}`)}}function Fa(e){let t=e.trim();if(!t.startsWith("//"))return t;let n=t.slice(2);if(/^\/+$/.test(n))return t;let r=n.trimStart();return r.length===0?"//":`// ${r}`}function tM(e){let t=e.trim();if(!t.startsWith("/*"))return t;let n=t.slice(2,-2),r=n.startsWith("*");if(n.includes(`
166
+ `),u({returnCode:f!==null?f:1,stdout:o.join(""),stderr:s.join("")})}),e.signal&&(e.signal.aborted?r.kill():e.signal.addEventListener("abort",()=>{r.killed||r.kill()},{once:!0}))})}var XJ=".ssl",zx=".tmp.ssl";function JJ(e){if(ap.platform()==="win32"||!e.startsWith("Z:/"))return e;let t=ap.homedir(),n=e.replace("Z:/","");return Nr.join(t,n)}function WO(e,t){let n=JJ(e);return Nr.isAbsolute(n)?n:Nr.join(t,n)}function*UO(e,t){let n=e.exec(t);for(;n!==null;)n.index===e.lastIndex&&e.lastIndex++,yield n,n=e.exec(t)}function zO(e,t){let n=sA().get(t);if(!n)return{errors:[],warnings:[]};let r=/\[Error\]( <Semantic>)? <(.+)>:([\d]*):([\d]*):? (.*)/g,o=/\[Warning\] <(.+)>:([\d]*):([\d]*):? (.*)/g,s=[],a=[],c=et(t),l=Nr.dirname(c);try{for(let u of UO(r,e)){let d=u[2],f=u[3],m=u[4],p=u[5];!d||!f||!p||s.push({uri:Ye(WO(d,l)),line:parseInt(f,10),columnStart:0,columnEnd:parseInt(m||"1",10)-1,message:p})}for(let u of UO(o,e)){let d=u[1],f=u[2],m=u[3],p=u[4];if(!d||!f||!p)continue;let g=parseInt(f,10),h=g-1,y=n.offsetAt({line:h+1,character:0})-1,w=n.positionAt(y).character;a.push({uri:Ye(WO(d,l)),line:g,columnStart:parseInt(m||"0",10),columnEnd:w,message:p})}}catch(u){T(`fallout-ssl parse output failed: ${at(u)}`,"error")}return{errors:s,warnings:a}}async function QJ(e,t,n,r){let o=np(r.compileOptions.split(/\s+/).filter(Boolean)),s=o.decompile?"-x":o.listing?"-X":"",c=(s===""?o.notices:[...o.notices,{fatal:!0,message:`${s} reads a compiled script, which this setting cannot do.`}]).filter(u=>u.fatal);if(c.length>0)return{errors:c.map(u=>({uri:Ye(t),line:1,columnStart:0,columnEnd:0,message:(u.unsupported?`bgforge.falloutSSL.compileOptions: remove ${u.unsupported}, or set bgforge.falloutSSL.compiler to "wasm", which supports it. `:"bgforge.falloutSSL.compileOptions: ")+u.message})),warnings:[]};let l=r.headersDirectory?[r.headersDirectory]:[];try{return await MO({text:e,filepath:t,dstPath:n,includeDirs:[...l,...o.includeDirs],defines:o.defines,level:o.level,shortCircuit:o.shortCircuit,noWarnings:o.noWarnings})}catch(u){let d=u instanceof Error?u.message:String(u);return{errors:[{uri:Ye(t),line:1,columnStart:0,columnEnd:0,message:d}],warnings:[]}}}function ZJ(e,t,n){let r=zO(t,e);Wr(r,e,n)}var HO={path:null},VO=new Set,KO=new Map;function YO(){Aa(KO),$O()}async function e9(e){return e===HO.path?!0:new Promise(t=>{let{executable:n,prefixArgs:r}=jl(e),o=Ux(n);GO.execFile(n,[...r,"--version"],{shell:o},s=>{T(`Compiler check '${e} --version' err=${s}`),s?t(!1):(HO.path=e,t(!0))})})}function t9(e,t,n,r,o){let{executable:s,prefixArgs:a}=jl(e),c=[...a,...t,zx,"-o",r];return ip(s,c,n,o)}async function XO(e,t,n=!1,r,o=!1){let s=et(e),a=Nr.dirname(s),c=Nr.join(a,zx),l=Ye(c),u=Nr.parse(s),d=u.base,f=t.compileOptions.split(/\s+/).filter(Boolean),m=n||t.compileOnValidate,p=sp(s,t.outputDirectory,e,m);if(u.ext.toLowerCase()!==XJ){T("Not a Fallout SSL file! Please focus a Fallout SSL file to compile."),n&&bn("Please focus a Fallout SSL file to compile!");return}T(`compiling ${d}...`),await Wl({uri:e,activeCompiles:KO,cleanupPaths:m?[c]:[c,p],run:async g=>{let h=!t.compilePath||VO.has(t.compilePath);if(!h&&!await e9(t.compilePath))if(!n)h=!0;else if((await UA(`Failed to run '${t.compilePath}'! Switch to the extension's own compiler?`,{title:"Switch",id:"switch"},{title:"Cancel",id:"cancel"}))?.id==="switch")h=!0,VO.add(t.compilePath),bn("Using the extension's own compiler. To make this permanent, clear the bgforge.falloutSSL.compilePath setting.");else return;if(h&&t.compiler==="built-in"){let y=await QJ(r,s,p,t);if(g.aborted)return;Zc(y,n,`Compiled ${d}.`,`Failed to compile ${d}!`),Wr(y,e,Ye(s));return}await DO(a,async()=>{if(g.aborted)return;if(await Vx(c,r),h){let{stdout:b,returnCode:S}=await jO({interactive:n,cwd:a,inputFileName:zx,outputFileName:p,options:t.compileOptions,headersDir:t.headersDirectory,signal:g,debug:o});if(g.aborted)return;S===0?n&&bn(`Compiled ${d}.`):n&&ir(`Failed to compile ${d}!`),ZJ(e,b,l);return}let{err:y,stdout:w}=await t9(t.compilePath,f,a,p,g);if(g.aborted)return;let _=zO(w,e);y&&_.errors.length===0&&(_=pf(_,y,Ye(s),w)),Zc(_,n,`Compiled ${d}.`,`Failed to compile ${d}!`),Wr(_,e,l)})}})}var JO=B(le());function ka(e,t){let n=e.split(`
167
+ `),r=n[n.length-1]??"";return[JO.TextEdit.replace({start:{line:0,character:0},end:{line:n.length-1,character:r.length}},t)]}function QO(e){return e.type==="ERROR"||e.isError||e.isMissing}function Kx(e){if(QO(e))return e;if(!e.hasError)return null;for(let t of e.children){if(!t)continue;let n=Kx(t);if(n)return n}return null}function cp(e){let t=[];return ZO(e,t),t}function ZO(e,t){if(QO(e)){t.push(e);return}if(e.hasError)for(let n of e.children)n&&ZO(n,t)}function Er(e){return e.startsWith("\uFEFF")?e.slice(1):e}function pi(e){let t=Kx(e);if(t){let{row:n,column:r}=t.startPosition,o=t.isMissing?"MISSING":"ERROR";throw new Error(`${n+1}:${r+1}: Parse ${o}`)}}function Fa(e){let t=e.trim();if(!t.startsWith("//"))return t;let n=t.slice(2);if(/^\/+$/.test(n))return t;let r=n.trimStart();return r.length===0?"//":`// ${r}`}function tM(e){let t=e.trim();if(!t.startsWith("/*"))return t;let n=t.slice(2,-2),r=n.startsWith("*");if(n.includes(`
168
168
  `)){let s=n;return!r&&s.length>0&&s[0]!==`
169
169
  `&&(s=s.replace(/^[ \t]*/," ")),s.length>0&&!s.endsWith(`
170
- `)&&(s=s.replace(/[ \t]*$/," ")),`/*${s}*/`}let o=n.trim();if(o.length===0)return"/* */";if(r){let s=o.slice(1).trim();return s.length===0?"/** */":`/** ${s} */`}return`/* ${o} */`}function ee(e){let t=e.trim();return t.startsWith("//")?Fa(t):t.startsWith("/*")?tM(t):t}var eM=5;function Ul(e,t){let n=t,r=0;for(;n<e.length&&e[n]==="~";)r++,n++;let o=r>=eM?eM:1,s=t+o,a=e.indexOf("~".repeat(o),s);return{delimLen:o,contentStart:s,closerStart:a}}function nM(e,t){let n="",r=0;for(;r<e.length;){if(t.handleTildeStrings&&e[r]==="~"){let{delimLen:o,contentStart:s,closerStart:a}=Ul(e,r);n+=e.slice(r,s),a!==-1?(n+=e.slice(s,a+o),r=a+o):r=s;continue}if(e[r]==='"'){let o=r++;for(;r<e.length&&e[r]!=='"';)e[r]==="\\"&&r++,r++;n+=e.slice(o,++r);continue}if(e[r]==="/"&&e[r+1]==="*"){let o=e.indexOf("*/",r+2);r=o!==-1?o+2:e.length;continue}if(e[r]==="/"&&e[r+1]==="/"){for(;r<e.length&&e[r]!==`
171
- `;)r++;continue}n+=e[r++]}return n}function ns(e){return nM(e,{handleTildeStrings:!0})}function La(e){let t=[],n=0,r=0,o=s=>{s>r&&t.push({type:0,text:e.slice(r,s)})};for(;n<e.length;){if(e[n]==="~"){let{delimLen:s,contentStart:a,closerStart:c}=Ul(e,n);c!==-1?(o(n),t.push({type:1,text:e.slice(n,c+s)}),n=c+s,r=n):n=a;continue}if(e[n]==='"'){let s=n++;for(;n<e.length&&e[n]!=='"';)e[n]==="\\"&&n++,n++;n<e.length&&n++,o(s),t.push({type:1,text:e.slice(s,n)}),r=n;continue}if(e[n]==="%"){let s=n++,a=e.indexOf("%",n);a!==-1&&(o(s),t.push({type:1,text:e.slice(s,a+1)}),n=a+1,r=n);continue}if(e[n]==="/"&&e[n+1]==="*"){let s=n,a=e.indexOf("*/",n+2);n=a!==-1?a+2:e.length,o(s),t.push({type:2,text:e.slice(s,n)}),r=n;continue}if(e[n]==="/"&&e[n+1]==="/"){let s=n;for(;n<e.length&&e[n]!==`
172
- `;)n++;o(s),t.push({type:2,text:e.slice(s,n)}),r=n;continue}n++}return o(e.length),t}function uo(e){let t=La(e),n=[];for(let r of t)if(r.type===0){let o=r.text.replaceAll(/\s+/g," ");n.push(o)}else n.push(r.text);return n.join("").trim()}function Xx(e){return nM(e,{handleTildeStrings:!1})}function Jx(e,t,n){let r=a=>n(a).replaceAll(/\s+/g,""),o=r(e),s=r(t);if(o!==s){let a=Math.min(o.length,s.length),c=0;for(;c<a&&o[c]===s[c];)c++;let l=20,u=o.slice(Math.max(0,c-l),c+l),d=s.slice(Math.max(0,c-l),c+l);return`content changed at position ${c}: "${u}" vs "${d}"`}return null}var t9=new Map([["orelse","orElse"],["andalso","andAlso"]]);function ge(e){let t=e.toLowerCase();return t9.get(t)??t}var n9=new Set(["and","andalso","begin","break","bwand","bwnot","bwor","bwxor","call","callstart","cancel","cancelall","case","continue","critical","default","detach","div","do","else","end","endcritical","exec","exit","export","false","floor","for","foreach","fork","if","import","in","inline","noop","not","or","orelse","procedure","pure","return","spawn","startcritical","switch","then","true","variable","wait","when","while"]);function Qx(e){let t=e.childForFieldName("op")?.text;return t===void 0?"":ge(t)}function r9(e){let t="",n=0;for(;n<e.length;){let r=e.indexOf('"',n),o=r===-1?e.slice(n):e.slice(n,r);if(t+=o.replaceAll(/[A-Za-z_][A-Za-z0-9_]*/g,a=>n9.has(a.toLowerCase())?ge(a):a),r===-1)return t;let s=r+1;for(;s<e.length&&e[s]!=='"';)s+=e[s]==="\\"?2:1;t+=e.slice(r,Math.min(s+1,e.length)),n=s+1}return t}function Zx(e){return r9(Xx(e))}function ye(e,t=0,n=0){if(!e)return"";if(e.type==="ERROR")return e.text;switch(e.type){case"binary_expr":return i9(e,t,n);case"unary_expr":return o9(e);case"ternary_expr":return s9(e);case"call_expr":return rM(e,t,n);case"subscript_expr":return a9(e);case"member_expr":return c9(e);case"paren_expr":{let r=e.children[1];return(!r||r.type==="comment"||r.type==="line_comment")&&zt(`Unexpected paren_expr structure: ${e.text}`,e.startPosition.row+1,e.startPosition.column+1),`(${ye(r,t+1,n>0?n-1:0)})`}case"array_expr":return l9(e,t,n);case"map_expr":return u9(e,t,n);case"proc_ref":{let r=e.children[1];return(!r||r.type!=="identifier")&&zt(`Unexpected proc_ref structure: ${e.text}`,e.startPosition.row+1,e.startPosition.column+1),`@${r.text}`}case"identifier":return e.text;case"boolean":return ge(e.text);case"number":case"string":return e.text;case"for_var_decl":{let r=e.childForFieldName("name"),o=e.childForFieldName("value");(!r||!o)&&zt(`Malformed for_var_decl: ${e.text}`,e.startPosition.row+1,e.startPosition.column+1);let s=e.children.find(a=>a.text===":="||a.text==="=")?.text||"=";return`${ge("variable")} ${r.text} ${s} ${ye(o)}`}case"for_init_assign":{let r=e.childForFieldName("name"),o=e.childForFieldName("value");(!r||!o)&&zt(`Malformed for_init_assign: ${e.text}`,e.startPosition.row+1,e.startPosition.column+1);let s=e.children.find(a=>a.text===":="||a.text==="=")?.text||"=";return`${r.text} ${s} ${ye(o)}`}default:return e.text}}function ev(e){return Qx(e)}function tv(e,t){let n=e.childForFieldName("left"),r=e.childForFieldName("right"),o=[];return n?.type==="binary_expr"&&ev(n)===t?o.push(...tv(n,t)):n&&o.push(n),r?.type==="binary_expr"&&ev(r)===t?o.push(...tv(r,t)):r&&o.push(r),o}function i9(e,t=0,n=0){let r=wn(),o=e.childForFieldName("left"),s=e.childForFieldName("right"),a=ev(e);if(["or","and","bwor","bwand","bwxor"].includes(a)){let d=tv(e,a),m=d.map(y=>ye(y)).join(` ${a} `);if(t+m.length+n<=r.lineLimit)return m;let p=t+a.length+1,g=d.map((y,w)=>ye(y,w===0?t:p)),h=" ".repeat(t);return g.join(`
173
- ${h}${a} `)}let l=ye(o,t),u=t+l.length+a.length+2;return`${l} ${a} ${ye(s,u)}`}function o9(e){let t=Qx(e),n=e.childForFieldName("expr");return e.children[0]?.text==="++"||e.children[0]?.text==="--"?`${t}${ye(n)}`:e.children[1]?.text==="++"||e.children[1]?.text==="--"?`${ye(n)}${t}`:t==="-"?`${t}${ye(n)}`:`${t} ${ye(n)}`}function s9(e){let t=e.childForFieldName("true_value"),n=e.childForFieldName("cond"),r=e.childForFieldName("false_value");return`${ye(t)} if ${ye(n)} else ${ye(r)}`}function rM(e,t=0,n=0){let r=wn(),s=e.childForFieldName("func")?.text||"",c=e.namedChildren.slice(1).filter(d=>d.type!=="comment").map(d=>ye(d)),l=`${s}(${c.join(", ")})`;if(t+l.length+n<=r.lineLimit||c.length<=1)return l;let u=" ".repeat(t+s.length+1);return`${s}(${c.join(`,
174
- `+u)})`}function a9(e){let t=e.childForFieldName("object"),n=e.childForFieldName("index");return`${ye(t)}[${ye(n)}]`}function c9(e){let t=e.childForFieldName("object"),n=e.childForFieldName("member");return`${ye(t)}.${n?.text||""}`}function l9(e,t=0,n=0){let r=wn(),o=[];for(let c of e.children)c.type!=="["&&c.type!=="]"&&c.type!==","&&!hi(c)&&o.push(ye(c));let s=`[${o.join(", ")}]`;if(t+s.length+n<=r.lineLimit||o.length<=1)return s;let a=" ".repeat(t+1);return`[${o.join(`,
175
- `+a)}]`}function u9(e,t=0,n=0){let r=wn(),o=[];for(let c of e.children)if(c.type==="map_entry"){let l=c.childForFieldName("key"),u=c.childForFieldName("value");o.push(`${ye(l)}: ${ye(u)}`)}let s=`{${o.join(", ")}}`;if(t+s.length+n<=r.lineLimit||o.length<=1)return s;let a=" ".repeat(t+1);return`{${o.join(`,
176
- `+a)}}`}function iM(e){let t=e.childForFieldName("target"),n=e.childForFieldName("delay");if(!t)return e.text;let r=`${ge("call")} `;return t.type==="call_expr"?r+=rM(t):r+=t.text,n&&(r+=` in ${ye(n)}`),r+";"}function oM(e){let t=e.childForFieldName("left"),n=e.childForFieldName("right"),r="=";for(let o of e.children)if(["=",":=","+=","-=","*=","/="].includes(o.text)){r=o.text;break}return`${ye(t)} ${r} ${ye(n)};`}function sM(e,t){let n=wn(),r=e.children.find(a=>a.type!==";");if(!r)return"";let o=e.children.some(a=>a.text===";"),s=t*n.indent.length;return ye(r,s)+(o?";":"")}function nv(e,t,n=!1){let r=wn(),o=e.childForFieldName("cond"),s=e.childForFieldName("then"),a=e.childForFieldName("else"),c=s?.type==="block",l=e.children.find(S=>S.type==="then"),u=l?.startPosition.row??-1,d=[],f="";if(a)for(let S of e.children)(S.type==="comment"||S.type==="line_comment")&&S.startPosition.row>=(s?.endPosition.row??0)&&S.startPosition.row<a.startPosition.row&&d.push(ee(S.text));for(let S of e.children)if((S.type==="comment"||S.type==="line_comment")&&S.startPosition.row===u&&l&&S.startPosition.column>l.endPosition.column){f=r.indent+ee(S.text);break}let m=t*r.indent.length+(n?8:3),g=ye(o,m,c?11:5),h=g.includes(`
170
+ `)&&(s=s.replace(/[ \t]*$/," ")),`/*${s}*/`}let o=n.trim();if(o.length===0)return"/* */";if(r){let s=o.slice(1).trim();return s.length===0?"/** */":`/** ${s} */`}return`/* ${o} */`}function ee(e){let t=e.trim();return t.startsWith("//")?Fa(t):t.startsWith("/*")?tM(t):t}var eM=5;function Hl(e,t){let n=t,r=0;for(;n<e.length&&e[n]==="~";)r++,n++;let o=r>=eM?eM:1,s=t+o,a=e.indexOf("~".repeat(o),s);return{delimLen:o,contentStart:s,closerStart:a}}function nM(e,t){let n="",r=0;for(;r<e.length;){if(t.handleTildeStrings&&e[r]==="~"){let{delimLen:o,contentStart:s,closerStart:a}=Hl(e,r);n+=e.slice(r,s),a!==-1?(n+=e.slice(s,a+o),r=a+o):r=s;continue}if(e[r]==='"'){let o=r++;for(;r<e.length&&e[r]!=='"';)e[r]==="\\"&&r++,r++;n+=e.slice(o,++r);continue}if(e[r]==="/"&&e[r+1]==="*"){let o=e.indexOf("*/",r+2);r=o!==-1?o+2:e.length;continue}if(e[r]==="/"&&e[r+1]==="/"){for(;r<e.length&&e[r]!==`
171
+ `;)r++;continue}n+=e[r++]}return n}function ns(e){return nM(e,{handleTildeStrings:!0})}function La(e){let t=[],n=0,r=0,o=s=>{s>r&&t.push({type:0,text:e.slice(r,s)})};for(;n<e.length;){if(e[n]==="~"){let{delimLen:s,contentStart:a,closerStart:c}=Hl(e,n);c!==-1?(o(n),t.push({type:1,text:e.slice(n,c+s)}),n=c+s,r=n):n=a;continue}if(e[n]==='"'){let s=n++;for(;n<e.length&&e[n]!=='"';)e[n]==="\\"&&n++,n++;n<e.length&&n++,o(s),t.push({type:1,text:e.slice(s,n)}),r=n;continue}if(e[n]==="%"){let s=n++,a=e.indexOf("%",n);a!==-1&&(o(s),t.push({type:1,text:e.slice(s,a+1)}),n=a+1,r=n);continue}if(e[n]==="/"&&e[n+1]==="*"){let s=n,a=e.indexOf("*/",n+2);n=a!==-1?a+2:e.length,o(s),t.push({type:2,text:e.slice(s,n)}),r=n;continue}if(e[n]==="/"&&e[n+1]==="/"){let s=n;for(;n<e.length&&e[n]!==`
172
+ `;)n++;o(s),t.push({type:2,text:e.slice(s,n)}),r=n;continue}n++}return o(e.length),t}function uo(e){let t=La(e),n=[];for(let r of t)if(r.type===0){let o=r.text.replaceAll(/\s+/g," ");n.push(o)}else n.push(r.text);return n.join("").trim()}function Yx(e){return nM(e,{handleTildeStrings:!1})}function Xx(e,t,n){let r=a=>n(a).replaceAll(/\s+/g,""),o=r(e),s=r(t);if(o!==s){let a=Math.min(o.length,s.length),c=0;for(;c<a&&o[c]===s[c];)c++;let l=20,u=o.slice(Math.max(0,c-l),c+l),d=s.slice(Math.max(0,c-l),c+l);return`content changed at position ${c}: "${u}" vs "${d}"`}return null}var n9=new Map([["orelse","orElse"],["andalso","andAlso"]]);function ge(e){let t=e.toLowerCase();return n9.get(t)??t}var r9=new Set(["and","andalso","begin","break","bwand","bwnot","bwor","bwxor","call","callstart","cancel","cancelall","case","continue","critical","default","detach","div","do","else","end","endcritical","exec","exit","export","false","floor","for","foreach","fork","if","import","in","inline","noop","not","or","orelse","procedure","pure","return","spawn","startcritical","switch","then","true","variable","wait","when","while"]);function Jx(e){let t=e.childForFieldName("op")?.text;return t===void 0?"":ge(t)}function i9(e){let t="",n=0;for(;n<e.length;){let r=e.indexOf('"',n),o=r===-1?e.slice(n):e.slice(n,r);if(t+=o.replaceAll(/[A-Za-z_][A-Za-z0-9_]*/g,a=>r9.has(a.toLowerCase())?ge(a):a),r===-1)return t;let s=r+1;for(;s<e.length&&e[s]!=='"';)s+=e[s]==="\\"?2:1;t+=e.slice(r,Math.min(s+1,e.length)),n=s+1}return t}function Qx(e){return i9(Yx(e))}function ye(e,t=0,n=0){if(!e)return"";if(e.type==="ERROR")return e.text;switch(e.type){case"binary_expr":return o9(e,t,n);case"unary_expr":return s9(e);case"ternary_expr":return a9(e);case"call_expr":return rM(e,t,n);case"subscript_expr":return c9(e);case"member_expr":return l9(e);case"paren_expr":{let r=e.children[1];return(!r||r.type==="comment"||r.type==="line_comment")&&zt(`Unexpected paren_expr structure: ${e.text}`,e.startPosition.row+1,e.startPosition.column+1),`(${ye(r,t+1,n>0?n-1:0)})`}case"array_expr":return u9(e,t,n);case"map_expr":return d9(e,t,n);case"proc_ref":{let r=e.children[1];return(!r||r.type!=="identifier")&&zt(`Unexpected proc_ref structure: ${e.text}`,e.startPosition.row+1,e.startPosition.column+1),`@${r.text}`}case"identifier":return e.text;case"boolean":return ge(e.text);case"number":case"string":return e.text;case"for_var_decl":{let r=e.childForFieldName("name"),o=e.childForFieldName("value");(!r||!o)&&zt(`Malformed for_var_decl: ${e.text}`,e.startPosition.row+1,e.startPosition.column+1);let s=e.children.find(a=>a.text===":="||a.text==="=")?.text||"=";return`${ge("variable")} ${r.text} ${s} ${ye(o)}`}case"for_init_assign":{let r=e.childForFieldName("name"),o=e.childForFieldName("value");(!r||!o)&&zt(`Malformed for_init_assign: ${e.text}`,e.startPosition.row+1,e.startPosition.column+1);let s=e.children.find(a=>a.text===":="||a.text==="=")?.text||"=";return`${r.text} ${s} ${ye(o)}`}default:return e.text}}function Zx(e){return Jx(e)}function ev(e,t){let n=e.childForFieldName("left"),r=e.childForFieldName("right"),o=[];return n?.type==="binary_expr"&&Zx(n)===t?o.push(...ev(n,t)):n&&o.push(n),r?.type==="binary_expr"&&Zx(r)===t?o.push(...ev(r,t)):r&&o.push(r),o}function o9(e,t=0,n=0){let r=wn(),o=e.childForFieldName("left"),s=e.childForFieldName("right"),a=Zx(e);if(["or","and","bwor","bwand","bwxor"].includes(a)){let d=ev(e,a),m=d.map(y=>ye(y)).join(` ${a} `);if(t+m.length+n<=r.lineLimit)return m;let p=t+a.length+1,g=d.map((y,w)=>ye(y,w===0?t:p)),h=" ".repeat(t);return g.join(`
173
+ ${h}${a} `)}let l=ye(o,t),u=t+l.length+a.length+2;return`${l} ${a} ${ye(s,u)}`}function s9(e){let t=Jx(e),n=e.childForFieldName("expr");return e.children[0]?.text==="++"||e.children[0]?.text==="--"?`${t}${ye(n)}`:e.children[1]?.text==="++"||e.children[1]?.text==="--"?`${ye(n)}${t}`:t==="-"?`${t}${ye(n)}`:`${t} ${ye(n)}`}function a9(e){let t=e.childForFieldName("true_value"),n=e.childForFieldName("cond"),r=e.childForFieldName("false_value");return`${ye(t)} if ${ye(n)} else ${ye(r)}`}function rM(e,t=0,n=0){let r=wn(),s=e.childForFieldName("func")?.text||"",c=e.namedChildren.slice(1).filter(d=>d.type!=="comment").map(d=>ye(d)),l=`${s}(${c.join(", ")})`;if(t+l.length+n<=r.lineLimit||c.length<=1)return l;let u=" ".repeat(t+s.length+1);return`${s}(${c.join(`,
174
+ `+u)})`}function c9(e){let t=e.childForFieldName("object"),n=e.childForFieldName("index");return`${ye(t)}[${ye(n)}]`}function l9(e){let t=e.childForFieldName("object"),n=e.childForFieldName("member");return`${ye(t)}.${n?.text||""}`}function u9(e,t=0,n=0){let r=wn(),o=[];for(let c of e.children)c.type!=="["&&c.type!=="]"&&c.type!==","&&!hi(c)&&o.push(ye(c));let s=`[${o.join(", ")}]`;if(t+s.length+n<=r.lineLimit||o.length<=1)return s;let a=" ".repeat(t+1);return`[${o.join(`,
175
+ `+a)}]`}function d9(e,t=0,n=0){let r=wn(),o=[];for(let c of e.children)if(c.type==="map_entry"){let l=c.childForFieldName("key"),u=c.childForFieldName("value");o.push(`${ye(l)}: ${ye(u)}`)}let s=`{${o.join(", ")}}`;if(t+s.length+n<=r.lineLimit||o.length<=1)return s;let a=" ".repeat(t+1);return`{${o.join(`,
176
+ `+a)}}`}function iM(e){let t=e.childForFieldName("target"),n=e.childForFieldName("delay");if(!t)return e.text;let r=`${ge("call")} `;return t.type==="call_expr"?r+=rM(t):r+=t.text,n&&(r+=` in ${ye(n)}`),r+";"}function oM(e){let t=e.childForFieldName("left"),n=e.childForFieldName("right"),r="=";for(let o of e.children)if(["=",":=","+=","-=","*=","/="].includes(o.text)){r=o.text;break}return`${ye(t)} ${r} ${ye(n)};`}function sM(e,t){let n=wn(),r=e.children.find(a=>a.type!==";");if(!r)return"";let o=e.children.some(a=>a.text===";"),s=t*n.indent.length;return ye(r,s)+(o?";":"")}function tv(e,t,n=!1){let r=wn(),o=e.childForFieldName("cond"),s=e.childForFieldName("then"),a=e.childForFieldName("else"),c=s?.type==="block",l=e.children.find(S=>S.type==="then"),u=l?.startPosition.row??-1,d=[],f="";if(a)for(let S of e.children)(S.type==="comment"||S.type==="line_comment")&&S.startPosition.row>=(s?.endPosition.row??0)&&S.startPosition.row<a.startPosition.row&&d.push(ee(S.text));for(let S of e.children)if((S.type==="comment"||S.type==="line_comment")&&S.startPosition.row===u&&l&&S.startPosition.column>l.endPosition.column){f=r.indent+ee(S.text);break}let m=t*r.indent.length+(n?8:3),g=ye(o,m,c?11:5),h=g.includes(`
177
177
  `),y=ge("if"),w=ge("then"),_=ge("else"),b;if(h?b=`${y} ${g}
178
178
  ${r.indent.repeat(t)}${w}`+f:b=`${y} ${g} ${w}`+f,c?(b+=" "+rs(s,t),d.forEach((S,N)=>{N===0?b+=r.indent+S:b+=`
179
179
  `+r.indent.repeat(t)+S})):s&&(b+=`
180
180
  `+r.indent.repeat(t+1)+Mn(s,t+1)),a){let S=c&&d.length===0?" ":`
181
- `+r.indent.repeat(t);a.type==="if_stmt"?b+=S+_+" "+nv(a,t,!0):a.type==="block"?b+=S+_+" "+rs(a,t):b+=S+_+`
181
+ `+r.indent.repeat(t);a.type==="if_stmt"?b+=S+_+" "+tv(a,t,!0):a.type==="block"?b+=S+_+" "+rs(a,t):b+=S+_+`
182
182
  `+r.indent.repeat(t+1)+Mn(a,t+1)}return b}function aM(e,t){let n=wn(),r=e.childForFieldName("cond"),o=e.childForFieldName("body"),s=o?.type==="block",a=t*n.indent.length+6,l=ye(r,a,s?9:3),u=l.includes(`
183
183
  `),d=ge("while"),f=ge("do"),m;return u?m=`${d} ${l}
184
184
  ${n.indent.repeat(t)}${f}`:m=`${d} ${l} ${f}`,s?m+=" "+rs(o,t):o&&(m+=`
185
185
  `+n.indent.repeat(t+1)+Mn(o,t+1)),m}function cM(e,t){let n=wn(),r=e.childForFieldName("init"),o=e.childForFieldName("cond"),s=e.childForFieldName("update"),a=e.childForFieldName("body"),c=r?ye(r):"",l=o?ye(o):"",u=s?ye(s):"",d=`${ge("for")} (${c}; ${l}; ${u})`;return a?.type==="block"?d+=" "+rs(a,t):a&&(d+=`
186
186
  `+n.indent.repeat(t+1)+Mn(a,t+1)),d}function lM(e,t){let n=wn(),r=e.childForFieldName("key"),o=e.childForFieldName("value"),s=e.children.find(y=>y.type==="variable"),a=e.children.some(y=>y.text==="("),c=e.childForFieldName("iter"),l=e.childForFieldName("while_cond"),u=e.childForFieldName("body"),d=r&&o?`${r.text}: ${o.text}`:r?.text??"",f=d?`${s?`${ge("variable")} `:""}${d} `:"",m=l?` ${ge("while")} ${ye(l)}`:"",p=`${f}${ge("in")} ${ye(c)}${m}`,g=ge("foreach"),h=a?`${g} (${p})`:`${g} ${p}`;return u?.type==="block"?h+" "+rs(u,t):u?h+`
187
- `+n.indent.repeat(t+1)+Mn(u,t+1):h}function uM(e,t){let n=wn(),r=e.childForFieldName("value"),o=[`${ge("switch")} ${ye(r)} ${ge("begin")}`];for(let s of e.children)s.type==="case_clause"?o.push(d9(s,t+1)):s.type==="default_clause"&&o.push(f9(s,t+1));return o.push(n.indent.repeat(t)+ge("end")),o.join(`
188
- `)}function dM(e,t,n,r){let o=wn(),s=[],a=r?.startPosition;for(let c of e.children){if(n.has(c.type)||a&&c.startPosition.row===a.row&&c.startPosition.column===a.column)continue;let l=Mn(c,t+1);l.trim()&&s.push(o.indent.repeat(t+1)+l)}return s}function d9(e,t){let n=wn(),r=e.childForFieldName("value"),o=dM(e,t,new Set(["case",":"]),r??void 0),s=n.indent.repeat(t)+`${ge("case")} ${ye(r)}:`;return o.length>0?s+`
187
+ `+n.indent.repeat(t+1)+Mn(u,t+1):h}function uM(e,t){let n=wn(),r=e.childForFieldName("value"),o=[`${ge("switch")} ${ye(r)} ${ge("begin")}`];for(let s of e.children)s.type==="case_clause"?o.push(f9(s,t+1)):s.type==="default_clause"&&o.push(m9(s,t+1));return o.push(n.indent.repeat(t)+ge("end")),o.join(`
188
+ `)}function dM(e,t,n,r){let o=wn(),s=[],a=r?.startPosition;for(let c of e.children){if(n.has(c.type)||a&&c.startPosition.row===a.row&&c.startPosition.column===a.column)continue;let l=Mn(c,t+1);l.trim()&&s.push(o.indent.repeat(t+1)+l)}return s}function f9(e,t){let n=wn(),r=e.childForFieldName("value"),o=dM(e,t,new Set(["case",":"]),r??void 0),s=n.indent.repeat(t)+`${ge("case")} ${ye(r)}:`;return o.length>0?s+`
189
189
  `+o.join(`
190
- `):s}function f9(e,t){let n=wn(),r=dM(e,t,new Set(["default",":"])),o=n.indent.repeat(t)+`${ge("default")}:`;return r.length>0?o+`
190
+ `):s}function m9(e,t){let n=wn(),r=dM(e,t,new Set(["default",":"])),o=n.indent.repeat(t)+`${ge("default")}:`;return r.length>0?o+`
191
191
  `+r.join(`
192
- `):o}var Xr={indentSize:4,lineLimit:120};function zt(e,t,n){throw new Error(`${t}:${n}: ${e}`)}var Ft={indent:" ",lineLimit:120};function wn(){return Ft}var m9=/^(begin|end)$/i,p9=/^(begin|end|procedure)$/i;function hi(e){return e.type==="comment"||e.type==="line_comment"}function rv(e,t){return t!==void 0&&hi(t)&&t.startPosition.row===is(e)}function is(e){return e.text.endsWith(`
192
+ `):o}var Xr={indentSize:4,lineLimit:120};function zt(e,t,n){throw new Error(`${t}:${n}: ${e}`)}var Ft={indent:" ",lineLimit:120};function wn(){return Ft}var p9=/^(begin|end)$/i,h9=/^(begin|end|procedure)$/i;function hi(e){return e.type==="comment"||e.type==="line_comment"}function nv(e,t){return t!==void 0&&hi(t)&&t.startPosition.row===is(e)}function is(e){return e.text.endsWith(`
193
193
  `)?e.endPosition.row-1:e.endPosition.row}function mM(e){let t=e.length;for(;t>0;){let o=e.codePointAt(t-1);if(o!==10&&o!==13)break;t--}let n=e.slice(0,t),r=n.indexOf("//");if(r>0){let o=n.slice(0,r).trimEnd(),s=n.slice(r);if(o&&!s.includes(`
194
194
  `))return o+Ft.indent+ee(s)}if(n.endsWith("*/")){let o=n.lastIndexOf("/*");if(o>0){let s=n.slice(o);if(!s.includes(`
195
195
  `)){let a=n.slice(0,o).trimEnd();if(a)return a+Ft.indent+ee(s)}}}return e.endsWith(`\r
196
196
  `)?e.slice(0,-2):e.endsWith(`
197
- `)?e.slice(0,-1):e}function iv(e,t=Xr){return pi(e),Ft={indent:" ".repeat(t.indentSize),lineLimit:t.lineLimit},{text:Mn(e,0).replaceAll("\r","")}}function Mn(e,t){if(e.type==="ERROR")return e.text;switch(e.type){case"source_file":{let r=h9(e,t).replaceAll(" ",Ft.indent).replace(/^\n+/,""),o=r.length;for(;o>0&&r.codePointAt(o-1)===10;)o--;return r.slice(0,o)+`
198
- `}case"preprocessor":return mM(e.text);case"comment":case"line_comment":return ee(e.text);case"procedure_forward":return _9(e);case"procedure":return y9(e,t);case"variable_decl":return S9(e,t);case"export_decl":return w9(e);case"if_stmt":return nv(e,t);case"while_stmt":return aM(e,t);case"for_stmt":return cM(e,t);case"foreach_stmt":return lM(e,t);case"switch_stmt":return uM(e,t);case"return_stmt":{let n=e.namedChildren[0],r=t*Ft.indent.length+7;return`${ge("return")}${n?" "+ye(n,r,1):""};`}case"call_stmt":return iM(e);case"assignment":return oM(e);case"expression_stmt":return sM(e,t);case"block":return rs(e,t);default:return e.text}}function h9(e,t){let n=[],r=e.children,o=!1;return r.forEach((s,a)=>{let c=r[a-1],l=r[a+1],u=c!==void 0&&s.startPosition.row-is(c)>1,d=rv(s,l);if(hi(s)){if(c&&is(c)===s.startPosition.row)return;let f=c?.type==="procedure"&&!u;n.length>0&&!f&&(o||u)&&(n.push(""),o=!1),n.push(ee(s.text)),f&&(o=!0)}else if(s.type==="preprocessor"){n.length>0&&(o||u)&&(n.push(""),o=!1);let f=mM(s.text);l&&l.type==="line_comment"&&l.startPosition.row===is(s)&&(f=f.trimEnd()+" "+ee(l.text)),n.push(f)}else if(s.type==="procedure"){if(n.length>0)if(o||u)n.push(""),o=!1;else{let m=n[n.length-1];m&&!m.startsWith("/*")&&!m.startsWith("//")&&n.push("")}let f=Mn(s,t);d&&l&&(f+=Ft.indent+ee(l.text)),n.push(f),o=!0}else{o&&n.length>0&&(n.push(""),o=!1);let f=Mn(s,t);d&&l&&(f+=Ft.indent+ee(l.text)),n.push(f)}}),n.join(`
199
- `)}function pM(e){let t=e.childForFieldName("critical"),n=e.childForFieldName("modifier");return`${t?`${ge(t.text)} `:""}${n?`${ge(n.text)} `:""}`}function g9(e){let t=e.childForFieldName("timed");if(t)return` ${ge("in")} ${Mn(t,0)}`;let n=e.childForFieldName("condition");return n?` ${ge("when")} ${Mn(n,0)}`:""}function _9(e){let t=e.childForFieldName("name")?.text||"",n=e.childForFieldName("params"),r=`${pM(e)}${ge("procedure")} ${t}`;return n?`${r}${hM(n)};`:`${r};`}function y9(e,t){let n=e.childForFieldName("name")?.text||"",r=e.childForFieldName("params"),s=`${`${pM(e)}${ge("procedure")} ${n}${r?hM(r):""}`}${g9(e)} ${ge("begin")}`,a=[],c=new Set(["identifier","param_list"]),l=new Set([e.childForFieldName("timed"),e.childForFieldName("condition")].filter(f=>f!==null).map(f=>f.id)),u=e.children;u.forEach((f,m)=>{let p=u[m+1],g=u[m-1];if(c.has(f.type)||l.has(f.id)||l.size>0&&/^(?:in|when)$/i.test(f.text)||p9.test(f.text)||f.type.includes("procedure"))return;let h=g!==void 0&&f.startPosition.row-is(g)>1,y=rv(f,p);if(hi(f)){if(g&&is(g)===f.startPosition.row)return;a.length>0&&h&&a.push(""),a.push(Ft.indent+ee(f.text))}else{a.length>0&&h&&a.push("");let w=Mn(f,t+1);y&&p&&(w+=Ft.indent+ee(p.text)),w.trim()&&a.push(Ft.indent+w)}});let d=ge("end");return a.length===0?`${s}
197
+ `)?e.slice(0,-1):e}function rv(e,t=Xr){return pi(e),Ft={indent:" ".repeat(t.indentSize),lineLimit:t.lineLimit},{text:Mn(e,0).replaceAll("\r","")}}function Mn(e,t){if(e.type==="ERROR")return e.text;switch(e.type){case"source_file":{let r=g9(e,t).replaceAll(" ",Ft.indent).replace(/^\n+/,""),o=r.length;for(;o>0&&r.codePointAt(o-1)===10;)o--;return r.slice(0,o)+`
198
+ `}case"preprocessor":return mM(e.text);case"comment":case"line_comment":return ee(e.text);case"procedure_forward":return y9(e);case"procedure":return b9(e,t);case"variable_decl":return w9(e,t);case"export_decl":return x9(e);case"if_stmt":return tv(e,t);case"while_stmt":return aM(e,t);case"for_stmt":return cM(e,t);case"foreach_stmt":return lM(e,t);case"switch_stmt":return uM(e,t);case"return_stmt":{let n=e.namedChildren[0],r=t*Ft.indent.length+7;return`${ge("return")}${n?" "+ye(n,r,1):""};`}case"call_stmt":return iM(e);case"assignment":return oM(e);case"expression_stmt":return sM(e,t);case"block":return rs(e,t);default:return e.text}}function g9(e,t){let n=[],r=e.children,o=!1;return r.forEach((s,a)=>{let c=r[a-1],l=r[a+1],u=c!==void 0&&s.startPosition.row-is(c)>1,d=nv(s,l);if(hi(s)){if(c&&is(c)===s.startPosition.row)return;let f=c?.type==="procedure"&&!u;n.length>0&&!f&&(o||u)&&(n.push(""),o=!1),n.push(ee(s.text)),f&&(o=!0)}else if(s.type==="preprocessor"){n.length>0&&(o||u)&&(n.push(""),o=!1);let f=mM(s.text);l&&l.type==="line_comment"&&l.startPosition.row===is(s)&&(f=f.trimEnd()+" "+ee(l.text)),n.push(f)}else if(s.type==="procedure"){if(n.length>0)if(o||u)n.push(""),o=!1;else{let m=n[n.length-1];m&&!m.startsWith("/*")&&!m.startsWith("//")&&n.push("")}let f=Mn(s,t);d&&l&&(f+=Ft.indent+ee(l.text)),n.push(f),o=!0}else{o&&n.length>0&&(n.push(""),o=!1);let f=Mn(s,t);d&&l&&(f+=Ft.indent+ee(l.text)),n.push(f)}}),n.join(`
199
+ `)}function pM(e){let t=e.childForFieldName("critical"),n=e.childForFieldName("modifier");return`${t?`${ge(t.text)} `:""}${n?`${ge(n.text)} `:""}`}function _9(e){let t=e.childForFieldName("timed");if(t)return` ${ge("in")} ${Mn(t,0)}`;let n=e.childForFieldName("condition");return n?` ${ge("when")} ${Mn(n,0)}`:""}function y9(e){let t=e.childForFieldName("name")?.text||"",n=e.childForFieldName("params"),r=`${pM(e)}${ge("procedure")} ${t}`;return n?`${r}${hM(n)};`:`${r};`}function b9(e,t){let n=e.childForFieldName("name")?.text||"",r=e.childForFieldName("params"),s=`${`${pM(e)}${ge("procedure")} ${n}${r?hM(r):""}`}${_9(e)} ${ge("begin")}`,a=[],c=new Set(["identifier","param_list"]),l=new Set([e.childForFieldName("timed"),e.childForFieldName("condition")].filter(f=>f!==null).map(f=>f.id)),u=e.children;u.forEach((f,m)=>{let p=u[m+1],g=u[m-1];if(c.has(f.type)||l.has(f.id)||l.size>0&&/^(?:in|when)$/i.test(f.text)||h9.test(f.text)||f.type.includes("procedure"))return;let h=g!==void 0&&f.startPosition.row-is(g)>1,y=nv(f,p);if(hi(f)){if(g&&is(g)===f.startPosition.row)return;a.length>0&&h&&a.push(""),a.push(Ft.indent+ee(f.text))}else{a.length>0&&h&&a.push("");let w=Mn(f,t+1);y&&p&&(w+=Ft.indent+ee(p.text)),w.trim()&&a.push(Ft.indent+w)}});let d=ge("end");return a.length===0?`${s}
200
200
  ${d}`:`${s}
201
201
  ${a.join(`
202
202
  `)}
203
- ${d}`}function hM(e){let t=[],n=!1;for(let r of e.children)r.type==="param"?(t.push(b9(r)),n=!1):r.text===","&&(n=!0);return`(${t.join(", ")}${n?",":""})`}function b9(e){let t=e.children.find(s=>s.type==="variable"),n=e.childForFieldName("name")?.text||"",r=e.childForFieldName("default"),o=t?`${ge("variable")} ${n}`:n;if(r){let s=e.children.find(a=>a.text===":="||a.text==="=")?.text||"=";o+=` ${s} ${ye(r)}`}return o}function S9(e,t=0){if(e.children.some(c=>c.text.match(/^begin$/i))){let c=[],l=[];for(let d of e.children)d.type==="var_init"?l.push(fM(d,t+1)):d.text===";"&&l.length>0&&(c.push(Ft.indent+l.join(", ")+";"),l=[]);return l.length>0&&c.push(Ft.indent+l.join(", ")+";"),`${ge("variable")} ${ge("begin")}
203
+ ${d}`}function hM(e){let t=[],n=!1;for(let r of e.children)r.type==="param"?(t.push(S9(r)),n=!1):r.text===","&&(n=!0);return`(${t.join(", ")}${n?",":""})`}function S9(e){let t=e.children.find(s=>s.type==="variable"),n=e.childForFieldName("name")?.text||"",r=e.childForFieldName("default"),o=t?`${ge("variable")} ${n}`:n;if(r){let s=e.children.find(a=>a.text===":="||a.text==="=")?.text||"=";o+=` ${s} ${ye(r)}`}return o}function w9(e,t=0){if(e.children.some(c=>c.text.match(/^begin$/i))){let c=[],l=[];for(let d of e.children)d.type==="var_init"?l.push(fM(d,t+1)):d.text===";"&&l.length>0&&(c.push(Ft.indent+l.join(", ")+";"),l=[]);return l.length>0&&c.push(Ft.indent+l.join(", ")+";"),`${ge("variable")} ${ge("begin")}
204
204
  ${c.join(`
205
205
  `)}
206
- ${ge("end")}`}let r=e.children.find(c=>c.type==="import"),o=e.children.some(c=>c.text===";"),s=`${r?`${ge("import")} `:""}${ge("variable")} `,a=[];for(let c of e.children)c.type==="var_init"&&a.push(fM(c,t,s.length));return`${s}${a.join(", ")}${o?";":""}`}function fM(e,t=0,n=0){let r=e.childForFieldName("name")?.text||"",o=e.childForFieldName("size"),s=e.childForFieldName("value"),a=r;if(o&&(a+=`[${ye(o)}]`),s){let c=e.children.find(u=>u.text===":="||u.text==="=")?.text||"=",l=t*Ft.indent.length+n+r.length+c.length+2;a+=` ${c} ${ye(s,l)}`}return a}function w9(e){let t=e.childForFieldName("name")?.text||"",n=e.childForFieldName("value"),r=`${ge("export")} ${ge("variable")} ${t}`;if(n){let o=e.children.find(s=>s.text===":="||s.text==="=")?.text||"=";return`${r} ${o} ${ye(n)};`}return`${r};`}function rs(e,t){let n=[],r=e.children,o="",s="",a=e.startPosition.row,c=e.endPosition.row;for(let d of r)if(hi(d)&&d.startPosition.row===c){s=Ft.indent+ee(d.text);break}r.forEach((d,f)=>{let m=r[f+1],p=r[f-1];if(m9.test(d.text))return;if(hi(d)&&d.startPosition.row===a){o=Ft.indent+ee(d.text);return}if(hi(d)&&d.startPosition.row===c)return;let g=rv(d,m);if(hi(d)){if(p&&is(p)===d.startPosition.row)return;n.push(Ft.indent.repeat(t+1)+ee(d.text))}else{let h=Mn(d,t+1);g&&m&&(h+=Ft.indent+ee(m.text)),h.trim()&&n.push(Ft.indent.repeat(t+1)+h)}});let l=ge("begin"),u=ge("end");return n.length===0?`${l}${o}
206
+ ${ge("end")}`}let r=e.children.find(c=>c.type==="import"),o=e.children.some(c=>c.text===";"),s=`${r?`${ge("import")} `:""}${ge("variable")} `,a=[];for(let c of e.children)c.type==="var_init"&&a.push(fM(c,t,s.length));return`${s}${a.join(", ")}${o?";":""}`}function fM(e,t=0,n=0){let r=e.childForFieldName("name")?.text||"",o=e.childForFieldName("size"),s=e.childForFieldName("value"),a=r;if(o&&(a+=`[${ye(o)}]`),s){let c=e.children.find(u=>u.text===":="||u.text==="=")?.text||"=",l=t*Ft.indent.length+n+r.length+c.length+2;a+=` ${c} ${ye(s,l)}`}return a}function x9(e){let t=e.childForFieldName("name")?.text||"",n=e.childForFieldName("value"),r=`${ge("export")} ${ge("variable")} ${t}`;if(n){let o=e.children.find(s=>s.text===":="||s.text==="=")?.text||"=";return`${r} ${o} ${ye(n)};`}return`${r};`}function rs(e,t){let n=[],r=e.children,o="",s="",a=e.startPosition.row,c=e.endPosition.row;for(let d of r)if(hi(d)&&d.startPosition.row===c){s=Ft.indent+ee(d.text);break}r.forEach((d,f)=>{let m=r[f+1],p=r[f-1];if(p9.test(d.text))return;if(hi(d)&&d.startPosition.row===a){o=Ft.indent+ee(d.text);return}if(hi(d)&&d.startPosition.row===c)return;let g=nv(d,m);if(hi(d)){if(p&&is(p)===d.startPosition.row)return;n.push(Ft.indent.repeat(t+1)+ee(d.text))}else{let h=Mn(d,t+1);g&&m&&(h+=Ft.indent+ee(m.text)),h.trim()&&n.push(Ft.indent.repeat(t+1)+h)}});let l=ge("begin"),u=ge("end");return n.length===0?`${l}${o}
207
207
  ${u}${s}`:`${l}${o}
208
208
  ${n.join(`
209
209
  `)}
210
- ${Ft.indent.repeat(t)}${u}${s}`}var x9={indentSize:4},yM=" ";function Vl(e){return e.type==="comment"||e.type==="line_comment"}function ov(e,t,n,r){n===t.startPosition.row&&e.length>0?e[e.length-1]+=yM+ee(t.text):e.push(r+ee(t.text))}function gM(e,t,n,r,o){for(let s of e.children){if(!Vl(s))continue;let a=s.startPosition.row;a<n||a>r||(a===n&&t.length>0?t[t.length-1]+=yM+ee(s.text):a>n&&t.push(o+ee(s.text)))}}function v9(e){return e.type==="call_expr"?sv(e):e.text}function sv(e){let n=e.childForFieldName("func")?.text??"",o=e.childrenForFieldName("args").map(s=>v9(s));return n+"("+o.join(", ")+")"}function _M(e){let t=e.children.some(o=>o.text==="!"),n=e.childForFieldName("call"),r=n?sv(n):"";return(t?"!":"")+r}function C9(e){let t=e.childForFieldName("call");return t?sv(t):""}function P9(e){return"OR("+(e.childForFieldName("count")?.text??"")+")"}function N9(e,t,n){t.push("IF");let r=!1,o=0,s=-1;for(let a of e.children)if(a.type==="or_marker"){t.push(n.indent+P9(a));let c=a.childForFieldName("count");o=parseInt(c?.text??"0",10),r=!0,s=a.endPosition.row}else if(a.type==="condition")r&&o>0?(t.push(n.indent2+_M(a)),o--,o===0&&(r=!1)):t.push(n.indent+_M(a)),s=a.endPosition.row;else if(Vl(a)){let c=r&&o>0?n.indent2:n.indent;ov(t,a,s,c),s=a.endPosition.row}}function E9(e,t,n){t.push("THEN");let r=-1;for(let o of e.children)o.type==="response"?(R9(o,t,n),r=o.endPosition.row):Vl(o)&&(ov(t,o,r,n.indent),r=o.endPosition.row)}function R9(e,t,n){let r=e.childForFieldName("weight");t.push(n.indent+"RESPONSE #"+(r?.text??"100"));let o=r?.endPosition.row??-1;for(let s of e.children)s.type==="action"?(t.push(n.indent2+C9(s)),o=s.endPosition.row):Vl(s)&&(ov(t,s,o,n.indent2),o=s.endPosition.row)}function T9(e,t,n){let r=e.childForFieldName("if"),o=e.childForFieldName("then");r&&N9(r,t,n);let s=r?.endPosition.row??-1,a=o?.startPosition.row??1/0;gM(e,t,s,a-1,n.indent),o&&E9(o,t,n);let c=o?.endPosition.row??-1,l=e.endPosition.row;gM(e,t,c,l-1,n.indent2),t.push("END")}function av(e,t){pi(e);let n={...x9,...t},r={indent:" ".repeat(n.indentSize),indent2:" ".repeat(n.indentSize*2)},o=[],s=-1;for(let a of e.children)(a.type==="block"||Vl(a))&&(s>=0&&a.startPosition.row>s+1&&o.push(""),a.type==="block"?T9(a,o,r):o.push(ee(a.text)),s=a.endPosition.row);for(;o.length>0&&o[o.length-1]==="";)o.pop();return{text:o.join(`
210
+ ${Ft.indent.repeat(t)}${u}${s}`}var v9={indentSize:4},yM=" ";function Gl(e){return e.type==="comment"||e.type==="line_comment"}function iv(e,t,n,r){n===t.startPosition.row&&e.length>0?e[e.length-1]+=yM+ee(t.text):e.push(r+ee(t.text))}function gM(e,t,n,r,o){for(let s of e.children){if(!Gl(s))continue;let a=s.startPosition.row;a<n||a>r||(a===n&&t.length>0?t[t.length-1]+=yM+ee(s.text):a>n&&t.push(o+ee(s.text)))}}function C9(e){return e.type==="call_expr"?ov(e):e.text}function ov(e){let n=e.childForFieldName("func")?.text??"",o=e.childrenForFieldName("args").map(s=>C9(s));return n+"("+o.join(", ")+")"}function _M(e){let t=e.children.some(o=>o.text==="!"),n=e.childForFieldName("call"),r=n?ov(n):"";return(t?"!":"")+r}function P9(e){let t=e.childForFieldName("call");return t?ov(t):""}function N9(e){return"OR("+(e.childForFieldName("count")?.text??"")+")"}function E9(e,t,n){t.push("IF");let r=!1,o=0,s=-1;for(let a of e.children)if(a.type==="or_marker"){t.push(n.indent+N9(a));let c=a.childForFieldName("count");o=parseInt(c?.text??"0",10),r=!0,s=a.endPosition.row}else if(a.type==="condition")r&&o>0?(t.push(n.indent2+_M(a)),o--,o===0&&(r=!1)):t.push(n.indent+_M(a)),s=a.endPosition.row;else if(Gl(a)){let c=r&&o>0?n.indent2:n.indent;iv(t,a,s,c),s=a.endPosition.row}}function R9(e,t,n){t.push("THEN");let r=-1;for(let o of e.children)o.type==="response"?(T9(o,t,n),r=o.endPosition.row):Gl(o)&&(iv(t,o,r,n.indent),r=o.endPosition.row)}function T9(e,t,n){let r=e.childForFieldName("weight");t.push(n.indent+"RESPONSE #"+(r?.text??"100"));let o=r?.endPosition.row??-1;for(let s of e.children)s.type==="action"?(t.push(n.indent2+P9(s)),o=s.endPosition.row):Gl(s)&&(iv(t,s,o,n.indent2),o=s.endPosition.row)}function A9(e,t,n){let r=e.childForFieldName("if"),o=e.childForFieldName("then");r&&E9(r,t,n);let s=r?.endPosition.row??-1,a=o?.startPosition.row??1/0;gM(e,t,s,a-1,n.indent),o&&R9(o,t,n);let c=o?.endPosition.row??-1,l=e.endPosition.row;gM(e,t,c,l-1,n.indent2),t.push("END")}function sv(e,t){pi(e);let n={...v9,...t},r={indent:" ".repeat(n.indentSize),indent2:" ".repeat(n.indentSize*2)},o=[],s=-1;for(let a of e.children)(a.type==="block"||Gl(a))&&(s>=0&&a.startPosition.row>s+1&&o.push(""),a.type==="block"?A9(a,o,r):o.push(ee(a.text)),s=a.endPosition.row);for(;o.length>0&&o[o.length-1]==="";)o.pop();return{text:o.join(`
211
211
  `).replaceAll("\r","")+`
212
- `}}var qt=" ",_e="BEGIN",be="END",Gl="ELSE",cp="THEN",Oa="WITH",Ma="DEFAULT",cv="IN",lv="ALWAYS",uv="QUICK_MENU",dv="ALWAYS_ASK",bM="BUT_ONLY",SM="BUT_ONLY_IF_IT_CHANGES",wM="IF_EXISTS",lp="UNLESS",up="IF",xM="FOR",vM="OUTER_FOR",CM="LPF",PM="LAF",NM="LPM",EM="LAM",RM="PATCH_IF",TM="ACTION_IF",AM="PATCH_TRY",IM="ACTION_TRY",DM=["backup_directive","author_directive","support_directive","version_flag","readme_directive","no_if_eval_bug_flag","auto_eval_strings_flag","allow_missing_directive","language_directive"],fv=["action_for_each","action_php_each","action_bash_for","patch_bash_for","patch_for_each","patch_php_each"],kM="patch_try",FM="action_try",LM="inner_patch",OM="inner_patch_save",MM="inner_patch_file",$M="patch_replace_bcs_block",qM="inner_action",BM="component",jM="always_block",WM="patch_file",UM="inlined_file",HM="match_case",VM="action_match_case",GM="action_require_predicate",zM=["action_if","action_match","action_try","outer_for","outer_while","patch_if","patch_match","patch_try","patch_for","patch_while","patch_with_scope","action_alter_tlk_list","action_define_array","action_define_associative_array","patch_define_array","patch_define_associative_array","action_outer_patch","action_outer_patch_save","action_outer_inner_patch","action_outer_inner_patch_save","patch_decompile_and_patch","patch_replace_evaluate","action_with_tra","action_with_scope","action_make_biff",...fv],KM=["action_copy","action_copy_existing","action_copy_existing_regexp","action_copy_random","action_copy_large","action_copy_kit","action_copy_2da","action_copy_all_gam_files"],YM=["action_define_function","action_define_patch_function","action_define_dimorphic_function","action_define_macro","action_define_patch_macro"],XM=["action_launch_function","action_launch_macro","patch_launch_function","patch_launch_macro"];var I9=new Set(DM),D9=new Set(zM),k9=new Set(KM),F9=new Set(YM),L9=new Set(XM),O9=new Set(fv),M9=new Set(["INT_VAR","STR_VAR","RET","RET_ARRAY"]),$9=new Set(["action_define_associative_array","patch_define_associative_array"]),q9=new Set(["value","binary_expr","variable_ref","identifier","string","number"]),B9=new Set(["text_sprint_action"]),j9=new Set(["write_var","read_var","set_var"]);function ve(e){return e.type==="line_comment"||e.type==="comment"}function cr(e){if(!e.includes("//"))return e;let t=e.indexOf("//"),n=e.slice(0,t);if(!n.trim())return n+Fa(e.slice(t));let r=n.trimEnd(),o=e.slice(t+2).trimStart();return o?r+qt+"// "+o:r+qt+"//"}function zl(e,t,n){if(n<0||t.startPosition.row!==n||e.length===0)return!1;let r=e[e.length-1];return r===void 0||r.includes("//")?!1:(e[e.length-1]=r+qt+ee(t.text),!0)}function Nt(e,t,n,r){return zl(e,t,r)||e.push(n+ee(t.text)),t.endPosition.row}function yt(e,t,n){n<0||t.startPosition.row<=n+1||e.length===0||e[e.length-1]===""||e.push("")}function Ce(e){if(e.includes("/*"))return e.trim();let t=La(e),n=t.some(c=>c.type===2&&c.text.startsWith("//")),r=t.some(c=>c.type===1&&c.text.includes(`
212
+ `}}var qt=" ",_e="BEGIN",be="END",zl="ELSE",lp="THEN",Oa="WITH",Ma="DEFAULT",av="IN",cv="ALWAYS",lv="QUICK_MENU",uv="ALWAYS_ASK",bM="BUT_ONLY",SM="BUT_ONLY_IF_IT_CHANGES",wM="IF_EXISTS",up="UNLESS",dp="IF",xM="FOR",vM="OUTER_FOR",CM="LPF",PM="LAF",NM="LPM",EM="LAM",RM="PATCH_IF",TM="ACTION_IF",AM="PATCH_TRY",IM="ACTION_TRY",DM=["backup_directive","author_directive","support_directive","version_flag","readme_directive","no_if_eval_bug_flag","auto_eval_strings_flag","allow_missing_directive","language_directive"],dv=["action_for_each","action_php_each","action_bash_for","patch_bash_for","patch_for_each","patch_php_each"],kM="patch_try",FM="action_try",LM="inner_patch",OM="inner_patch_save",MM="inner_patch_file",$M="patch_replace_bcs_block",qM="inner_action",BM="component",jM="always_block",WM="patch_file",UM="inlined_file",HM="match_case",VM="action_match_case",GM="action_require_predicate",zM=["action_if","action_match","action_try","outer_for","outer_while","patch_if","patch_match","patch_try","patch_for","patch_while","patch_with_scope","action_alter_tlk_list","action_define_array","action_define_associative_array","patch_define_array","patch_define_associative_array","action_outer_patch","action_outer_patch_save","action_outer_inner_patch","action_outer_inner_patch_save","patch_decompile_and_patch","patch_replace_evaluate","action_with_tra","action_with_scope","action_make_biff",...dv],KM=["action_copy","action_copy_existing","action_copy_existing_regexp","action_copy_random","action_copy_large","action_copy_kit","action_copy_2da","action_copy_all_gam_files"],YM=["action_define_function","action_define_patch_function","action_define_dimorphic_function","action_define_macro","action_define_patch_macro"],XM=["action_launch_function","action_launch_macro","patch_launch_function","patch_launch_macro"];var D9=new Set(DM),k9=new Set(zM),F9=new Set(KM),L9=new Set(YM),O9=new Set(XM),M9=new Set(dv),$9=new Set(["INT_VAR","STR_VAR","RET","RET_ARRAY"]),q9=new Set(["action_define_associative_array","patch_define_associative_array"]),B9=new Set(["value","binary_expr","variable_ref","identifier","string","number"]),j9=new Set(["text_sprint_action"]),W9=new Set(["write_var","read_var","set_var"]);function ve(e){return e.type==="line_comment"||e.type==="comment"}function cr(e){if(!e.includes("//"))return e;let t=e.indexOf("//"),n=e.slice(0,t);if(!n.trim())return n+Fa(e.slice(t));let r=n.trimEnd(),o=e.slice(t+2).trimStart();return o?r+qt+"// "+o:r+qt+"//"}function Kl(e,t,n){if(n<0||t.startPosition.row!==n||e.length===0)return!1;let r=e[e.length-1];return r===void 0||r.includes("//")?!1:(e[e.length-1]=r+qt+ee(t.text),!0)}function Nt(e,t,n,r){return Kl(e,t,r)||e.push(n+ee(t.text)),t.endPosition.row}function yt(e,t,n){n<0||t.startPosition.row<=n+1||e.length===0||e[e.length-1]===""||e.push("")}function Ce(e){if(e.includes("/*"))return e.trim();let t=La(e),n=t.some(c=>c.type===2&&c.text.startsWith("//")),r=t.some(c=>c.type===1&&c.text.includes(`
213
213
  `));if(!n&&!r)return uo(e);let o=[],s=[],a=()=>{if(s.length===0)return;let c="";for(let d=0;d<s.length;d++){let f=s[d];if(f)if(f.type===0){let m=f.text.replaceAll(/\s+/g," ");d===0&&(m=m.trimStart()),d===s.length-1&&(m=m.trimEnd()),c+=m}else c+=f.text}let l=s[s.length-1],u=l&&l.type===0;(c.trim()||s.some(d=>d.type!==0))&&o.push(u?c.trimEnd():c),s=[]};for(let c of t){if(c.type===2&&c.text.startsWith("//")){let u=Fa(c.text);s.push({type:2,text:u}),a();continue}if(c.type===1||c.type===2){s.push(c);continue}let l=c.text.split(`
214
214
  `);for(let u=0;u<l.length;u++){let d=l[u];d!==void 0&&(s.push({type:0,text:d}),u<l.length-1&&a())}}return a(),o.join(`
215
- `).trim()}function QM(e){return I9.has(e)}function os(e){return e.startsWith("action_")||e.startsWith("outer_")||B9.has(e)}function ss(e){return e.startsWith("patch_")||e.startsWith("inner_")||j9.has(e)}function ZM(e){return M9.has(e)}function lr(e){return D9.has(e)}function e1(e){return $9.has(e)}function t1(e){return O9.has(e)}function $a(e){return F9.has(e)}function ur(e){return L9.has(e)}function Kl(e){return k9.has(e)}function dr(e){return os(e)||ss(e)||lr(e)||ur(e)||e==="patch_assignment"||e==="inlined_file"}function re(e,t){return e.text===t}var W9=new Set(["match_case","action_match_case","assoc_entry"]);function n1(e){return dr(e)||W9.has(e)||q9.has(e)||e==="directory_file_regexp"}function Yl(e,t,n,r,o=" = "){let s=[],a=0;for(let u of e)u.type==="assignment"&&u.value&&(a=Math.max(a,u.name.length));let c=!1,l=-1;for(let u of e)if(u.type==="comment"){if(l>=0&&u.startRow===l&&s.length>0){let d=s[s.length-1];if(d!==void 0&&!d.includes("//")){s[s.length-1]=d+qt+u.text;continue}}!c&&t&&(s.push(n+t),c=!0),s.push(r+u.text)}else{if(!c&&t&&(s.push(n+t),c=!0),u.value){let d=" ".repeat(a-u.name.length);s.push(r+u.name+d+o+u.value)}else s.push(r+u.name);l=u.endRow}return!c&&t&&s.push(n+t),s}function dp(e,t,n,r){for(let o=0;o<e.length;o++){let s=e[o];if(s&&s.length>0){let a=o===0?n:r;t.push(a+Ce(s.join(" ")))}}}function qa(e){return e[e.length-1]}function fo(e){return e.type==="comment"||e.type==="line_comment"}function pv(e){return e.type==="copy_trans"}function i1(e){return e.type==="transition"?e.children[0]??null:o1(e)?e:null}function o1(e){return e.type==="transition_full"||e.type==="transition_short"}function U9(e){if(!e)return e;let t=e[0];if(t!=="~"&&t!=='"'&&t!=="%")return e;let n=e.slice(1,-1);return n.includes("//")?e:t+uo(n)+t}function H9(e){return e.type==="goto_next"||e.type==="exit_next"||e.type==="extern_next"||e.type==="short_goto"}function V9(e,t){let n=o=>o==="~"||o==='"',r=o=>/\w/.test(o);return n(e)&&r(t)||r(e)&&n(t)}function as(e){let t=La(e),n="";for(let r of t){let o=r.type===0?r.text.replaceAll(/\s+/g," "):r.text;o.length>0&&n.length>0&&V9(n[n.length-1],o[0])&&(n+=" "),n+=o}return n.trim()}function G9(e){let t=e.indexOf("//");return t!==-1?e.slice(0,t).trimEnd().length:e.length}function mv(e,t){let n=e.startIndex;return t.startIndex-n}function z9(e,t,n,r){let o=as(e.text),s=cr(t+o);if(G9(s)<=r)return s;let a=e.children.find(l=>l.type==="do_feature"),c=e.children.find(H9);if(a){let l=mv(e,a),u=as(e.text.slice(0,l)),d=as(e.text.slice(l)),f=t+u;if(f.length<=r){let m=n+d;if(m.length<=r)return f+`
216
- `+m;if(c){let p=mv(e,c);if(p>l){let g=as(e.text.slice(l,p)),h=as(e.text.slice(p));return f+`
215
+ `).trim()}function QM(e){return D9.has(e)}function os(e){return e.startsWith("action_")||e.startsWith("outer_")||j9.has(e)}function ss(e){return e.startsWith("patch_")||e.startsWith("inner_")||W9.has(e)}function ZM(e){return $9.has(e)}function lr(e){return k9.has(e)}function e1(e){return q9.has(e)}function t1(e){return M9.has(e)}function $a(e){return L9.has(e)}function ur(e){return O9.has(e)}function Yl(e){return F9.has(e)}function dr(e){return os(e)||ss(e)||lr(e)||ur(e)||e==="patch_assignment"||e==="inlined_file"}function re(e,t){return e.text===t}var U9=new Set(["match_case","action_match_case","assoc_entry"]);function n1(e){return dr(e)||U9.has(e)||B9.has(e)||e==="directory_file_regexp"}function Xl(e,t,n,r,o=" = "){let s=[],a=0;for(let u of e)u.type==="assignment"&&u.value&&(a=Math.max(a,u.name.length));let c=!1,l=-1;for(let u of e)if(u.type==="comment"){if(l>=0&&u.startRow===l&&s.length>0){let d=s[s.length-1];if(d!==void 0&&!d.includes("//")){s[s.length-1]=d+qt+u.text;continue}}!c&&t&&(s.push(n+t),c=!0),s.push(r+u.text)}else{if(!c&&t&&(s.push(n+t),c=!0),u.value){let d=" ".repeat(a-u.name.length);s.push(r+u.name+d+o+u.value)}else s.push(r+u.name);l=u.endRow}return!c&&t&&s.push(n+t),s}function fp(e,t,n,r){for(let o=0;o<e.length;o++){let s=e[o];if(s&&s.length>0){let a=o===0?n:r;t.push(a+Ce(s.join(" ")))}}}function qa(e){return e[e.length-1]}function fo(e){return e.type==="comment"||e.type==="line_comment"}function mv(e){return e.type==="copy_trans"}function i1(e){return e.type==="transition"?e.children[0]??null:o1(e)?e:null}function o1(e){return e.type==="transition_full"||e.type==="transition_short"}function H9(e){if(!e)return e;let t=e[0];if(t!=="~"&&t!=='"'&&t!=="%")return e;let n=e.slice(1,-1);return n.includes("//")?e:t+uo(n)+t}function V9(e){return e.type==="goto_next"||e.type==="exit_next"||e.type==="extern_next"||e.type==="short_goto"}function G9(e,t){let n=o=>o==="~"||o==='"',r=o=>/\w/.test(o);return n(e)&&r(t)||r(e)&&n(t)}function as(e){let t=La(e),n="";for(let r of t){let o=r.type===0?r.text.replaceAll(/\s+/g," "):r.text;o.length>0&&n.length>0&&G9(n[n.length-1],o[0])&&(n+=" "),n+=o}return n.trim()}function z9(e){let t=e.indexOf("//");return t!==-1?e.slice(0,t).trimEnd().length:e.length}function fv(e,t){let n=e.startIndex;return t.startIndex-n}function K9(e,t,n,r){let o=as(e.text),s=cr(t+o);if(z9(s)<=r)return s;let a=e.children.find(l=>l.type==="do_feature"),c=e.children.find(V9);if(a){let l=fv(e,a),u=as(e.text.slice(0,l)),d=as(e.text.slice(l)),f=t+u;if(f.length<=r){let m=n+d;if(m.length<=r)return f+`
216
+ `+m;if(c){let p=fv(e,c);if(p>l){let g=as(e.text.slice(l,p)),h=as(e.text.slice(p));return f+`
217
217
  `+n+g+`
218
- `+n+h}}}}if(c){let l=mv(e,c),u=as(e.text.slice(0,l)),d=as(e.text.slice(l)),f=t+u;if(f.length<=r)return f+`
218
+ `+n+h}}}}if(c){let l=fv(e,c),u=as(e.text.slice(0,l)),d=as(e.text.slice(l)),f=t+u;if(f.length<=r)return f+`
219
219
  `+n+d}return s}function s1(e,t,n,r){let o=e.text;if(!o.includes(`
220
- `))return z9(e,t,n,r);let s=La(o),a=[],c="",l=()=>{if(c.trim()||a.length===0){let d=a.length===0?t:n;a.push(cr(d+c.trimEnd()))}c=""},u=(d,f)=>{let m=d.split(`
220
+ `))return K9(e,t,n,r);let s=La(o),a=[],c="",l=()=>{if(c.trim()||a.length===0){let d=a.length===0?t:n;a.push(cr(d+c.trimEnd()))}c=""},u=(d,f)=>{let m=d.split(`
221
221
  `);for(let p=0;p<m.length;p++){let g=m[p];if(g!==void 0){let h=f?g.trim().replaceAll(/\s+/g," "):p===0?g:g.trimStart();h||f&&p<m.length-1?p===0?(c&&!c.endsWith(" ")&&(c+=" "),c+=h):(l(),c=h):p<m.length-1&&l()}}};for(let d of s){if(d.type!==0){d.text.includes(`
222
222
  `)?u(d.text,!1):(c&&!c.endsWith(" ")&&(c+=" "),c+=d.text);continue}if(d.text.includes(`
223
223
  `))u(d.text,!0);else{let f=d.text.trim().replaceAll(/\s+/g," ");f&&(c&&!c.endsWith(" ")&&(c+=" "),c+=f)}}return l(),a.join(`
224
- `)}function K9(e,t){let n=e.startPosition.row,r=e.text.split(`
224
+ `)}function Y9(e,t){let n=e.startPosition.row,r=e.text.split(`
225
225
  `),o=Array.from({length:r.length}).fill(0),s=r.length-1;for(;s>0&&!r[s]?.trim();)s--;function a(u){let d=u.type==="string",f=u.startPosition.row-n,m=u.endPosition.row-n;if(d&&m>f&&f>=0){let p=(f<o.length?o[f]:0)??0;for(let g=f+1;g<=m;g++)g<o.length&&(o[g]=Math.max(o[g]??0,p+1))}for(let p of u.children)a(p)}a(e);let c=[],l=!1;return r.forEach((u,d)=>{let f=u.trim();if(!f){!l&&c.length>0&&c.push(""),l=!0;return}l=!1;let g=c.length===0||d===s?1:2+(o[d]??0);c.push(cr(t.indent.repeat(g)+f))}),c.join(`
226
- `)}function Y9(e,t){let n=e.text;if(!n.includes(`
227
- `)){let r=cr(t.indent+uo(n));return r.length<=t.lineLimit?r:X9(e,t)}return K9(e,t)}function X9(e,t){let n=[],{indent:r,indent2:o,lineLimit:s}=t,a=e.childForFieldName("weight"),c=e.childForFieldName("trigger"),l=e.childForFieldName("label"),u=e.childForFieldName("say"),d=r+"IF";if(a&&(d+=" WEIGHT #"+a.text),d+=" "+(c?U9(c.text):"~~"),d+=" "+(l?.text??""),u){let f="SAY "+J9(u),m=d+" "+f;m.length<=s?d=m:(n.push(d),d=o+f)}n.push(d);for(let f of e.children){let m=i1(f);m?n.push(s1(m,o,o+r,s)):pv(f)?n.push(o+uo(f.text)):fo(f)&&n.push(o+ee(f.text))}return n.push(r+"END"),n.join(`
228
- `)}function J9(e){let t=[];for(let n of e.children)n.type!=="="&&!fo(n)&&t.push(n.text);return t.join(" = ")}function Q9(e,t){switch(e.type){case"begin_action":return r1(e,t,!1);case"append_action":return r1(e,t,!0);case"extend_action":return t5(e,t);default:return e.text}}function Z9(e){let t=e.startPosition.row,n=[];for(let r of e.children){if(r.type==="state"||r.text==="END"||fo(r)&&r.startPosition.row!==t)break;n.push(fo(r)?ee(r.text):r.text)}return uo(n.join(" "))}function a1(e,t,n){let r=e.startPosition.row;for(let o of e.children){o.startPosition.row>r+1&&t.push("");let s=n(o);s!==null&&t.push(s),r=o.endPosition.row}}function r1(e,t,n){let r=e.startPosition.row,o=[Z9(e)];return a1(e,o,s=>s.type==="state"?Y9(s,t):fo(s)?s.startPosition.row===r?null:t.indent+ee(s.text):null),n&&o.push("END"),o.join(`
229
- `)}function e5(e){let t="";for(let n of e.children){if(n.type==="transition"||o1(n)||fo(n)||pv(n)||n.text==="END")break;t.length>0&&!t.endsWith("#")&&(t+=" "),t+=n.text}return t}function t5(e,t){let{indent:n,indent2:r,lineLimit:o}=t,s=[e5(e)];return a1(e,s,a=>{let c=i1(a);return c?s1(c,n,r,o):pv(a)?n+uo(a.text):fo(a)?n+ee(a.text):null}),s.push("END"),s.join(`
230
- `)}function hv(e,t){pi(e);let n={...Xr,...t},r=" ".repeat(n.indentSize),o={indent:r,indent2:r+r,lineLimit:n.lineLimit},s=[],a=-1;for(let c of e.children)fo(c)?a>=0&&c.startPosition.row===a?s.length>0&&(s[s.length-1]+=" "+c.text):(a>=0&&c.startPosition.row>a+1&&s.push(""),s.push(ee(c.text))):(a>=0&&c.startPosition.row>a+1&&s.push(""),s.push(Q9(c,o))),a=c.endPosition.row;for(;s.length>0&&s[s.length-1]==="";)s.pop();return{text:s.join(`
226
+ `)}function X9(e,t){let n=e.text;if(!n.includes(`
227
+ `)){let r=cr(t.indent+uo(n));return r.length<=t.lineLimit?r:J9(e,t)}return Y9(e,t)}function J9(e,t){let n=[],{indent:r,indent2:o,lineLimit:s}=t,a=e.childForFieldName("weight"),c=e.childForFieldName("trigger"),l=e.childForFieldName("label"),u=e.childForFieldName("say"),d=r+"IF";if(a&&(d+=" WEIGHT #"+a.text),d+=" "+(c?H9(c.text):"~~"),d+=" "+(l?.text??""),u){let f="SAY "+Q9(u),m=d+" "+f;m.length<=s?d=m:(n.push(d),d=o+f)}n.push(d);for(let f of e.children){let m=i1(f);m?n.push(s1(m,o,o+r,s)):mv(f)?n.push(o+uo(f.text)):fo(f)&&n.push(o+ee(f.text))}return n.push(r+"END"),n.join(`
228
+ `)}function Q9(e){let t=[];for(let n of e.children)n.type!=="="&&!fo(n)&&t.push(n.text);return t.join(" = ")}function Z9(e,t){switch(e.type){case"begin_action":return r1(e,t,!1);case"append_action":return r1(e,t,!0);case"extend_action":return n5(e,t);default:return e.text}}function e5(e){let t=e.startPosition.row,n=[];for(let r of e.children){if(r.type==="state"||r.text==="END"||fo(r)&&r.startPosition.row!==t)break;n.push(fo(r)?ee(r.text):r.text)}return uo(n.join(" "))}function a1(e,t,n){let r=e.startPosition.row;for(let o of e.children){o.startPosition.row>r+1&&t.push("");let s=n(o);s!==null&&t.push(s),r=o.endPosition.row}}function r1(e,t,n){let r=e.startPosition.row,o=[e5(e)];return a1(e,o,s=>s.type==="state"?X9(s,t):fo(s)?s.startPosition.row===r?null:t.indent+ee(s.text):null),n&&o.push("END"),o.join(`
229
+ `)}function t5(e){let t="";for(let n of e.children){if(n.type==="transition"||o1(n)||fo(n)||mv(n)||n.text==="END")break;t.length>0&&!t.endsWith("#")&&(t+=" "),t+=n.text}return t}function n5(e,t){let{indent:n,indent2:r,lineLimit:o}=t,s=[t5(e)];return a1(e,s,a=>{let c=i1(a);return c?s1(c,n,r,o):mv(a)?n+uo(a.text):fo(a)?n+ee(a.text):null}),s.push("END"),s.join(`
230
+ `)}function pv(e,t){pi(e);let n={...Xr,...t},r=" ".repeat(n.indentSize),o={indent:r,indent2:r+r,lineLimit:n.lineLimit},s=[],a=-1;for(let c of e.children)fo(c)?a>=0&&c.startPosition.row===a?s.length>0&&(s[s.length-1]+=" "+c.text):(a>=0&&c.startPosition.row>a+1&&s.push(""),s.push(ee(c.text))):(a>=0&&c.startPosition.row>a+1&&s.push(""),s.push(Z9(c,o))),a=c.endPosition.row;for(;s.length>0&&s[s.length-1]==="";)s.pop();return{text:s.join(`
231
231
  `).replaceAll("\r","")+`
232
232
  `}}function c1(e){if(e.type!=="patch_for"&&e.type!=="outer_for")return null;let t=[],n=!1,r=[[],[],[]],o=0;for(let s of e.children){if(s.text===xM||s.text===vM){t.push(s.text);continue}if(s.text==="("){n=!0;continue}if(s.text===")"){n=!1;let a=r.map(c=>c.join(" "));t.push("("+a.join("; ")+")");continue}if(re(s,_e))break;if(n){if(s.text===";"){o++;continue}!ve(s)&&o<3&&r[o]?.push(Ce(s.text))}}return t.join(" ")}function l1(e,t,n,r,o){let s=t.indent.repeat(n),a=t.indent.repeat(n+1),c=[s+r+" "+_e],l=-1,u=!1;for(let d of e.children){if(re(d,_e)){u=!0,l=d.startPosition.row;continue}if(re(d,be))break;u&&(ve(d)?l=Nt(c,d,a,l):dr(d.type)&&(yt(c,d,l),c.push(o(d,t,n+1)),l=d.endPosition.row))}return c.push(s+be),c.join(`
233
- `)}function u1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[],c=[],l=!1;for(let w of e.children){if(re(w,_e))break;if(re(w,cv)){l=!0,a.push(cv);continue}ve(w)||(l?c.push(w.text):a.push(w.text))}let u=[],d=c.join(" ").length,f=o.length+a.join(" ").length+1+d;if(c.length>1&&f>t.lineLimit){u.push(o+a.join(" "));for(let w of c)u.push(s+w);u.push(o+_e)}else{let w=[...a,...c].join(" ");u.push(o+w+" "+_e)}let p=[],g=!1,h=-1,y=-1;for(let w of e.children){if(re(w,_e)){g=!0,y=w.startPosition.row;continue}if(re(w,be))break;if(g)if(ve(w)){if(y>=0&&w.startPosition.row===y){let _=u[u.length-1];if(_&&!_.includes("//")){u[u.length-1]=_+qt+ee(w.text),y=-1;continue}}y=-1,h=Nt(p,w,s,h)}else dr(w.type)&&(y=-1,yt(p,w,h),p.push(r(w,t,n+1)),h=w.endPosition.row)}return[...u,...p,o+be].join(`
234
- `)}function n5(e){let t=-1;for(let o=0;o<e.children.length;o++){let s=e.children[o];if(s&&s.text==="=>"){t=o;break}}if(t<0||t>=e.children.length-1)return null;let n=[];for(let o=0;o<t;o++){let s=e.children[o];s&&n.push(s.text)}let r=[];for(let o=t+1;o<e.children.length;o++){let s=e.children[o];s&&r.push(s.text)}return{name:n.join(" "),value:r.join(" ")}}function d1(e,t,n){let r=t.indent.repeat(n),o=t.indent.repeat(n+1),s=[],a=[],c=[],l=!1,u=-1;for(let f of e.children){if(re(f,_e)){s.push(r+a.join(" ")+" "+_e),l=!0,u=f.startPosition.row;continue}if(re(f,be))break;if(!l){a.push(f.text);continue}if(ve(f)){if(zl(s,f,u)){u=-1;continue}u=-1,c.push({type:"comment",text:ee(f.text),startRow:f.startPosition.row,endRow:f.endPosition.row});continue}if(u=-1,f.type==="assoc_entry"){let m=n5(f);m&&c.push({type:"assignment",name:m.name,value:m.value,endRow:f.endPosition.row})}}let d=Yl(c,"",r,o," => ");return s.push(...d,r+be),s.join(`
235
- `)}function r5(){return{lines:[],headerParts:[],inBody:!1,afterElse:!1,lastContentRow:-1,beginRow:-1,lastHeaderRow:-1,headerComment:"",hasThen:!1,conditionNode:null,conditionKeyword:""}}function i5(e){let t=[],n=r=>{if(ve(r)){t.push({row:r.startPosition.row,column:r.startPosition.column,text:ee(r.text)});return}r.children.forEach(o=>n(o))};return n(e),t}function f1(e){let t=e.childForFieldName("op");if(!t)return null;let n=t.text;if(n!=="OR"&&n!=="AND")return null;let r=e.childForFieldName("left"),o=e.childForFieldName("right");if(!r||!o)return null;let s=[];if(r.type==="binary_expr"){let a=f1(r);a?s.push(...a):s.push({operator:null,text:Ce(r.text),endRow:r.endPosition.row,endColumn:r.endPosition.column})}else s.push({operator:null,text:Ce(r.text),endRow:r.endPosition.row,endColumn:r.endPosition.column});return s.push({operator:t.text,text:Ce(o.text),endRow:o.endPosition.row,endColumn:o.endPosition.column}),s}function Xl(e,t,n,r,o){if(!e)return[n+t];let s=i5(e),a=Ce(e.text).replaceAll(/\(\s+/g,"(").replaceAll(/\s+\)/g,")"),c=n+t+" "+a;if(s.length===0&&c.length<=o)return[c];let l=e,u=!1,d="";if(l.type==="value"&&l.children.length>0){for(let f of l.children)if(f.type==="binary_expr"||f.type==="paren_expr"||f.type==="unary_expr"){l=f;break}}if(l.type==="unary_expr"){let f=l.childForFieldName("op"),m=l.childForFieldName("operand");f&&m&&(d=f.text+" ",l=m)}if(l.type==="paren_expr"&&l.children.length>0){for(let f of l.children)if(f.type==="binary_expr"){l=f,u=!0;break}}if(l.type==="binary_expr"){let f=f1(l);if(f&&f.length>1){let m=[],p=new Set,g=u?"(":"",h=u?")":"";for(let y=0;y<f.length;y++){let w=f[y];if(!w)continue;let _;y===0?_=n+t+" "+d+g+w.text:y===f.length-1?_=r+w.operator+" "+w.text+h:_=r+w.operator+" "+w.text;for(let b=0;b<s.length;b++){let S=s[b];!S||p.has(b)||S.row!==w.endRow||S.column<w.endColumn||(_+=qt+S.text,p.add(b))}m.push(_)}return m}}return[c]}function o5(e,t,n,r,o){if(e.afterElse&&e.lines.length>0){let l=qa(e.lines);if(l&&l.trimEnd().endsWith(Gl)){e.lines[e.lines.length-1]=l+" "+_e,e.headerParts=[],e.conditionNode=null,e.conditionKeyword="",e.inBody=!0,e.afterElse=!1,e.beginRow=t.startPosition.row;return}}if(e.afterElse=!1,e.conditionNode&&e.conditionKeyword){let l=Xl(e.conditionNode,e.conditionKeyword,n,r,o);e.lines.push(...l);let u=e.hasThen?cp+" ":"";if(e.headerComment){let d=e.lines.length-1;d>=0&&(e.lines[d]+=qt+e.headerComment),e.lines.push(n+u+_e),e.headerComment=""}else if(l.length>1)e.lines.push(n+u+_e);else{let d=e.lines.length-1;d>=0&&(e.lines[d]+=" "+u+_e)}e.headerParts=[],e.conditionNode=null,e.conditionKeyword="",e.hasThen=!1,e.inBody=!0,e.beginRow=t.startPosition.row;return}let s=e.headerParts.some(l=>l.includes("//"));dp([e.headerParts],e.lines,n,r);let c=(qa(e.lines)??"").includes("//");if(s||e.headerParts.length===0||c)e.lines.push(n+_e);else{let l=e.lines.length-1;l>=0?e.lines[l]+=" "+_e:e.lines.push(n+_e)}e.headerParts=[],e.inBody=!0,e.beginRow=t.startPosition.row}function s5(e,t,n,r){if(t.inBody){let o=t.beginRow>=0?t.beginRow:t.lastContentRow;if(zl(t.lines,e,o)){t.beginRow=-1;return}t.lines.push(r+ee(e.text)),t.lastContentRow=e.endPosition.row,t.beginRow=-1}else t.afterElse?t.lines.push(n+ee(e.text)):t.lastHeaderRow>=0&&e.startPosition.row===t.lastHeaderRow?t.headerComment=ee(e.text):t.headerParts.push(ee(e.text))}function a5(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[],c=-1;for(let l of e.children){if(l.text===AM||l.text===IM){a.push(o+l.text);continue}if(re(l,Oa)){a.push(o+Oa),c=l.startPosition.row;continue}if(re(l,Ma)){let u=qa(a);u&&u.trimEnd().endsWith(Oa)?a[a.length-1]=u+" "+Ma:a.push(o+Ma),c=l.startPosition.row;continue}if(re(l,be)){a.push(o+be);continue}if(ve(l)){c=Nt(a,l,s,c);continue}dr(l.type)&&(yt(a,l,c),a.push(r(l,t,n+1)),c=l.endPosition.row)}return a.join(`
236
- `)}function m1(e,t,n,r){e.children.length===0&&zt(`Empty control flow node '${e.type}'`,e.startPosition.row+1,e.startPosition.column+1);let o=c1(e);if(o!==null)return l1(e,t,n,o,r);if(t1(e.type))return u1(e,t,n,r);if(e1(e.type))return d1(e,t,n);if(e.type===kM||e.type===FM)return a5(e,t,n,r);let s=t.indent.repeat(n),a=s+t.indent,c=t.indent.repeat(n+1),l=r5();for(let u of e.children){if(re(u,_e)){o5(l,u,s,a,t.lineLimit);continue}if(re(u,be)){l.inBody=!1,l.lines.push(s+be);continue}if(re(u,Gl)){let d=qa(l.lines);d&&d.trimEnd().endsWith(be)?l.lines[l.lines.length-1]=d+" "+Gl:l.lines.push(s+Gl),l.afterElse=!0;continue}if(re(u,cp)){l.hasThen=!0,l.headerParts.push(cp);continue}if(re(u,Oa)){dp([l.headerParts],l.lines,s,a),l.headerParts=[],l.lines.push(s+Oa),l.inBody=!0,l.beginRow=u.startPosition.row;continue}if(re(u,Ma)){l.lines.push(s+Ma),l.beginRow=u.startPosition.row;continue}if(l.afterElse&&(u.type==="action_if"||u.type==="patch_if")){let d=r(u,t,n).split(`
237
- `),f=d[0]?.trimStart()??"",m=qa(l.lines);m&&f&&(l.lines[l.lines.length-1]=m+" "+f);for(let p=1;p<d.length;p++)l.lines.push(d[p]??"");l.afterElse=!1;continue}if(ve(u)){s5(u,l,s,c);continue}if(l.inBody){if(n1(u.type)){let d=l.beginRow>=0?l.beginRow:l.lastContentRow;yt(l.lines,u,d),l.lines.push(r(u,t,n+1)),l.lastContentRow=u.endPosition.row,l.beginRow=-1}}else{if(u.text===RM||u.text===TM){l.conditionKeyword=u.text,l.conditionNode=e.childForFieldName("condition")??null,l.lastHeaderRow=u.endPosition.row;continue}if(l.conditionNode&&u===l.conditionNode){l.lastHeaderRow=u.endPosition.row;continue}l.lastHeaderRow=u.endPosition.row,l.headerParts.push(u.text)}}return dp([l.headerParts],l.lines,s,a),l.lines.join(`
233
+ `)}function u1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[],c=[],l=!1;for(let w of e.children){if(re(w,_e))break;if(re(w,av)){l=!0,a.push(av);continue}ve(w)||(l?c.push(w.text):a.push(w.text))}let u=[],d=c.join(" ").length,f=o.length+a.join(" ").length+1+d;if(c.length>1&&f>t.lineLimit){u.push(o+a.join(" "));for(let w of c)u.push(s+w);u.push(o+_e)}else{let w=[...a,...c].join(" ");u.push(o+w+" "+_e)}let p=[],g=!1,h=-1,y=-1;for(let w of e.children){if(re(w,_e)){g=!0,y=w.startPosition.row;continue}if(re(w,be))break;if(g)if(ve(w)){if(y>=0&&w.startPosition.row===y){let _=u[u.length-1];if(_&&!_.includes("//")){u[u.length-1]=_+qt+ee(w.text),y=-1;continue}}y=-1,h=Nt(p,w,s,h)}else dr(w.type)&&(y=-1,yt(p,w,h),p.push(r(w,t,n+1)),h=w.endPosition.row)}return[...u,...p,o+be].join(`
234
+ `)}function r5(e){let t=-1;for(let o=0;o<e.children.length;o++){let s=e.children[o];if(s&&s.text==="=>"){t=o;break}}if(t<0||t>=e.children.length-1)return null;let n=[];for(let o=0;o<t;o++){let s=e.children[o];s&&n.push(s.text)}let r=[];for(let o=t+1;o<e.children.length;o++){let s=e.children[o];s&&r.push(s.text)}return{name:n.join(" "),value:r.join(" ")}}function d1(e,t,n){let r=t.indent.repeat(n),o=t.indent.repeat(n+1),s=[],a=[],c=[],l=!1,u=-1;for(let f of e.children){if(re(f,_e)){s.push(r+a.join(" ")+" "+_e),l=!0,u=f.startPosition.row;continue}if(re(f,be))break;if(!l){a.push(f.text);continue}if(ve(f)){if(Kl(s,f,u)){u=-1;continue}u=-1,c.push({type:"comment",text:ee(f.text),startRow:f.startPosition.row,endRow:f.endPosition.row});continue}if(u=-1,f.type==="assoc_entry"){let m=r5(f);m&&c.push({type:"assignment",name:m.name,value:m.value,endRow:f.endPosition.row})}}let d=Xl(c,"",r,o," => ");return s.push(...d,r+be),s.join(`
235
+ `)}function i5(){return{lines:[],headerParts:[],inBody:!1,afterElse:!1,lastContentRow:-1,beginRow:-1,lastHeaderRow:-1,headerComment:"",hasThen:!1,conditionNode:null,conditionKeyword:""}}function o5(e){let t=[],n=r=>{if(ve(r)){t.push({row:r.startPosition.row,column:r.startPosition.column,text:ee(r.text)});return}r.children.forEach(o=>n(o))};return n(e),t}function f1(e){let t=e.childForFieldName("op");if(!t)return null;let n=t.text;if(n!=="OR"&&n!=="AND")return null;let r=e.childForFieldName("left"),o=e.childForFieldName("right");if(!r||!o)return null;let s=[];if(r.type==="binary_expr"){let a=f1(r);a?s.push(...a):s.push({operator:null,text:Ce(r.text),endRow:r.endPosition.row,endColumn:r.endPosition.column})}else s.push({operator:null,text:Ce(r.text),endRow:r.endPosition.row,endColumn:r.endPosition.column});return s.push({operator:t.text,text:Ce(o.text),endRow:o.endPosition.row,endColumn:o.endPosition.column}),s}function Jl(e,t,n,r,o){if(!e)return[n+t];let s=o5(e),a=Ce(e.text).replaceAll(/\(\s+/g,"(").replaceAll(/\s+\)/g,")"),c=n+t+" "+a;if(s.length===0&&c.length<=o)return[c];let l=e,u=!1,d="";if(l.type==="value"&&l.children.length>0){for(let f of l.children)if(f.type==="binary_expr"||f.type==="paren_expr"||f.type==="unary_expr"){l=f;break}}if(l.type==="unary_expr"){let f=l.childForFieldName("op"),m=l.childForFieldName("operand");f&&m&&(d=f.text+" ",l=m)}if(l.type==="paren_expr"&&l.children.length>0){for(let f of l.children)if(f.type==="binary_expr"){l=f,u=!0;break}}if(l.type==="binary_expr"){let f=f1(l);if(f&&f.length>1){let m=[],p=new Set,g=u?"(":"",h=u?")":"";for(let y=0;y<f.length;y++){let w=f[y];if(!w)continue;let _;y===0?_=n+t+" "+d+g+w.text:y===f.length-1?_=r+w.operator+" "+w.text+h:_=r+w.operator+" "+w.text;for(let b=0;b<s.length;b++){let S=s[b];!S||p.has(b)||S.row!==w.endRow||S.column<w.endColumn||(_+=qt+S.text,p.add(b))}m.push(_)}return m}}return[c]}function s5(e,t,n,r,o){if(e.afterElse&&e.lines.length>0){let l=qa(e.lines);if(l&&l.trimEnd().endsWith(zl)){e.lines[e.lines.length-1]=l+" "+_e,e.headerParts=[],e.conditionNode=null,e.conditionKeyword="",e.inBody=!0,e.afterElse=!1,e.beginRow=t.startPosition.row;return}}if(e.afterElse=!1,e.conditionNode&&e.conditionKeyword){let l=Jl(e.conditionNode,e.conditionKeyword,n,r,o);e.lines.push(...l);let u=e.hasThen?lp+" ":"";if(e.headerComment){let d=e.lines.length-1;d>=0&&(e.lines[d]+=qt+e.headerComment),e.lines.push(n+u+_e),e.headerComment=""}else if(l.length>1)e.lines.push(n+u+_e);else{let d=e.lines.length-1;d>=0&&(e.lines[d]+=" "+u+_e)}e.headerParts=[],e.conditionNode=null,e.conditionKeyword="",e.hasThen=!1,e.inBody=!0,e.beginRow=t.startPosition.row;return}let s=e.headerParts.some(l=>l.includes("//"));fp([e.headerParts],e.lines,n,r);let c=(qa(e.lines)??"").includes("//");if(s||e.headerParts.length===0||c)e.lines.push(n+_e);else{let l=e.lines.length-1;l>=0?e.lines[l]+=" "+_e:e.lines.push(n+_e)}e.headerParts=[],e.inBody=!0,e.beginRow=t.startPosition.row}function a5(e,t,n,r){if(t.inBody){let o=t.beginRow>=0?t.beginRow:t.lastContentRow;if(Kl(t.lines,e,o)){t.beginRow=-1;return}t.lines.push(r+ee(e.text)),t.lastContentRow=e.endPosition.row,t.beginRow=-1}else t.afterElse?t.lines.push(n+ee(e.text)):t.lastHeaderRow>=0&&e.startPosition.row===t.lastHeaderRow?t.headerComment=ee(e.text):t.headerParts.push(ee(e.text))}function c5(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[],c=-1;for(let l of e.children){if(l.text===AM||l.text===IM){a.push(o+l.text);continue}if(re(l,Oa)){a.push(o+Oa),c=l.startPosition.row;continue}if(re(l,Ma)){let u=qa(a);u&&u.trimEnd().endsWith(Oa)?a[a.length-1]=u+" "+Ma:a.push(o+Ma),c=l.startPosition.row;continue}if(re(l,be)){a.push(o+be);continue}if(ve(l)){c=Nt(a,l,s,c);continue}dr(l.type)&&(yt(a,l,c),a.push(r(l,t,n+1)),c=l.endPosition.row)}return a.join(`
236
+ `)}function m1(e,t,n,r){e.children.length===0&&zt(`Empty control flow node '${e.type}'`,e.startPosition.row+1,e.startPosition.column+1);let o=c1(e);if(o!==null)return l1(e,t,n,o,r);if(t1(e.type))return u1(e,t,n,r);if(e1(e.type))return d1(e,t,n);if(e.type===kM||e.type===FM)return c5(e,t,n,r);let s=t.indent.repeat(n),a=s+t.indent,c=t.indent.repeat(n+1),l=i5();for(let u of e.children){if(re(u,_e)){s5(l,u,s,a,t.lineLimit);continue}if(re(u,be)){l.inBody=!1,l.lines.push(s+be);continue}if(re(u,zl)){let d=qa(l.lines);d&&d.trimEnd().endsWith(be)?l.lines[l.lines.length-1]=d+" "+zl:l.lines.push(s+zl),l.afterElse=!0;continue}if(re(u,lp)){l.hasThen=!0,l.headerParts.push(lp);continue}if(re(u,Oa)){fp([l.headerParts],l.lines,s,a),l.headerParts=[],l.lines.push(s+Oa),l.inBody=!0,l.beginRow=u.startPosition.row;continue}if(re(u,Ma)){l.lines.push(s+Ma),l.beginRow=u.startPosition.row;continue}if(l.afterElse&&(u.type==="action_if"||u.type==="patch_if")){let d=r(u,t,n).split(`
237
+ `),f=d[0]?.trimStart()??"",m=qa(l.lines);m&&f&&(l.lines[l.lines.length-1]=m+" "+f);for(let p=1;p<d.length;p++)l.lines.push(d[p]??"");l.afterElse=!1;continue}if(ve(u)){a5(u,l,s,c);continue}if(l.inBody){if(n1(u.type)){let d=l.beginRow>=0?l.beginRow:l.lastContentRow;yt(l.lines,u,d),l.lines.push(r(u,t,n+1)),l.lastContentRow=u.endPosition.row,l.beginRow=-1}}else{if(u.text===RM||u.text===TM){l.conditionKeyword=u.text,l.conditionNode=e.childForFieldName("condition")??null,l.lastHeaderRow=u.endPosition.row;continue}if(l.conditionNode&&u===l.conditionNode){l.lastHeaderRow=u.endPosition.row;continue}l.lastHeaderRow=u.endPosition.row,l.headerParts.push(u.text)}}return fp([l.headerParts],l.lines,s,a),l.lines.join(`
238
238
  `)}function p1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[],c=[],l=!1,u=-1;for(let d of e.children){if(re(d,_e)){let f=Ce(c.join(" "));f.includes("//")?a.push(o+f,o+_e):a.push(o+f+" "+_e),l=!0,u=d.startPosition.row;continue}if(re(d,be)){a.push(o+be),l=!1;continue}if(ve(d)){l?u=Nt(a,d,s,u):c.push(ee(d.text));continue}l?dr(d.type)&&(yt(a,d,u),a.push(r(d,t,n+1)),u=d.endPosition.row):c.push(d.text)}return a.join(`
239
- `)}function h1(e){return e==="file_pair"||e==="copy_random_item"||e==="copy_large_item"||e==="copy_2da_item"}function g1(e){return ss(e)||lr(e)||ur(e)||e==="patch_block"||e==="patches"||e==="if_filter"||e==="inner_action"}function c5(e){return re(e,bM)||re(e,SM)||re(e,wM)}function l5(e){let t=[],n=e.children;for(let r=0;r<n.length;r++){let o=n[r];if(!o)continue;if(ve(o)){t.push(ee(o.text));continue}let s=o.text;if(s==="IF_EXISTS"||s==="BUT_ONLY"||s==="BUT_ONLY_IF_IT_CHANGES"){t.push(s);continue}if(s==="IF"||s==="UNLESS"||s==="IF_SIZE_IS"){let a=r+1,c=[];for(;a<n.length&&n[a]&&ve(n[a]);)c.push(ee(n[a].text)),a++;let l=n[a];l&&gv(l.type)?(t.push(s+" "+l.text,...c),r=a):t.push(s,...c)}}return t}function gv(e){return e==="value"||e==="string"||e==="variable_ref"||e==="identifier"||e==="number"}function u5(e){return e==="GLOB"||e==="NOGLOB"||e==="+"||e==="-"}function d5(e){let t={keyword:"",filePairs:[],headerComment:"",patches:[],suffix:[]},n=!1,r=-1,o=e.children,s=-1;for(let a=o.length-1;a>=0;a--){let c=o[a];if(c&&h1(c.type)){s=a;break}}for(let[a,c]of o.entries()){if(h1(c.type)){t.filePairs.push(Ce(c.text)),r=c.endPosition.row;continue}if(c.type==="identifier"&&!t.keyword){t.keyword=c.text,r=c.endPosition.row;continue}if(c.text.startsWith("COPY")||c.text==="INNER_ACTION"){t.keyword=c.text,r=c.endPosition.row;continue}if(t.keyword&&t.filePairs.length===0&&u5(c.text)){t.keyword+=" "+c.text,r=c.endPosition.row;continue}if(ve(c)&&!n&&r>=0&&(c.startPosition.row===r||a<s)){if(t.filePairs.length>0){let l=t.filePairs.length-1;t.filePairs[l]=t.filePairs[l]+qt+ee(c.text)}else t.headerComment=ee(c.text);continue}if(g1(c.type)||ve(c)){n=!0,t.patches.push(c);continue}if(c.type==="when"){n=!0,t.suffix.push(...l5(c));continue}if(c5(c)){n=!0,t.suffix.push(c.text);continue}if(re(c,up)&&n){t.suffix.push(c.text);continue}if(re(c,lp)){n=!0,t.suffix.push(c.text);continue}if(n&&t.suffix.length>0&&t.suffix[t.suffix.length-1]===lp&&gv(c.type)){t.suffix[t.suffix.length-1]=lp+" "+c.text;continue}if(n&&t.suffix.length>0&&t.suffix[t.suffix.length-1]===up&&gv(c.type)){t.suffix[t.suffix.length-1]=up+" "+c.text;continue}}return t}function f5(e,t,n,r){let o=[];if(e.filePairs.length<=1){let s=e.filePairs[0]??"",a=e.keyword+" "+s;t.length+a.length<=r||e.filePairs.length===0?o.push(t+a):o.push(t+e.keyword,n+s)}else{o.push(t+e.keyword);for(let s of e.filePairs)o.push(n+s)}return e.headerComment&&o.length>0&&(o[0]=o[0]+qt+e.headerComment),o}function _1(e,t,n,r){let o=t.indent.repeat(n+1),s=t.indent.repeat(n+2),a=[],c=-1;for(let l of e){if(ve(l)){c=Nt(a,l,o,c);continue}if(l.type==="patches"){let u=_1(l.children,t,n,r);a.push(...u),c=l.endPosition.row;continue}if(yt(a,l,c),l.type==="patch_block"){a.push(o+_e);let u=-1;for(let d of l.children){if(re(d,_e)){u=d.startPosition.row;continue}re(d,be)||(ve(d)?u=Nt(a,d,s,u):g1(d.type)&&(yt(a,d,u),a.push(r(d,t,n+2)),u=d.endPosition.row))}a.push(o+be)}else a.push(r(l,t,n+1));c=l.endPosition.row}return a}function m5(e,t){if(e.length===0)return[];let n=[],r="";for(let o of e)o.startsWith("//")?(r&&(n.push(t+r),r=""),n.push(t+ee(o))):r=r?r+" "+o:o;return r&&n.push(t+r),n}function y1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=d5(e);a.keyword||zt("COPY action missing keyword",e.startPosition.row+1,e.startPosition.column+1),a.filePairs.length===0&&a.patches.length===0&&zt(`COPY action '${a.keyword}' has no file pairs`,e.startPosition.row+1,e.startPosition.column+1);let c=f5(a,o,s,t.lineLimit),l=_1(a.patches,t,n,r),u=m5(a.suffix,o);return[...c,...l,...u].join(`
240
- `)}function b1(e){let t=e.childForFieldName("name")??e.childForFieldName("var"),n=e.childForFieldName("value");if(t||(t=e.childForFieldName("left"),n=e.childForFieldName("right")),!t&&e.type.endsWith("_call_item")){let r=e.children,o=r[0];if(o&&(o.type==="identifier"||o.type==="string"||o.type==="var_name_numeric")){t=o;let s=r[1],a=r[2];s&&s.text==="="&&a&&(n=a)}}if(!t&&e.type==="ternary_expr"){let r=e.text,o=r.indexOf("=");if(o>0){let s=r.slice(0,o).trim(),a=r.slice(o+1).trim();return{name:s,value:Ce(a)}}}return t?{name:t.text,value:n?Ce(n.text):""}:null}function p5(e,t,n){let r=t+n.indent,o=[],s=e.firstChild?.text??"",a=e.children;for(let c=0;c<a.length;c++){let l=a[c];if(l){if(ve(l))o.push({type:"comment",text:ee(l.text),startRow:l.startPosition.row,endRow:l.endPosition.row});else if(l.type==="patch_assignment"){let u=b1(l);u&&o.push({type:"assignment",name:u.name,value:u.value,endRow:l.endPosition.row})}else if(l.type==="variable_ref"||l.type==="identifier"||l.type==="string"||l.type==="var_name_numeric"){let u=a[c+1];if(u&&u.text==="="){let d=a[c+2];d&&!ve(d)?(o.push({type:"assignment",name:l.text,value:Ce(d.text),endRow:d.endPosition.row}),c+=2):(o.push({type:"assignment",name:l.text,value:"",endRow:l.endPosition.row}),c++)}else o.push({type:"assignment",name:l.text,value:"",endRow:l.endPosition.row})}}}return Yl(o,s,t,r)}function h5(e,t,n){let r=t+n.indent,o=[],s="";for(let a of e.children)if(ZM(a.text))s=a.text;else if(ve(a))o.push({type:"comment",text:ee(a.text),startRow:a.startPosition.row,endRow:a.endPosition.row});else if(a.type==="int_var_call_item"||a.type==="str_var_call_item"||a.type==="ret_call_item"||a.type==="ret_array_call_item"||a.type==="binary_expr"||a.type==="ternary_expr"){let c=b1(a);c&&o.push({type:"assignment",name:c.name,value:c.value,endRow:a.endPosition.row})}else(a.type==="variable_ref"||a.type==="identifier")&&o.push({type:"assignment",name:a.text,value:"",endRow:a.endPosition.row});return Yl(o,s,t,r)}function S1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[],c="",l=!1,u=-1,d=-1,f=!1,m=!1,p=!1,g=!1;for(let h of e.children){if(re(h,_e)&&(f=!0),re(h,be)&&(m=!0),re(h,_e)){c&&!p&&!g?(a.push(o+c+" "+_e),c=""):(c&&(a.push(o+c),c=""),a.push(o+_e)),l=!0,u=h.startPosition.row;continue}if(re(h,be)){l=!1,a.push(o+be);continue}if(ve(h)){l?u=Nt(a,h,s,u):c&&d>=0&&h.startPosition.row===d?(c+=qt+ee(h.text),g=!0):(c&&(a.push(o+c),c="",g=!1),a.push(o+ee(h.text)));continue}l?(dr(h.type)||h.type==="local_set"||h.type==="local_sprint")&&(yt(a,h,u),a.push(r(h,t,n+1)),u=h.endPosition.row):h.type.endsWith("_var_decl")||h.type==="ret_decl"||h.type==="ret_array_decl"?(c&&(a.push(o+c),c="",g=!1),a.push(...p5(h,s,t)),p=!0):h.text.startsWith("DEFINE_")?(c=h.text,d=h.endPosition.row):(h.type==="identifier"||h.type==="string"||h.type==="var_name_numeric")&&(c=c?c+" "+h.text:h.text,d=h.endPosition.row)}return c&&a.push(o+c),f||zt("Function definition missing BEGIN",e.startPosition.row+1,e.startPosition.column+1),m||zt("Function definition missing END",e.startPosition.row+1,e.startPosition.column+1),a.join(`
241
- `)}function w1(e,t,n){let r=t.indent.repeat(n),o=t.indent.repeat(n+1),s=[],a="",c=!1,l="",u=-1;for(let f of e.children){if(re(f,be)){c=!0,a&&(s.push(r+a),a=""),s.push(r+be),u=f.endPosition.row;continue}if(ve(f)){if(a&&(s.push(r+a),a=""),u>=0&&f.startPosition.row===u&&s.length>0){let m=s[s.length-1];if(m!==void 0&&!m.includes("//")){s[s.length-1]=m+qt+ee(f.text);continue}}s.push(r+ee(f.text));continue}if(f.type==="int_var_call"||f.type==="str_var_call"||f.type==="ret_call"||f.type==="ret_array_call"){a&&(s.push(r+a),a="");let m=h5(f,o,t);s.push(...m),u=f.endPosition.row}else if(re(f,CM)||re(f,PM)||re(f,NM)||re(f,EM))a=f.text,l=f.text;else if(f.type==="identifier")a=a?a+" "+f.text:f.text;else{let m=Ce(f.text);a=a?a+" "+m:m}}a&&s.push(r+a);let d=e.type==="action_launch_macro"||e.type==="patch_launch_macro";return!c&&!d&&zt(`Function call '${l}' missing END`,e.startPosition.row+1,e.startPosition.column+1),s.join(`
242
- `)}function x1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[o+"INNER_ACTION BEGIN"],c=-1;for(let l of e.children){if(re(l,_e)){c=l.startPosition.row;continue}re(l,be)||l.type==="identifier"&&l.text.toUpperCase()==="INNER_ACTION"||(ve(l)?c=Nt(a,l,s,c):(os(l.type)||Kl(l.type)||lr(l.type)||ur(l.type)||l.type==="inlined_file")&&(yt(a,l,c),a.push(r(l,t,n+1)),c=l.endPosition.row))}return a.push(o+be),a.join(`
243
- `)}function g5(e){return ss(e)||lr(e)||ur(e)}function v1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[],c="INNER_PATCH";for(let g of e.children)if(g.text==="INNER_PATCH"||g.text==="INNER_PATCH_SAVE"||g.text==="INNER_PATCH_FILE"){c=g.text;break}let l=[c],u=e.childForFieldName("var");u&&l.push(Ce(u.text));let d=e.childForFieldName("buffer");d&&l.push(Ce(d.text));let f=e.childForFieldName("file");f&&l.push(Ce(f.text));let m=l.join(" ")+" "+_e;a.push(o+m);let p=-1;for(let g of e.children){if(re(g,_e)){p=g.startPosition.row;continue}re(g,be)||g.text!==c&&(g===u||g===d||g===f||(ve(g)?p=Nt(a,g,s,p):g5(g.type)&&(yt(a,g,p),a.push(r(g,t,n+1)),p=g.endPosition.row)))}return a.push(o+be),a.join(`
239
+ `)}function h1(e){return e==="file_pair"||e==="copy_random_item"||e==="copy_large_item"||e==="copy_2da_item"}function g1(e){return ss(e)||lr(e)||ur(e)||e==="patch_block"||e==="patches"||e==="if_filter"||e==="inner_action"}function l5(e){return re(e,bM)||re(e,SM)||re(e,wM)}function u5(e){let t=[],n=e.children;for(let r=0;r<n.length;r++){let o=n[r];if(!o)continue;if(ve(o)){t.push(ee(o.text));continue}let s=o.text;if(s==="IF_EXISTS"||s==="BUT_ONLY"||s==="BUT_ONLY_IF_IT_CHANGES"){t.push(s);continue}if(s==="IF"||s==="UNLESS"||s==="IF_SIZE_IS"){let a=r+1,c=[];for(;a<n.length&&n[a]&&ve(n[a]);)c.push(ee(n[a].text)),a++;let l=n[a];l&&hv(l.type)?(t.push(s+" "+l.text,...c),r=a):t.push(s,...c)}}return t}function hv(e){return e==="value"||e==="string"||e==="variable_ref"||e==="identifier"||e==="number"}function d5(e){return e==="GLOB"||e==="NOGLOB"||e==="+"||e==="-"}function f5(e){let t={keyword:"",filePairs:[],headerComment:"",patches:[],suffix:[]},n=!1,r=-1,o=e.children,s=-1;for(let a=o.length-1;a>=0;a--){let c=o[a];if(c&&h1(c.type)){s=a;break}}for(let[a,c]of o.entries()){if(h1(c.type)){t.filePairs.push(Ce(c.text)),r=c.endPosition.row;continue}if(c.type==="identifier"&&!t.keyword){t.keyword=c.text,r=c.endPosition.row;continue}if(c.text.startsWith("COPY")||c.text==="INNER_ACTION"){t.keyword=c.text,r=c.endPosition.row;continue}if(t.keyword&&t.filePairs.length===0&&d5(c.text)){t.keyword+=" "+c.text,r=c.endPosition.row;continue}if(ve(c)&&!n&&r>=0&&(c.startPosition.row===r||a<s)){if(t.filePairs.length>0){let l=t.filePairs.length-1;t.filePairs[l]=t.filePairs[l]+qt+ee(c.text)}else t.headerComment=ee(c.text);continue}if(g1(c.type)||ve(c)){n=!0,t.patches.push(c);continue}if(c.type==="when"){n=!0,t.suffix.push(...u5(c));continue}if(l5(c)){n=!0,t.suffix.push(c.text);continue}if(re(c,dp)&&n){t.suffix.push(c.text);continue}if(re(c,up)){n=!0,t.suffix.push(c.text);continue}if(n&&t.suffix.length>0&&t.suffix[t.suffix.length-1]===up&&hv(c.type)){t.suffix[t.suffix.length-1]=up+" "+c.text;continue}if(n&&t.suffix.length>0&&t.suffix[t.suffix.length-1]===dp&&hv(c.type)){t.suffix[t.suffix.length-1]=dp+" "+c.text;continue}}return t}function m5(e,t,n,r){let o=[];if(e.filePairs.length<=1){let s=e.filePairs[0]??"",a=e.keyword+" "+s;t.length+a.length<=r||e.filePairs.length===0?o.push(t+a):o.push(t+e.keyword,n+s)}else{o.push(t+e.keyword);for(let s of e.filePairs)o.push(n+s)}return e.headerComment&&o.length>0&&(o[0]=o[0]+qt+e.headerComment),o}function _1(e,t,n,r){let o=t.indent.repeat(n+1),s=t.indent.repeat(n+2),a=[],c=-1;for(let l of e){if(ve(l)){c=Nt(a,l,o,c);continue}if(l.type==="patches"){let u=_1(l.children,t,n,r);a.push(...u),c=l.endPosition.row;continue}if(yt(a,l,c),l.type==="patch_block"){a.push(o+_e);let u=-1;for(let d of l.children){if(re(d,_e)){u=d.startPosition.row;continue}re(d,be)||(ve(d)?u=Nt(a,d,s,u):g1(d.type)&&(yt(a,d,u),a.push(r(d,t,n+2)),u=d.endPosition.row))}a.push(o+be)}else a.push(r(l,t,n+1));c=l.endPosition.row}return a}function p5(e,t){if(e.length===0)return[];let n=[],r="";for(let o of e)o.startsWith("//")?(r&&(n.push(t+r),r=""),n.push(t+ee(o))):r=r?r+" "+o:o;return r&&n.push(t+r),n}function y1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=f5(e);a.keyword||zt("COPY action missing keyword",e.startPosition.row+1,e.startPosition.column+1),a.filePairs.length===0&&a.patches.length===0&&zt(`COPY action '${a.keyword}' has no file pairs`,e.startPosition.row+1,e.startPosition.column+1);let c=m5(a,o,s,t.lineLimit),l=_1(a.patches,t,n,r),u=p5(a.suffix,o);return[...c,...l,...u].join(`
240
+ `)}function b1(e){let t=e.childForFieldName("name")??e.childForFieldName("var"),n=e.childForFieldName("value");if(t||(t=e.childForFieldName("left"),n=e.childForFieldName("right")),!t&&e.type.endsWith("_call_item")){let r=e.children,o=r[0];if(o&&(o.type==="identifier"||o.type==="string"||o.type==="var_name_numeric")){t=o;let s=r[1],a=r[2];s&&s.text==="="&&a&&(n=a)}}if(!t&&e.type==="ternary_expr"){let r=e.text,o=r.indexOf("=");if(o>0){let s=r.slice(0,o).trim(),a=r.slice(o+1).trim();return{name:s,value:Ce(a)}}}return t?{name:t.text,value:n?Ce(n.text):""}:null}function h5(e,t,n){let r=t+n.indent,o=[],s=e.firstChild?.text??"",a=e.children;for(let c=0;c<a.length;c++){let l=a[c];if(l){if(ve(l))o.push({type:"comment",text:ee(l.text),startRow:l.startPosition.row,endRow:l.endPosition.row});else if(l.type==="patch_assignment"){let u=b1(l);u&&o.push({type:"assignment",name:u.name,value:u.value,endRow:l.endPosition.row})}else if(l.type==="variable_ref"||l.type==="identifier"||l.type==="string"||l.type==="var_name_numeric"){let u=a[c+1];if(u&&u.text==="="){let d=a[c+2];d&&!ve(d)?(o.push({type:"assignment",name:l.text,value:Ce(d.text),endRow:d.endPosition.row}),c+=2):(o.push({type:"assignment",name:l.text,value:"",endRow:l.endPosition.row}),c++)}else o.push({type:"assignment",name:l.text,value:"",endRow:l.endPosition.row})}}}return Xl(o,s,t,r)}function g5(e,t,n){let r=t+n.indent,o=[],s="";for(let a of e.children)if(ZM(a.text))s=a.text;else if(ve(a))o.push({type:"comment",text:ee(a.text),startRow:a.startPosition.row,endRow:a.endPosition.row});else if(a.type==="int_var_call_item"||a.type==="str_var_call_item"||a.type==="ret_call_item"||a.type==="ret_array_call_item"||a.type==="binary_expr"||a.type==="ternary_expr"){let c=b1(a);c&&o.push({type:"assignment",name:c.name,value:c.value,endRow:a.endPosition.row})}else(a.type==="variable_ref"||a.type==="identifier")&&o.push({type:"assignment",name:a.text,value:"",endRow:a.endPosition.row});return Xl(o,s,t,r)}function S1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[],c="",l=!1,u=-1,d=-1,f=!1,m=!1,p=!1,g=!1;for(let h of e.children){if(re(h,_e)&&(f=!0),re(h,be)&&(m=!0),re(h,_e)){c&&!p&&!g?(a.push(o+c+" "+_e),c=""):(c&&(a.push(o+c),c=""),a.push(o+_e)),l=!0,u=h.startPosition.row;continue}if(re(h,be)){l=!1,a.push(o+be);continue}if(ve(h)){l?u=Nt(a,h,s,u):c&&d>=0&&h.startPosition.row===d?(c+=qt+ee(h.text),g=!0):(c&&(a.push(o+c),c="",g=!1),a.push(o+ee(h.text)));continue}l?(dr(h.type)||h.type==="local_set"||h.type==="local_sprint")&&(yt(a,h,u),a.push(r(h,t,n+1)),u=h.endPosition.row):h.type.endsWith("_var_decl")||h.type==="ret_decl"||h.type==="ret_array_decl"?(c&&(a.push(o+c),c="",g=!1),a.push(...h5(h,s,t)),p=!0):h.text.startsWith("DEFINE_")?(c=h.text,d=h.endPosition.row):(h.type==="identifier"||h.type==="string"||h.type==="var_name_numeric")&&(c=c?c+" "+h.text:h.text,d=h.endPosition.row)}return c&&a.push(o+c),f||zt("Function definition missing BEGIN",e.startPosition.row+1,e.startPosition.column+1),m||zt("Function definition missing END",e.startPosition.row+1,e.startPosition.column+1),a.join(`
241
+ `)}function w1(e,t,n){let r=t.indent.repeat(n),o=t.indent.repeat(n+1),s=[],a="",c=!1,l="",u=-1;for(let f of e.children){if(re(f,be)){c=!0,a&&(s.push(r+a),a=""),s.push(r+be),u=f.endPosition.row;continue}if(ve(f)){if(a&&(s.push(r+a),a=""),u>=0&&f.startPosition.row===u&&s.length>0){let m=s[s.length-1];if(m!==void 0&&!m.includes("//")){s[s.length-1]=m+qt+ee(f.text);continue}}s.push(r+ee(f.text));continue}if(f.type==="int_var_call"||f.type==="str_var_call"||f.type==="ret_call"||f.type==="ret_array_call"){a&&(s.push(r+a),a="");let m=g5(f,o,t);s.push(...m),u=f.endPosition.row}else if(re(f,CM)||re(f,PM)||re(f,NM)||re(f,EM))a=f.text,l=f.text;else if(f.type==="identifier")a=a?a+" "+f.text:f.text;else{let m=Ce(f.text);a=a?a+" "+m:m}}a&&s.push(r+a);let d=e.type==="action_launch_macro"||e.type==="patch_launch_macro";return!c&&!d&&zt(`Function call '${l}' missing END`,e.startPosition.row+1,e.startPosition.column+1),s.join(`
242
+ `)}function x1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[o+"INNER_ACTION BEGIN"],c=-1;for(let l of e.children){if(re(l,_e)){c=l.startPosition.row;continue}re(l,be)||l.type==="identifier"&&l.text.toUpperCase()==="INNER_ACTION"||(ve(l)?c=Nt(a,l,s,c):(os(l.type)||Yl(l.type)||lr(l.type)||ur(l.type)||l.type==="inlined_file")&&(yt(a,l,c),a.push(r(l,t,n+1)),c=l.endPosition.row))}return a.push(o+be),a.join(`
243
+ `)}function _5(e){return ss(e)||lr(e)||ur(e)}function v1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[],c="INNER_PATCH";for(let g of e.children)if(g.text==="INNER_PATCH"||g.text==="INNER_PATCH_SAVE"||g.text==="INNER_PATCH_FILE"){c=g.text;break}let l=[c],u=e.childForFieldName("var");u&&l.push(Ce(u.text));let d=e.childForFieldName("buffer");d&&l.push(Ce(d.text));let f=e.childForFieldName("file");f&&l.push(Ce(f.text));let m=l.join(" ")+" "+_e;a.push(o+m);let p=-1;for(let g of e.children){if(re(g,_e)){p=g.startPosition.row;continue}re(g,be)||g.text!==c&&(g===u||g===d||g===f||(ve(g)?p=Nt(a,g,s,p):_5(g.type)&&(yt(a,g,p),a.push(r(g,t,n+1)),p=g.endPosition.row)))}return a.push(o+be),a.join(`
244
244
  `)}function C1(e,t,n,r){let o=t.indent.repeat(n),s=t.indent.repeat(n+1),a=[],c=[],l=!1,u=!1,d=-1;for(let f of e.children){let m=f.text.toUpperCase();if(m==="R_B_B"||m==="REPLACE_BCS_BLOCK"){c.push(f.text);continue}if(m==="CASE_SENSITIVE"||m==="CASE_INSENSITIVE"){c.push(f.text);continue}if(m==="ON_MISMATCH"){u=!0,l=!0,a.push(o+c.join(" "),o+"ON_MISMATCH"),d=f.startPosition.row;continue}if(m!=="END"){if(!l&&f.type==="string"){c.push(f.text);continue}l&&(ve(f)?d=Nt(a,f,s,d):(ss(f.type)||lr(f.type)||ur(f.type))&&(yt(a,f,d),a.push(r(f,t,n+1)),d=f.endPosition.row))}}return u?(a.push(o+be),a.join(`
245
- `)):o+c.join(" ")}function P1(e,t,n){let r=t.indent.repeat(n),o=r+t.indent,s=e.childForFieldName("predicate"),a=e.childForFieldName("message");if(!s||!a)return cr(r+Ce(e.text));let c=Xl(s,"REQUIRE_PREDICATE",r,o,t.lineLimit);return c.length===1?c[0]+" "+Ce(a.text):(c[c.length-1]+=" "+Ce(a.text),c.join(`
246
- `))}function _5(e){return Ce(e.text)}function y5(e,t){let n=[],r="",o=-1,s=-1;for(let a of e.children){if(ve(a)){r&&s>=0&&a.startPosition.row===s?(n.push(r+qt+ee(a.text)),r=""):(r&&(n.push(r),r=""),o=Nt(n,a,"",o));continue}if(re(a,_e)){r=_e,s=a.endPosition.row;continue}if(a.type==="value"||a.type==="string"||a.type==="identifier"||a.type==="variable_ref"||a.type==="tra_ref"){r=r?r+" "+Ce(a.text):Ce(a.text),s=a.endPosition.row;continue}if(a.type==="designated_flag"||a.type==="deprecated_flag"||a.type==="subcomponent_flag"||a.type==="group_flag"||a.type==="label_flag"||a.type==="require_predicate_flag"||a.type==="require_component_flag"||a.type==="forbid_component_flag"||a.type==="require_file_flag"||a.type==="forbid_file_flag"||a.type==="forced_subcomponent_flag"||a.type==="metadata_flag"||a.type==="no_log_record_flag"||a.type==="install_by_default_flag"){if(r&&(n.push(r),r=""),a.type==="require_predicate_flag"){let c="REQUIRE_PREDICATE",l=a.childForFieldName("predicate"),u=a.childForFieldName("message"),d=t.indent,f=Xl(l,c,"",d,t.lineLimit);u&&(f[f.length-1]+=" "+Ce(u.text)),r=f.join(`
245
+ `)):o+c.join(" ")}function P1(e,t,n){let r=t.indent.repeat(n),o=r+t.indent,s=e.childForFieldName("predicate"),a=e.childForFieldName("message");if(!s||!a)return cr(r+Ce(e.text));let c=Jl(s,"REQUIRE_PREDICATE",r,o,t.lineLimit);return c.length===1?c[0]+" "+Ce(a.text):(c[c.length-1]+=" "+Ce(a.text),c.join(`
246
+ `))}function y5(e){return Ce(e.text)}function b5(e,t){let n=[],r="",o=-1,s=-1;for(let a of e.children){if(ve(a)){r&&s>=0&&a.startPosition.row===s?(n.push(r+qt+ee(a.text)),r=""):(r&&(n.push(r),r=""),o=Nt(n,a,"",o));continue}if(re(a,_e)){r=_e,s=a.endPosition.row;continue}if(a.type==="value"||a.type==="string"||a.type==="identifier"||a.type==="variable_ref"||a.type==="tra_ref"){r=r?r+" "+Ce(a.text):Ce(a.text),s=a.endPosition.row;continue}if(a.type==="designated_flag"||a.type==="deprecated_flag"||a.type==="subcomponent_flag"||a.type==="group_flag"||a.type==="label_flag"||a.type==="require_predicate_flag"||a.type==="require_component_flag"||a.type==="forbid_component_flag"||a.type==="require_file_flag"||a.type==="forbid_file_flag"||a.type==="forced_subcomponent_flag"||a.type==="metadata_flag"||a.type==="no_log_record_flag"||a.type==="install_by_default_flag"){if(r&&(n.push(r),r=""),a.type==="require_predicate_flag"){let c="REQUIRE_PREDICATE",l=a.childForFieldName("predicate"),u=a.childForFieldName("message"),d=t.indent,f=Jl(l,c,"",d,t.lineLimit);u&&(f[f.length-1]+=" "+Ce(u.text)),r=f.join(`
247
247
  `)}else r=Ce(a.text);s=a.endPosition.row;continue}(os(a.type)||lr(a.type)||ur(a.type)||a.type==="inlined_file")&&(r&&(n.push(r),r=""),yt(n,a,o),n.push(Rr(a,t,0)),o=a.endPosition.row)}return r&&n.push(r),n.join(`
248
- `)}function b5(e,t){let n=[],r=-1;for(let o of e.children){if(re(o,lv)){n.push(lv),r=o.endPosition.row;continue}re(o,be)||(ve(o)?r=Nt(n,o,t.indent,r):o.type==="inlined_file"?(yt(n,o,r),n.push(N1(o,t,1)),r=o.endPosition.row):(os(o.type)||lr(o.type)||ur(o.type))&&(yt(n,o,r),n.push(Rr(o,t,1)),r=o.endPosition.row))}return n.push(be),n.join(`
249
- `)}function S5(e,t){let n=t.indent,r=t.indent.repeat(2),o=[],s="",a=!1,c=-1;for(let l of e.children){if(re(l,_e)){o.push(n+(s+" "+_e).trim()),a=!0,c=l.endPosition.row;continue}if(!re(l,be)){if(ve(l)){c=Nt(o,l,a?r:n,c);continue}a?o.push(r+Ce(l.text)):s=Ce(l.text),c=l.endPosition.row}}return o.push(n+be),o.join(`
250
- `)}function w5(e,t){let n=[uv],r=!1,o=-1;for(let s of e.children){if(re(s,uv)){o=s.endPosition.row;continue}if(re(s,dv)){n.push(t.indent+dv),r=!0,o=s.endPosition.row;continue}if(re(s,be)){r&&(n.push(t.indent+be),r=!1),o=s.endPosition.row;continue}if(ve(s)){o=Nt(n,s,t.indent,o);continue}s.type==="quick_menu_entry"?(yt(n,s,o),n.push(S5(s,t))):n.push(t.indent.repeat(2)+Ce(s.text)),o=s.endPosition.row}return n.push(be),n.join(`
251
- `)}function x5(e,t){let n=[],r=-1;for(let o of e.children)ve(o)?r=Nt(n,o,"",r):dr(o.type)&&(yt(n,o,r),n.push(Rr(o,t,0)),r=o.endPosition.row);return n.join(`
252
- `)}function N1(e,t,n){return t.indent.repeat(n)+e.text.trim()}function v5(e){let t=[],n=/SAY\b/gi,r=0,o;for(;(o=n.exec(e))!==null;){let s=o.index,a=0;for(;s>r&&/\s/.test(e[s-1]??"");)s--,a++;a!==0&&(t.push(e.slice(r,s)),r=o.index)}return r<e.length&&t.push(e.slice(r)),t}function C5(e,t,n){let r=t.indent.repeat(n),o=r+Ce(e.text);if(e.children.some(g=>g.text==="BEGIN"||g.text==="END")&&zt(`Unhandled block node type '${e.type}' - using simple formatting`,e.startPosition.row+1,e.startPosition.column+1),o.length<=t.lineLimit)return cr(o);let a=[];for(let g of e.children)g.type==="string"&&a.push(g);if(a.length<2)return cr(o);let c=a[0];if(!c)return cr(o);let l=c.startIndex-e.startIndex,u=Ce(e.text.slice(0,l)),d=t.indent.repeat(n+1),f=[r+u],m=c.endIndex-e.startIndex;f.push(d+c.text);for(let g=1;g<a.length;g++){let h=a[g];if(!h)continue;let y=m,w=h.startIndex-e.startIndex,_=Ce(e.text.slice(y,w));_&&f.push(d+_),f.push(d+h.text),m=h.endIndex-e.startIndex}let p=a[a.length-1];if(p){let g=p.endIndex-e.startIndex,h=Ce(e.text.slice(g));if(h)for(let y of v5(h))y.trim()&&f.push(d+y.trim())}return f.join(`
253
- `)}function Rr(e,t,n){let r=e.type;return r===UM?N1(e,t,n):QM(r)?_5(e):r===BM?y5(e,t):r===jM?b5(e,t):r==="quick_menu_directive"?w5(e,t):r===WM?x5(e,t):Kl(r)?y1(e,t,n,Rr):lr(r)?m1(e,t,n,Rr):r===HM||r===VM?p1(e,t,n,Rr):$a(r)?S1(e,t,n,Rr):ur(r)?w1(e,t,n):r===GM?P1(e,t,n):r===qM?x1(e,t,n,Rr):r===LM||r===OM||r===MM?v1(e,t,n,Rr):r===$M?C1(e,t,n,Rr):C5(e,t,n)}function P5(e,t,n){if(!ve(t)||n<0||t.startPosition.row!==n||e.length===0)return!1;let r=e[e.length-1];if(!r)return!1;let o=r.split(`
248
+ `)}function S5(e,t){let n=[],r=-1;for(let o of e.children){if(re(o,cv)){n.push(cv),r=o.endPosition.row;continue}re(o,be)||(ve(o)?r=Nt(n,o,t.indent,r):o.type==="inlined_file"?(yt(n,o,r),n.push(N1(o,t,1)),r=o.endPosition.row):(os(o.type)||lr(o.type)||ur(o.type))&&(yt(n,o,r),n.push(Rr(o,t,1)),r=o.endPosition.row))}return n.push(be),n.join(`
249
+ `)}function w5(e,t){let n=t.indent,r=t.indent.repeat(2),o=[],s="",a=!1,c=-1;for(let l of e.children){if(re(l,_e)){o.push(n+(s+" "+_e).trim()),a=!0,c=l.endPosition.row;continue}if(!re(l,be)){if(ve(l)){c=Nt(o,l,a?r:n,c);continue}a?o.push(r+Ce(l.text)):s=Ce(l.text),c=l.endPosition.row}}return o.push(n+be),o.join(`
250
+ `)}function x5(e,t){let n=[lv],r=!1,o=-1;for(let s of e.children){if(re(s,lv)){o=s.endPosition.row;continue}if(re(s,uv)){n.push(t.indent+uv),r=!0,o=s.endPosition.row;continue}if(re(s,be)){r&&(n.push(t.indent+be),r=!1),o=s.endPosition.row;continue}if(ve(s)){o=Nt(n,s,t.indent,o);continue}s.type==="quick_menu_entry"?(yt(n,s,o),n.push(w5(s,t))):n.push(t.indent.repeat(2)+Ce(s.text)),o=s.endPosition.row}return n.push(be),n.join(`
251
+ `)}function v5(e,t){let n=[],r=-1;for(let o of e.children)ve(o)?r=Nt(n,o,"",r):dr(o.type)&&(yt(n,o,r),n.push(Rr(o,t,0)),r=o.endPosition.row);return n.join(`
252
+ `)}function N1(e,t,n){return t.indent.repeat(n)+e.text.trim()}function C5(e){let t=[],n=/SAY\b/gi,r=0,o;for(;(o=n.exec(e))!==null;){let s=o.index,a=0;for(;s>r&&/\s/.test(e[s-1]??"");)s--,a++;a!==0&&(t.push(e.slice(r,s)),r=o.index)}return r<e.length&&t.push(e.slice(r)),t}function P5(e,t,n){let r=t.indent.repeat(n),o=r+Ce(e.text);if(e.children.some(g=>g.text==="BEGIN"||g.text==="END")&&zt(`Unhandled block node type '${e.type}' - using simple formatting`,e.startPosition.row+1,e.startPosition.column+1),o.length<=t.lineLimit)return cr(o);let a=[];for(let g of e.children)g.type==="string"&&a.push(g);if(a.length<2)return cr(o);let c=a[0];if(!c)return cr(o);let l=c.startIndex-e.startIndex,u=Ce(e.text.slice(0,l)),d=t.indent.repeat(n+1),f=[r+u],m=c.endIndex-e.startIndex;f.push(d+c.text);for(let g=1;g<a.length;g++){let h=a[g];if(!h)continue;let y=m,w=h.startIndex-e.startIndex,_=Ce(e.text.slice(y,w));_&&f.push(d+_),f.push(d+h.text),m=h.endIndex-e.startIndex}let p=a[a.length-1];if(p){let g=p.endIndex-e.startIndex,h=Ce(e.text.slice(g));if(h)for(let y of C5(h))y.trim()&&f.push(d+y.trim())}return f.join(`
253
+ `)}function Rr(e,t,n){let r=e.type;return r===UM?N1(e,t,n):QM(r)?y5(e):r===BM?b5(e,t):r===jM?S5(e,t):r==="quick_menu_directive"?x5(e,t):r===WM?v5(e,t):Yl(r)?y1(e,t,n,Rr):lr(r)?m1(e,t,n,Rr):r===HM||r===VM?p1(e,t,n,Rr):$a(r)?S1(e,t,n,Rr):ur(r)?w1(e,t,n):r===GM?P1(e,t,n):r===qM?x1(e,t,n,Rr):r===LM||r===OM||r===MM?v1(e,t,n,Rr):r===$M?C1(e,t,n,Rr):P5(e,t,n)}function N5(e,t,n){if(!ve(t)||n<0||t.startPosition.row!==n||e.length===0)return!1;let r=e[e.length-1];if(!r)return!1;let o=r.split(`
254
254
  `),s=o[o.length-1];return!s||s.includes("//")?!1:(o[o.length-1]=s+qt+ee(t.text),e[e.length-1]=o.join(`
255
- `),!0)}function N5(e,t,n){let r=e[t];if(!r||!ve(r)||!(n<0||r.startPosition.row>n+1))return!1;let s=t+1,a=r.endPosition.row;for(;s<e.length;){let l=e[s];if(!l||!ve(l))break;a=l.endPosition.row,s++}let c=e[s];return c&&c.type==="component"?c.startPosition.row<=a+1:!1}function _v(e,t){pi(e);let n={...Xr,...t},r={indent:" ".repeat(n.indentSize),lineLimit:n.lineLimit,indentSize:n.indentSize},o=[],s=-1,a=e.children,c=!1;for(let l=0;l<a.length;l++){let u=a[l];if(!u||P5(o,u,s))continue;let d=N5(a,l,s);d&&(c=!0),s>=0&&u.startPosition.row>s+1&&o.push(""),(d||u.type==="component"&&!c)&&o.length>0&&o[o.length-1]!==""&&o.push(""),u.type==="component"&&(c=!1),ve(u)?o.push(ee(u.text)):o.push(Rr(u,r,0)),s=u.endPosition.row}for(;o.length>0&&o[o.length-1]==="";)o.pop();return{text:o.join(`
255
+ `),!0)}function E5(e,t,n){let r=e[t];if(!r||!ve(r)||!(n<0||r.startPosition.row>n+1))return!1;let s=t+1,a=r.endPosition.row;for(;s<e.length;){let l=e[s];if(!l||!ve(l))break;a=l.endPosition.row,s++}let c=e[s];return c&&c.type==="component"?c.startPosition.row<=a+1:!1}function gv(e,t){pi(e);let n={...Xr,...t},r={indent:" ".repeat(n.indentSize),lineLimit:n.lineLimit,indentSize:n.indentSize},o=[],s=-1,a=e.children,c=!1;for(let l=0;l<a.length;l++){let u=a[l];if(!u||N5(o,u,s))continue;let d=E5(a,l,s);d&&(c=!0),s>=0&&u.startPosition.row>s+1&&o.push(""),(d||u.type==="component"&&!c)&&o.length>0&&o[o.length-1]!==""&&o.push(""),u.type==="component"&&(c=!1),ve(u)?o.push(ee(u.text)):o.push(Rr(u,r,0)),s=u.endPosition.row}for(;o.length>0&&o[o.length-1]==="";)o.pop();return{text:o.join(`
256
256
  `).replaceAll("\r","")+`
257
- `}}var E5=/^(@)\s*(-?\d+)\s*=\s*/;function R5(e,t){let{delimLen:n,closerStart:r}=Ul(e,t);return r===-1?e.length:r+n}function T5(e,t){for(t++;t<e.length&&e[t]!=='"';)e[t]==="\\"&&t++,t++;return t<e.length?t+1:t}function A5(e,t){let n=[],r=t;for(;t<e.length;)if(e[t]==="~"){n.push(e.slice(r,t));let s=R5(e,t);n.push(e.slice(t,s)),t=s,r=t}else if(e[t]==='"'){n.push(e.slice(r,t));let s=T5(e,t);n.push(e.slice(t,s)),t=s,r=t}else{if(e[t]===`
257
+ `}}var R5=/^(@)\s*(-?\d+)\s*=\s*/;function T5(e,t){let{delimLen:n,closerStart:r}=Hl(e,t);return r===-1?e.length:r+n}function A5(e,t){for(t++;t<e.length&&e[t]!=='"';)e[t]==="\\"&&t++,t++;return t<e.length?t+1:t}function I5(e,t){let n=[],r=t;for(;t<e.length;)if(e[t]==="~"){n.push(e.slice(r,t));let s=T5(e,t);n.push(e.slice(t,s)),t=s,r=t}else if(e[t]==='"'){n.push(e.slice(r,t));let s=A5(e,t);n.push(e.slice(t,s)),t=s,r=t}else{if(e[t]===`
258
258
  `)break;t++}n.push(e.slice(r,t).trimEnd());let o=t<e.length&&e[t]===`
259
- `?t+1:t;return{rest:n.join(""),nextPos:o}}function I5(e,t){if(e[t]===`
259
+ `?t+1:t;return{rest:n.join(""),nextPos:o}}function D5(e,t){if(e[t]===`
260
260
  `||t>=e.length)return{text:"",nextPos:t<e.length?t+1:t};if(e[t]==="/"&&e[t+1]==="/"||e[t]==="/"&&e[t+1]==="*"){let s=e.indexOf(`
261
261
  `,t),a=s===-1?e.length:s;return{text:e.slice(t,a).trimEnd(),nextPos:a+(s===-1?0:1)}}if(e[t]==="@"){let s=e.indexOf(`
262
- `,t),a=s===-1?e.length:s,c=e.slice(t,a),l=E5.exec(c);if(l){let d=`@${l[2]??""} = `,f=t+l[0].length,{rest:m,nextPos:p}=A5(e,f);return{text:(d+m).trimEnd(),nextPos:p}}}let n=e.indexOf(`
263
- `,t),r=n===-1?e.length:n;return{text:e.slice(t,r).trimEnd(),nextPos:r+(n===-1?0:1)}}function yv(e){let t=Er(e);if(t.length===0)return{text:e};let n=[],r=0;for(;r<t.length;){let{text:u,nextPos:d}=I5(t,r);n.push(u),r=d}let s=n.filter((u,d)=>!(u===""&&n[d-1]==="")).join(`
262
+ `,t),a=s===-1?e.length:s,c=e.slice(t,a),l=R5.exec(c);if(l){let d=`@${l[2]??""} = `,f=t+l[0].length,{rest:m,nextPos:p}=I5(e,f);return{text:(d+m).trimEnd(),nextPos:p}}}let n=e.indexOf(`
263
+ `,t),r=n===-1?e.length:n;return{text:e.slice(t,r).trimEnd(),nextPos:r+(n===-1?0:1)}}function _v(e){let t=Er(e);if(t.length===0)return{text:e};let n=[],r=0;for(;r<t.length;){let{text:u,nextPos:d}=D5(t,r);n.push(u),r=d}let s=n.filter((u,d)=>!(u===""&&n[d-1]==="")).join(`
264
264
  `)+`
265
- `;if(s===e)return{text:e};let a=u=>{let d=[],f=/^@\s*(-?\d+)\s*=/gm,m;for(;(m=f.exec(u))!==null;)d.push(m[1]??"");return d},c=a(t),l=a(s);return c.join("\0")!==l.join("\0")?{text:e,warning:"TRA formatter: entry number mismatch after formatting, skipping"}:{text:s}}function D5(e,t){if(e[t]!=="{")return null;let n=t+1,r=n;for(;n<e.length&&e[n]!=="}";)n++;if(n>=e.length)return null;let o=e.slice(r,n).trim();if(n++,n>=e.length||e[n]!=="{")return null;n++;let s=n;for(;n<e.length&&e[n]!=="}";)n++;if(n>=e.length)return null;let a=e.slice(s,n).trim();if(n++,n>=e.length||e[n]!=="{")return null;n++;let c=n;for(;n<e.length&&e[n]!=="}";)n++;if(n>=e.length)return null;let l=e.slice(c,n);return n++,{number:o,audio:a,text:l,nextPos:n}}function k5(e,t){if(e[t]===`
266
- `)return{text:"",nextPos:t+1};if(e[t]==="{"){let s=D5(e,t);if(s!==null){let a=`{${s.number}}{${s.audio}}{${s.text}}`,c=s.nextPos;for(;c<e.length&&e[c]!==`
265
+ `;if(s===e)return{text:e};let a=u=>{let d=[],f=/^@\s*(-?\d+)\s*=/gm,m;for(;(m=f.exec(u))!==null;)d.push(m[1]??"");return d},c=a(t),l=a(s);return c.join("\0")!==l.join("\0")?{text:e,warning:"TRA formatter: entry number mismatch after formatting, skipping"}:{text:s}}function k5(e,t){if(e[t]!=="{")return null;let n=t+1,r=n;for(;n<e.length&&e[n]!=="}";)n++;if(n>=e.length)return null;let o=e.slice(r,n).trim();if(n++,n>=e.length||e[n]!=="{")return null;n++;let s=n;for(;n<e.length&&e[n]!=="}";)n++;if(n>=e.length)return null;let a=e.slice(s,n).trim();if(n++,n>=e.length||e[n]!=="{")return null;n++;let c=n;for(;n<e.length&&e[n]!=="}";)n++;if(n>=e.length)return null;let l=e.slice(c,n);return n++,{number:o,audio:a,text:l,nextPos:n}}function F5(e,t){if(e[t]===`
266
+ `)return{text:"",nextPos:t+1};if(e[t]==="{"){let s=k5(e,t);if(s!==null){let a=`{${s.number}}{${s.audio}}{${s.text}}`,c=s.nextPos;for(;c<e.length&&e[c]!==`
267
267
  `;)c++;let l=c<e.length?c+1:c;return{text:a,nextPos:l}}}let n=e.indexOf(`
268
- `,t),r=n===-1?e.length:n;return{text:e.slice(t,r).trimEnd(),nextPos:r+(n===-1?0:1)}}function bv(e){let t=Er(e);if(t.length===0)return{text:e};let n=[],r=0;for(;r<t.length;){let{text:u,nextPos:d}=k5(t,r);n.push(u),r=d}let s=n.filter((u,d)=>!(u===""&&n[d-1]==="")).join(`
268
+ `,t),r=n===-1?e.length:n;return{text:e.slice(t,r).trimEnd(),nextPos:r+(n===-1?0:1)}}function yv(e){let t=Er(e);if(t.length===0)return{text:e};let n=[],r=0;for(;r<t.length;){let{text:u,nextPos:d}=F5(t,r);n.push(u),r=d}let s=n.filter((u,d)=>!(u===""&&n[d-1]==="")).join(`
269
269
  `)+`
270
- `;if(s===e)return{text:e};let a=u=>{let d=[],f=/^\{(\s*\d+\s*)\}/gm,m;for(;(m=f.exec(u))!==null;)d.push((m[1]??"").trim());return d},c=a(t),l=a(s);return c.join("\0")!==l.join("\0")?{text:e,warning:"MSG formatter: entry number mismatch after formatting, skipping"}:{text:s}}var fp=4,E1=/\S+/g;function R1(e){let t=[];E1.lastIndex=0;let n;for(;(n=E1.exec(e))!==null;)t.push(n[0]);return t}function F5(e){let t=e.split(`
271
- `).map(l=>l.trimEnd()),n=0,r=null,o=null,s=t[0]??"";/^2DA\s/i.test(s)&&(r=s.trim().replaceAll(/\s+/g," "),n++,n<t.length&&(o=t[n]??null,n++));let a=[];for(;n<t.length;){let l=t[n]??"";if(l.length===0){n++;continue}(l[0]===" "||l[0]===" ")&&(a=R1(l),n++);break}let c=[];for(;n<t.length;n++){let l=t[n]??"";if(l.length===0)continue;let[u,...d]=R1(l);u!==void 0&&c.push({label:u,values:d})}return{signature:r,defaultValue:o,columnNames:a,dataRows:c}}function Sv(e){let t=Er(e),{signature:n,defaultValue:r,columnNames:o,dataRows:s}=F5(t);if(n===null&&o.length===0&&s.length===0)return{text:e};let a=s.reduce((p,g)=>Math.max(p,g.label.length),0),c=Math.max(o.length,...s.map(p=>p.values.length)),l=[];for(let p=0;p<c;p++){let g=(o[p]??"").length,h=s.reduce((y,w)=>Math.max(y,(w.values[p]??"").length),0);l.push(Math.max(g,h))}let u=[];if(n!==null&&u.push(n),r!==null&&u.push(r),o.length>0){let p=" ".repeat(a+fp),g=o.map((h,y)=>h.padEnd((l[y]??h.length)+fp));u.push((p+g.join("")).trimEnd())}for(let{label:p,values:g}of s){let h=g.map((y,w)=>y.padEnd((l[w]??y.length)+fp));u.push((p.padEnd(a+fp)+h.join("")).trimEnd())}let d=u.join(`
270
+ `;if(s===e)return{text:e};let a=u=>{let d=[],f=/^\{(\s*\d+\s*)\}/gm,m;for(;(m=f.exec(u))!==null;)d.push((m[1]??"").trim());return d},c=a(t),l=a(s);return c.join("\0")!==l.join("\0")?{text:e,warning:"MSG formatter: entry number mismatch after formatting, skipping"}:{text:s}}var mp=4,E1=/\S+/g;function R1(e){let t=[];E1.lastIndex=0;let n;for(;(n=E1.exec(e))!==null;)t.push(n[0]);return t}function L5(e){let t=e.split(`
271
+ `).map(l=>l.trimEnd()),n=0,r=null,o=null,s=t[0]??"";/^2DA\s/i.test(s)&&(r=s.trim().replaceAll(/\s+/g," "),n++,n<t.length&&(o=t[n]??null,n++));let a=[];for(;n<t.length;){let l=t[n]??"";if(l.length===0){n++;continue}(l[0]===" "||l[0]===" ")&&(a=R1(l),n++);break}let c=[];for(;n<t.length;n++){let l=t[n]??"";if(l.length===0)continue;let[u,...d]=R1(l);u!==void 0&&c.push({label:u,values:d})}return{signature:r,defaultValue:o,columnNames:a,dataRows:c}}function bv(e){let t=Er(e),{signature:n,defaultValue:r,columnNames:o,dataRows:s}=L5(t);if(n===null&&o.length===0&&s.length===0)return{text:e};let a=s.reduce((p,g)=>Math.max(p,g.label.length),0),c=Math.max(o.length,...s.map(p=>p.values.length)),l=[];for(let p=0;p<c;p++){let g=(o[p]??"").length,h=s.reduce((y,w)=>Math.max(y,(w.values[p]??"").length),0);l.push(Math.max(g,h))}let u=[];if(n!==null&&u.push(n),r!==null&&u.push(r),o.length>0){let p=" ".repeat(a+mp),g=o.map((h,y)=>h.padEnd((l[y]??h.length)+mp));u.push((p+g.join("")).trimEnd())}for(let{label:p,values:g}of s){let h=g.map((y,w)=>y.padEnd((l[w]??y.length)+mp));u.push((p.padEnd(a+mp)+h.join("")).trimEnd())}let d=u.join(`
272
272
  `)+`
273
- `;if(d===e)return{text:e};let f=t.split(/\s+/).filter(p=>p.length>0),m=d.split(/\s+/).filter(p=>p.length>0);return f.join("\0")!==m.join("\0")?{text:e,warning:"2DA formatter: token mismatch after formatting, skipping"}:{text:d}}var T1=4,L5=/^(\S+\.int)([ \t]+;[^#]*)?([ \t]+#.*)?$/i;function O5(e){let t=L5.exec(e);if(!t)return null;let n=t[1]??"",r=t[2]?.trim()??"",o=t[3]?.trim()??"",s=r.length>0?"; "+r.slice(1).trimStart():"",a=o.length>0?"# "+o.slice(1).trimStart():"";return{filename:n,comment:s,metadata:a}}function wv(e){let t=Er(e).replaceAll(`\r
273
+ `;if(d===e)return{text:e};let f=t.split(/\s+/).filter(p=>p.length>0),m=d.split(/\s+/).filter(p=>p.length>0);return f.join("\0")!==m.join("\0")?{text:e,warning:"2DA formatter: token mismatch after formatting, skipping"}:{text:d}}var T1=4,O5=/^(\S+\.int)([ \t]+;[^#]*)?([ \t]+#.*)?$/i;function M5(e){let t=O5.exec(e);if(!t)return null;let n=t[1]??"",r=t[2]?.trim()??"",o=t[3]?.trim()??"",s=r.length>0?"; "+r.slice(1).trimStart():"",a=o.length>0?"# "+o.slice(1).trimStart():"";return{filename:n,comment:s,metadata:a}}function Sv(e){let t=Er(e).replaceAll(`\r
274
274
  `,`
275
275
  `).replaceAll("\r",`
276
276
  `);if(t.length===0)return{text:e};let n=t.split(`
277
- `),r=n[n.length-1]===""?n.slice(0,-1):n,o=r.map(m=>O5(m)),s=0,a=0;for(let m of o)m!==null&&(m.filename.length>s&&(s=m.filename.length),m.comment.length>a&&(a=m.comment.length));let c=[];for(let m=0;m<r.length;m++){let p=o[m]??null,g=r[m]??"";if(p===null){c.push(g.trimEnd());continue}if(p.comment===""&&p.metadata===""){c.push(p.filename);continue}let h=p.filename.padEnd(s+T1);p.metadata!==""?(h+=p.comment.padEnd(a+T1),h+=p.metadata):h+=p.comment,c.push(h.trimEnd())}let l=c.join(`\r
277
+ `),r=n[n.length-1]===""?n.slice(0,-1):n,o=r.map(m=>M5(m)),s=0,a=0;for(let m of o)m!==null&&(m.filename.length>s&&(s=m.filename.length),m.comment.length>a&&(a=m.comment.length));let c=[];for(let m=0;m<r.length;m++){let p=o[m]??null,g=r[m]??"";if(p===null){c.push(g.trimEnd());continue}if(p.comment===""&&p.metadata===""){c.push(p.filename);continue}let h=p.filename.padEnd(s+T1);p.metadata!==""?(h+=p.comment.padEnd(a+T1),h+=p.metadata):h+=p.comment,c.push(h.trimEnd())}let l=c.join(`\r
278
278
  `)+`\r
279
- `;if(l===e)return{text:e};let u=m=>m.split(/\s+/).filter(p=>p.length>0),d=u(t),f=u(l);return d.join("\0")!==f.join("\0")?{text:e,warning:"scripts.lst formatter: token mismatch after formatting, skipping"}:{text:l}}var pp=B(require("fs"),1),cs=B(require("path"),1),L1=B(F1(),1);function M5(e,t){if(t==="*")return!0;if(t.startsWith("*.")){let n=t.slice(2),r=n.match(/^\{(.+)\}$/);return r&&r[1]?r[1].split(",").some(s=>e.endsWith("."+s.trim())):e.endsWith("."+n)}return e===t}function Cv(e){let t=cs.basename(e),n=cs.dirname(e),r={indentSize:null,maxLineLength:null};for(;;){let o=cs.join(n,".editorconfig");if(pp.existsSync(o))try{let a=pp.readFileSync(o,"utf-8"),c=(0,L1.parse)(a);for(let l of Object.keys(c))if(M5(t,l)){let u=c[l],d=u.indent_size;if(typeof d=="number")r.indentSize=d;else if(typeof d=="string"){let m=parseInt(d,10);isNaN(m)||(r.indentSize=m)}let f=u.max_line_length;if(typeof f=="number")r.maxLineLength=f;else if(typeof f=="string"&&f!=="off"){let m=parseInt(f,10);isNaN(m)||(r.maxLineLength=m)}}if(r.indentSize!==null&&r.maxLineLength!==null)return r;if(c.root===!0||c.root==="true")break}catch{}let s=cs.dirname(n);if(s===n)break;n=s}return r}function Ba(e,t){return t?.lookup(e)}function O1(e,t,n,r,o,s){let a=s(e,t,n,r);if(a)return a;if(o){let c=o.lookup(e);if(c&&c.source.uri!==r)return c}}function ja(e){return e?e.query({}).map(t=>t.completion):[]}function mo(e){if(!e.isInitialized())return{edits:[]};let t=e.parse(e.text);if(!t)return{edits:[]};let n=e.getFormatOptions(e.uri),r;try{r=e.formatAst(t.rootNode,n)}catch(s){let a=s instanceof Error?s.message:String(s);return T(`${e.languageName} formatter error: ${a}`),{edits:[],warning:`${e.languageName} formatter error: ${a}`}}if(r.warning)return T(`${e.languageName} formatter error: ${r.warning}`),{edits:[],warning:r.warning};let o=Jx(e.text,r.text,e.normalizeForCompare);return o?(T(`${e.languageName} formatter validation failed: ${o}`),{edits:[],warning:`${e.languageName} formatter validation failed: ${o}`}):r.text===e.text?{edits:[]}:{edits:ka(e.text,r.text)}}var Pv=B(le());var $5=["array","any","bit","bool","float","int","list","map","mixed","ObjectPtr","string"],q5=["array","bit","bool","filename","ids","int","list","map","resref","string"],B5=["list","map"],j5=[...new Set([...$5,...q5,...B5])].sort(),hp=j5.join("|"),Jl=["param","arg"],Ql=["ret","return","returns"],Zl=["type","deprecated"],M1=[...Jl,...Ql,...Zl].sort();var W5={title:"",command:"editor.action.triggerSuggest"},$1=new Set([...Jl,...Ql,Zl[0]]),U5=new Map([...Jl.map((e,t)=>[e,t===0?"Function parameter":`Function parameter (alias for @${Jl[0]})`]),...Ql.map((e,t)=>[e,t===0?"Return type":`Return type (alias for @${Ql[0]})`]),[Zl[0],"Variable type"],[Zl[1],"Mark as deprecated"]]),H5=new RegExp(`@(?:${[...$1].join("|")})\\s+\\{?\\w*$`),V5=/@\w*$/;function G5(e){return H5.test(e)?"type":V5.test(e)?"tag":"none"}function gp(e,t){let n=G5(t);return n==="tag"?z5():n==="type"?K5(e):[]}function z5(){return[...M1].map(e=>{let t=$1.has(e),n=t?" ":"";return{label:`@${e}`,insertText:`${e}${n}`,filterText:e,kind:Pv.CompletionItemKind.Keyword,detail:U5.get(e)??e,...t?{command:W5}:{}}})}function K5(e){return[...e].map(([t,{detail:n}])=>({label:t,detail:n,kind:Pv.CompletionItemKind.TypeParameter}))}var q1=new Map([["array",{detail:"Array type"}],["any",{detail:"Any type"}],["bit",{detail:"Bit type"}],["bool",{detail:"Boolean type"}],["float",{detail:"Floating point type"}],["int",{detail:"Integer type"}],["list",{detail:"List type"}],["map",{detail:"Map type"}],["mixed",{detail:"Mixed type (int or float)"}],["ObjectPtr",{detail:"Object pointer"}],["string",{detail:"String type"}]]);var W1=require("url");var B1=4,j1=120;function po(e){let t={indentSize:B1,lineLimit:j1},n;try{n=(0,W1.fileURLToPath)(e)}catch{return t}try{let r=Cv(n);return{indentSize:r.indentSize??B1,lineLimit:r.maxLineLength??j1}}catch(r){return T(`cannot read .editorconfig for ${n}: ${r.message}`),t}}var U1=require("fs"),H1=B(require("path"));function Y5(e,t){try{let n=H1.join(__dirname,`${e}.${t}.json`);return JSON.parse((0,U1.readFileSync)(n,"utf-8"))}catch(n){T(`Failed to load static ${e} data for ${t}: ${n}`);return}}function V1(e,t){let n=Y5(e,t);return n?new Map(Object.entries(n)):new Map}function G1(e){return V1("signature",e)}function Nv(e,t){return{signatures:[e],activeSignature:0,activeParameter:t}}function z1(e,t){let r=e.split(/\r?\n/g)[t.line];if(!r)return;let o=t.character,s=r.slice(0,o);if(s.slice(-1)===")")return;let c=s.split("("),l=c.pop();if(!l&&l!=="")return;let u=c.at(-1);if(!u||(u=u.split(" ").at(-1),!u))return;let d=o-(s.length-l.length),m=l.slice(0,d).split(",").length-1;return{symbol:u,parameter:m}}var _p=()=>Me.initOne(mt,"tree-sitter-ssl.wasm","SSL");var we=()=>Me.isInitialized(mt),De=e=>Me.parseWithCache(mt,e);var K1=B(le()),J5=new Set(["comment","line_comment"]);function ho(e,t,n){return r=>{if(!e())return[];let o=t(r);return o?Q5(o.rootNode,n):[]}}function Q5(e,t){let n=[];return Y1(e,t,n),n}function Y1(e,t,n){for(let r of e.children){let o=r.startPosition.row,s=r.endPosition.row;s>o&&(J5.has(r.type)?n.push({startLine:o,endLine:s,kind:K1.FoldingRangeKind.Comment}):t.has(r.type)&&n.push({startLine:o,endLine:s})),Y1(r,t,n)}}var Ev=B(le());function X1(e,t){return{line:e,character:t}}function J(e){return{start:X1(e.startPosition.row,e.startPosition.column),end:X1(e.endPosition.row,e.endPosition.column)}}function $n(e,t){let{row:n,column:r}=t.startPosition,{row:o,column:s}=t.endPosition;return(e.line>n||e.line===n&&e.character>=r)&&(e.line<o||e.line===o&&e.character<=s)}function Z5(e,t){return e.startPosition.row===t.startPosition.row&&e.startPosition.column===t.startPosition.column&&e.endPosition.row===t.endPosition.row&&e.endPosition.column===t.endPosition.column}function eQ(e,t){let n=e.descendantForPosition({row:t.line,column:t.character}),r=[],o=n;for(;o;){let a=r[r.length-1];(!a||!Z5(a,o))&&r.push(o),o=o.parent}let s;for(let a=r.length-1;a>=0;a--)s=Ev.SelectionRange.create(J(r[a]),s);return s??Ev.SelectionRange.create({start:t,end:t})}function go(e,t){return(n,r)=>{if(!e())return[];let o=t(n);return o?r.map(s=>eQ(o.rootNode,s)):[]}}var yi=B(le());var us=B(le());function Kt(e){let t=e.previousNamedSibling;for(;t;){let n=t.text;if(n.startsWith("/**"))return n;if(!n.startsWith("//"))return null;t=t.previousNamedSibling}return null}var tQ=/@(?:arg|param)\s+\{(\w+)\}\s+(?:(\w+)(!)?|\[(\w+)=([^\]]+)\])(?:\s+-\s+|\s+)?(.+)?/,nQ=new RegExp(`@(?:arg|param)\\s+(${hp})\\s+(\\w+)(!)?(?:\\s+-\\s+|\\s+)?(.+)?`),rQ=/@(?:ret|return|returns)\s+\{(\w+)\}(?:\s+-\s+|\s+)?(.+)?/,iQ=new RegExp(`@(?:ret|return|returns)\\s+(${hp})\\b(?:\\s+-\\s+|\\s+)?(.+)?`),oQ=/@(?:ret|return|returns)\s+\{(\w+)\}\s+(\w+)(?:\s+-\s+|\s+)?(.+)?/,sQ=new RegExp(`@(?:ret|return|returns)\\s+(${hp})\\s+(\\w+)(?:\\s+-\\s+|\\s+)?(.+)?`),aQ=/@deprecated(?:\s+(.*))?/,cQ=/@type\s+(?:\{([^}]+)\}|(\w+))(?:\s+-\s+|\s+)?(.+)?/,lQ=new Set(["offset","array offset"]),uQ=/^\s*\*\s?/;function Yt(e,t){let n=e.split(`
280
- `);if(n.length===1){let m=e.replace(/^\/\*\*\s*/,"").replace(/\s*\*\/$/,"").trim();n.length=0,m&&n.push(m)}else n.shift(),n.pop();let r=t?.returnMode??"unnamed",o=[],s=[],a=[],c,l,u;for(let m of n){let p=m.replace(uQ,"");if(!p.startsWith("@")){a.push(p);continue}let g=dQ(p);if(g){o.push(g);continue}if(r==="named"){let w=mQ(p);if(w){s.push(w);continue}}else{let w=fQ(p);if(w){c=w;continue}}let h=pQ(p);if(h){u=h.type,h.desc&&a.push(h.desc);continue}let y=hQ(p);y!==null&&(l=y)}let d={args:o},f=a.join(`
281
- `).trim();return f&&(d.desc=f),c&&(d.ret=c),s.length>0&&(d.rets=s),u&&(d.type=u),l!==void 0&&(d.deprecated=l),d}function dQ(e){let t=e.match(tQ);if(t){let[,l,u,d,f,,m]=t,p=u||f;if(!l||!p)return null;let g={name:p,type:l};return d==="!"&&(g.required=!0),m&&(g.description=m),g}let n=e.match(nQ);if(!n)return null;let[,r,o,s,a]=n;if(!r||!o)return null;let c={name:o,type:r};return s==="!"&&(c.required=!0),a&&(c.description=a),c}function fQ(e){let t=e.match(rQ);if(t&&t[1]){let o={type:t[1]};return t[2]&&(o.description=t[2].trim()),o}let n=e.match(iQ);if(!n||!n[1])return null;let r={type:n[1]};return n[2]&&(r.description=n[2].trim()),r}function mQ(e){let t=e.match(oQ);if(t&&t[1]&&t[2]){let o={name:t[2],type:t[1]};return t[3]&&(o.description=t[3].trim()),o}let n=e.match(sQ);if(!n||!n[1]||!n[2])return null;let r={name:n[2],type:n[1]};return n[3]&&(r.description=n[3].trim()),r}function pQ(e){let t=e.match(cQ);if(!t)return null;let n=t[1]||t[2];if(!n)return null;let r=n.trim(),o=r.indexOf(" ");if(o!==-1){let a=r.slice(o+1).trim();if(!lQ.has(a))return null}let s=t[3]?.trim();return{type:r,desc:s||void 0}}function hQ(e){let t=e.match(aQ);return t?t[1]?.trim()||!0:null}function J1(e){let t=new Map;if(!e?.args)return t;for(let n of e.args){let r={};n.description&&(r.description=n.description),n.required&&(r.required=!0),(r.description||r.required)&&t.set(n.name,r)}return t}function qn(e,t,n){let r=[`\`\`\`${t}`,e,"```"];return n&&r.push("```bgforge-mls-comment",n,"```"),r.join(`
282
- `)}function Rv(e){return e===void 0?"":e===!0?`
279
+ `;if(l===e)return{text:e};let u=m=>m.split(/\s+/).filter(p=>p.length>0),d=u(t),f=u(l);return d.join("\0")!==f.join("\0")?{text:e,warning:"scripts.lst formatter: token mismatch after formatting, skipping"}:{text:l}}var hp=B(require("fs"),1),cs=B(require("path"),1),L1=B(F1(),1);function $5(e,t){if(t==="*")return!0;if(t.startsWith("*.")){let n=t.slice(2),r=n.match(/^\{(.+)\}$/);return r&&r[1]?r[1].split(",").some(s=>e.endsWith("."+s.trim())):e.endsWith("."+n)}return e===t}function vv(e){let t=cs.basename(e),n=cs.dirname(e),r={indentSize:null,maxLineLength:null};for(;;){let o=cs.join(n,".editorconfig");if(hp.existsSync(o))try{let a=hp.readFileSync(o,"utf-8"),c=(0,L1.parse)(a);for(let l of Object.keys(c))if($5(t,l)){let u=c[l],d=u.indent_size;if(typeof d=="number")r.indentSize=d;else if(typeof d=="string"){let m=parseInt(d,10);isNaN(m)||(r.indentSize=m)}let f=u.max_line_length;if(typeof f=="number")r.maxLineLength=f;else if(typeof f=="string"&&f!=="off"){let m=parseInt(f,10);isNaN(m)||(r.maxLineLength=m)}}if(r.indentSize!==null&&r.maxLineLength!==null)return r;if(c.root===!0||c.root==="true")break}catch{}let s=cs.dirname(n);if(s===n)break;n=s}return r}function Ba(e,t){return t?.lookup(e)}function O1(e,t,n,r,o,s){let a=s(e,t,n,r);if(a)return a;if(o){let c=o.lookup(e);if(c&&c.source.uri!==r)return c}}function ja(e){return e?e.query({}).map(t=>t.completion):[]}function mo(e){if(!e.isInitialized())return{edits:[]};let t=e.parse(e.text);if(!t)return{edits:[]};let n=e.getFormatOptions(e.uri),r;try{r=e.formatAst(t.rootNode,n)}catch(s){let a=s instanceof Error?s.message:String(s);return T(`${e.languageName} formatter error: ${a}`),{edits:[],warning:`${e.languageName} formatter error: ${a}`}}if(r.warning)return T(`${e.languageName} formatter error: ${r.warning}`),{edits:[],warning:r.warning};let o=Xx(e.text,r.text,e.normalizeForCompare);return o?(T(`${e.languageName} formatter validation failed: ${o}`),{edits:[],warning:`${e.languageName} formatter validation failed: ${o}`}):r.text===e.text?{edits:[]}:{edits:ka(e.text,r.text)}}var Cv=B(le());var q5=["array","any","bit","bool","float","int","list","map","mixed","ObjectPtr","string"],B5=["array","bit","bool","filename","ids","int","list","map","resref","string"],j5=["list","map"],W5=[...new Set([...q5,...B5,...j5])].sort(),gp=W5.join("|"),Ql=["param","arg"],Zl=["ret","return","returns"],eu=["type","deprecated"],M1=[...Ql,...Zl,...eu].sort();var U5={title:"",command:"editor.action.triggerSuggest"},$1=new Set([...Ql,...Zl,eu[0]]),H5=new Map([...Ql.map((e,t)=>[e,t===0?"Function parameter":`Function parameter (alias for @${Ql[0]})`]),...Zl.map((e,t)=>[e,t===0?"Return type":`Return type (alias for @${Zl[0]})`]),[eu[0],"Variable type"],[eu[1],"Mark as deprecated"]]),V5=new RegExp(`@(?:${[...$1].join("|")})\\s+\\{?\\w*$`),G5=/@\w*$/;function z5(e){return V5.test(e)?"type":G5.test(e)?"tag":"none"}function _p(e,t){let n=z5(t);return n==="tag"?K5():n==="type"?Y5(e):[]}function K5(){return[...M1].map(e=>{let t=$1.has(e),n=t?" ":"";return{label:`@${e}`,insertText:`${e}${n}`,filterText:e,kind:Cv.CompletionItemKind.Keyword,detail:H5.get(e)??e,...t?{command:U5}:{}}})}function Y5(e){return[...e].map(([t,{detail:n}])=>({label:t,detail:n,kind:Cv.CompletionItemKind.TypeParameter}))}var q1=new Map([["array",{detail:"Array type"}],["any",{detail:"Any type"}],["bit",{detail:"Bit type"}],["bool",{detail:"Boolean type"}],["float",{detail:"Floating point type"}],["int",{detail:"Integer type"}],["list",{detail:"List type"}],["map",{detail:"Map type"}],["mixed",{detail:"Mixed type (int or float)"}],["ObjectPtr",{detail:"Object pointer"}],["string",{detail:"String type"}]]);var W1=require("url");var B1=4,j1=120;function po(e){let t={indentSize:B1,lineLimit:j1},n;try{n=(0,W1.fileURLToPath)(e)}catch{return t}try{let r=vv(n);return{indentSize:r.indentSize??B1,lineLimit:r.maxLineLength??j1}}catch(r){return T(`cannot read .editorconfig for ${n}: ${r.message}`),t}}var U1=require("fs"),H1=B(require("path"));function X5(e,t){try{let n=H1.join(__dirname,`${e}.${t}.json`);return JSON.parse((0,U1.readFileSync)(n,"utf-8"))}catch(n){T(`Failed to load static ${e} data for ${t}: ${n}`);return}}function V1(e,t){let n=X5(e,t);return n?new Map(Object.entries(n)):new Map}function G1(e){return V1("signature",e)}function Pv(e,t){return{signatures:[e],activeSignature:0,activeParameter:t}}function z1(e,t){let r=e.split(/\r?\n/g)[t.line];if(!r)return;let o=t.character,s=r.slice(0,o);if(s.slice(-1)===")")return;let c=s.split("("),l=c.pop();if(!l&&l!=="")return;let u=c.at(-1);if(!u||(u=u.split(" ").at(-1),!u))return;let d=o-(s.length-l.length),m=l.slice(0,d).split(",").length-1;return{symbol:u,parameter:m}}var yp=()=>Me.initOne(mt,"tree-sitter-ssl.wasm","SSL");var we=()=>Me.isInitialized(mt),De=e=>Me.parseWithCache(mt,e);var K1=B(le()),Q5=new Set(["comment","line_comment"]);function ho(e,t,n){return r=>{if(!e())return[];let o=t(r);return o?Z5(o.rootNode,n):[]}}function Z5(e,t){let n=[];return Y1(e,t,n),n}function Y1(e,t,n){for(let r of e.children){let o=r.startPosition.row,s=r.endPosition.row;s>o&&(Q5.has(r.type)?n.push({startLine:o,endLine:s,kind:K1.FoldingRangeKind.Comment}):t.has(r.type)&&n.push({startLine:o,endLine:s})),Y1(r,t,n)}}var Nv=B(le());function X1(e,t){return{line:e,character:t}}function J(e){return{start:X1(e.startPosition.row,e.startPosition.column),end:X1(e.endPosition.row,e.endPosition.column)}}function $n(e,t){let{row:n,column:r}=t.startPosition,{row:o,column:s}=t.endPosition;return(e.line>n||e.line===n&&e.character>=r)&&(e.line<o||e.line===o&&e.character<=s)}function eQ(e,t){return e.startPosition.row===t.startPosition.row&&e.startPosition.column===t.startPosition.column&&e.endPosition.row===t.endPosition.row&&e.endPosition.column===t.endPosition.column}function tQ(e,t){let n=e.descendantForPosition({row:t.line,column:t.character}),r=[],o=n;for(;o;){let a=r[r.length-1];(!a||!eQ(a,o))&&r.push(o),o=o.parent}let s;for(let a=r.length-1;a>=0;a--)s=Nv.SelectionRange.create(J(r[a]),s);return s??Nv.SelectionRange.create({start:t,end:t})}function go(e,t){return(n,r)=>{if(!e())return[];let o=t(n);return o?r.map(s=>tQ(o.rootNode,s)):[]}}var yi=B(le());var us=B(le());function Kt(e){let t=e.previousNamedSibling;for(;t;){let n=t.text;if(n.startsWith("/**"))return n;if(!n.startsWith("//"))return null;t=t.previousNamedSibling}return null}var nQ=/@(?:arg|param)\s+\{(\w+)\}\s+(?:(\w+)(!)?|\[(\w+)=([^\]]+)\])(?:\s+-\s+|\s+)?(.+)?/,rQ=new RegExp(`@(?:arg|param)\\s+(${gp})\\s+(\\w+)(!)?(?:\\s+-\\s+|\\s+)?(.+)?`),iQ=/@(?:ret|return|returns)\s+\{(\w+)\}(?:\s+-\s+|\s+)?(.+)?/,oQ=new RegExp(`@(?:ret|return|returns)\\s+(${gp})\\b(?:\\s+-\\s+|\\s+)?(.+)?`),sQ=/@(?:ret|return|returns)\s+\{(\w+)\}\s+(\w+)(?:\s+-\s+|\s+)?(.+)?/,aQ=new RegExp(`@(?:ret|return|returns)\\s+(${gp})\\s+(\\w+)(?:\\s+-\\s+|\\s+)?(.+)?`),cQ=/@deprecated(?:\s+(.*))?/,lQ=/@type\s+(?:\{([^}]+)\}|(\w+))(?:\s+-\s+|\s+)?(.+)?/,uQ=new Set(["offset","array offset"]),dQ=/^\s*\*\s?/;function Yt(e,t){let n=e.split(`
280
+ `);if(n.length===1){let m=e.replace(/^\/\*\*\s*/,"").replace(/\s*\*\/$/,"").trim();n.length=0,m&&n.push(m)}else n.shift(),n.pop();let r=t?.returnMode??"unnamed",o=[],s=[],a=[],c,l,u;for(let m of n){let p=m.replace(dQ,"");if(!p.startsWith("@")){a.push(p);continue}let g=fQ(p);if(g){o.push(g);continue}if(r==="named"){let w=pQ(p);if(w){s.push(w);continue}}else{let w=mQ(p);if(w){c=w;continue}}let h=hQ(p);if(h){u=h.type,h.desc&&a.push(h.desc);continue}let y=gQ(p);y!==null&&(l=y)}let d={args:o},f=a.join(`
281
+ `).trim();return f&&(d.desc=f),c&&(d.ret=c),s.length>0&&(d.rets=s),u&&(d.type=u),l!==void 0&&(d.deprecated=l),d}function fQ(e){let t=e.match(nQ);if(t){let[,l,u,d,f,,m]=t,p=u||f;if(!l||!p)return null;let g={name:p,type:l};return d==="!"&&(g.required=!0),m&&(g.description=m),g}let n=e.match(rQ);if(!n)return null;let[,r,o,s,a]=n;if(!r||!o)return null;let c={name:o,type:r};return s==="!"&&(c.required=!0),a&&(c.description=a),c}function mQ(e){let t=e.match(iQ);if(t&&t[1]){let o={type:t[1]};return t[2]&&(o.description=t[2].trim()),o}let n=e.match(oQ);if(!n||!n[1])return null;let r={type:n[1]};return n[2]&&(r.description=n[2].trim()),r}function pQ(e){let t=e.match(sQ);if(t&&t[1]&&t[2]){let o={name:t[2],type:t[1]};return t[3]&&(o.description=t[3].trim()),o}let n=e.match(aQ);if(!n||!n[1]||!n[2])return null;let r={name:n[2],type:n[1]};return n[3]&&(r.description=n[3].trim()),r}function hQ(e){let t=e.match(lQ);if(!t)return null;let n=t[1]||t[2];if(!n)return null;let r=n.trim(),o=r.indexOf(" ");if(o!==-1){let a=r.slice(o+1).trim();if(!uQ.has(a))return null}let s=t[3]?.trim();return{type:r,desc:s||void 0}}function gQ(e){let t=e.match(cQ);return t?t[1]?.trim()||!0:null}function J1(e){let t=new Map;if(!e?.args)return t;for(let n of e.args){let r={};n.description&&(r.description=n.description),n.required&&(r.required=!0),(r.description||r.required)&&t.set(n.name,r)}return t}function qn(e,t,n){let r=[`\`\`\`${t}`,e,"```"];return n&&r.push("```bgforge-mls-comment",n,"```"),r.join(`
282
+ `)}function Ev(e){return e===void 0?"":e===!0?`
283
283
 
284
284
  **Deprecated**`:`
285
285
 
286
- **Deprecated:** ${e}`}function Tv(e){let t=qn(e.signature,e.langId,e.filePath);return e.description&&(t+=`
286
+ **Deprecated:** ${e}`}function Rv(e){let t=qn(e.signature,e.langId,e.filePath);return e.description&&(t+=`
287
287
 
288
288
  ---
289
289
 
290
290
  `+e.description),e.paramTable&&(t+=`
291
291
 
292
- `+e.paramTable),t+=Rv(e.deprecated),t}function Lt(e){return e.toLowerCase()}function Zt(e,t){return e!=null&&t!==null&&t!==void 0&&Lt(e)===Lt(t)}function ls(e,t){let n=e.get(t);if(n!==void 0)return n;let r=Lt(t);for(let[o,s]of e)if(Lt(o)===r)return s}var Av=new Map([["array",{detail:"Array type",category:"int"}],["bit",{detail:"Bit type",category:"int"}],["bool",{detail:"Boolean type",category:"int"}],["filename",{detail:"File name",category:"str"}],["ids",{detail:"IDS reference",category:"str"}],["int",{detail:"Integer type",category:"int"}],["list",{detail:"List type",category:"int"}],["map",{detail:"Map type",category:"int"}],["resref",{detail:"Resource reference",category:"str"}],["byte array offset",{detail:"Byte array (offset field)",category:"int"}],["char array offset",{detail:"Char array (offset field)",category:"int"}],["resref offset",{detail:"Resource reference (offset field)",category:"str"}],["string",{detail:"String type",category:"str"}]]),gQ="https://ielib.bgforge.net/types#";function Q1(e){if(!e)return"";if(!Av.has(e))return e;let t=e.split(" ",1)[0];return`[${e}](${gQ}${t})`}function Z1(e){let t=e.filter(r=>r.rows.length>0);if(t.length===0)return"";let n=["| | | | |","|-:|:-|:-|:-|"];for(let r of t){let[o,s]=r.label.split(" ");n.push(`|**${o}**|**${s}**|||`);for(let a of r.rows){let c=Q1(a.type),l=_Q(a),u=a.description?`&nbsp;&nbsp;${a.description}`:"";n.push(`|${c}|${a.name}|${l}|${u}|`)}}return n.join(`
293
- `)}function _Q(e){return e.required?"_required_":e.default!==void 0?`=&nbsp;${e.default}`:""}function e$(e){let t=e.filter(r=>r.description);if(t.length===0)return"";let n=["|||","|:-|:-|"];for(let r of t)n.push(`|\`${r.name}\`|&nbsp;&nbsp;${r.description}|`);return n.join(`
294
- `)}function yQ(e){let t=`
292
+ `+e.paramTable),t+=Ev(e.deprecated),t}function Lt(e){return e.toLowerCase()}function Zt(e,t){return e!=null&&t!==null&&t!==void 0&&Lt(e)===Lt(t)}function ls(e,t){let n=e.get(t);if(n!==void 0)return n;let r=Lt(t);for(let[o,s]of e)if(Lt(o)===r)return s}var Tv=new Map([["array",{detail:"Array type",category:"int"}],["bit",{detail:"Bit type",category:"int"}],["bool",{detail:"Boolean type",category:"int"}],["filename",{detail:"File name",category:"str"}],["ids",{detail:"IDS reference",category:"str"}],["int",{detail:"Integer type",category:"int"}],["list",{detail:"List type",category:"int"}],["map",{detail:"Map type",category:"int"}],["resref",{detail:"Resource reference",category:"str"}],["byte array offset",{detail:"Byte array (offset field)",category:"int"}],["char array offset",{detail:"Char array (offset field)",category:"int"}],["resref offset",{detail:"Resource reference (offset field)",category:"str"}],["string",{detail:"String type",category:"str"}]]),_Q="https://ielib.bgforge.net/types#";function Q1(e){if(!e)return"";if(!Tv.has(e))return e;let t=e.split(" ",1)[0];return`[${e}](${_Q}${t})`}function Z1(e){let t=e.filter(r=>r.rows.length>0);if(t.length===0)return"";let n=["| | | | |","|-:|:-|:-|:-|"];for(let r of t){let[o,s]=r.label.split(" ");n.push(`|**${o}**|**${s}**|||`);for(let a of r.rows){let c=Q1(a.type),l=yQ(a),u=a.description?`&nbsp;&nbsp;${a.description}`:"";n.push(`|${c}|${a.name}|${l}|${u}|`)}}return n.join(`
293
+ `)}function yQ(e){return e.required?"_required_":e.default!==void 0?`=&nbsp;${e.default}`:""}function e$(e){let t=e.filter(r=>r.description);if(t.length===0)return"";let n=["|||","|:-|:-|"];for(let r of t)n.push(`|\`${r.name}\`|&nbsp;&nbsp;${r.description}|`);return n.join(`
294
+ `)}function bQ(e){let t=`
295
295
  ---
296
296
  `;e.desc&&(t+=`
297
297
  ${e.desc}`);let n=e$(e.args);return n&&(t+=`
298
298
 
299
299
  `+n),e.ret?.description&&(t+=`
300
300
 
301
- **Returns** ${e.ret.description}`),t+=Rv(e.deprecated),t}function tu(e,t,n,r){let o=qn(e,$r,n);return t&&(o+=yQ(t)),r&&(t?o+=`
301
+ **Returns** ${e.ret.description}`),t+=Ev(e.deprecated),t}function nu(e,t,n,r){let o=qn(e,$r,n);return t&&(o+=bQ(t)),r&&(t?o+=`
302
302
 
303
303
  ---
304
304
 
305
305
  `:o+=`
306
306
 
307
- `,o+=r),o}var _o=B(le());function yp(e){if(e.params.length===0)return`${e.prefix}${e.name}`;let t=e.params.map(n=>{let r=n.type?`${n.type} ${n.name}`:n.name;return n.defaultValue&&(r+=` = ${n.defaultValue}`),r});return`${e.prefix}${e.name}(${t.join(", ")})`}function t$(e){return/^[A-Z][A-Z0-9_]+$/.test(e)}function n$(e){let t=e.replace(/\/\/.*$/,"").replace(/\/\*.*\*\//,"").trim();return/^\(?-?(?:0x[0-9a-fA-F]+|\d+)\)?$/.test(t)}function nu(e){let t=e.replaceAll(/^\(|\)$/g,"").trim();return t?t.split(",").map(n=>n.trim()).filter(n=>n.length>0):[]}function bQ(e){if(!e.hasParams&&e.firstline!==void 0&&n$(e.firstline))return e.firstline;let n=e.hasParams&&e.params?e.params.map((o,s)=>({name:o,type:e.jsdoc?.args[s]?.type??"var"})):[],r="macro ";return e.jsdoc?.ret&&(r=`${e.jsdoc.ret.type} `),yp({name:e.name,prefix:r,params:n})}function Iv(e,t){let n=bQ(e);if(e.jsdoc)return tu(n,e.jsdoc,t||void 0);let r=tu(n,null,t||void 0),o=!e.hasParams&&t$(e.name),s=!e.hasParams&&e.firstline!==void 0&&n$(e.firstline);return!o&&!s&&!e.multiline&&e.firstline&&(r+=`
307
+ `,o+=r),o}var _o=B(le());function bp(e){if(e.params.length===0)return`${e.prefix}${e.name}`;let t=e.params.map(n=>{let r=n.type?`${n.type} ${n.name}`:n.name;return n.defaultValue&&(r+=` = ${n.defaultValue}`),r});return`${e.prefix}${e.name}(${t.join(", ")})`}function t$(e){return/^[A-Z][A-Z0-9_]+$/.test(e)}function n$(e){let t=e.replace(/\/\/.*$/,"").replace(/\/\*.*\*\//,"").trim();return/^\(?-?(?:0x[0-9a-fA-F]+|\d+)\)?$/.test(t)}function ru(e){let t=e.replaceAll(/^\(|\)$/g,"").trim();return t?t.split(",").map(n=>n.trim()).filter(n=>n.length>0):[]}function SQ(e){if(!e.hasParams&&e.firstline!==void 0&&n$(e.firstline))return e.firstline;let n=e.hasParams&&e.params?e.params.map((o,s)=>({name:o,type:e.jsdoc?.args[s]?.type??"var"})):[],r="macro ";return e.jsdoc?.ret&&(r=`${e.jsdoc.ret.type} `),bp({name:e.name,prefix:r,params:n})}function Av(e,t){let n=SQ(e);if(e.jsdoc)return nu(n,e.jsdoc,t||void 0);let r=nu(n,null,t||void 0),o=!e.hasParams&&t$(e.name),s=!e.hasParams&&e.firstline!==void 0&&n$(e.firstline);return!o&&!s&&!e.multiline&&e.firstline&&(r+=`
308
308
  `+qn(e.firstline,$r)),r}function Wa(e,t,n,r){let o=t.map((c,l)=>{let u=n?.args[l],d=u?.type?`${u.type} ${c.name}`:`var ${c.name}`;c.defaultValue&&(d+=` = ${c.defaultValue}`);let f={label:d};if(u?.type||u?.description){let m=u.type?`${u.type} `:"",p=qn(`${m}${c.name}`,$r);u.description&&(p+=`
309
309
  `+u.description),f.documentation={kind:"markdown",value:p}}return f}),s=e+"("+o.map(c=>c.label).join(", ")+")";n?.ret&&(s=`${n.ret.type} ${s}`);let a={label:s,uri:r,parameters:o};return n?.desc&&(a.documentation={kind:"markdown",value:`
310
310
  ---
311
- `+n.desc}),a}function r$(e,t,n){let r=!e.hasParams&&t$(e.name),o=Iv(e,n),s=r?_o.CompletionItemKind.Constant:e.hasParams?_o.CompletionItemKind.Function:_o.CompletionItemKind.Snippet,a={label:e.name,kind:s,documentation:{kind:_o.MarkupKind.Markdown,value:o}};return n&&(a.labelDetails={description:n}),e.jsdoc?.deprecated!==void 0&&(a.tags=[_o.CompletionItemTag.Deprecated]),a}function Ua(e){switch(e.type){case"param_default":{if(e.hasError||e.namedChildren.length!==1)return!1;let[t]=e.namedChildren;return t!==void 0&&Ua(t)}case"param_default_group":{if(e.hasError||e.namedChildren.length!==1)return!1;let[t]=e.namedChildren;return t!==void 0&&Ua(t)}case"param_default_unary":{if(e.hasError)return!1;let t=e.childForFieldName("expr");return t?Ua(t):!1}case"identifier":case"number":case"boolean":case"string":return!0;case"paren_expr":{let t=e.namedChildren[0];return t?Ua(t):!1}case"unary_expr":{let t=e.childForFieldName("expr");return t?Ua(t):!1}default:return!1}}function Ha(e){let t=e.childForFieldName("params");if(!t)return[];let n=[];for(let r of t.children)if(r.type==="param"){let o=r.childForFieldName("name"),s=r.childForFieldName("default");o&&n.push({name:o.text,defaultValue:s&&Ua(s)?s.text:void 0})}return n}function SQ(e,t,n){let r=t.map((s,a)=>({name:s.name,type:n?.args[a]?.type??"var",defaultValue:s.defaultValue})),o="procedure ";return n?.ret?o=`${n.ret.type} `:n&&(o="void "),yp({name:e,prefix:o,params:r})}function fr(e){let t=new Map,n=new Map;for(let r of e.children)if(r.type==="procedure"){let o=r.childForFieldName("name");if(o){let s=n.get(Lt(o.text));s!==void 0&&t.delete(s),t.set(o.text,{node:r,isForward:!1}),n.set(Lt(o.text),o.text)}}else if(r.type==="procedure_forward"){let o=r.childForFieldName("name");o&&!n.has(Lt(o.text))&&(t.set(o.text,{node:r,isForward:!0}),n.set(Lt(o.text),o.text))}return t}function i$(e,t){let n=fr(e);return ls(n,t)?.node??null}function o$(e,t){return Tr(e,t)?.text??null}function Tr(e,t){function n(r){if(!$n(t,r))return null;if(r.type==="identifier")return r;for(let o of r.children){let s=n(o);if(s)return s}return null}return n(e)}function wQ(e,t){let n=fr(e),r=ls(n,t);if(r)return r.node;let o=ru(e,t);if(o)return o;function s(a){if(a.type==="procedure"){let c=a.childForFieldName("params");if(c){for(let l of c.children)if(l.type==="param"){let u=l.childForFieldName("name");if(Zt(u?.text,t))return l}}for(let l of a.children){let u=s(l);if(u)return u}}else if(a.type==="variable_decl"){for(let c of a.children)if(c.type==="var_init"){let l=c.childForFieldName("name");if(Zt(l?.text,t))return c}}else if(a.type==="for_var_decl"){let c=a.childForFieldName("name");if(Zt(c?.text,t))return a}else if(a.type==="foreach_stmt"){let c=a.childForFieldName("var");if(Zt(c?.text,t))return c;let l=a.childForFieldName("key");if(Zt(l?.text,t))return l;let u=a.childForFieldName("value");if(Zt(u?.text,t))return u}else if(a.type==="export_decl"){let c=a.childForFieldName("name");if(Zt(c?.text,t))return a}return null}for(let a of e.children){let c=s(a);if(c)return c}return null}function Dv(e,t){return wQ(e,t)!==null}function yo(e){let t=[];function n(s,a){let c=s.childForFieldName("name"),l=s.childForFieldName("params"),u=s.childForFieldName("body");if(!c)return;let d=c.text,f=(l??c).endIndex,m=f>s.startIndex?s.text.slice(f-s.startIndex).trimEnd():u?.text??"",p,g=!1,h=m.trimStart();l&&(p=nu(l.text),g=!0);let y=h.includes(`
311
+ `+n.desc}),a}function r$(e,t,n){let r=!e.hasParams&&t$(e.name),o=Av(e,n),s=r?_o.CompletionItemKind.Constant:e.hasParams?_o.CompletionItemKind.Function:_o.CompletionItemKind.Snippet,a={label:e.name,kind:s,documentation:{kind:_o.MarkupKind.Markdown,value:o}};return n&&(a.labelDetails={description:n}),e.jsdoc?.deprecated!==void 0&&(a.tags=[_o.CompletionItemTag.Deprecated]),a}function Ua(e){switch(e.type){case"param_default":{if(e.hasError||e.namedChildren.length!==1)return!1;let[t]=e.namedChildren;return t!==void 0&&Ua(t)}case"param_default_group":{if(e.hasError||e.namedChildren.length!==1)return!1;let[t]=e.namedChildren;return t!==void 0&&Ua(t)}case"param_default_unary":{if(e.hasError)return!1;let t=e.childForFieldName("expr");return t?Ua(t):!1}case"identifier":case"number":case"boolean":case"string":return!0;case"paren_expr":{let t=e.namedChildren[0];return t?Ua(t):!1}case"unary_expr":{let t=e.childForFieldName("expr");return t?Ua(t):!1}default:return!1}}function Ha(e){let t=e.childForFieldName("params");if(!t)return[];let n=[];for(let r of t.children)if(r.type==="param"){let o=r.childForFieldName("name"),s=r.childForFieldName("default");o&&n.push({name:o.text,defaultValue:s&&Ua(s)?s.text:void 0})}return n}function wQ(e,t,n){let r=t.map((s,a)=>({name:s.name,type:n?.args[a]?.type??"var",defaultValue:s.defaultValue})),o="procedure ";return n?.ret?o=`${n.ret.type} `:n&&(o="void "),bp({name:e,prefix:o,params:r})}function fr(e){let t=new Map,n=new Map;for(let r of e.children)if(r.type==="procedure"){let o=r.childForFieldName("name");if(o){let s=n.get(Lt(o.text));s!==void 0&&t.delete(s),t.set(o.text,{node:r,isForward:!1}),n.set(Lt(o.text),o.text)}}else if(r.type==="procedure_forward"){let o=r.childForFieldName("name");o&&!n.has(Lt(o.text))&&(t.set(o.text,{node:r,isForward:!0}),n.set(Lt(o.text),o.text))}return t}function i$(e,t){let n=fr(e);return ls(n,t)?.node??null}function o$(e,t){return Tr(e,t)?.text??null}function Tr(e,t){function n(r){if(!$n(t,r))return null;if(r.type==="identifier")return r;for(let o of r.children){let s=n(o);if(s)return s}return null}return n(e)}function xQ(e,t){let n=fr(e),r=ls(n,t);if(r)return r.node;let o=iu(e,t);if(o)return o;function s(a){if(a.type==="procedure"){let c=a.childForFieldName("params");if(c){for(let l of c.children)if(l.type==="param"){let u=l.childForFieldName("name");if(Zt(u?.text,t))return l}}for(let l of a.children){let u=s(l);if(u)return u}}else if(a.type==="variable_decl"){for(let c of a.children)if(c.type==="var_init"){let l=c.childForFieldName("name");if(Zt(l?.text,t))return c}}else if(a.type==="for_var_decl"){let c=a.childForFieldName("name");if(Zt(c?.text,t))return a}else if(a.type==="foreach_stmt"){let c=a.childForFieldName("var");if(Zt(c?.text,t))return c;let l=a.childForFieldName("key");if(Zt(l?.text,t))return l;let u=a.childForFieldName("value");if(Zt(u?.text,t))return u}else if(a.type==="export_decl"){let c=a.childForFieldName("name");if(Zt(c?.text,t))return a}return null}for(let a of e.children){let c=s(a);if(c)return c}return null}function Iv(e,t){return xQ(e,t)!==null}function yo(e){let t=[];function n(s,a){let c=s.childForFieldName("name"),l=s.childForFieldName("params"),u=s.childForFieldName("body");if(!c)return;let d=c.text,f=(l??c).endIndex,m=f>s.startIndex?s.text.slice(f-s.startIndex).trimEnd():u?.text??"",p,g=!1,h=m.trimStart();l&&(p=ru(l.text),g=!0);let y=h.includes(`
312
312
  `),w=y?(h.split(`
313
- `)[0]||"").trim():h.trim(),_=Kt(a),b=_?Yt(_):void 0;t.push({name:d,params:p,hasParams:g,body:h.trim(),firstline:w,multiline:y,jsdoc:b,node:s})}function r(s,a){let c=s.children,l=!1,u=null,d=null,f=-1;for(let S=0;S<c.length;S++){let N=c[S];if(N.text==="#define"||N.type==="#define"){l=!0;continue}if(l&&!u&&N.type==="identifier"){u=N;continue}if(l&&u&&!d&&N.type==="macro_params"){d=N;continue}if(l&&u){f=S;break}}if(!l||!u)return;let m=u.text,p,g=!1;d&&(p=nu(d.text),g=!0);let h="";if(f>=0){let S=c[f],N=c[c.length-1],R=s.text,$=s.startIndex,I=S.startIndex-$,U=N.endIndex-$;h=R.substring(I,U).trim()}let y=h.includes(`
313
+ `)[0]||"").trim():h.trim(),_=Kt(a),b=_?Yt(_):void 0;t.push({name:d,params:p,hasParams:g,body:h.trim(),firstline:w,multiline:y,jsdoc:b,node:s})}function r(s,a){let c=s.children,l=!1,u=null,d=null,f=-1;for(let S=0;S<c.length;S++){let N=c[S];if(N.text==="#define"||N.type==="#define"){l=!0;continue}if(l&&!u&&N.type==="identifier"){u=N;continue}if(l&&u&&!d&&N.type==="macro_params"){d=N;continue}if(l&&u){f=S;break}}if(!l||!u)return;let m=u.text,p,g=!1;d&&(p=ru(d.text),g=!0);let h="";if(f>=0){let S=c[f],N=c[c.length-1],R=s.text,$=s.startIndex,I=S.startIndex-$,U=N.endIndex-$;h=R.substring(I,U).trim()}let y=h.includes(`
314
314
  `),w=y?(h.split(`
315
- `)[0]||"").trim():h.trim(),_=Kt(a),b=_?Yt(_):void 0;t.push({name:m,params:p,hasParams:g,body:h,firstline:w,multiline:y,jsdoc:b,node:s})}function o(s){if(s.type==="preprocessor")for(let a of s.children)a.type==="define"&&n(a,s);s.type==="ERROR"&&s.parent?.type==="source_file"&&r(s,s);for(let a of s.children)o(a)}return o(e),t}function ru(e,t){let n=null;function r(o){if(!n){if(o.type==="preprocessor"){for(let s of o.children)if(s.type==="define"&&s.childForFieldName("name")?.text===t){n=s;return}}for(let s of o.children)r(s)}}return r(e),n}function bp(e,t,n,r,o,s={}){let{displayPath:a,engineDoc:c}=s,l=J(n),u=SQ(e,r,o),d=tu(u,o,a,c),f={kind:us.MarkupKind.Markdown,value:d},m=r.length>0?Wa(e,r,o,t):void 0,p=a!==void 0;return{name:e,kind:K.Procedure,location:{uri:t,range:l},scope:{level:p?kt.Workspace:kt.File},source:p?{type:Ee.Workspace,uri:t,displayPath:a}:{type:Ee.Document,uri:t},completion:{label:e,kind:us.CompletionItemKind.Function,...p&&{labelDetails:{description:a}},documentation:f},hover:{contents:f},signature:m,callable:{parameters:r.map(g=>{let h=o?.args.find(y=>y.name===g.name);return{name:g.name,type:h?.type,description:h?.description,defaultValue:g.defaultValue}})}}}function Sp(e,t,n){let r=e.node?{uri:t,range:J(e.node)}:null,o={kind:us.MarkupKind.Markdown,value:Iv(e,n??"")},s=r$(e,t,n??""),a=e.hasParams&&e.params?Wa(e.name,e.params.map(u=>({name:u})),e.jsdoc??null,t):void 0,c=n!==void 0,l={name:e.name,location:r,scope:{level:c?kt.Workspace:kt.File},source:c?{type:Ee.Workspace,uri:t,displayPath:n}:{type:Ee.Document,uri:t},completion:s,hover:{contents:o},signature:a,nameCase:"exact"};return e.hasParams?{...l,kind:K.Macro,callable:{parameters:e.params?.map(u=>({name:u}))}}:{...l,kind:K.Constant,constant:{value:e.firstline??""}}}function Va(e,t,n,r,o,s){let a=o?.type?`${o.type} ${e}`:r?`${r} ${e}`:`variable ${e}`,c=qn(a,$r,s);r&&(c+=`
315
+ `)[0]||"").trim():h.trim(),_=Kt(a),b=_?Yt(_):void 0;t.push({name:m,params:p,hasParams:g,body:h,firstline:w,multiline:y,jsdoc:b,node:s})}function o(s){if(s.type==="preprocessor")for(let a of s.children)a.type==="define"&&n(a,s);s.type==="ERROR"&&s.parent?.type==="source_file"&&r(s,s);for(let a of s.children)o(a)}return o(e),t}function iu(e,t){let n=null;function r(o){if(!n){if(o.type==="preprocessor"){for(let s of o.children)if(s.type==="define"&&s.childForFieldName("name")?.text===t){n=s;return}}for(let s of o.children)r(s)}}return r(e),n}function Sp(e,t,n,r,o,s={}){let{displayPath:a,engineDoc:c}=s,l=J(n),u=wQ(e,r,o),d=nu(u,o,a,c),f={kind:us.MarkupKind.Markdown,value:d},m=r.length>0?Wa(e,r,o,t):void 0,p=a!==void 0;return{name:e,kind:K.Procedure,location:{uri:t,range:l},scope:{level:p?kt.Workspace:kt.File},source:p?{type:Ee.Workspace,uri:t,displayPath:a}:{type:Ee.Document,uri:t},completion:{label:e,kind:us.CompletionItemKind.Function,...p&&{labelDetails:{description:a}},documentation:f},hover:{contents:f},signature:m,callable:{parameters:r.map(g=>{let h=o?.args.find(y=>y.name===g.name);return{name:g.name,type:h?.type,description:h?.description,defaultValue:g.defaultValue}})}}}function wp(e,t,n){let r=e.node?{uri:t,range:J(e.node)}:null,o={kind:us.MarkupKind.Markdown,value:Av(e,n??"")},s=r$(e,t,n??""),a=e.hasParams&&e.params?Wa(e.name,e.params.map(u=>({name:u})),e.jsdoc??null,t):void 0,c=n!==void 0,l={name:e.name,location:r,scope:{level:c?kt.Workspace:kt.File},source:c?{type:Ee.Workspace,uri:t,displayPath:n}:{type:Ee.Document,uri:t},completion:s,hover:{contents:o},signature:a,nameCase:"exact"};return e.hasParams?{...l,kind:K.Macro,callable:{parameters:e.params?.map(u=>({name:u}))}}:{...l,kind:K.Constant,constant:{value:e.firstline??""}}}function Va(e,t,n,r,o,s){let a=o?.type?`${o.type} ${e}`:r?`${r} ${e}`:`variable ${e}`,c=qn(a,$r,s);r&&(c+=`
316
316
 
317
317
  `+r),o?.desc&&(c+=`
318
318
 
319
- `+o.desc);let l={kind:us.MarkupKind.Markdown,value:c},u=s!==void 0;return{name:e,kind:K.Variable,location:{uri:t,range:n},scope:{level:u?kt.Workspace:kt.File},source:u?{type:Ee.Workspace,uri:t,displayPath:s}:{type:Ee.Document,uri:t},completion:{label:e,kind:us.CompletionItemKind.Variable,...u&&{labelDetails:{description:s},documentation:l}},hover:{contents:l},variable:{description:o?.desc??r}}}function ds(e,t,n,r,o){let s=t.text;return s?{name:s,detail:r,kind:n,range:J(e),selectionRange:J(t),children:o}:null}function s$(e,t){let n=[];if(e.type==="variable_decl"){for(let r of e.children)if(r.type==="var_init"){let o=r.childForFieldName("name");if(o){let s=ds(r,o,yi.SymbolKind.Variable,t);s&&n.push(s)}}}else if(e.type==="for_var_decl"){let r=e.childForFieldName("name");if(r){let o=ds(e,r,yi.SymbolKind.Variable,t);o&&n.push(o)}}for(let r of e.children)n.push(...s$(r,t));return n}function xQ(e,t){let n=[],r=e.childForFieldName("params");if(!r)return n;for(let o of r.children)if(o.type==="param"){let s=o.childForFieldName("name");if(s){let a=ds(o,s,yi.SymbolKind.Variable,t);a&&n.push(a)}}return n}function vQ(e){let t=fr(e),n=[];for(let[c,{node:l}]of t){let u=l.childForFieldName("name");if(!u)continue;let d=[...xQ(l,c),...s$(l,c)],f=ds(l,u,yi.SymbolKind.Function,void 0,d.length>0?d:void 0);f&&n.push(f)}let r=yo(e),o=[];function s(c){if(c.type==="preprocessor"){for(let l of c.children)if(l.type==="define"){let u=l.childForFieldName("name");if(!u)continue;let d=u.text,f=r.find(g=>g.name===d);if(!f)continue;let m=f.hasParams?yi.SymbolKind.Method:yi.SymbolKind.Constant,p=ds(l,u,m);p&&o.push(p)}}for(let l of c.children)s(l)}s(e);let a=[];for(let c of e.children)if(c.type==="variable_decl"){for(let l of c.children)if(l.type==="var_init"){let u=l.childForFieldName("name");if(u){let d=ds(l,u,yi.SymbolKind.Variable);d&&a.push(d)}}}else if(c.type==="export_decl"){let l=c.childForFieldName("name");if(l){let u=ds(c,l,yi.SymbolKind.Variable);u&&a.push(u)}}return[...n,...o,...a]}function a$(e){if(!we())return[];let t=De(e);return t?vQ(t.rootNode):[]}var iu=B(le());function kv(e){let t=e.parent;for(;t;){if(t.type==="procedure")return t;t=t.parent}return null}function Fv(e){let t=e.parent;for(;t;){if(t.type==="define")return t;t=t.parent}return null}function Lv(e,t){let n=e.childForFieldName("params");if(!n)return null;for(let r of n.children)if(r.type==="identifier"&&r.text===t)return r;return null}function c$(e){let t=e.parent?.type;return t==="param"||t==="macro_params"}function l$(e,t){let n=e.childForFieldName("params");if(n){for(let r of n.children)if(r.type==="param"){let o=r.childForFieldName("name");if(Zt(o?.text,t))return o}}return u$(e,t)}function wp(e,t){return l$(e,t)!==null}function u$(e,t){if(e.type==="variable_decl"){for(let n of e.children)if(n.type==="var_init"){let r=n.childForFieldName("name");if(Zt(r?.text,t))return r}}else if(e.type==="for_var_decl"){let n=e.childForFieldName("name");if(Zt(n?.text,t))return n}else if(e.type==="foreach_stmt")for(let n of["var","key","value"]){let r=e.childForFieldName(n);if(Zt(r?.text,t))return r}for(let n of e.children){let r=u$(n,t);if(r)return r}return null}function xp(e,t){let n=ls(fr(e),t)?.node;if(n)return n.childForFieldName("name");for(let o of e.children)if(o.type==="export_decl"){let s=o.childForFieldName("name");if(Zt(s?.text,t))return s}for(let o of e.children)if(o.type==="variable_decl"){for(let s of o.children)if(s.type==="var_init"){let a=s.childForFieldName("name");if(Zt(a?.text,t))return a}}return ru(e,t)?.childForFieldName("name")??null}function Ov(e,t){return xp(e,t)!==null}function d$(e,t,n){let r=new Set;for(let o of e.lookupAll(t))o.location&&o.location.uri!==n&&r.add(o.location.uri);return r}function Ar(e,t){let n=t.text,r=Fv(t);if(r){let s=Lv(r,n);if(s)return s}let o=kv(t);if(o){let s=l$(o,n);if(s)return s}return xp(e,n)}function vp(e){let t=new Map;return n=>{let r=t.get(n);if(r!==void 0||t.has(n))return r??null;let o=e(n);return t.set(n,o),o}}var CQ=new Set(["call_expr","call_stmt","macro_call_stmt","proc_ref"]);function Mv(e,t){t(e);for(let n of e.children)Mv(n,t)}function m$(e){if(e.childForFieldName("params"))return!0;let t=e.childForFieldName("body");if(!t)return!1;let n=!1;return Mv(t,r=>{CQ.has(r.type)&&(n=!0)}),n}function $v(e){return e.type==="procedure"||e.type==="procedure_forward"?!0:e.type==="define"&&m$(e)}function p$(e){let t=e.parent;return t!==null&&$v(t)}function qv(e){let t=e.parent;return!t||!$v(t)?!1:t.childForFieldName("name")?.id===e.id}function h$(e,t,n){if(qv(e))return!1;let r=Ar(t,e);return r?p$(r):n(e.text)!==null}function PQ(e,t){let n=Ar(t,e);return n!==null&&!p$(n)}function g$(e,t){let n=ls(fr(e),t);if(n)return n.node;let r=ru(e,t);return r&&m$(r)?r:null}function _$(e,t){let n=e.childForFieldName("name");return n?{name:n.text,kind:e.type==="define"?iu.SymbolKind.Method:iu.SymbolKind.Function,uri:t,range:J(e),selectionRange:J(n)}:null}function NQ(e,t){return{name:e,kind:iu.SymbolKind.Function,uri:t.uri,range:t.range,selectionRange:t.range}}function y$(e,t,n,r){let o=g$(t,e);if(o)return _$(o,n);let s=r(e);return s?NQ(e,s):null}function b$(e,t,n,r){if(!we())return null;let o=De(e);if(!o)return null;let s=Tr(o.rootNode,t);if(!s||!qv(s)&&!h$(s,o.rootNode,r))return null;let a=y$(s.text,o.rootNode,n,r);return a?[a]:null}function S$(e,t,n){if(!we())return[];let r=t(e.uri);if(!r)return[];let o=De(r);if(!o)return[];let s=g$(o.rootNode,e.name);if(!s)return[];let a=new Map;Mv(s,l=>{if(l.type!=="identifier"||!h$(l,o.rootNode,n))return;let u=l.text,d=a.get(u);d||(d={to:y$(u,o.rootNode,e.uri,n),ranges:[]},a.set(u,d)),d.ranges.push(J(l))});let c=[];for(let{to:l,ranges:u}of a.values())l&&c.push({to:l,fromRanges:u});return c}var f$={start:{line:0,character:0},end:{line:0,character:0}};function EQ(e){let n=e.split(/[?#]/,1)[0].split("/").pop();return n?decodeURIComponent(n):e}function RQ(e){for(let t=e.parent;t;t=t.parent)if($v(t))return t;return null}function TQ(e,t){let n=RQ(e);if(n){let r=_$(n,t);if(r)return r}return{name:EQ(t),kind:iu.SymbolKind.File,uri:t,range:f$,selectionRange:f$}}function w$(e,t,n){if(!we())return[];let r=vp(n),o=new Map;for(let s of t){let a=r(s.uri);if(!a)continue;let c=De(a);if(!c)continue;let l=Tr(c.rootNode,s.range.start);if(!l||l.text!==e.name||qv(l)||PQ(l,c.rootNode))continue;let u=TQ(l,s.uri),d=`${u.uri} ${u.name} ${u.range.start.line}:${u.range.start.character}`,f=o.get(d);f||(f={from:u,ranges:[]},o.set(d,f)),f.ranges.push(J(l))}return[...o.values()].map(({from:s,ranges:a})=>({from:s,fromRanges:a}))}var Np=B(require("path"));var ou=B(require("fs")),su=B(require("path"));var IQ={start:{line:0,character:0},end:{line:0,character:0}},Cp=2e4;function Pp(e,t){let n={line:e.startPosition.row,character:e.startPosition.column};return{uri:t,range:{start:n,end:n}}}function Ga(e){return{uri:Ye(e),range:IQ}}function au(e){if(ou.existsSync(e))return e;let t=e.split(su.sep),n=t[0]??"",r=n===""?su.sep:n,o=0;for(let s of t.slice(1)){if(s==="")continue;let a;try{a=ou.readdirSync(r)}catch{return null}if(o+=a.length,o>Cp)return null;let c=a.find(l=>l.toLowerCase()===s.toLowerCase());if(c===void 0)return null;r=su.join(r,c)}return ou.existsSync(r)?r:null}function Ep(e,t,n){if(!we())return null;let r=De(e);if(!r)return null;let o=DQ(r.rootNode,n,t);if(o)return o;let s=Tr(r.rootNode,n);if(!s)return null;let a=Ar(r.rootNode,s);return a?{uri:t,range:J(a)}:null}function DQ(e,t,n){let r=e.descendantForPosition({row:t.line,column:t.character});if(!r)return null;let o=r;for(;o&&o.type!=="include";)o=o.parent;if(!o)return null;let s=o.childForFieldName("path");if(!s||s.type!=="string")return null;let a=s.startPosition,c=s.endPosition;if(t.line<a.row||t.line>c.row||t.line===a.row&&t.character<a.column||t.line===c.row&&t.character>=c.column)return null;let l=Pp(s,n),u=s.text.replaceAll(/^["<]|[">]$/g,"");if(!u)return l;let d=Np.dirname(et(n)),f=au(Np.resolve(d,u));return f?Ga(f):l}var nt={File:"file",Procedure:"procedure",Macro:"macro",External:"external"};function x$(e){throw new Error(`Unhandled ScopeKind: ${String(e)}`)}function cu(e,t){let n=Tr(e,t);if(!n)return null;let r=n.text,o=Fv(n);if(o){let l=Lv(o,r);if(l)return{name:r,scope:nt.Macro,defineNode:o,definitionNode:l}}let s=kv(n),a=s&&wp(s,r)?Ar(e,n):null;if(s&&a)return{name:r,scope:nt.Procedure,procedureNode:s,definitionNode:a};let c=xp(e,r);return c?{name:r,scope:nt.File,definitionNode:c}:{name:r,scope:nt.External}}function kQ(e,t){let n=e.childForFieldName("params");return n?nu(n.text).includes(t):!1}function FQ(e,t){switch(e.scope){case nt.File:return t;case nt.External:return t;case nt.Procedure:return e.procedureNode??t;case nt.Macro:return e.defineNode??t;default:return x$(e.scope)}}function za(e,t){if(t.scope===nt.External)return[];if(t.scope===nt.Procedure&&!t.procedureNode)return[];if(t.scope===nt.Macro&&!t.defineNode)return[];let n=[],r=FQ(t,e);if(t.definitionNode){let s=a=>{if(a.type==="identifier")if(a.id===t.definitionNode.id)n.push(a);else{let c=Ar(e,a);c&&c.id===t.definitionNode.id&&n.push(a)}for(let c of a.children)s(c)};return s(r),n}function o(s){if(!(t.scope===nt.File&&s.type==="procedure"&&wp(s,t.name))&&!(t.scope===nt.File&&s.type==="macro_body"&&s.parent?.type==="define"&&kQ(s.parent,t.name))&&!(t.scope===nt.File&&s.type==="macro_params")){s.type==="identifier"&&(t.scope===nt.Macro||t.nameCase==="exact"?s.text===t.name:Zt(s.text,t.name))&&n.push(s);for(let a of s.children)o(a)}}return o(r),n}function v$(e,t,n,r){let o=Ep(t,n,r);return o?e.filter(s=>s.uri!==n||s.range.start.line!==o.range.start.line||s.range.start.character!==o.range.start.character):e}function C$(e,t,n,r,o,s){let a=De(e);if(!a)return[];let c=cu(a.rootNode,t);if(!c)return[];let l=s?.nameCaseOf(c.name);if(c.scope===nt.External){if(!o)return[];let m=o.lookup(c.name,l),p={name:c.name,scope:nt.File,nameCase:l},h=za(a.rootNode,p).map(_=>({uri:n,range:J(_)})),y=m.filter(_=>_.uri!==n),w=[...h,...y];return r?w:v$(w,e,n,t)}let u=za(a.rootNode,c);if(u.length===0)return[];let d=u.map(m=>({uri:n,range:J(m)})),f=d;if(c.scope===nt.File&&o){let m=s?d$(s,c.name,n):new Set,p=o.lookup(c.name,l).filter(g=>g.uri!==n&&!m.has(g.uri));f=[...d,...p]}return r?f:v$(f,e,n,t)}var Rp=require("node:path"),Bv=require("node:url"),Tp=B(le());var P$=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function N$(e,t){let n=(0,Rp.relative)(t,e);return!n.startsWith("..")&&!(0,Rp.isAbsolute)(n)}function E$(e,t){if(!we())return null;let n=De(e);if(!n)return null;let r=Tr(n.rootNode,t);if(!r)return null;let o=cu(n.rootNode,t);return!o||o.scope===nt.External?null:{range:{start:{line:r.startPosition.row,character:r.startPosition.column},end:{line:r.endPosition.row,character:r.endPosition.column}},placeholder:r.text}}function R$(e,t,n,r){if(!we()||!P$.test(n))return null;let o=De(e);if(!o)return null;let s=cu(o.rootNode,t);if(!s||s.scope===nt.External)return null;let a=za(o.rootNode,s);if(a.length===0)return null;let c=a.map(l=>({range:J(l),newText:n}));return{changes:{[r]:c}}}function LQ(e,t,n,r,o){if(Dv(n,e))return Ov(n,e)?{uri:t,isExternal:!1}:null;let s=r.lookup(e);if(!s||s.source.type===Ee.Static)return null;if(s.source.type===Ee.Workspace){let a=s.location?.uri;if(!a)return null;if(o&&a.startsWith("file://")){let c=(0,Bv.fileURLToPath)(a);return{uri:a,isExternal:!N$(c,o)}}return{uri:a,isExternal:!1}}if(s.source.type===Ee.External){let a=s.location?.uri;return a?{uri:a,isExternal:!0}:null}return null}function T$(e,t,n,r){if(!we())return null;let o=De(e);if(!o)return null;let s=Tr(o.rootNode,t);if(!s||Dv(o.rootNode,s.text))return null;let a=n.lookup(s.text);if(!a||a.source.type!==Ee.Workspace)return null;let c=a.location?.uri;if(!c)return null;if(r&&c.startsWith("file://")){let l=(0,Bv.fileURLToPath)(c);if(!N$(l,r))return null}return{range:{start:{line:s.startPosition.row,character:s.startPosition.column},end:{line:s.endPosition.row,character:s.endPosition.column}},placeholder:s.text}}async function A$(e,t,n,r,o,s,a,c){if(!we()||!P$.test(n))return null;let l=De(e);if(!l)return null;let u=o$(l.rootNode,t);if(!u)return T(`rename: no identifier at position ${t.line}:${t.character}`,"debug"),null;T(`rename: symbol="${u}" uri=${r}`,"debug");let d=LQ(u,r,l.rootNode,s,c);if(!d)return T("rename: findDefinitionUri returned null (not a workspace-scope symbol)","debug"),null;if(d.isExternal)return T(`rename: symbol defined in external headers (read-only), uri=${d.uri}`,"debug"),null;let f=Ne(r),m=Ne(d.uri);T(`rename: definitionUri=${m}`,"debug");let p=o.lookupUris(u);T(`rename: ReferencesIndex returned ${p.size} file(s) for "${u}"`,"debug");let g=new Set([...p,m,f]);T(`rename: ${g.size} candidate files to scan`,"debug");let h=[],y={name:u,scope:nt.File,nameCase:s.nameCaseOf(u)};for(let w of g){let _=w===f?e:await a(w);if(!_){T(`rename: skipping ${w} (could not read file text)`,"debug");continue}let b=De(_);if(!b){T(`rename: skipping ${w} (parse failed)`,"debug");continue}if(w!==m&&Ov(b.rootNode,u)){T(`rename: skipping ${w} (symbol redefined at file scope)`,"debug");continue}let S=za(b.rootNode,y);if(S.length===0){T(`rename: skipping ${w} (no references found)`,"debug");continue}T(`rename: ${w} -> ${S.length} reference(s)`,"debug");let N=S.map(R=>({range:J(R),newText:n}));h.push(Tp.TextDocumentEdit.create(Tp.OptionalVersionedTextDocumentIdentifier.create(w,null),N))}return h.length===0?(T("rename: no edits produced across all candidates","debug"),null):(T(`rename: workspace edit covers ${h.length} file(s)`,"debug"),{documentChanges:h})}function I$(e,t,n){if(!we())return null;let r=De(e);if(!r)return null;let o=i$(r.rootNode,t);if(o){let c=Ha(o),l=Kt(o),u=l?Yt(l):null;return{signatures:[Wa(t,c,u,"")],activeSignature:0,activeParameter:n}}let a=yo(r.rootNode).find(c=>c.name===t&&c.hasParams);return a&&a.params?{signatures:[Wa(a.name,a.params.map(l=>({name:l})),a.jsdoc??null,"")],activeSignature:0,activeParameter:n}:null}var bi={symbols:[],refs:new Map};function D$(e,t,n,r){if(!we())return bi;let o=De(t);if(!o)return bi;let s=o.rootNode,a=OQ(s,e,n,r),c=MQ(s,e);return{symbols:a,refs:c}}function OQ(e,t,n,r){let o=ca(t,n),s=[],a=fr(e);for(let[l,{node:u}]of a){let d=Kt(u),f=d?Yt(d):null,m=Ha(u);s.push(bp(l,t,u,m,f,{displayPath:o}))}let c=yo(e);for(let l of c)s.push(Sp(l,t,o));for(let l of e.children)if(l.type==="variable_decl"){let u=Kt(l),d=u?Yt(u):null;for(let f of l.children)if(f.type==="var_init"){let m=f.childForFieldName("name");m&&s.push(Va(m.text,t,J(f),void 0,d,o))}}else if(l.type==="export_decl"){let u=Kt(l),d=u?Yt(u):null,f=l.childForFieldName("name");f&&s.push(Va(f.text,t,J(l),"export variable",d,o))}return Ym(s,r)}function MQ(e,t){let n=new Map;function r(o){if(o.type==="identifier"){let s=o.text,a=n.get(s);a||(a=[],n.set(s,a)),a.push({uri:t,range:J(o)})}for(let s of o.children)r(s)}return r(e),n}var $Q=50,Ka=class{cache=new Map;maxSize;constructor(t=$Q){this.maxSize=t}getOrParse(t,n,r,o){if(n===void 0)return o(r,t);let s=Ne(t),a=this.cache.get(s);if(a&&a.version===n)return a.data;let c=o(r,t);if(c===null)return null;if(this.cache.size>=this.maxSize){let l=this.cache.keys().next().value;l!==void 0&&this.cache.delete(l)}return this.cache.set(s,{version:n,data:c}),c}clear(t){this.cache.delete(Ne(t))}clearAll(){this.cache.clear()}get size(){return this.cache.size}};var k$={barter_init_p_proc:"Called when the barter screen is initialized.",barter_p_proc:"Called when the player initiates bartering with the critter.",combat_is_over_p_proc:"Called every time before combat ends.",combat_is_starting_p_proc:"Called every time before the start of combat.",combat_p_proc:"Called in combat (every turn?). The specific combat event number is passed via `fixed_param`.",create_p_proc:"Called when the object is first created on the map.",critter_p_proc:`This procedure is called every "heartbeat", which means it's run ten times each second, except during combat.
319
+ `+o.desc);let l={kind:us.MarkupKind.Markdown,value:c},u=s!==void 0;return{name:e,kind:K.Variable,location:{uri:t,range:n},scope:{level:u?kt.Workspace:kt.File},source:u?{type:Ee.Workspace,uri:t,displayPath:s}:{type:Ee.Document,uri:t},completion:{label:e,kind:us.CompletionItemKind.Variable,...u&&{labelDetails:{description:s},documentation:l}},hover:{contents:l},variable:{description:o?.desc??r}}}function ds(e,t,n,r,o){let s=t.text;return s?{name:s,detail:r,kind:n,range:J(e),selectionRange:J(t),children:o}:null}function s$(e,t){let n=[];if(e.type==="variable_decl"){for(let r of e.children)if(r.type==="var_init"){let o=r.childForFieldName("name");if(o){let s=ds(r,o,yi.SymbolKind.Variable,t);s&&n.push(s)}}}else if(e.type==="for_var_decl"){let r=e.childForFieldName("name");if(r){let o=ds(e,r,yi.SymbolKind.Variable,t);o&&n.push(o)}}for(let r of e.children)n.push(...s$(r,t));return n}function vQ(e,t){let n=[],r=e.childForFieldName("params");if(!r)return n;for(let o of r.children)if(o.type==="param"){let s=o.childForFieldName("name");if(s){let a=ds(o,s,yi.SymbolKind.Variable,t);a&&n.push(a)}}return n}function CQ(e){let t=fr(e),n=[];for(let[c,{node:l}]of t){let u=l.childForFieldName("name");if(!u)continue;let d=[...vQ(l,c),...s$(l,c)],f=ds(l,u,yi.SymbolKind.Function,void 0,d.length>0?d:void 0);f&&n.push(f)}let r=yo(e),o=[];function s(c){if(c.type==="preprocessor"){for(let l of c.children)if(l.type==="define"){let u=l.childForFieldName("name");if(!u)continue;let d=u.text,f=r.find(g=>g.name===d);if(!f)continue;let m=f.hasParams?yi.SymbolKind.Method:yi.SymbolKind.Constant,p=ds(l,u,m);p&&o.push(p)}}for(let l of c.children)s(l)}s(e);let a=[];for(let c of e.children)if(c.type==="variable_decl"){for(let l of c.children)if(l.type==="var_init"){let u=l.childForFieldName("name");if(u){let d=ds(l,u,yi.SymbolKind.Variable);d&&a.push(d)}}}else if(c.type==="export_decl"){let l=c.childForFieldName("name");if(l){let u=ds(c,l,yi.SymbolKind.Variable);u&&a.push(u)}}return[...n,...o,...a]}function a$(e){if(!we())return[];let t=De(e);return t?CQ(t.rootNode):[]}var ou=B(le());function Dv(e){let t=e.parent;for(;t;){if(t.type==="procedure")return t;t=t.parent}return null}function kv(e){let t=e.parent;for(;t;){if(t.type==="define")return t;t=t.parent}return null}function Fv(e,t){let n=e.childForFieldName("params");if(!n)return null;for(let r of n.children)if(r.type==="identifier"&&r.text===t)return r;return null}function c$(e){let t=e.parent?.type;return t==="param"||t==="macro_params"}function l$(e,t){let n=e.childForFieldName("params");if(n){for(let r of n.children)if(r.type==="param"){let o=r.childForFieldName("name");if(Zt(o?.text,t))return o}}return u$(e,t)}function xp(e,t){return l$(e,t)!==null}function u$(e,t){if(e.type==="variable_decl"){for(let n of e.children)if(n.type==="var_init"){let r=n.childForFieldName("name");if(Zt(r?.text,t))return r}}else if(e.type==="for_var_decl"){let n=e.childForFieldName("name");if(Zt(n?.text,t))return n}else if(e.type==="foreach_stmt")for(let n of["var","key","value"]){let r=e.childForFieldName(n);if(Zt(r?.text,t))return r}for(let n of e.children){let r=u$(n,t);if(r)return r}return null}function vp(e,t){let n=ls(fr(e),t)?.node;if(n)return n.childForFieldName("name");for(let o of e.children)if(o.type==="export_decl"){let s=o.childForFieldName("name");if(Zt(s?.text,t))return s}for(let o of e.children)if(o.type==="variable_decl"){for(let s of o.children)if(s.type==="var_init"){let a=s.childForFieldName("name");if(Zt(a?.text,t))return a}}return iu(e,t)?.childForFieldName("name")??null}function Lv(e,t){return vp(e,t)!==null}function d$(e,t,n){let r=new Set;for(let o of e.lookupAll(t))o.location&&o.location.uri!==n&&r.add(o.location.uri);return r}function Ar(e,t){let n=t.text,r=kv(t);if(r){let s=Fv(r,n);if(s)return s}let o=Dv(t);if(o){let s=l$(o,n);if(s)return s}return vp(e,n)}function Cp(e){let t=new Map;return n=>{let r=t.get(n);if(r!==void 0||t.has(n))return r??null;let o=e(n);return t.set(n,o),o}}var PQ=new Set(["call_expr","call_stmt","macro_call_stmt","proc_ref"]);function Ov(e,t){t(e);for(let n of e.children)Ov(n,t)}function m$(e){if(e.childForFieldName("params"))return!0;let t=e.childForFieldName("body");if(!t)return!1;let n=!1;return Ov(t,r=>{PQ.has(r.type)&&(n=!0)}),n}function Mv(e){return e.type==="procedure"||e.type==="procedure_forward"?!0:e.type==="define"&&m$(e)}function p$(e){let t=e.parent;return t!==null&&Mv(t)}function $v(e){let t=e.parent;return!t||!Mv(t)?!1:t.childForFieldName("name")?.id===e.id}function h$(e,t,n){if($v(e))return!1;let r=Ar(t,e);return r?p$(r):n(e.text)!==null}function NQ(e,t){let n=Ar(t,e);return n!==null&&!p$(n)}function g$(e,t){let n=ls(fr(e),t);if(n)return n.node;let r=iu(e,t);return r&&m$(r)?r:null}function _$(e,t){let n=e.childForFieldName("name");return n?{name:n.text,kind:e.type==="define"?ou.SymbolKind.Method:ou.SymbolKind.Function,uri:t,range:J(e),selectionRange:J(n)}:null}function EQ(e,t){return{name:e,kind:ou.SymbolKind.Function,uri:t.uri,range:t.range,selectionRange:t.range}}function y$(e,t,n,r){let o=g$(t,e);if(o)return _$(o,n);let s=r(e);return s?EQ(e,s):null}function b$(e,t,n,r){if(!we())return null;let o=De(e);if(!o)return null;let s=Tr(o.rootNode,t);if(!s||!$v(s)&&!h$(s,o.rootNode,r))return null;let a=y$(s.text,o.rootNode,n,r);return a?[a]:null}function S$(e,t,n){if(!we())return[];let r=t(e.uri);if(!r)return[];let o=De(r);if(!o)return[];let s=g$(o.rootNode,e.name);if(!s)return[];let a=new Map;Ov(s,l=>{if(l.type!=="identifier"||!h$(l,o.rootNode,n))return;let u=l.text,d=a.get(u);d||(d={to:y$(u,o.rootNode,e.uri,n),ranges:[]},a.set(u,d)),d.ranges.push(J(l))});let c=[];for(let{to:l,ranges:u}of a.values())l&&c.push({to:l,fromRanges:u});return c}var f$={start:{line:0,character:0},end:{line:0,character:0}};function RQ(e){let n=e.split(/[?#]/,1)[0].split("/").pop();return n?decodeURIComponent(n):e}function TQ(e){for(let t=e.parent;t;t=t.parent)if(Mv(t))return t;return null}function AQ(e,t){let n=TQ(e);if(n){let r=_$(n,t);if(r)return r}return{name:RQ(t),kind:ou.SymbolKind.File,uri:t,range:f$,selectionRange:f$}}function w$(e,t,n){if(!we())return[];let r=Cp(n),o=new Map;for(let s of t){let a=r(s.uri);if(!a)continue;let c=De(a);if(!c)continue;let l=Tr(c.rootNode,s.range.start);if(!l||l.text!==e.name||$v(l)||NQ(l,c.rootNode))continue;let u=AQ(l,s.uri),d=`${u.uri} ${u.name} ${u.range.start.line}:${u.range.start.character}`,f=o.get(d);f||(f={from:u,ranges:[]},o.set(d,f)),f.ranges.push(J(l))}return[...o.values()].map(({from:s,ranges:a})=>({from:s,fromRanges:a}))}var Ep=B(require("path"));var su=B(require("fs")),au=B(require("path"));var DQ={start:{line:0,character:0},end:{line:0,character:0}},Pp=2e4;function Np(e,t){let n={line:e.startPosition.row,character:e.startPosition.column};return{uri:t,range:{start:n,end:n}}}function Ga(e){return{uri:Ye(e),range:DQ}}function cu(e){if(su.existsSync(e))return e;let t=e.split(au.sep),n=t[0]??"",r=n===""?au.sep:n,o=0;for(let s of t.slice(1)){if(s==="")continue;let a;try{a=su.readdirSync(r)}catch{return null}if(o+=a.length,o>Pp)return null;let c=a.find(l=>l.toLowerCase()===s.toLowerCase());if(c===void 0)return null;r=au.join(r,c)}return su.existsSync(r)?r:null}function Rp(e,t,n){if(!we())return null;let r=De(e);if(!r)return null;let o=kQ(r.rootNode,n,t);if(o)return o;let s=Tr(r.rootNode,n);if(!s)return null;let a=Ar(r.rootNode,s);return a?{uri:t,range:J(a)}:null}function kQ(e,t,n){let r=e.descendantForPosition({row:t.line,column:t.character});if(!r)return null;let o=r;for(;o&&o.type!=="include";)o=o.parent;if(!o)return null;let s=o.childForFieldName("path");if(!s||s.type!=="string")return null;let a=s.startPosition,c=s.endPosition;if(t.line<a.row||t.line>c.row||t.line===a.row&&t.character<a.column||t.line===c.row&&t.character>=c.column)return null;let l=Np(s,n),u=s.text.replaceAll(/^["<]|[">]$/g,"");if(!u)return l;let d=Ep.dirname(et(n)),f=cu(Ep.resolve(d,u));return f?Ga(f):l}var nt={File:"file",Procedure:"procedure",Macro:"macro",External:"external"};function x$(e){throw new Error(`Unhandled ScopeKind: ${String(e)}`)}function lu(e,t){let n=Tr(e,t);if(!n)return null;let r=n.text,o=kv(n);if(o){let l=Fv(o,r);if(l)return{name:r,scope:nt.Macro,defineNode:o,definitionNode:l}}let s=Dv(n),a=s&&xp(s,r)?Ar(e,n):null;if(s&&a)return{name:r,scope:nt.Procedure,procedureNode:s,definitionNode:a};let c=vp(e,r);return c?{name:r,scope:nt.File,definitionNode:c}:{name:r,scope:nt.External}}function FQ(e,t){let n=e.childForFieldName("params");return n?ru(n.text).includes(t):!1}function LQ(e,t){switch(e.scope){case nt.File:return t;case nt.External:return t;case nt.Procedure:return e.procedureNode??t;case nt.Macro:return e.defineNode??t;default:return x$(e.scope)}}function za(e,t){if(t.scope===nt.External)return[];if(t.scope===nt.Procedure&&!t.procedureNode)return[];if(t.scope===nt.Macro&&!t.defineNode)return[];let n=[],r=LQ(t,e);if(t.definitionNode){let s=a=>{if(a.type==="identifier")if(a.id===t.definitionNode.id)n.push(a);else{let c=Ar(e,a);c&&c.id===t.definitionNode.id&&n.push(a)}for(let c of a.children)s(c)};return s(r),n}function o(s){if(!(t.scope===nt.File&&s.type==="procedure"&&xp(s,t.name))&&!(t.scope===nt.File&&s.type==="macro_body"&&s.parent?.type==="define"&&FQ(s.parent,t.name))&&!(t.scope===nt.File&&s.type==="macro_params")){s.type==="identifier"&&(t.scope===nt.Macro||t.nameCase==="exact"?s.text===t.name:Zt(s.text,t.name))&&n.push(s);for(let a of s.children)o(a)}}return o(r),n}function v$(e,t,n,r){let o=Rp(t,n,r);return o?e.filter(s=>s.uri!==n||s.range.start.line!==o.range.start.line||s.range.start.character!==o.range.start.character):e}function C$(e,t,n,r,o,s){let a=De(e);if(!a)return[];let c=lu(a.rootNode,t);if(!c)return[];let l=s?.nameCaseOf(c.name);if(c.scope===nt.External){if(!o)return[];let m=o.lookup(c.name,l),p={name:c.name,scope:nt.File,nameCase:l},h=za(a.rootNode,p).map(_=>({uri:n,range:J(_)})),y=m.filter(_=>_.uri!==n),w=[...h,...y];return r?w:v$(w,e,n,t)}let u=za(a.rootNode,c);if(u.length===0)return[];let d=u.map(m=>({uri:n,range:J(m)})),f=d;if(c.scope===nt.File&&o){let m=s?d$(s,c.name,n):new Set,p=o.lookup(c.name,l).filter(g=>g.uri!==n&&!m.has(g.uri));f=[...d,...p]}return r?f:v$(f,e,n,t)}var Tp=require("node:path"),qv=require("node:url"),Ap=B(le());var P$=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function N$(e,t){let n=(0,Tp.relative)(t,e);return!n.startsWith("..")&&!(0,Tp.isAbsolute)(n)}function E$(e,t){if(!we())return null;let n=De(e);if(!n)return null;let r=Tr(n.rootNode,t);if(!r)return null;let o=lu(n.rootNode,t);return!o||o.scope===nt.External?null:{range:{start:{line:r.startPosition.row,character:r.startPosition.column},end:{line:r.endPosition.row,character:r.endPosition.column}},placeholder:r.text}}function R$(e,t,n,r){if(!we()||!P$.test(n))return null;let o=De(e);if(!o)return null;let s=lu(o.rootNode,t);if(!s||s.scope===nt.External)return null;let a=za(o.rootNode,s);if(a.length===0)return null;let c=a.map(l=>({range:J(l),newText:n}));return{changes:{[r]:c}}}function OQ(e,t,n,r,o){if(Iv(n,e))return Lv(n,e)?{uri:t,isExternal:!1}:null;let s=r.lookup(e);if(!s||s.source.type===Ee.Static)return null;if(s.source.type===Ee.Workspace){let a=s.location?.uri;if(!a)return null;if(o&&a.startsWith("file://")){let c=(0,qv.fileURLToPath)(a);return{uri:a,isExternal:!N$(c,o)}}return{uri:a,isExternal:!1}}if(s.source.type===Ee.External){let a=s.location?.uri;return a?{uri:a,isExternal:!0}:null}return null}function T$(e,t,n,r){if(!we())return null;let o=De(e);if(!o)return null;let s=Tr(o.rootNode,t);if(!s||Iv(o.rootNode,s.text))return null;let a=n.lookup(s.text);if(!a||a.source.type!==Ee.Workspace)return null;let c=a.location?.uri;if(!c)return null;if(r&&c.startsWith("file://")){let l=(0,qv.fileURLToPath)(c);if(!N$(l,r))return null}return{range:{start:{line:s.startPosition.row,character:s.startPosition.column},end:{line:s.endPosition.row,character:s.endPosition.column}},placeholder:s.text}}async function A$(e,t,n,r,o,s,a,c){if(!we()||!P$.test(n))return null;let l=De(e);if(!l)return null;let u=o$(l.rootNode,t);if(!u)return T(`rename: no identifier at position ${t.line}:${t.character}`,"debug"),null;T(`rename: symbol="${u}" uri=${r}`,"debug");let d=OQ(u,r,l.rootNode,s,c);if(!d)return T("rename: findDefinitionUri returned null (not a workspace-scope symbol)","debug"),null;if(d.isExternal)return T(`rename: symbol defined in external headers (read-only), uri=${d.uri}`,"debug"),null;let f=Ne(r),m=Ne(d.uri);T(`rename: definitionUri=${m}`,"debug");let p=o.lookupUris(u);T(`rename: ReferencesIndex returned ${p.size} file(s) for "${u}"`,"debug");let g=new Set([...p,m,f]);T(`rename: ${g.size} candidate files to scan`,"debug");let h=[],y={name:u,scope:nt.File,nameCase:s.nameCaseOf(u)};for(let w of g){let _=w===f?e:await a(w);if(!_){T(`rename: skipping ${w} (could not read file text)`,"debug");continue}let b=De(_);if(!b){T(`rename: skipping ${w} (parse failed)`,"debug");continue}if(w!==m&&Lv(b.rootNode,u)){T(`rename: skipping ${w} (symbol redefined at file scope)`,"debug");continue}let S=za(b.rootNode,y);if(S.length===0){T(`rename: skipping ${w} (no references found)`,"debug");continue}T(`rename: ${w} -> ${S.length} reference(s)`,"debug");let N=S.map(R=>({range:J(R),newText:n}));h.push(Ap.TextDocumentEdit.create(Ap.OptionalVersionedTextDocumentIdentifier.create(w,null),N))}return h.length===0?(T("rename: no edits produced across all candidates","debug"),null):(T(`rename: workspace edit covers ${h.length} file(s)`,"debug"),{documentChanges:h})}function I$(e,t,n){if(!we())return null;let r=De(e);if(!r)return null;let o=i$(r.rootNode,t);if(o){let c=Ha(o),l=Kt(o),u=l?Yt(l):null;return{signatures:[Wa(t,c,u,"")],activeSignature:0,activeParameter:n}}let a=yo(r.rootNode).find(c=>c.name===t&&c.hasParams);return a&&a.params?{signatures:[Wa(a.name,a.params.map(l=>({name:l})),a.jsdoc??null,"")],activeSignature:0,activeParameter:n}:null}var bi={symbols:[],refs:new Map};function D$(e,t,n,r){if(!we())return bi;let o=De(t);if(!o)return bi;let s=o.rootNode,a=MQ(s,e,n,r),c=$Q(s,e);return{symbols:a,refs:c}}function MQ(e,t,n,r){let o=ca(t,n),s=[],a=fr(e);for(let[l,{node:u}]of a){let d=Kt(u),f=d?Yt(d):null,m=Ha(u);s.push(Sp(l,t,u,m,f,{displayPath:o}))}let c=yo(e);for(let l of c)s.push(wp(l,t,o));for(let l of e.children)if(l.type==="variable_decl"){let u=Kt(l),d=u?Yt(u):null;for(let f of l.children)if(f.type==="var_init"){let m=f.childForFieldName("name");m&&s.push(Va(m.text,t,J(f),void 0,d,o))}}else if(l.type==="export_decl"){let u=Kt(l),d=u?Yt(u):null,f=l.childForFieldName("name");f&&s.push(Va(f.text,t,J(l),"export variable",d,o))}return Xm(s,r)}function $Q(e,t){let n=new Map;function r(o){if(o.type==="identifier"){let s=o.text,a=n.get(s);a||(a=[],n.set(s,a)),a.push({uri:t,range:J(o)})}for(let s of o.children)r(s)}return r(e),n}var qQ=50,Ka=class{cache=new Map;maxSize;constructor(t=qQ){this.maxSize=t}getOrParse(t,n,r,o){if(n===void 0)return o(r,t);let s=Ne(t),a=this.cache.get(s);if(a&&a.version===n)return a.data;let c=o(r,t);if(c===null)return null;if(this.cache.size>=this.maxSize){let l=this.cache.keys().next().value;l!==void 0&&this.cache.delete(l)}return this.cache.set(s,{version:n,data:c}),c}clear(t){this.cache.delete(Ne(t))}clearAll(){this.cache.clear()}get size(){return this.cache.size}};var k$={barter_init_p_proc:"Called when the barter screen is initialized.",barter_p_proc:"Called when the player initiates bartering with the critter.",combat_is_over_p_proc:"Called every time before combat ends.",combat_is_starting_p_proc:"Called every time before the start of combat.",combat_p_proc:"Called in combat (every turn?). The specific combat event number is passed via `fixed_param`.",create_p_proc:"Called when the object is first created on the map.",critter_p_proc:`This procedure is called every "heartbeat", which means it's run ten times each second, except during combat.
320
320
  Note: if this procedure is not present in the script, errors can occur, and the first encountered procedure may be treated as this handler.`,damage_p_proc:"Called when the critter takes damage. The amount of damage received is passed via `fixed_param`.\nNote: not called if the damage is fully absorbed by armor.",description_p_proc:"Called when the player inspects the object (binoculars). By default, the description from the prototype object is shown.\nNote: must use `script_overrides` to prevent simultaneous execution with the default description.",destroy_p_proc:"Called on death of the critter or destruction of the object (except when using `destroy_object(self_obj)`).",drop_p_proc:"Called when the self-object is dropped to the ground.",is_dropping_p_proc:"Called when trying to drop an object.",look_at_p_proc:"Called when the player passes the cursor over any object. By default, the prototype name of the object is displayed.\nNote: must use `script_overrides` to prevent simultaneous execution with the default name display.",map_enter_p_proc:"Called once by the engine each time the map is entered from another map. It is not run when the elevation is changed.",map_exit_p_proc:"Called when the player leaves the map.",map_update_p_proc:"Called every 250 game ticks (1 tick = 1/10 second, so roughly every 25 seconds). It is also called each time you exit a dialogue, each time you exit the pipboy screen and each time you use an item. In addition to that, it is run once when you enter the map, and, seemingly, twice when you change elevation.",pickup_p_proc:`In object scripts, called when a critter tries to pick up this item.
321
321
  For container objects, called when a critter tries to open them or steal something.
322
322
  In critter scripts, called when someone tries to steal from this critter.`,push_p_proc:"Called when trying to push the object.",spatial_p_proc:"Called when an object passes over the self-object's spatial trigger area.",start:"Called by the engine when the script is first run or the game object is first created, then never again, unless specifically called from somewhere else.",talk_p_proc:"Called when the player tries to initiate dialogue with the critter.",timed_event_p_proc:"This procedure is called by the function `add_timer_event(ObjectPtr obj, int time, int fixed_param)`.\n`ObjectPtr` points to the object whose script's `timed_event_p_proc` procedure you want to access.\nTime is the number of game ticks (1 game tick = 1/10 seconds) you want to pass before the `timed_event_p_proc` is called.\n`fixed_param` is a variable you can set to differentiate between various timed events.\nIn `timed_event_p_proc`, you can check the value of `fixed_param` against whatever number you used when calling `add_timer_event`.\nThis allows for multiple uses of `timed_event_p_proc` in the same script.",use_ad_on_p_proc:"Called when an advantage is used on the object.",use_disad_on_p_proc:"Called when a disadvantage is used on the object.",use_obj_on_p_proc:`Called when:
@@ -328,49 +328,49 @@ The parameter \`obj_being_used_with\` receives a pointer to the object that was
328
328
  - A critter uses an object from inventory which have "Use" action flag set or it's an active flare or dynamite.
329
329
  - Player uses an object from main interface.
330
330
  Use \`source_obj\` to get the object being used. Note: not called for some item types when working with inventory.
331
- `,use_skill_on_p_proc:"Called when a skill is used on the object. The skill number is passed via `action_being_used` (see DEFINE.H, Skill Equates)."};var BQ=k$,jv=new Ka;function F$(e,t){if(!we())return null;let n=De(e);if(!n)return null;let r=[],o=n.rootNode,s=fr(o);for(let[l,{node:u}]of s){let d=Kt(u),f=d?Yt(d):null,m=Ha(u),p=BQ[l];r.push(bp(l,t,u,m,f,{engineDoc:p}))}let a=yo(o);for(let l of a)r.push(Sp(l,t));for(let l of o.children)if(l.type==="variable_decl"){let u=Kt(l),d=u?Yt(u):null;for(let f of l.children)if(f.type==="var_init"){let m=f.childForFieldName("name");m&&r.push(Va(m.text,t,J(f),void 0,d))}}else if(l.type==="export_decl"){let u=Kt(l),d=u?Yt(u):null,f=l.childForFieldName("name");f&&r.push(Va(f.text,t,J(l),"export variable",d))}let c=new Map;for(let l of r)c.has(l.name)||c.set(l.name,l);return{symbols:r,byName:c}}function Wv(e,t,n){return jv.getOrParse(n,t,e,F$)?.symbols??[]}function L$(e,t,n,r){return jv.getOrParse(r,n,t,F$)?.byName.get(e)}function O$(e){jv.clear(e)}function lu(e,t,n){let r=e.descendantForPosition({row:t.line,column:t.character}),o=r?n(r):null;if(o!==null)return o;if(t.character>0){let s=e.descendantForPosition({row:t.line,column:t.character-1});if(s)return n(s)}return null}function Ya(e,t,n){return(r,o)=>{if(!e())return!1;let s=t(r);return s?lu(s.rootNode,o,a=>n.has(a.type)?!0:null)===!0:!1}}var Se={Prologue:"prologue",Flag:"flag",Component:je.component,ComponentFlag:je.component_flag,Language:"language",Action:"action",Patch:"patch",Constants:"constants",Vars:"vars",Value:"value",When:"when",OptGlob:je.opt_glob,OptCase:je.opt_case,OptExact:je.opt_exact,Caching:"caching",ArraySortType:je.array_sort_type,FuncVarKeyword:je.func_var_keyword,ActionFunctions:je.action_functions,PatchFunctions:je.patch_functions,DimorphicFunctions:je.dimorphic_functions,ActionMacros:je.action_macros,PatchMacros:je.patch_macros,Jsdoc:"jsdoc"};function Ap(e,t,n,r){return lu(e,t,o=>o.type===n?o.text.trimStart().startsWith("/**")?"jsdoc":"comment":o.type===r?"comment":null)??"none"}function M$(e,t,n){let r=0,o=0;for(let c=0;c<e.length;c++){if(r===t){o=c;break}e[c]===`
331
+ `,use_skill_on_p_proc:"Called when a skill is used on the object. The skill number is passed via `action_being_used` (see DEFINE.H, Skill Equates)."};var jQ=k$,Bv=new Ka;function F$(e,t){if(!we())return null;let n=De(e);if(!n)return null;let r=[],o=n.rootNode,s=fr(o);for(let[l,{node:u}]of s){let d=Kt(u),f=d?Yt(d):null,m=Ha(u),p=jQ[l];r.push(Sp(l,t,u,m,f,{engineDoc:p}))}let a=yo(o);for(let l of a)r.push(wp(l,t));for(let l of o.children)if(l.type==="variable_decl"){let u=Kt(l),d=u?Yt(u):null;for(let f of l.children)if(f.type==="var_init"){let m=f.childForFieldName("name");m&&r.push(Va(m.text,t,J(f),void 0,d))}}else if(l.type==="export_decl"){let u=Kt(l),d=u?Yt(u):null,f=l.childForFieldName("name");f&&r.push(Va(f.text,t,J(l),"export variable",d))}let c=new Map;for(let l of r)c.has(l.name)||c.set(l.name,l);return{symbols:r,byName:c}}function jv(e,t,n){return Bv.getOrParse(n,t,e,F$)?.symbols??[]}function L$(e,t,n,r){return Bv.getOrParse(r,n,t,F$)?.byName.get(e)}function O$(e){Bv.clear(e)}function uu(e,t,n){let r=e.descendantForPosition({row:t.line,column:t.character}),o=r?n(r):null;if(o!==null)return o;if(t.character>0){let s=e.descendantForPosition({row:t.line,column:t.character-1});if(s)return n(s)}return null}function Ya(e,t,n){return(r,o)=>{if(!e())return!1;let s=t(r);return s?uu(s.rootNode,o,a=>n.has(a.type)?!0:null)===!0:!1}}var Se={Prologue:"prologue",Flag:"flag",Component:je.component,ComponentFlag:je.component_flag,Language:"language",Action:"action",Patch:"patch",Constants:"constants",Vars:"vars",Value:"value",When:"when",OptGlob:je.opt_glob,OptCase:je.opt_case,OptExact:je.opt_exact,Caching:"caching",ArraySortType:je.array_sort_type,FuncVarKeyword:je.func_var_keyword,ActionFunctions:je.action_functions,PatchFunctions:je.patch_functions,DimorphicFunctions:je.dimorphic_functions,ActionMacros:je.action_macros,PatchMacros:je.patch_macros,Jsdoc:"jsdoc"};function Ip(e,t,n,r){return uu(e,t,o=>o.type===n?o.text.trimStart().startsWith("/**")?"jsdoc":"comment":o.type===r?"comment":null)??"none"}function M$(e,t,n){let r=0,o=0;for(let c=0;c<e.length;c++){if(r===t){o=c;break}e[c]===`
332
332
  `&&r++}if(r<t)return Buffer.byteLength(e,"utf8");let s=0;for(let c=o;c<e.length;c++){if(s===n)return Buffer.byteLength(e.substring(0,c),"utf8");if(e[c]===`
333
- `)return Buffer.byteLength(e.substring(0,c),"utf8")+(n-s);s++}return Buffer.byteLength(e,"utf8")+(n-s)}function Xa(e,t,n){return(r,o)=>{if(!e())return!1;let s=t(r);return s?lu(s.rootNode,o,a=>{for(let c=a;c;c=c.parent)if(n.has(c.type))return!0;return null})===!0:!1}}var Uv=Xa(we,De,new Set(["string"]));function Hv(e,t){if(!we())return"code";let n=De(e);if(!n)return"code";switch(Ap(n.rootNode,t,"comment","line_comment")){case"jsdoc":return"jsdoc";case"comment":return"comment";default:return"code"}}var WQ=/^\s*(?:export\s+)?(?:variable|procedure)\s+\S*$|^\s*#define\s+\S*$/i;function $$(e,t){return WQ.test(Pr(e,t))}var q$=B(le());function UQ(e,t){t.push({line:e.startPosition.row,startChar:e.startPosition.column,length:e.endPosition.column-e.startPosition.column,tokenType:q$.SemanticTokenTypes.parameter,tokenModifiers:0})}function Vv(e,t,n){if(t.type==="identifier"){let r=Ar(e,t);r&&r!==t&&c$(r)&&UQ(t,n)}for(let r of t.children)Vv(e,r,n)}function HQ(e,t,n){let r=t.childForFieldName("params"),o=t.childForFieldName("name");if(r)for(let s of t.children)s.type!=="param_list"&&(o&&s.type==="identifier"&&s.startIndex===o.startIndex&&s.endIndex===o.endIndex||Vv(e,s,n))}function VQ(e,t,n){let r=t.childForFieldName("params"),o=t.childForFieldName("body");if(!(!r||!o))for(let s of o.children)Vv(e,s,n)}function B$(e,t,n){if(t.type==="procedure"){HQ(e,t,n);return}if(t.type==="define"){VQ(e,t,n);return}for(let r of t.children)B$(e,r,n)}function j$(e){if(!we())return[];let t=De(e);if(!t)return[];let n=[];return B$(t.rootNode,t.rootNode,n),n}var GQ=new Set(["procedure","if_stmt","while_stmt","for_stmt","foreach_stmt","switch_stmt","block"]),zQ=ho(we,De,GQ),KQ=go(we,De),zv=class{id=mt;indexExtensions=[...rb];fileIndex;staticSignatures;storedContext;lookupFallbackSymbol(t,n){return this.fileIndex?.symbols.lookupAll(t).find(r=>r.source.type!==Ee.Navigation&&r.source.uri!==n)}async init(t){this.storedContext=t,await _p(),this.fileIndex=new co(this.id);let n=On(mt);this.fileIndex.loadStatic(n),this.staticSignatures=G1(mt),T(`Fallout SSL provider initialized with ${n.length} static symbols`)}async readFileText(t){let n=this.storedContext?.getDocumentText?.(t);if(n!==void 0)return n;try{return await Ip.promises.readFile((0,Gv.fileURLToPath)(t),"utf-8")}catch(r){return T(`readFileText: failed to read ${t}: ${at(r)}`,"warn"),null}}resolveSymbol(t,n,r){let o=this.storedContext?.getDocumentVersion?.(r),s=L$(t,n,o,r);if(s)return T(`resolveSymbol: name="${t}" uri="${r}" local=found`,"debug"),s;if(this.storedContext?.settings.debug){let c=Wv(n,o,r);T(`resolveSymbol: name="${t}" uri="${r}" local=not found; local symbols: [${c.map(l=>l.name).join(", ")}]`,"debug")}let a=this.lookupFallbackSymbol(t,r);return T(`resolveSymbol: fallback=${a?"found":"not found"}`,"debug"),a}format(t,n){return mo({text:t,uri:n,languageName:"SSL",isInitialized:we,parse:De,formatAst:(r,o)=>iv(r,o),getFormatOptions:po,normalizeForCompare:Zx})}symbols(t){return we()?a$(t):[]}foldingRanges(t){return zQ(t)}selectionRanges(t,n){return KQ(t,n)}definition(t,n,r){return we()?Ep(t,r,n):null}references(t,n,r,o,s){return we()?C$(t,n,r,o,this.fileIndex?.refs,this.fileIndex?.symbols):[]}callableDef(t){let n=this.fileIndex?.symbols.lookupAll(t).find(r=>r.kind===K.Procedure||r.kind===K.Macro);return n?.location?{uri:n.location.uri,range:n.location.range}:null}readTextSync(t){let n=this.storedContext?.getDocumentText?.(t);if(n!==void 0)return n;try{return(0,Ip.readFileSync)((0,Gv.fileURLToPath)(t),"utf-8")}catch(r){return T(`call-hierarchy readTextSync: failed to read ${t}: ${at(r)}`,"warn"),null}}prepareCallHierarchy(t,n,r){return we()?b$(t,n,r,o=>this.callableDef(o)):null}incomingCalls(t){if(!we())return[];let n=this.fileIndex?.refsOf(t.name)??[];return w$(t,n,r=>this.readTextSync(r))}outgoingCalls(t){return we()?S$(t,n=>this.readTextSync(n),n=>this.callableDef(n)):[]}filterCompletions(t,n,r,o,s){let a=Hv(n,r);if(a==="comment")return[];if(a==="jsdoc")return gp(q1,Pr(n,r));if(Uv(n,r))return[];if(s==="@")return[];if($$(n,r))return[];let c=this.storedContext?.getDocumentVersion?.(o),l=Wv(n,c,o),u=new Set(l.map(f=>f.name)),d=t.filter(f=>!u.has(f.label));return[...l.map(f=>f.completion),...d]}shouldProvideFeatures(t,n){return Hv(t,n)==="code"}isPositionInString(t,n){return Uv(t,n)}localSignature(t,n,r){return we()?I$(t,n,r):null}semanticTokens(t,n){return j$(t)}prepareRename(t,n){if(!we())return null;if(this.fileIndex){let r=T$(t,n,this.fileIndex.symbols,this.storedContext?.workspaceRoot);if(r)return r}return E$(t,n)}async rename(t,n,r,o){if(!we())return null;if(this.fileIndex){T(`rename: trying workspace rename for "${r}" at ${o}`,"debug");let a=await A$(t,n,r,o,this.fileIndex.refs,this.fileIndex.symbols,c=>this.readFileText(c),this.storedContext?.workspaceRoot);if(a)return T("rename: workspace rename succeeded","debug"),a;T("rename: workspace rename returned null, falling back to single-file","debug")}else T("rename: no fileIndex, using single-file rename","debug");let s=R$(t,n,r,o);return T(`rename: single-file rename ${s?"succeeded":"returned null"}`,"debug"),s}getCompletions(t){return this.fileIndex?this.fileIndex.symbols.query({excludeUri:t}).map(n=>n.completion):[]}getSignature(t,n,r){if(this.staticSignatures){let s=this.staticSignatures.get(n);if(s)return Nv(s,r)}let o=this.fileIndex?.symbols.lookup(n);return o?.signature?Nv(o.signature,r):null}getSymbolDefinition(t){return this.lookupFallbackSymbol(t)?.location??null}reloadFileData(t,n){if(we()&&this.fileIndex){let r=Wo(t)?Ee.Workspace:Ee.Navigation,o=D$(t,n,this.storedContext?.workspaceRoot,r);this.fileIndex.updateFile(t,o)}}onWatchedFileDeleted(t){this.fileIndex?.removeFile(t)}workspaceSymbols(t,n){return this.fileIndex?.symbols.searchWorkspaceSymbols(t,500,n)??[]}onDocumentClosed(t){O$(t)}async compile(t,n,r){if(!this.storedContext){T("Fallout SSL provider not initialized, cannot compile");return}await XO(t,this.storedContext.settings.falloutSSL,r,n,this.storedContext.settings.debug)}},W$=new zv;var Kv=class{id=rf;symbolStore;async init(t){this.symbolStore=new Yr;let n=On(rf);this.symbolStore.loadStatic(n),T(`Fallout Worldmap provider initialized with ${n.length} static symbols`)}resolveSymbol(t,n,r){return Ba(t,this.symbolStore)}getCompletions(t){return ja(this.symbolStore)}},U$=new Kv;var H$=new Map([["AddJournalEntry",[0]],["AddMapNote",[1]],["DisplayString",[1]],["DisplayStringHead",[1]],["DisplayStringHeadDead",[1]],["DisplayStringHeadNoLog",[1]],["DisplayStringHeadOwner",[1]],["DisplayStringNoName",[1]],["DisplayStringNoNameDlg",[1]],["DisplayStringNoNameHead",[1]],["DisplayStringPoint",[1]],["DisplayStringPointLog",[1]],["DisplayStringWait",[1]],["EraseJournalEntry",[0]],["RemoveMapNote",[1]],["SetName",[0]],["SetPlayerSound",[1]],["SetQuestDone",[0]],["SetToken",[1]]]);var V$=()=>Me.initOne(Tt,"tree-sitter-baf.wasm","BAF");var uu=()=>Me.isInitialized(Tt),Ja=e=>Me.parseWithCache(Tt,e);function Qa(e){return e!==void 0&&e.toLowerCase().startsWith("area")}var Yv="ANYONE",ms=5,du={bg:["EA","GENERAL","RACE","CLASS","SPECIFIC","GENDER","ALIGN"],iwd:["EA","GENERAL","RACE","CLASS","SPECIFIC","GENDER","ALIGN"],pst:["EA","FACTION","TEAM","GENERAL","RACE","CLASS","SPECIFIC","GENDER","ALIGN"],iwd2:["EA","GENERAL","RACE","CLASS","SPECIFIC","GENDER","ALIGNMNT","SUBRACE","AVCLASS","CLASSMSK"]},Xv={bg:0,iwd:0,pst:0,iwd2:2};function G$(e){return e!=="bg"}var YQ=/^([^(]+)\((.*)\)$/s;function Dp(e){let t=YQ.exec(e.trim());if(t===null)return;let n=t[2].trim(),r=n===""?[]:n.split(",").map(o=>XQ(o));return{name:t[1].trim(),parameters:r}}function XQ(e){let t=e.trim(),n=t.indexOf("*"),r=t.indexOf(":"),o=n===-1?t.length:n,s=n===-1?"":t.slice(n+1).trim();return{type:t.slice(0,1),tag:r===-1?"":t.slice(r+1,o).trim(),table:s===""?void 0:s}}function Zv(e){let t=o=>{let s=new Map;for(let[a,c]of e.idsAll(o)??[])for(let l of c){let u=l.indexOf("("),d=(u===-1?l:l.slice(0,u)).trim().toLowerCase();s.set(d,[...s.get(d)??[],{id:a,signature:l}])}return s},n=t("TRIGGER"),r=t("ACTION");return{triggerByName:o=>n.get(o.toLowerCase())??[],actionByName:o=>r.get(o.toLowerCase())??[],idsAll:o=>e.idsAll(o)}}var bo=class extends Error{diagnostics;constructor(t){let n=t[0];super(n?`${n.line}:${n.column}: ${n.message}`:"compilation failed"),this.name="BcsCompileError",this.diagnostics=t}},kp=2,JQ=new Set(["CreateCreatureAtLocation","CreateItemGlobal","Global","GlobalGT","GlobalLT","IncrementGlobal","IncrementGlobalOnce","MoveToSavedLocation","MoveToSavedLocationn","RealSetGlobalTimer","SetGlobal","SetGlobalRandom","SetGlobalRandomPlus","SetGlobalTimer","SetGlobalTimerRandom","SetTokenGlobal"].map(e=>e.toLowerCase())),QQ=/^UnknownTrigger(\d+)$/i,ZQ=/^UnknownAction(\d+)$/i;function eC(e,t,n,r="bg"){let o=e.parse(t);if(o===null)throw new bo([{line:1,column:1,message:"parser returned no tree"}]);try{let s=ap(o.rootNode);if(s.length>0)throw new bo(s.map(a=>({...K$(a),message:a.isMissing?`missing ${a.type}`:"syntax error"})));return new Qv(n,r).script(o.rootNode)}finally{o.delete()}}function K$(e){return{line:e.startPosition.row+1,column:e.startPosition.column+1}}function z$(e){return Int32Array.of(e)[0]}var Jv=e=>Array.from({length:e},()=>0);function ps(e){return e.namedChildren.filter(t=>t!==null&&t.type!=="comment"&&t.type!=="line_comment")}var Qv=class{symbols;engine;diagnostics=[];byName=new Map;constructor(t,n){this.symbols=t,this.engine=n}script(t){let n=ps(t).filter(r=>r.type==="block").map(r=>this.block(r));if(this.diagnostics.length>0)throw new bo(this.diagnostics);return{blocks:n}}fail(t,n){this.diagnostics.push({...K$(t),message:n})}block(t){let n=[];for(let o of ps(t.childForFieldName("if"))){if(o.type==="or_marker"){n.push(this.orMarker(o));continue}let s=o.childForFieldName("call"),a=o.children.some(c=>c?.type==="!");if(this.callName(s).toLowerCase()==="triggeroverride"){let c=this.arguments(s);if(c.length!==2||c[1].type!=="call_expr"){this.fail(s,"TriggerOverride takes an object and the trigger it retargets");continue}n.push(this.nextTriggerObject(s,c[0]),this.trigger(c[1],a));continue}n.push(this.trigger(s,a))}let r=ps(t.childForFieldName("then")).filter(o=>o.type==="response").map(o=>this.response(o));return{triggers:n,responses:r}}response(t){let n=t.childForFieldName("weight");return{weight:n===null?0:this.integer(n),actions:ps(t).filter(r=>r.type==="action").map(r=>this.action(r))}}callName(t){return t.childForFieldName("func")?.text??""}arguments(t){return t.childrenForFieldName("args").filter(n=>n!==null)}select(t,n){if(t.length<=1)return t[0];let r=t.filter(o=>Dp(o.signature)?.parameters.length===n);return(r.length>0?r:t).at(-1)}trigger(t,n){let r=this.callName(t),o=QQ.exec(r);if(o!==null)return this.emptyTrigger(Number(o[1]),n);let s=this.arguments(t),a=this.select(this.symbols.triggerByName(r),s.length);if(a===void 0)return this.fail(t,`this game's TRIGGER.IDS has no trigger called ${r}`),this.emptyTrigger(0,n);let c=this.bind(t,a,s);return{ints:[a.id,c.integers[0]??0,n?1:0,c.integers[1]??0,c.integers[2]??0],...this.engine==="pst"?{point:c.point??[0,0]}:{},strings:c.strings,object:c.objects[0]??this.emptyObject()}}emptyTrigger(t,n){return{ints:[t,0,n?1:0,0,0],...this.engine==="pst"?{point:[0,0]}:{},strings:["",""],object:this.emptyObject()}}nextTriggerObject(t,n){let r=this.select(this.symbols.triggerByName("NextTriggerObject"),1);return r===void 0?(this.fail(t,"this game's TRIGGER.IDS has no NextTriggerObject, so TriggerOverride cannot be written"),this.emptyTrigger(0,!1)):{...this.emptyTrigger(r.id,!1),object:this.object(n)}}orMarker(t){let n=this.select(this.symbols.triggerByName("OR"),1);if(n===void 0)return this.fail(t,"this game's TRIGGER.IDS has no OR"),this.emptyTrigger(0,!1);let r=t.childForFieldName("count"),o=this.emptyTrigger(n.id,!1);return o.ints[1]=r===null?0:this.integer(r),o}action(t){let n=t.childForFieldName("call"),r;if(this.callName(n).toLowerCase()==="actionoverride"){let d=this.arguments(n);if(d.length!==2||d[1].type!=="call_expr")return this.fail(n,"ActionOverride takes an object and the action it applies to"),this.emptyAction(0);r=this.object(d[0]),n=d[1]}let o=this.callName(n),s=ZQ.exec(o);if(s!==null)return{...this.emptyAction(Number(s[1])),objects:this.objects(r,[])};let a=this.arguments(n),c=this.select(this.symbols.actionByName(o),a.length);if(c===void 0)return this.fail(n,`this game's ACTION.IDS has no action called ${o}`),this.emptyAction(0);let l=this.bind(n,c,a),u=l.point??[0,0];return{id:c.id,objects:this.objects(r,l.objects),ints:[l.integers[0]??0,u[0]??0,u[1]??0,l.integers[1]??0,l.integers[2]??0],strings:l.strings}}emptyAction(t){return{id:t,objects:this.objects(void 0,[]),ints:[0,0,0,0,0],strings:["",""]}}objects(t,n){return[t??this.emptyObject(),n[0]??this.emptyObject(),n[1]??this.emptyObject()]}bind(t,n,r){let s=Dp(n.signature)?.parameters??[];r.length!==s.length&&this.fail(t,`${n.signature} takes ${s.length} argument${s.length===1?"":"s"}, not ${r.length}`);let a=[],c=[],l=[],u;for(let[d,f]of s.entries()){let m=r[d];if(m!==void 0)switch(f.type){case"I":a.push(this.enumerated(m,f));break;case"S":c.push(this.string(m));break;case"O":l.push(this.object(m));break;case"P":u=this.point(m);break;default:this.fail(m,`${n.signature} takes an argument of a type BCS has no stored form for`)}}return{integers:a,strings:this.pack(t,s,c),objects:l,point:u}}pack(t,n,r){let o=n.filter(c=>c.type==="S").map(c=>c.tag),s=JQ.has(this.callName(t).toLowerCase()),a=[];for(let c=0;c<o.length;)if(s&&c+1<o.length&&(Qa(o[c])||Qa(o[c+1]))){let u=Qa(o[c])?r[c]:r[c+1],d=Qa(o[c])?r[c+1]:r[c];a.push(`${u??""}${d??""}`),c+=2}else a.push(r[c]??""),c+=1;for(a.length>kp&&(this.fail(t,`this call's strings do not fit the ${kp} a record stores`),a.length=kp);a.length<kp;)a.push("");return a}string(t){return t.type!=="string"?(this.fail(t,`expected a quoted string, not ${t.text}`),""):t.text.slice(1,-1)}point(t){let n=ps(t).map(r=>this.integer(r));return n.length!==2?(this.fail(t,`expected a point like [640.480], not ${t.text}`),[0,0]):n}enumerated(t,n){if(t.type==="number")return this.integer(t);if(t.type==="object_ref"){let o=ps(t);if(o.length===1)return this.enumerated(o[0],n)}if(t.type!=="identifier")return this.fail(t,`expected a number, not ${t.text}`),0;let r=this.value(n.table,t.text);return r===void 0?(this.fail(t,n.table===void 0?`${t.text} is a name where a number belongs, and this argument names no table`:`this game's ${n.table.toUpperCase()}.IDS does not name ${t.text}`),0):r}integer(t){let n=t.text,r=/^-?0x/i.test(n)?Number.parseInt(n,16):Number(n);return Number.isFinite(r)?z$(r):(this.fail(t,`${n} is not a number`),0)}value(t,n){if(t===void 0)return;let r=t.toUpperCase(),o=this.byName.get(r);if(o===void 0){let s=new Map;for(let[a,c]of this.symbols.idsAll(t)??[])for(let l of c){let u=l.toLowerCase();s.has(u)||s.set(u,z$(a))}o=s,this.byName.set(r,o)}return o.get(n.toLowerCase())}emptyObject(){let t=du[this.engine],n=Xv[this.engine];return{ints:Jv(t.length-n+ms),...G$(this.engine)?{region:[-1,-1,-1,-1]}:{},string:"",...n>0?{trailingInts:Jv(n)}:{}}}object(t){let n=du[this.engine],r=Xv[this.engine],o=Jv(n.length),s=[],a="";for(let c=t;c!==void 0;){switch(c.type){case"call_expr":s.push(this.identifier(c,this.callName(c))),c=this.arguments(c)[0];continue;case"identifier":s.push(this.identifier(c,c.text));break;case"string":a=this.string(c);break;case"object_ref":case"point":this.objectFields(c,o);break;default:this.fail(c,`${c.text} is not an object`)}c=void 0}for(s.reverse(),s.length>ms&&(this.fail(t,`an object nests at most ${ms} identifiers`),s.length=ms);s.length<ms;)s.push(0);return{...this.emptyObject(),ints:[...o.slice(0,n.length-r),...s],string:a,...r>0?{trailingInts:o.slice(n.length-r)}:{}}}identifier(t,n){let r=this.value("OBJECT",n);return r!==void 0?r:(this.fail(t,`this game's OBJECT.IDS does not name ${n}`),0)}objectFields(t,n){let r=ps(t);if(r.length===1&&r[0].text.toUpperCase()===Yv)return;let o=du[this.engine];if(r.length>o.length){this.fail(t,`this game's objects take at most ${o.length} fields, not ${r.length}`);return}for(let[s,a]of r.entries()){let c=o[s];if(a.type==="number"){n[s]=this.integer(a);continue}let l=this.field(c,a.text);l===void 0?this.fail(a,`this game's ${c}.IDS does not name ${a.text}`):n[s]=l}}field(t,n){let r=this.value(t,n);return r===void 0||t!=="SUBRACE"?r:r&65535}};function Y$(e){switch(e){case"bg1":case"bg2":return"bg";case"iwd1":return"iwd";case"iwd2":return"iwd2";case"pst":return"pst";default:return e}}var X$=3e4,Fp,J$,e7=new Promise(e=>{J$=e}),Q$=setTimeout(()=>{T(`ServerContext was not initialized within ${X$} ms; request handlers awaiting the init barrier will hang. This indicates an early return between provider init and initServerContext() in onInitialize.`,"warn")},X$);Q$.unref();function Z$(e){clearTimeout(Q$),Fp=e,Qy(e.settings.debug),J$(e)}function xn(){return e7}function Si(){return Fp}function Lp(e){if(!Fp)throw new Error("ServerContext not initialized. Call initServerContext first.");Fp.settings=e,Qy(e.debug)}var eq=B(require("crypto")),hs=B(require("path"));var tq=new Map;function nq(){Aa(tq)}var t7=new Map([[".tp2","tp2"],[".tph","tpa"],[".tpa","tpa"],[".tpp","tpp"],[".d","d"],[".baf","baf"]]);function n7(e){let t=/\[(\S+)\]\s+(?:(?:PARSE|LEXER)\s+)?ERROR at line (\d+) column (\d+)-(\d+)/g,n=[],r=[],o=new Set;try{let a=t.exec(e);for(;a!==null;){a.index===t.lastIndex&&t.lastIndex++;let c=a[1],l=a[2],u=a[3],d=a[4];if(!c||!l||!u||!d){a=t.exec(e);continue}let f=`${c}:${l}:${u}-${d}`;if(!o.has(f)){o.add(f);let p=e.slice(a.index+a[0].length).split(/\r?\n/).slice(1).filter(w=>w.length>0),g=4,y=(p.length>g?[...p.slice(0,g),"..."]:p).join(`
334
- `);n.push({uri:Ye(hs.normalize(c)),line:parseInt(l,10),columnStart:Math.max(0,parseInt(u,10)-1),columnEnd:parseInt(d,10),message:y})}a=t.exec(e)}}catch(a){T(`weidu parse output failed: ${at(a)}`,"error")}return{errors:n,warnings:r}}async function So(e,t,n=!1,r){let o=t.gamePath,{executable:s,prefixArgs:a}=Bl(t.path),c=et(e),l=Ji,u=hs.parse(c).base,d=hs.parse(c).ext.toLowerCase(),f=eq.createHash("md5").update(e).digest("hex").slice(0,8),m=hs.join(Ji,`tmp-${f}${d}`),p=Ye(m),g=["--no-exit-pause","--noautoupdate","--debug-assign","--parse-check"];o===""?g.unshift("--nogame"):g.unshift("--game",o);let h=t7.get(d);if(!h){T("Not a WeiDU file (tp2, tph, tpa, tpp, d, baf)! Focus a WeiDU file to parse."),n&&bn("Focus a WeiDU file to parse!");return}if((h==="d"||h==="baf")&&o===""){T("Path to IE game is not specified in settings, can't parse D or BAF!"),n&&Sr("Path to IE game is not specified in settings, can't parse D or BAF!");return}T(`parsing ${u}...`),await AO({uri:e,tmpPath:m,text:r,activeCompiles:tq,run:async y=>{let w=[...a,...g,h,m],{err:_,stdout:b}=await rp(s,w,l,y);if(y.aborted)return;let S=n7(b);S={...S,errors:S.errors.map(R=>({...R,message:R.message.replaceAll(m,u)})),warnings:S.warnings.map(R=>({...R,message:R.message.replaceAll(m,u)}))};let N=!1;_&&S.errors.length===0&&(ff(_)==="ENOENT"&&(ir(`WeiDU not found at '${s}'. Check bgforge.mls.weidu.path setting.`),N=!0),S=mf(S,_,Ye(c),b.replaceAll(m,u))),N||Qc(S,n,`Successfully parsed ${u}.`,`Failed to parse ${u}!`),Wr(S,e,p)}})}var i7=[{pattern:/%[A-Za-z_][A-Za-z0-9_]*%/g,explain:e=>`${e} is assigned during installation, so this compiler cannot resolve it. Set bgforge.weidu.compiler to "weidu" to compile this file.`},{pattern:/@\d+/g,explain:e=>`${e} names a translation line whose number is assigned during installation, so this compiler cannot resolve it. Set bgforge.weidu.compiler to "weidu" to compile this file.`}];function o7(e){let t=[];return e.split(`
335
- `).forEach((n,r)=>{for(let{pattern:o,explain:s}of i7){o.lastIndex=0;let a=o.exec(n);for(;a!==null;)t.push({row:r,column:a.index,message:s(a[0])}),a=o.exec(n)}}),t}function s7(e,t){let n=e.parse(t);if(n===null)return[];try{return n.rootNode.descendantsOfType(["comment","line_comment"]).map(r=>({start:r.startPosition,end:r.endPosition}))}finally{n.delete()}}function a7(e,t,n){return e.some(({start:r,end:o})=>!(t<r.row||t>o.row||t===r.row&&n<r.column||t===o.row&&n>=o.column))}function c7(e,t){let n=o7(e);if(n.length===0)return[];let r=s7(t,e);return n.filter(o=>!a7(r,o.row,o.column)).map(({row:o,column:s,message:a})=>({line:o+1,column:s+1,message:a})).sort((o,s)=>o.line-s.line||o.column-s.column)}function rq(e){let{text:t,uri:n,parser:r,symbols:o,engine:s}=e,a=[],c=u=>{a.push({uri:n,line:u.line,columnStart:u.column-1,columnEnd:u.column-1,message:u.message})},l=c7(t,r);l.forEach(u=>c(u));try{eC(r,t,o,s)}catch(u){if(u instanceof bo){let d=new Set(l.map(f=>`${f.line}:${f.column}`));u.diagnostics.forEach(f=>{d.has(`${f.line}:${f.column}`)||c(f)})}else c({line:1,column:1,message:u instanceof Error?u.message:String(u)})}return{errors:a,warnings:[]}}async function Op(e,t,n,r){if(n.weidu.compiler==="built-in"){if(!n.weidu.gamePath)return r&&Sr("Path to IE game is not specified in settings, can't parse BAF with the built-in compiler!"),!1;if(!Me.isInitialized(Tt))return!1;let{configuredGame:o}=await xn(),s=o.tables(n.weidu),a=o.scriptStyle(n.weidu);if(s===void 0||a===void 0)return r&&Sr(`Cannot open IE game at "${n.weidu.gamePath}", can't parse BAF with the built-in compiler!`),!1;let c=rq({text:t,uri:e,parser:Me.getParser(Tt),symbols:Zv(s),engine:Y$(a)});return Wr(c,e,e),!0}return await So(e,n.weidu,r,t),!0}function iq(e,t){let n=[];return oq(e,t,n),n}function oq(e,t,n){if(e.type==="call_expr"){let r=e.childForFieldName("func")?.text,o=r===void 0?void 0:t(r);if(o!==void 0){let s=e.childrenForFieldName("args");for(let a of o){let c=s[a];c?.type==="number"&&n.push({strref:Number(c.text),range:{start:{line:c.startPosition.row,character:c.startPosition.column},end:{line:c.endPosition.row,character:c.endPosition.column}}})}}}for(let r of e.namedChildren)r&&oq(r,t,n)}var l7=new Set(["comment","line_comment"]),sq=Ya(uu,Ja,l7),u7=new Set(["block","response"]),d7=ho(uu,Ja,u7),f7=go(uu,Ja),tC=class{id=Tt;symbolStore;storedContext;async init(t){this.storedContext=t,await V$(),this.symbolStore=new Yr;let n=On(Tt);this.symbolStore.loadStatic(n),T(`WeiDU BAF provider initialized with ${n.length} static symbols`)}shouldProvideFeatures(t,n){return!sq(t,n)}resolveSymbol(t,n,r){return Ba(t,this.symbolStore)}strRefs(t){let n=Ja(t);return n?iq(n.rootNode,r=>H$.get(r)):[]}foldingRanges(t){return d7(t)}selectionRanges(t,n){return f7(t,n)}format(t,n){return mo({text:t,uri:n,languageName:"BAF",isInitialized:uu,parse:Ja,formatAst:(r,o)=>av(r,o),getFormatOptions:po,normalizeForCompare:ns})}getCompletions(t){return ja(this.symbolStore)}filterCompletions(t,n,r){return sq(n,r)?[]:t}async compile(t,n,r){if(!this.storedContext){T("WeiDU BAF provider not initialized, cannot compile");return}await Op(t,n,this.storedContext.settings,r)}},aq=new tC;var cq=()=>Me.initOne(At,"tree-sitter-weidu_d.wasm","WeiDU D");var ct=()=>Me.isInitialized(At),lt=e=>Me.parseWithCache(At,e);var m7=new Set(["trigger","condition"]),p7=new Set(["action"]);function nC(e,t){if(!ct())return null;let n=lt(e);if(!n)return null;let r=n.rootNode.descendantForPosition({row:t.line,column:t.character});for(;r&&r.type!=="string";)r=r.parent;let o=r?.parent;if(!r||!o)return null;for(let s of m7)if(o.childForFieldName(s)?.id===r.id)return"trigger";for(let s of p7)if(o.childForFieldName(s)?.id===r.id)return"action";return null}var Mp,lq;function uq(){if(Mp)return;let e=new Yr;e.loadStatic(On(Tt));let t=new Map;for(let n of e.query({}))t.set(n.name.toLowerCase(),n);Mp=e,lq=t}function dq(e){return lq?.get(e.toLowerCase())}function fq(e){if(!Mp)return[];let t=e==="trigger"?K.Trigger:K.Action;return Mp.query({kinds:[t,K.Constant]}).map(n=>n.completion)}var h7=new Set(["comment","line_comment"]),rC=Ya(ct,lt,h7),g7=new Set(["tilde_string","double_string"]),mq=Xa(ct,lt,g7);var Za=B(le());function _7(e){return e.startsWith("~")&&e.endsWith("~")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Bn(e){return _7(e).toLowerCase()}function pq(e){let t=e;for(;t;){if(t.type==="begin_action"||t.type==="append_action"){let n=t.childForFieldName("file");if(n)return{scopeNode:t,dialogFile:Bn(n.text)}}t=t.parent}return null}function y7(e){let t=[];function n(r){if(r.type==="state"){let o=r.childForFieldName("label");o&&t.push({name:o.text,labelNode:o,stateNode:r})}for(let o of r.children)n(o)}return n(e),t}var b7=new Set(["extend_action","add_state_trigger","add_trans_trigger","replace_say","replace_state_trigger","set_weight"]),S7=new Set(["chain_action","interject_action","interject_copy_trans"]);function wi(e,t){function n(r){if(!$n(t,r))return null;if(r.type==="state"){let o=r.childForFieldName("label");if(o&&$n(t,o)){let s=pq(r);if(s)return{labelNode:o,dialogFile:s.dialogFile}}}if(r.type==="goto_next"||r.type==="short_goto"){let o=r.childForFieldName("label");if(o&&$n(t,o)){let s=pq(r);if(s)return{labelNode:o,dialogFile:s.dialogFile}}}if(r.type==="extern_next"){let o=r.childForFieldName("label");if(o&&$n(t,o)){let s=r.childForFieldName("file");if(s)return{labelNode:o,dialogFile:Bn(s.text)}}}if(r.type==="copy_trans"){let o=r.childForFieldName("state");if(o&&$n(t,o)){let s=r.childForFieldName("file");if(s)return{labelNode:o,dialogFile:Bn(s.text)}}}if(r.type==="chain_epilogue"){let o=r.childForFieldName("label");if(o&&$n(t,o)){let s=r.childForFieldName("file");if(s)return{labelNode:o,dialogFile:Bn(s.text)}}}if(b7.has(r.type))if(r.type==="extend_action"){let o=r.childrenForFieldName("states");for(let s of o)if($n(t,s)){let a=r.childForFieldName("file");if(a)return{labelNode:s,dialogFile:Bn(a.text)}}}else{let o=r.childForFieldName("state");if(o&&$n(t,o)){let s=r.childForFieldName("file");if(s)return{labelNode:o,dialogFile:Bn(s.text)}}}if(S7.has(r.type)){let o=r.childForFieldName("label");if(o&&$n(t,o)){let s=r.childForFieldName("file");if(s)return{labelNode:o,dialogFile:Bn(s.text)}}}for(let o of r.children){let s=n(o);if(s)return s}return null}return n(e)}function $p(e,t,n){function r(o){if(o.type==="begin_action"||o.type==="append_action"){let s=o.childForFieldName("file");if(s&&Bn(s.text)===t){let a=y7(o).find(c=>c.name===n);if(a)return a}}for(let s of o.children){let a=r(s);if(a)return a}return null}return r(e)}function qp(e,t){function n(c,l,u){let d=c.childForFieldName(l),f=c.childForFieldName(u);d&&f&&t(Bn(d.text),f,!1)}function r(c,l){function u(d){if(d.type==="goto_next"||d.type==="short_goto"){let f=d.childForFieldName("label");f&&t(l,f,!1)}for(let f of d.children)u(f)}u(c)}function o(c,l){function u(d){if(d.type==="state"){let f=d.childForFieldName("label");f&&t(l,f,!0)}else if(d.type==="goto_next"||d.type==="short_goto"){let f=d.childForFieldName("label");f&&t(l,f,!1)}else if(d.type==="extern_next"){let f=d.childForFieldName("file"),m=d.childForFieldName("label");f&&m&&t(Bn(f.text),m,!1)}else if(d.type==="copy_trans"){let f=d.childForFieldName("file"),m=d.childForFieldName("state");f&&m&&t(Bn(f.text),m,!1)}for(let f of d.children)u(f)}u(c)}function s(c){let l=c.type;if(l==="chain_action"||l==="interject_action"||l==="interject_copy_trans"){n(c,"file","label");for(let u of c.children)u.type==="chain_epilogue"&&n(u,"file","label");return!0}if(l==="extend_action"){let u=c.childForFieldName("file");if(u){let d=Bn(u.text);for(let f of c.childrenForFieldName("states"))t(d,f,!1);r(c,d)}return!0}return l==="add_state_trigger"||l==="add_trans_trigger"||l==="replace_say"||l==="replace_state_trigger"||l==="set_weight"?(n(c,"file","state"),!0):!1}function a(c){if(c.type==="begin_action"||c.type==="append_action"){let l=c.childForFieldName("file");l&&o(c,Bn(l.text));return}if(!s(c))for(let l of c.children)a(l)}a(e)}function hq(e,t){return`${e}:${t}`}function w7(e,t,n,r){let o=n.text,s=hq(t,o);return{name:s,kind:K.State,location:{uri:e,range:J(n)},scope:{level:kt.File},source:{type:Ee.Navigation,uri:e,displayPath:r},completion:{label:o,kind:Za.CompletionItemKind.Field,detail:`state (${t})`,insertTextFormat:Za.InsertTextFormat.PlainText,labelDetails:{description:r}},hover:{contents:{kind:Za.MarkupKind.Markdown,value:qn(`state ${s}`,Uc,r)}}}}function gq(e,t,n){if(!ct())return bi;let r=lt(t);if(!r)return bi;let o=[],s=new Map,a=ca(e,n)||aa(e);function c(l,u,d){let f=hq(l,u),m=s.get(f);m||(m=[],s.set(f,m)),m.push(d)}return qp(r.rootNode,(l,u,d)=>{c(l,u.text,{uri:e,range:J(u)}),d&&o.push(w7(e,l,u,a))}),{symbols:o,refs:s}}function _q(e,t,n){if(!ct())return null;let r=lt(e);if(!r)return null;let o=wi(r.rootNode,n);if(!o)return null;let s=$p(r.rootNode,o.dialogFile,o.labelNode.text);return s?{uri:t,range:J(s.labelNode)}:null}var yq=B(le());function bq(e,t,n,r){if(!ct())return Gt.notHandled();let o=lt(e);if(!o)return Gt.notHandled();let s=wi(o.rootNode,r);if(!s)return Gt.notHandled();let a=$p(o.rootNode,s.dialogFile,s.labelNode.text);if(!a)return Gt.notHandled();let c=Kt(a.stateNode);if(c===null)return Gt.notHandled();let l=Yt(c);if(!l.desc)return Gt.notHandled();let u=`state ${s.labelNode.text}`,d=qn(u,Uc)+`
333
+ `)return Buffer.byteLength(e.substring(0,c),"utf8")+(n-s);s++}return Buffer.byteLength(e,"utf8")+(n-s)}function Xa(e,t,n){return(r,o)=>{if(!e())return!1;let s=t(r);return s?uu(s.rootNode,o,a=>{for(let c=a;c;c=c.parent)if(n.has(c.type))return!0;return null})===!0:!1}}var Wv=Xa(we,De,new Set(["string"]));function Uv(e,t){if(!we())return"code";let n=De(e);if(!n)return"code";switch(Ip(n.rootNode,t,"comment","line_comment")){case"jsdoc":return"jsdoc";case"comment":return"comment";default:return"code"}}var UQ=/^\s*(?:export\s+)?(?:variable|procedure)\s+\S*$|^\s*#define\s+\S*$/i;function $$(e,t){return UQ.test(Pr(e,t))}var q$=B(le());function HQ(e,t){t.push({line:e.startPosition.row,startChar:e.startPosition.column,length:e.endPosition.column-e.startPosition.column,tokenType:q$.SemanticTokenTypes.parameter,tokenModifiers:0})}function Hv(e,t,n){if(t.type==="identifier"){let r=Ar(e,t);r&&r!==t&&c$(r)&&HQ(t,n)}for(let r of t.children)Hv(e,r,n)}function VQ(e,t,n){let r=t.childForFieldName("params"),o=t.childForFieldName("name");if(r)for(let s of t.children)s.type!=="param_list"&&(o&&s.type==="identifier"&&s.startIndex===o.startIndex&&s.endIndex===o.endIndex||Hv(e,s,n))}function GQ(e,t,n){let r=t.childForFieldName("params"),o=t.childForFieldName("body");if(!(!r||!o))for(let s of o.children)Hv(e,s,n)}function B$(e,t,n){if(t.type==="procedure"){VQ(e,t,n);return}if(t.type==="define"){GQ(e,t,n);return}for(let r of t.children)B$(e,r,n)}function j$(e){if(!we())return[];let t=De(e);if(!t)return[];let n=[];return B$(t.rootNode,t.rootNode,n),n}var zQ=new Set(["procedure","if_stmt","while_stmt","for_stmt","foreach_stmt","switch_stmt","block"]),KQ=ho(we,De,zQ),YQ=go(we,De),Gv=class{id=mt;indexExtensions=[...nb];fileIndex;staticSignatures;storedContext;lookupFallbackSymbol(t,n){return this.fileIndex?.symbols.lookupAll(t).find(r=>r.source.type!==Ee.Navigation&&r.source.uri!==n)}async init(t){this.storedContext=t,await yp(),this.fileIndex=new co(this.id);let n=On(mt);this.fileIndex.loadStatic(n),this.staticSignatures=G1(mt),T(`Fallout SSL provider initialized with ${n.length} static symbols`)}async readFileText(t){let n=this.storedContext?.getDocumentText?.(t);if(n!==void 0)return n;try{return await Dp.promises.readFile((0,Vv.fileURLToPath)(t),"utf-8")}catch(r){return T(`readFileText: failed to read ${t}: ${at(r)}`,"warn"),null}}resolveSymbol(t,n,r){let o=this.storedContext?.getDocumentVersion?.(r),s=L$(t,n,o,r);if(s)return T(`resolveSymbol: name="${t}" uri="${r}" local=found`,"debug"),s;if(this.storedContext?.settings.debug){let c=jv(n,o,r);T(`resolveSymbol: name="${t}" uri="${r}" local=not found; local symbols: [${c.map(l=>l.name).join(", ")}]`,"debug")}let a=this.lookupFallbackSymbol(t,r);return T(`resolveSymbol: fallback=${a?"found":"not found"}`,"debug"),a}format(t,n){return mo({text:t,uri:n,languageName:"SSL",isInitialized:we,parse:De,formatAst:(r,o)=>rv(r,o),getFormatOptions:po,normalizeForCompare:Qx})}symbols(t){return we()?a$(t):[]}foldingRanges(t){return KQ(t)}selectionRanges(t,n){return YQ(t,n)}definition(t,n,r){return we()?Rp(t,r,n):null}references(t,n,r,o,s){return we()?C$(t,n,r,o,this.fileIndex?.refs,this.fileIndex?.symbols):[]}callableDef(t){let n=this.fileIndex?.symbols.lookupAll(t).find(r=>r.kind===K.Procedure||r.kind===K.Macro);return n?.location?{uri:n.location.uri,range:n.location.range}:null}readTextSync(t){let n=this.storedContext?.getDocumentText?.(t);if(n!==void 0)return n;try{return(0,Dp.readFileSync)((0,Vv.fileURLToPath)(t),"utf-8")}catch(r){return T(`call-hierarchy readTextSync: failed to read ${t}: ${at(r)}`,"warn"),null}}prepareCallHierarchy(t,n,r){return we()?b$(t,n,r,o=>this.callableDef(o)):null}incomingCalls(t){if(!we())return[];let n=this.fileIndex?.refsOf(t.name)??[];return w$(t,n,r=>this.readTextSync(r))}outgoingCalls(t){return we()?S$(t,n=>this.readTextSync(n),n=>this.callableDef(n)):[]}filterCompletions(t,n,r,o,s){let a=Uv(n,r);if(a==="comment")return[];if(a==="jsdoc")return _p(q1,Pr(n,r));if(Wv(n,r))return[];if(s==="@")return[];if($$(n,r))return[];let c=this.storedContext?.getDocumentVersion?.(o),l=jv(n,c,o),u=new Set(l.map(f=>f.name)),d=t.filter(f=>!u.has(f.label));return[...l.map(f=>f.completion),...d]}shouldProvideFeatures(t,n){return Uv(t,n)==="code"}isPositionInString(t,n){return Wv(t,n)}localSignature(t,n,r){return we()?I$(t,n,r):null}semanticTokens(t,n){return j$(t)}prepareRename(t,n){if(!we())return null;if(this.fileIndex){let r=T$(t,n,this.fileIndex.symbols,this.storedContext?.workspaceRoot);if(r)return r}return E$(t,n)}async rename(t,n,r,o){if(!we())return null;if(this.fileIndex){T(`rename: trying workspace rename for "${r}" at ${o}`,"debug");let a=await A$(t,n,r,o,this.fileIndex.refs,this.fileIndex.symbols,c=>this.readFileText(c),this.storedContext?.workspaceRoot);if(a)return T("rename: workspace rename succeeded","debug"),a;T("rename: workspace rename returned null, falling back to single-file","debug")}else T("rename: no fileIndex, using single-file rename","debug");let s=R$(t,n,r,o);return T(`rename: single-file rename ${s?"succeeded":"returned null"}`,"debug"),s}getCompletions(t){return this.fileIndex?this.fileIndex.symbols.query({excludeUri:t}).map(n=>n.completion):[]}getSignature(t,n,r){if(this.staticSignatures){let s=this.staticSignatures.get(n);if(s)return Pv(s,r)}let o=this.fileIndex?.symbols.lookup(n);return o?.signature?Pv(o.signature,r):null}getSymbolDefinition(t){return this.lookupFallbackSymbol(t)?.location??null}reloadFileData(t,n){if(we()&&this.fileIndex){let r=Wo(t)?Ee.Workspace:Ee.Navigation,o=D$(t,n,this.storedContext?.workspaceRoot,r);this.fileIndex.updateFile(t,o)}}onWatchedFileDeleted(t){this.fileIndex?.removeFile(t)}workspaceSymbols(t,n){return this.fileIndex?.symbols.searchWorkspaceSymbols(t,500,n)??[]}onDocumentClosed(t){O$(t)}async compile(t,n,r){if(!this.storedContext){T("Fallout SSL provider not initialized, cannot compile");return}await XO(t,this.storedContext.settings.falloutSSL,r,n,this.storedContext.settings.debug)}},W$=new Gv;var zv=class{id=of;symbolStore;async init(t){this.symbolStore=new Yr;let n=On(of);this.symbolStore.loadStatic(n),T(`Fallout Worldmap provider initialized with ${n.length} static symbols`)}resolveSymbol(t,n,r){return Ba(t,this.symbolStore)}getCompletions(t){return ja(this.symbolStore)}},U$=new zv;var H$=new Map([["AddJournalEntry",[0]],["AddMapNote",[1]],["DisplayString",[1]],["DisplayStringHead",[1]],["DisplayStringHeadDead",[1]],["DisplayStringHeadNoLog",[1]],["DisplayStringHeadOwner",[1]],["DisplayStringNoName",[1]],["DisplayStringNoNameDlg",[1]],["DisplayStringNoNameHead",[1]],["DisplayStringPoint",[1]],["DisplayStringPointLog",[1]],["DisplayStringWait",[1]],["EraseJournalEntry",[0]],["RemoveMapNote",[1]],["SetName",[0]],["SetPlayerSound",[1]],["SetQuestDone",[0]],["SetToken",[1]]]);var V$=()=>Me.initOne(Tt,"tree-sitter-baf.wasm","BAF");var du=()=>Me.isInitialized(Tt),Ja=e=>Me.parseWithCache(Tt,e);function Qa(e){return e!==void 0&&e.toLowerCase().startsWith("area")}var Kv="ANYONE",ms=5,fu={bg:["EA","GENERAL","RACE","CLASS","SPECIFIC","GENDER","ALIGN"],iwd:["EA","GENERAL","RACE","CLASS","SPECIFIC","GENDER","ALIGN"],pst:["EA","FACTION","TEAM","GENERAL","RACE","CLASS","SPECIFIC","GENDER","ALIGN"],iwd2:["EA","GENERAL","RACE","CLASS","SPECIFIC","GENDER","ALIGNMNT","SUBRACE","AVCLASS","CLASSMSK"]},Yv={bg:0,iwd:0,pst:0,iwd2:2};function G$(e){return e!=="bg"}var XQ=/^([^(]+)\((.*)\)$/s;function kp(e){let t=XQ.exec(e.trim());if(t===null)return;let n=t[2].trim(),r=n===""?[]:n.split(",").map(o=>JQ(o));return{name:t[1].trim(),parameters:r}}function JQ(e){let t=e.trim(),n=t.indexOf("*"),r=t.indexOf(":"),o=n===-1?t.length:n,s=n===-1?"":t.slice(n+1).trim();return{type:t.slice(0,1),tag:r===-1?"":t.slice(r+1,o).trim(),table:s===""?void 0:s}}function Qv(e){let t=o=>{let s=new Map;for(let[a,c]of e.idsAll(o)??[])for(let l of c){let u=l.indexOf("("),d=(u===-1?l:l.slice(0,u)).trim().toLowerCase();s.set(d,[...s.get(d)??[],{id:a,signature:l}])}return s},n=t("TRIGGER"),r=t("ACTION");return{triggerByName:o=>n.get(o.toLowerCase())??[],actionByName:o=>r.get(o.toLowerCase())??[],idsAll:o=>e.idsAll(o)}}var bo=class extends Error{diagnostics;constructor(t){let n=t[0];super(n?`${n.line}:${n.column}: ${n.message}`:"compilation failed"),this.name="BcsCompileError",this.diagnostics=t}},Fp=2,QQ=new Set(["CreateCreatureAtLocation","CreateItemGlobal","Global","GlobalGT","GlobalLT","IncrementGlobal","IncrementGlobalOnce","MoveToSavedLocation","MoveToSavedLocationn","RealSetGlobalTimer","SetGlobal","SetGlobalRandom","SetGlobalRandomPlus","SetGlobalTimer","SetGlobalTimerRandom","SetTokenGlobal"].map(e=>e.toLowerCase())),ZQ=/^UnknownTrigger(\d+)$/i,e7=/^UnknownAction(\d+)$/i;function Zv(e,t,n,r="bg"){let o=e.parse(t);if(o===null)throw new bo([{line:1,column:1,message:"parser returned no tree"}]);try{let s=cp(o.rootNode);if(s.length>0)throw new bo(s.map(a=>({...K$(a),message:a.isMissing?`missing ${a.type}`:"syntax error"})));return new Jv(n,r).script(o.rootNode)}finally{o.delete()}}function K$(e){return{line:e.startPosition.row+1,column:e.startPosition.column+1}}function z$(e){return Int32Array.of(e)[0]}var Xv=e=>Array.from({length:e},()=>0);function ps(e){return e.namedChildren.filter(t=>t!==null&&t.type!=="comment"&&t.type!=="line_comment")}var Jv=class{symbols;engine;diagnostics=[];byName=new Map;constructor(t,n){this.symbols=t,this.engine=n}script(t){let n=ps(t).filter(r=>r.type==="block").map(r=>this.block(r));if(this.diagnostics.length>0)throw new bo(this.diagnostics);return{blocks:n}}fail(t,n){this.diagnostics.push({...K$(t),message:n})}block(t){let n=[];for(let o of ps(t.childForFieldName("if"))){if(o.type==="or_marker"){n.push(this.orMarker(o));continue}let s=o.childForFieldName("call"),a=o.children.some(c=>c?.type==="!");if(this.callName(s).toLowerCase()==="triggeroverride"){let c=this.arguments(s);if(c.length!==2||c[1].type!=="call_expr"){this.fail(s,"TriggerOverride takes an object and the trigger it retargets");continue}n.push(this.nextTriggerObject(s,c[0]),this.trigger(c[1],a));continue}n.push(this.trigger(s,a))}let r=ps(t.childForFieldName("then")).filter(o=>o.type==="response").map(o=>this.response(o));return{triggers:n,responses:r}}response(t){let n=t.childForFieldName("weight");return{weight:n===null?0:this.integer(n),actions:ps(t).filter(r=>r.type==="action").map(r=>this.action(r))}}callName(t){return t.childForFieldName("func")?.text??""}arguments(t){return t.childrenForFieldName("args").filter(n=>n!==null)}select(t,n){if(t.length<=1)return t[0];let r=t.filter(o=>kp(o.signature)?.parameters.length===n);return(r.length>0?r:t).at(-1)}trigger(t,n){let r=this.callName(t),o=ZQ.exec(r);if(o!==null)return this.emptyTrigger(Number(o[1]),n);let s=this.arguments(t),a=this.select(this.symbols.triggerByName(r),s.length);if(a===void 0)return this.fail(t,`this game's TRIGGER.IDS has no trigger called ${r}`),this.emptyTrigger(0,n);let c=this.bind(t,a,s);return{ints:[a.id,c.integers[0]??0,n?1:0,c.integers[1]??0,c.integers[2]??0],...this.engine==="pst"?{point:c.point??[0,0]}:{},strings:c.strings,object:c.objects[0]??this.emptyObject()}}emptyTrigger(t,n){return{ints:[t,0,n?1:0,0,0],...this.engine==="pst"?{point:[0,0]}:{},strings:["",""],object:this.emptyObject()}}nextTriggerObject(t,n){let r=this.select(this.symbols.triggerByName("NextTriggerObject"),1);return r===void 0?(this.fail(t,"this game's TRIGGER.IDS has no NextTriggerObject, so TriggerOverride cannot be written"),this.emptyTrigger(0,!1)):{...this.emptyTrigger(r.id,!1),object:this.object(n)}}orMarker(t){let n=this.select(this.symbols.triggerByName("OR"),1);if(n===void 0)return this.fail(t,"this game's TRIGGER.IDS has no OR"),this.emptyTrigger(0,!1);let r=t.childForFieldName("count"),o=this.emptyTrigger(n.id,!1);return o.ints[1]=r===null?0:this.integer(r),o}action(t){let n=t.childForFieldName("call"),r;if(this.callName(n).toLowerCase()==="actionoverride"){let d=this.arguments(n);if(d.length!==2||d[1].type!=="call_expr")return this.fail(n,"ActionOverride takes an object and the action it applies to"),this.emptyAction(0);r=this.object(d[0]),n=d[1]}let o=this.callName(n),s=e7.exec(o);if(s!==null)return{...this.emptyAction(Number(s[1])),objects:this.objects(r,[])};let a=this.arguments(n),c=this.select(this.symbols.actionByName(o),a.length);if(c===void 0)return this.fail(n,`this game's ACTION.IDS has no action called ${o}`),this.emptyAction(0);let l=this.bind(n,c,a),u=l.point??[0,0];return{id:c.id,objects:this.objects(r,l.objects),ints:[l.integers[0]??0,u[0]??0,u[1]??0,l.integers[1]??0,l.integers[2]??0],strings:l.strings}}emptyAction(t){return{id:t,objects:this.objects(void 0,[]),ints:[0,0,0,0,0],strings:["",""]}}objects(t,n){return[t??this.emptyObject(),n[0]??this.emptyObject(),n[1]??this.emptyObject()]}bind(t,n,r){let s=kp(n.signature)?.parameters??[];r.length!==s.length&&this.fail(t,`${n.signature} takes ${s.length} argument${s.length===1?"":"s"}, not ${r.length}`);let a=[],c=[],l=[],u;for(let[d,f]of s.entries()){let m=r[d];if(m!==void 0)switch(f.type){case"I":a.push(this.enumerated(m,f));break;case"S":c.push(this.string(m));break;case"O":l.push(this.object(m));break;case"P":u=this.point(m);break;default:this.fail(m,`${n.signature} takes an argument of a type BCS has no stored form for`)}}return{integers:a,strings:this.pack(t,s,c),objects:l,point:u}}pack(t,n,r){let o=n.filter(c=>c.type==="S").map(c=>c.tag),s=QQ.has(this.callName(t).toLowerCase()),a=[];for(let c=0;c<o.length;)if(s&&c+1<o.length&&(Qa(o[c])||Qa(o[c+1]))){let u=Qa(o[c])?r[c]:r[c+1],d=Qa(o[c])?r[c+1]:r[c];a.push(`${u??""}${d??""}`),c+=2}else a.push(r[c]??""),c+=1;for(a.length>Fp&&(this.fail(t,`this call's strings do not fit the ${Fp} a record stores`),a.length=Fp);a.length<Fp;)a.push("");return a}string(t){return t.type!=="string"?(this.fail(t,`expected a quoted string, not ${t.text}`),""):t.text.slice(1,-1)}point(t){let n=ps(t).map(r=>this.integer(r));return n.length!==2?(this.fail(t,`expected a point like [640.480], not ${t.text}`),[0,0]):n}enumerated(t,n){if(t.type==="number")return this.integer(t);if(t.type==="object_ref"){let o=ps(t);if(o.length===1)return this.enumerated(o[0],n)}if(t.type!=="identifier")return this.fail(t,`expected a number, not ${t.text}`),0;let r=this.value(n.table,t.text);return r===void 0?(this.fail(t,n.table===void 0?`${t.text} is a name where a number belongs, and this argument names no table`:`this game's ${n.table.toUpperCase()}.IDS does not name ${t.text}`),0):r}integer(t){let n=t.text,r=/^-?0x/i.test(n)?Number.parseInt(n,16):Number(n);return Number.isFinite(r)?z$(r):(this.fail(t,`${n} is not a number`),0)}value(t,n){if(t===void 0)return;let r=t.toUpperCase(),o=this.byName.get(r);if(o===void 0){let s=new Map;for(let[a,c]of this.symbols.idsAll(t)??[])for(let l of c){let u=l.toLowerCase();s.has(u)||s.set(u,z$(a))}o=s,this.byName.set(r,o)}return o.get(n.toLowerCase())}emptyObject(){let t=fu[this.engine],n=Yv[this.engine];return{ints:Xv(t.length-n+ms),...G$(this.engine)?{region:[-1,-1,-1,-1]}:{},string:"",...n>0?{trailingInts:Xv(n)}:{}}}object(t){let n=fu[this.engine],r=Yv[this.engine],o=Xv(n.length),s=[],a="";for(let c=t;c!==void 0;){switch(c.type){case"call_expr":s.push(this.identifier(c,this.callName(c))),c=this.arguments(c)[0];continue;case"identifier":s.push(this.identifier(c,c.text));break;case"string":a=this.string(c);break;case"object_ref":case"point":this.objectFields(c,o);break;default:this.fail(c,`${c.text} is not an object`)}c=void 0}for(s.reverse(),s.length>ms&&(this.fail(t,`an object nests at most ${ms} identifiers`),s.length=ms);s.length<ms;)s.push(0);return{...this.emptyObject(),ints:[...o.slice(0,n.length-r),...s],string:a,...r>0?{trailingInts:o.slice(n.length-r)}:{}}}identifier(t,n){let r=this.value("OBJECT",n);return r!==void 0?r:(this.fail(t,`this game's OBJECT.IDS does not name ${n}`),0)}objectFields(t,n){let r=ps(t);if(r.length===1&&r[0].text.toUpperCase()===Kv)return;let o=fu[this.engine];if(r.length>o.length){this.fail(t,`this game's objects take at most ${o.length} fields, not ${r.length}`);return}for(let[s,a]of r.entries()){let c=o[s];if(a.type==="number"){n[s]=this.integer(a);continue}let l=this.field(c,a.text);l===void 0?this.fail(a,`this game's ${c}.IDS does not name ${a.text}`):n[s]=l}}field(t,n){let r=this.value(t,n);return r===void 0||t!=="SUBRACE"?r:r&65535}};function Y$(e){switch(e){case"bg1":case"bg2":return"bg";case"iwd1":return"iwd";case"iwd2":return"iwd2";case"pst":return"pst";default:return e}}var X$=3e4,Za,J$,t7=new Promise(e=>{J$=e}),Q$=setTimeout(()=>{T(`ServerContext was not initialized within ${X$} ms; request handlers awaiting the init barrier will hang. This indicates an early return between provider init and initServerContext() in onInitialize.`,"warn")},X$);Q$.unref();function Z$(e){clearTimeout(Q$),Za=e,eq(!1,e.settings.debug,e.client),J$(e)}function eq(e,t,n){if(uA(t),!t||e)return;let r=n.info?`${n.info.name} ${n.info.version??""}`.trimEnd():"(not announced)";T(`LSP client: ${r}; capabilities: ${JSON.stringify(n.capabilities,null,2)}`,"debug")}function xn(){return t7}function Si(){return Za}function Lp(e){if(!Za)throw new Error("ServerContext not initialized. Call initServerContext first.");let t=Za.settings.debug;Za.settings=e,eq(t,e.debug,Za.client)}var tq=B(require("crypto")),hs=B(require("path"));var nq=new Map;function rq(){Aa(nq)}var n7=new Map([[".tp2","tp2"],[".tph","tpa"],[".tpa","tpa"],[".tpp","tpp"],[".d","d"],[".baf","baf"]]);function r7(e){let t=/\[(\S+)\]\s+(?:(?:PARSE|LEXER)\s+)?ERROR at line (\d+) column (\d+)-(\d+)/g,n=[],r=[],o=new Set;try{let a=t.exec(e);for(;a!==null;){a.index===t.lastIndex&&t.lastIndex++;let c=a[1],l=a[2],u=a[3],d=a[4];if(!c||!l||!u||!d){a=t.exec(e);continue}let f=`${c}:${l}:${u}-${d}`;if(!o.has(f)){o.add(f);let p=e.slice(a.index+a[0].length).split(/\r?\n/).slice(1).filter(w=>w.length>0),g=4,y=(p.length>g?[...p.slice(0,g),"..."]:p).join(`
334
+ `);n.push({uri:Ye(hs.normalize(c)),line:parseInt(l,10),columnStart:Math.max(0,parseInt(u,10)-1),columnEnd:parseInt(d,10),message:y})}a=t.exec(e)}}catch(a){T(`weidu parse output failed: ${at(a)}`,"error")}return{errors:n,warnings:r}}async function So(e,t,n=!1,r){let o=t.gamePath,{executable:s,prefixArgs:a}=jl(t.path),c=et(e),l=Ji,u=hs.parse(c).base,d=hs.parse(c).ext.toLowerCase(),f=tq.createHash("md5").update(e).digest("hex").slice(0,8),m=hs.join(Ji,`tmp-${f}${d}`),p=Ye(m),g=["--no-exit-pause","--noautoupdate","--debug-assign","--parse-check"];o===""?g.unshift("--nogame"):g.unshift("--game",o);let h=n7.get(d);if(!h){T("Not a WeiDU file (tp2, tph, tpa, tpp, d, baf)! Focus a WeiDU file to parse."),n&&bn("Focus a WeiDU file to parse!");return}if((h==="d"||h==="baf")&&o===""){T("Path to IE game is not specified in settings, can't parse D or BAF!"),n&&Sr("Path to IE game is not specified in settings, can't parse D or BAF!");return}T(`parsing ${u}...`),await AO({uri:e,tmpPath:m,text:r,activeCompiles:nq,run:async y=>{let w=[...a,...g,h,m],{err:_,stdout:b}=await ip(s,w,l,y);if(y.aborted)return;let S=r7(b);S={...S,errors:S.errors.map(R=>({...R,message:R.message.replaceAll(m,u)})),warnings:S.warnings.map(R=>({...R,message:R.message.replaceAll(m,u)}))};let N=!1;_&&S.errors.length===0&&(mf(_)==="ENOENT"&&(ir(`WeiDU not found at '${s}'. Check bgforge.mls.weidu.path setting.`),N=!0),S=pf(S,_,Ye(c),b.replaceAll(m,u))),N||Zc(S,n,`Successfully parsed ${u}.`,`Failed to parse ${u}!`),Wr(S,e,p)}})}var o7=[{pattern:/%[A-Za-z_][A-Za-z0-9_]*%/g,explain:e=>`${e} is assigned during installation, so this compiler cannot resolve it. Set bgforge.weidu.compiler to "weidu" to compile this file.`},{pattern:/@\d+/g,explain:e=>`${e} names a translation line whose number is assigned during installation, so this compiler cannot resolve it. Set bgforge.weidu.compiler to "weidu" to compile this file.`}];function s7(e){let t=[];return e.split(`
335
+ `).forEach((n,r)=>{for(let{pattern:o,explain:s}of o7){o.lastIndex=0;let a=o.exec(n);for(;a!==null;)t.push({row:r,column:a.index,message:s(a[0])}),a=o.exec(n)}}),t}function a7(e,t){let n=e.parse(t);if(n===null)return[];try{return n.rootNode.descendantsOfType(["comment","line_comment"]).map(r=>({start:r.startPosition,end:r.endPosition}))}finally{n.delete()}}function c7(e,t,n){return e.some(({start:r,end:o})=>!(t<r.row||t>o.row||t===r.row&&n<r.column||t===o.row&&n>=o.column))}function l7(e,t){let n=s7(e);if(n.length===0)return[];let r=a7(t,e);return n.filter(o=>!c7(r,o.row,o.column)).map(({row:o,column:s,message:a})=>({line:o+1,column:s+1,message:a})).sort((o,s)=>o.line-s.line||o.column-s.column)}function iq(e){let{text:t,uri:n,parser:r,symbols:o,engine:s}=e,a=[],c=u=>{a.push({uri:n,line:u.line,columnStart:u.column-1,columnEnd:u.column-1,message:u.message})},l=l7(t,r);l.forEach(u=>c(u));try{Zv(r,t,o,s)}catch(u){if(u instanceof bo){let d=new Set(l.map(f=>`${f.line}:${f.column}`));u.diagnostics.forEach(f=>{d.has(`${f.line}:${f.column}`)||c(f)})}else c({line:1,column:1,message:u instanceof Error?u.message:String(u)})}return{errors:a,warnings:[]}}async function Op(e,t,n,r){if(n.weidu.compiler==="built-in"){if(!n.weidu.gamePath)return r&&Sr("Path to IE game is not specified in settings, can't parse BAF with the built-in compiler!"),!1;if(!Me.isInitialized(Tt))return!1;let{configuredGame:o}=await xn(),s=o.tables(n.weidu),a=o.scriptStyle(n.weidu);if(s===void 0||a===void 0)return r&&Sr(`Cannot open IE game at "${n.weidu.gamePath}", can't parse BAF with the built-in compiler!`),!1;let c=iq({text:t,uri:e,parser:Me.getParser(Tt),symbols:Qv(s),engine:Y$(a)});return Wr(c,e,e),!0}return await So(e,n.weidu,r,t),!0}function oq(e,t){let n=[];return sq(e,t,n),n}function sq(e,t,n){if(e.type==="call_expr"){let r=e.childForFieldName("func")?.text,o=r===void 0?void 0:t(r);if(o!==void 0){let s=e.childrenForFieldName("args");for(let a of o){let c=s[a];c?.type==="number"&&n.push({strref:Number(c.text),range:{start:{line:c.startPosition.row,character:c.startPosition.column},end:{line:c.endPosition.row,character:c.endPosition.column}}})}}}for(let r of e.namedChildren)r&&sq(r,t,n)}var u7=new Set(["comment","line_comment"]),aq=Ya(du,Ja,u7),d7=new Set(["block","response"]),f7=ho(du,Ja,d7),m7=go(du,Ja),eC=class{id=Tt;symbolStore;storedContext;async init(t){this.storedContext=t,await V$(),this.symbolStore=new Yr;let n=On(Tt);this.symbolStore.loadStatic(n),T(`WeiDU BAF provider initialized with ${n.length} static symbols`)}shouldProvideFeatures(t,n){return!aq(t,n)}resolveSymbol(t,n,r){return Ba(t,this.symbolStore)}strRefs(t){let n=Ja(t);return n?oq(n.rootNode,r=>H$.get(r)):[]}foldingRanges(t){return f7(t)}selectionRanges(t,n){return m7(t,n)}format(t,n){return mo({text:t,uri:n,languageName:"BAF",isInitialized:du,parse:Ja,formatAst:(r,o)=>sv(r,o),getFormatOptions:po,normalizeForCompare:ns})}getCompletions(t){return ja(this.symbolStore)}filterCompletions(t,n,r){return aq(n,r)?[]:t}async compile(t,n,r){if(!this.storedContext){T("WeiDU BAF provider not initialized, cannot compile");return}await Op(t,n,this.storedContext.settings,r)}},cq=new eC;var lq=()=>Me.initOne(At,"tree-sitter-weidu_d.wasm","WeiDU D");var ct=()=>Me.isInitialized(At),lt=e=>Me.parseWithCache(At,e);var p7=new Set(["trigger","condition"]),h7=new Set(["action"]);function tC(e,t){if(!ct())return null;let n=lt(e);if(!n)return null;let r=n.rootNode.descendantForPosition({row:t.line,column:t.character});for(;r&&r.type!=="string";)r=r.parent;let o=r?.parent;if(!r||!o)return null;for(let s of p7)if(o.childForFieldName(s)?.id===r.id)return"trigger";for(let s of h7)if(o.childForFieldName(s)?.id===r.id)return"action";return null}var Mp,uq;function dq(){if(Mp)return;let e=new Yr;e.loadStatic(On(Tt));let t=new Map;for(let n of e.query({}))t.set(n.name.toLowerCase(),n);Mp=e,uq=t}function fq(e){return uq?.get(e.toLowerCase())}function mq(e){if(!Mp)return[];let t=e==="trigger"?K.Trigger:K.Action;return Mp.query({kinds:[t,K.Constant]}).map(n=>n.completion)}var g7=new Set(["comment","line_comment"]),nC=Ya(ct,lt,g7),_7=new Set(["tilde_string","double_string"]),pq=Xa(ct,lt,_7);var ec=B(le());function y7(e){return e.startsWith("~")&&e.endsWith("~")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Bn(e){return y7(e).toLowerCase()}function hq(e){let t=e;for(;t;){if(t.type==="begin_action"||t.type==="append_action"){let n=t.childForFieldName("file");if(n)return{scopeNode:t,dialogFile:Bn(n.text)}}t=t.parent}return null}function b7(e){let t=[];function n(r){if(r.type==="state"){let o=r.childForFieldName("label");o&&t.push({name:o.text,labelNode:o,stateNode:r})}for(let o of r.children)n(o)}return n(e),t}var S7=new Set(["extend_action","add_state_trigger","add_trans_trigger","replace_say","replace_state_trigger","set_weight"]),w7=new Set(["chain_action","interject_action","interject_copy_trans"]);function wi(e,t){function n(r){if(!$n(t,r))return null;if(r.type==="state"){let o=r.childForFieldName("label");if(o&&$n(t,o)){let s=hq(r);if(s)return{labelNode:o,dialogFile:s.dialogFile}}}if(r.type==="goto_next"||r.type==="short_goto"){let o=r.childForFieldName("label");if(o&&$n(t,o)){let s=hq(r);if(s)return{labelNode:o,dialogFile:s.dialogFile}}}if(r.type==="extern_next"){let o=r.childForFieldName("label");if(o&&$n(t,o)){let s=r.childForFieldName("file");if(s)return{labelNode:o,dialogFile:Bn(s.text)}}}if(r.type==="copy_trans"){let o=r.childForFieldName("state");if(o&&$n(t,o)){let s=r.childForFieldName("file");if(s)return{labelNode:o,dialogFile:Bn(s.text)}}}if(r.type==="chain_epilogue"){let o=r.childForFieldName("label");if(o&&$n(t,o)){let s=r.childForFieldName("file");if(s)return{labelNode:o,dialogFile:Bn(s.text)}}}if(S7.has(r.type))if(r.type==="extend_action"){let o=r.childrenForFieldName("states");for(let s of o)if($n(t,s)){let a=r.childForFieldName("file");if(a)return{labelNode:s,dialogFile:Bn(a.text)}}}else{let o=r.childForFieldName("state");if(o&&$n(t,o)){let s=r.childForFieldName("file");if(s)return{labelNode:o,dialogFile:Bn(s.text)}}}if(w7.has(r.type)){let o=r.childForFieldName("label");if(o&&$n(t,o)){let s=r.childForFieldName("file");if(s)return{labelNode:o,dialogFile:Bn(s.text)}}}for(let o of r.children){let s=n(o);if(s)return s}return null}return n(e)}function $p(e,t,n){function r(o){if(o.type==="begin_action"||o.type==="append_action"){let s=o.childForFieldName("file");if(s&&Bn(s.text)===t){let a=b7(o).find(c=>c.name===n);if(a)return a}}for(let s of o.children){let a=r(s);if(a)return a}return null}return r(e)}function qp(e,t){function n(c,l,u){let d=c.childForFieldName(l),f=c.childForFieldName(u);d&&f&&t(Bn(d.text),f,!1)}function r(c,l){function u(d){if(d.type==="goto_next"||d.type==="short_goto"){let f=d.childForFieldName("label");f&&t(l,f,!1)}for(let f of d.children)u(f)}u(c)}function o(c,l){function u(d){if(d.type==="state"){let f=d.childForFieldName("label");f&&t(l,f,!0)}else if(d.type==="goto_next"||d.type==="short_goto"){let f=d.childForFieldName("label");f&&t(l,f,!1)}else if(d.type==="extern_next"){let f=d.childForFieldName("file"),m=d.childForFieldName("label");f&&m&&t(Bn(f.text),m,!1)}else if(d.type==="copy_trans"){let f=d.childForFieldName("file"),m=d.childForFieldName("state");f&&m&&t(Bn(f.text),m,!1)}for(let f of d.children)u(f)}u(c)}function s(c){let l=c.type;if(l==="chain_action"||l==="interject_action"||l==="interject_copy_trans"){n(c,"file","label");for(let u of c.children)u.type==="chain_epilogue"&&n(u,"file","label");return!0}if(l==="extend_action"){let u=c.childForFieldName("file");if(u){let d=Bn(u.text);for(let f of c.childrenForFieldName("states"))t(d,f,!1);r(c,d)}return!0}return l==="add_state_trigger"||l==="add_trans_trigger"||l==="replace_say"||l==="replace_state_trigger"||l==="set_weight"?(n(c,"file","state"),!0):!1}function a(c){if(c.type==="begin_action"||c.type==="append_action"){let l=c.childForFieldName("file");l&&o(c,Bn(l.text));return}if(!s(c))for(let l of c.children)a(l)}a(e)}function gq(e,t){return`${e}:${t}`}function x7(e,t,n,r){let o=n.text,s=gq(t,o);return{name:s,kind:K.State,location:{uri:e,range:J(n)},scope:{level:kt.File},source:{type:Ee.Navigation,uri:e,displayPath:r},completion:{label:o,kind:ec.CompletionItemKind.Field,detail:`state (${t})`,insertTextFormat:ec.InsertTextFormat.PlainText,labelDetails:{description:r}},hover:{contents:{kind:ec.MarkupKind.Markdown,value:qn(`state ${s}`,Hc,r)}}}}function _q(e,t,n){if(!ct())return bi;let r=lt(t);if(!r)return bi;let o=[],s=new Map,a=ca(e,n)||aa(e);function c(l,u,d){let f=gq(l,u),m=s.get(f);m||(m=[],s.set(f,m)),m.push(d)}return qp(r.rootNode,(l,u,d)=>{c(l,u.text,{uri:e,range:J(u)}),d&&o.push(x7(e,l,u,a))}),{symbols:o,refs:s}}function yq(e,t,n){if(!ct())return null;let r=lt(e);if(!r)return null;let o=wi(r.rootNode,n);if(!o)return null;let s=$p(r.rootNode,o.dialogFile,o.labelNode.text);return s?{uri:t,range:J(s.labelNode)}:null}var bq=B(le());function Sq(e,t,n,r){if(!ct())return Gt.notHandled();let o=lt(e);if(!o)return Gt.notHandled();let s=wi(o.rootNode,r);if(!s)return Gt.notHandled();let a=$p(o.rootNode,s.dialogFile,s.labelNode.text);if(!a)return Gt.notHandled();let c=Kt(a.stateNode);if(c===null)return Gt.notHandled();let l=Yt(c);if(!l.desc)return Gt.notHandled();let u=`state ${s.labelNode.text}`,d=qn(u,Hc)+`
336
336
 
337
337
  ---
338
338
 
339
- `+l.desc;return Gt.found({contents:{kind:yq.MarkupKind.Markdown,value:d}})}function fu(e,t,n){let r=[];return qp(e,(o,s,a)=>{o===t&&s.text===n&&r.push({node:s,isDefinition:a})}),r}function Sq(e,t,n,r,o){let s=lt(e);if(!s)return[];let a=wi(s.rootNode,t);if(!a)return[];let c=a.labelNode.text,l=fu(s.rootNode,a.dialogFile,c),u=l.some(f=>f.isDefinition),d=l.filter(f=>r||!f.isDefinition).map(f=>({uri:n,range:J(f.node)}));if(o){let f=`${a.dialogFile}:${c}`,m=o.lookup(f).filter(p=>p.uri!==n);return u?[...d,...m]:m}return u?d:[]}var x7=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function wq(e,t){if(!ct())return null;let n=lt(e);if(!n)return null;let r=wi(n.rootNode,t);if(!r)return null;let o=fu(n.rootNode,r.dialogFile,r.labelNode.text);return o.some(a=>a.isDefinition)?(Bp={text:e,dialogFile:r.dialogFile,labelName:r.labelNode.text,refs:o},{range:J(r.labelNode),placeholder:r.labelNode.text}):(Bp=null,null)}function xq(e,t,n,r){if(!ct()||!x7.test(n))return null;let o=lt(e);if(!o)return null;let s=wi(o.rootNode,t);if(!s)return null;let a=Bp,c=a&&a.text===e&&a.dialogFile===s.dialogFile&&a.labelName===s.labelNode.text?a.refs:fu(o.rootNode,s.dialogFile,s.labelNode.text);if(Bp=null,c.length===0||!c.some(d=>d.isDefinition))return null;let u=c.map(d=>({range:J(d.node),newText:n}));return{changes:{[r]:u}}}var Bp=null;var vq=B(le());function Cq(e){if(!ct())return[];let t=lt(e);if(!t)return[];let n=[];function r(o){if(o.type==="state"){let s=o.childForFieldName("label");if(s&&s.text){let a=s.startPosition,c=s.endPosition;n.push({name:s.text,kind:vq.SymbolKind.Function,range:{start:{line:o.startPosition.row,character:o.startPosition.column},end:{line:o.endPosition.row,character:o.endPosition.column}},selectionRange:{start:{line:a.row,character:a.column},end:{line:c.row,character:c.column}}})}}for(let s of o.children)r(s)}return r(t.rootNode),n}var v7=new Set(["begin_action","append_action","chain_action","extend_action","interject_action","interject_copy_trans","replace_action","state","transition"]),C7=ho(ct,lt,v7),P7=go(ct,lt),iC=class{id=At;indexExtensions=[qo];fileIndex;storedContext;async init(t){this.storedContext=t,await cq(),this.fileIndex=new co(this.id);let n=On(At);this.fileIndex.loadStatic(n),uq(),T(`WeiDU D provider initialized with ${n.length} static symbols`)}shouldProvideFeatures(t,n){return!rC(t,n)}resolveSymbol(t,n,r){let o=Ba(t,this.fileIndex?.symbols);return o?.source.type===Ee.Static?o:void 0}format(t,n){return mo({text:t,uri:n,languageName:"D",isInitialized:ct,parse:lt,formatAst:(r,o)=>hv(r,o),getFormatOptions:po,normalizeForCompare:ns})}symbols(t){return Cq(t)}foldingRanges(t){return C7(t)}selectionRanges(t,n){return P7(t,n)}definition(t,n,r){return _q(t,r,n)}references(t,n,r,o,s){return ct()?Sq(t,n,r,o,this.fileIndex?.refs):[]}prepareRename(t,n){return wq(t,n)}async rename(t,n,r,o){return xq(t,n,r,o)}hover(t,n,r,o){if(nC(t,o)){let s=dq(n);return s?.hover?Gt.found(s.hover):Gt.notHandled()}return bq(t,n,r,o)}getCompletions(t){return ja(this.fileIndex?.symbols)}filterCompletions(t,n,r,o,s){let a=nC(n,r);return a?fq(a):rC(n,r)||mq(n,r)?[]:t}workspaceSymbols(t,n){return this.fileIndex?.symbols.searchWorkspaceSymbols(t,500,n)??[]}reloadFileData(t,n){if(ct()&&this.fileIndex){let r=gq(t,n,this.storedContext?.workspaceRoot);this.fileIndex.updateFile(t,r)}}onWatchedFileDeleted(t){this.fileIndex?.removeFile(t)}async compile(t,n,r){if(!this.storedContext){T("WeiDU D provider not initialized, cannot compile");return}await So(t,this.storedContext.settings.weidu,r,n)}},Pq=new iC;var wu=B(le()),WB=require("fs"),PC=require("path"),NC=require("url");var hu=B(le());var Nq=()=>Me.initOne(_n,"tree-sitter-weidu_tp2.wasm","WeiDU TP2");var Te=()=>Me.isInitialized(_n),ke=e=>Me.parseWithCache(_n,e);var Ot={File:"file",Function:"function",Loop:"loop"};function jn(e,t){function n(r){if(!$n(t,r))return null;for(let o of r.children){let s=n(o);if(s)return s}return r}return n(e)}function rt(e,t){let n=e;for(;n;){if(t.has(n.type))return n;n=n.parent}return null}function en(e,t){return e.startPosition.row===t.startPosition.row&&e.startPosition.column===t.startPosition.column&&e.endPosition.row===t.endPosition.row&&e.endPosition.column===t.endPosition.column&&e.text===t.text}function gs(e){return e.type==="variable_ref"?e.child(0)??e:e}function oC(e){if(e.type==="identifier")return e;for(let t of e.children){let n=oC(t);if(n)return n}return null}var N7=new Set(["patch_assignment"]),E7=new Set(["=","+=","-=","*=","/=","|=","&=","||=","&&="]);function jp(e){if(!N7.has(e.type))return!1;for(let t of e.children)if(E7.has(t.type))return t.startIndex===t.endIndex;return!0}function Jr(e){let t=e.split("_",1)[0];return t!==void 0&&t.length>0&&t===t.toUpperCase()&&/[A-Z]/.test(t)}function qe(e){if(e.length<2)return e;let t=e[0],n=e[e.length-1];return t==="~"&&n==="~"||t==='"'&&n==='"'||t==="%"&&n==="%"?e.slice(1,-1):e}var _s=new Set(["action_outer_set","action_outer_text_sprint","action_outer_sprint","patch_set","patch_text_sprint","patch_sprint","patch_sprintf","patch_assignment","int_var_decl","str_var_decl","ret_decl","ret_array_decl","patch_read_long","patch_read_short","patch_read_byte","patch_read_ascii","patch_read_strref","patch_read_2da_entry","patch_read_2da_entry_former","patch_read_2da_entries_now","action_define_array","action_define_associative_array","patch_define_array","patch_define_associative_array","action_php_each","patch_php_each","action_for_each","patch_for_each"]),sC=new Set(["int_var_decl","str_var_decl","ret_decl","ret_array_decl"]),xi=new Set(["tilde_content","double_content","five_tilde_content"]),Xn=new Set(["action_define_function","action_define_patch_function","action_define_dimorphic_function","action_define_macro","action_define_patch_macro"]),wo=new Set(["action_php_each","patch_php_each","action_for_each","patch_for_each"]);function aC(e){return rt(e,Xn)}function cC(e){return rt(e,wo)}function mu(e,t){let n=cC(t);if(n&&lC(n,e))return{scope:Ot.Loop,loopNode:n};let r=aC(t);return r?{scope:Ot.Function,functionNode:r}:{scope:Ot.File}}function lC(e,t){let n=e.childForFieldName("key_var"),r=e.childForFieldName("value_var"),o=e.childForFieldName("var");for(let s of[n,r,o]){if(!s)continue;let a=gs(s);if(a.type==="identifier"&&bt(a.text,t))return!0}return!1}function Eq(e){let t=new Set;for(let n of["key_var","value_var","var"]){let r=e.childForFieldName(n);if(!r)continue;let o=oC(r);o&&t.add(o.text)}return t}function R7(e,t){let n=e.text,r=T7(n,t,e.startPosition);if(r<0||r>n.length)return null;let o=/%([a-zA-Z_][a-zA-Z0-9_]*)%/g,s;for(;(s=o.exec(n))!==null;){let a=s.index,c=s.index+s[0].length;if(r>=a&&r<=c)return s[1]??null}return null}function T7(e,t,n){if(t.line<n.row||t.line===n.row&&t.character<n.column)return-1;let r=0,o=n.row,s=n.column;for(let a of e){if(o===t.line&&s===t.character)return r;a===`
340
- `?(o++,s=0):s++,r++}return o===t.line&&s===t.character?r:-1}function bt(e,t){return e===t}function Rq(e,t,n,r){if(!Te())return null;let o=ke(e);if(!o)return null;let s=ec(o.rootNode,n);if(!s)return null;if(s.scope===Ot.File){let c=r?.lookupDefinition(s.name);if(c)return c}let a=A7(o.rootNode,s);return a?{uri:t,range:J(a)}:null}function ec(e,t){let n=jn(e,t);if(!n)return null;if(n.type==="%"){let o=n.parent;o&&o.type==="percent_string"&&(n=o)}if(n.type==="percent_string"){let o=n.child(1);if(o&&o.type==="percent_content"){let s=o.text;return s?{name:s,kind:"variable",...mu(s,n),node:n}:null}}if(n.type==="percent_content"){let o=n.text;return o?{name:o,kind:"variable",...mu(o,n),node:n.parent&&n.parent.type==="percent_string"?n.parent:n}:null}if(xi.has(n.type)){let o=R7(n,t);if(o)return{name:o,kind:"variable",...mu(o,n),node:n}}if(n.type==="variable_ref"){let o=n.child(0),s=o?.text;return s?{name:s,kind:"variable",...mu(s,n),node:o}:null}if(n.type==="identifier"){let o=n.text;return{name:o,kind:"variable",...mu(o,n),node:n}}return null}function A7(e,t){let n=e;return t.scope===Ot.Loop&&t.loopNode?n=t.loopNode:t.scope===Ot.Function&&t.functionNode&&(n=t.functionNode),I7(n,t.name,t)}function I7(e,t,n){let r=null;function o(s){if(!r){if(_s.has(s.type)){if(wo.has(s.type)){if(!n.loopNode||en(n.loopNode,s)){let d=s.childForFieldName("key_var"),f=s.childForFieldName("value_var"),m=s.childForFieldName("var");for(let p of[d,f,m]){if(!p)continue;let g=gs(p);if(g.type==="identifier"&&bt(g.text,t)){r=g;return}}}if(n.scope===Ot.Loop)return}let a=s.childForFieldName("var");if(a&&bt(qe(a.text),t)){r=a;return}let c=s.childrenForFieldName("var");for(let u of c)if(u.type==="identifier"&&bt(u.text,t)){r=u;return}let l=s.childForFieldName("name");if(l){let u=l.child(0);if(u){let d=gs(u);if(d.type==="identifier"&&bt(d.text,t)){r=d;return}}}if(s.type==="int_var_decl"||s.type==="str_var_decl"||s.type==="ret_decl"||s.type==="ret_array_decl"){for(let u of s.children)if(u.type==="identifier"&&bt(u.text,t)){r=u;return}}}for(let a of s.children)if(o(a),r)return}}return o(e),r}var mn=new Set(["action_launch_function","action_launch_macro","patch_launch_function","patch_launch_macro"]);function pu(e,t){let n=jn(e,t);if(!n)return null;if(D7(n)){let s=n.parent;return!s||!k7(s)?null:Wp(s,Xn)?{name:n.text,kind:"function",scope:Ot.File,node:s}:Wp(s,mn)?{name:n.text,kind:"function",scope:Ot.File,node:s}:null}return n.type!=="identifier"&&n.type!=="string"?null:Wp(n,Xn)?{name:qe(n.text),kind:"function",scope:Ot.File,node:n}:Wp(n,mn)?{name:qe(n.text),kind:"function",scope:Ot.File,node:n}:null}function Wp(e,t){let n=rt(e,t);if(!n)return null;let r=n.childForFieldName("name");return!r||!en(r,e)?null:qe(r.text)}function D7(e){return e.type==="tilde_content"||e.type==="double_content"||e.type==="five_tilde_content"}function k7(e){return e.type==="string"||e.type==="tilde_string"||e.type==="double_string"||e.type==="five_tilde_string"}var F7=new Set(["component"]),L7=new Set([...Xn,...mn]);function Aq(e,t){for(let n=0;n<e.childCount;n++){let r=e.child(n);if(!r||!Xn.has(r.type))continue;let o=r.childForFieldName("name");if(o&&qe(o.text)===t)return r}return null}function Iq(e,t){let n=e.childForFieldName("name");return n?{name:qe(n.text),kind:hu.SymbolKind.Function,uri:t,range:J(e),selectionRange:J(n)}:null}function O7(e,t){return{name:e,kind:hu.SymbolKind.Function,uri:t.uri,range:t.range,selectionRange:t.range}}function Dq(e,t){t(e);for(let n of e.children)Dq(n,t)}function kq(e,t,n,r){let o=Aq(t,e);if(o)return Iq(o,n);let s=r(e);return s?O7(e,s):null}function Fq(e,t,n,r){if(!Te())return null;let o=ke(e);if(!o)return null;let s=jn(o.rootNode,t);if(!s)return null;let a=rt(s,L7);if(!a)return null;let c=a.childForFieldName("name");if(!c||s.startIndex<c.startIndex||s.endIndex>c.endIndex)return null;let l=qe(c.text),u=kq(l,o.rootNode,n,r);return u?[u]:null}function Lq(e,t,n){if(!Te())return[];let r=t(e.uri);if(!r)return[];let o=ke(r);if(!o)return[];let s=Aq(o.rootNode,e.name);if(!s)return[];let a=new Map;Dq(s,l=>{if(!mn.has(l.type))return;let u=l.childForFieldName("name");if(!u)return;let d=qe(u.text),f=a.get(d);f||(f={to:kq(d,o.rootNode,e.uri,n),ranges:[]},a.set(d,f)),f.ranges.push(J(u))});let c=[];for(let{to:l,ranges:u}of a.values())l&&c.push({to:l,fromRanges:u});return c}var Tq={start:{line:0,character:0},end:{line:0,character:0}};function M7(e){let n=e.split(/[?#]/,1)[0].split("/").pop();return n?decodeURIComponent(n):e}function $7(e,t){let n=rt(e,Xn);if(n){let o=Iq(n,t);if(o)return o}let r=rt(e,F7);if(r){let o=r.childForFieldName("name");return{name:o?qe(o.text):"component",kind:hu.SymbolKind.Module,uri:t,range:J(r),selectionRange:J(o??r)}}return{name:M7(t),kind:hu.SymbolKind.File,uri:t,range:Tq,selectionRange:Tq}}function Oq(e,t,n){if(!Te())return[];let r=vp(n),o=new Map;for(let s of t){let a=r(s.uri);if(!a)continue;let c=ke(a);if(!c)continue;let l=jn(c.rootNode,s.range.start);if(!l)continue;let u=rt(l,mn);if(!u)continue;let d=u.childForFieldName("name");if(!d||qe(d.text)!==e.name)continue;let f=$7(u,s.uri),m=`${f.uri}\0${f.name}\0${f.range.start.line}:${f.range.start.character}`,p=o.get(m);p||(p={from:f,ranges:[]},o.set(m,p)),p.ranges.push(J(d))}return[...o.values()].map(({from:s,ranges:a})=>({from:s,fromRanges:a}))}var Mq=/^\s*(LAF|LPF|LAM|LPM|LAUNCH_ACTION_FUNCTION|LAUNCH_PATCH_FUNCTION|LAUNCH_ACTION_MACRO|LAUNCH_PATCH_MACRO)\s+\S*$/i,$q=/^\s*(?:LAF|LPF|LAUNCH_ACTION_FUNCTION|LAUNCH_PATCH_FUNCTION)\s+\S+\s+/i,qq=/^\s*(?:OUTER_)?(?:SET|SPRINT|TEXT_SPRINT)\s+(?:(?:EVAL(?:UATE_BUFFER)?|GLOBAL)\s+)?\S*$/i,Bq=new RegExp("^\\s*(DEFINE_(?:ACTION|PATCH)_(?:FUNCTION|MACRO)\\s+|(?:ACTION_)?DEFINE_(?:ASSOCIATIVE_)?ARRAY\\s+|(?:PATCH_|ACTION_)?(?:FOR_EACH|PHP_EACH)\\s+)\\S*$","i");function jq(e,t=!1){let n=-1,r=-1,o=-1;for(let s of e.children)s.type===_e?n=s.endIndex:s.type===be?r=s.startIndex:t&&s.type==="identifier"&&o<0&&(o=s.endIndex);return{beginEnd:n,endStart:r,functionNameEnd:o}}var uC=null;function pC(){return uC}function Up(e,t,n,r){let o=e.parent;for(;o&&o!==n&&o.type!==t;)o=o.parent;if(o&&o!==n)return o;if(r){for(o=e.parent;o&&o!==n&&o.type!==r;)o=o.parent;if(o&&o!==n)return o}return null}function B7(e,t){return Vq(e,t,e,{sectionNode:null,sectionType:null,keywordPosition:-1})}function Vq(e,t,n,r){let o=r;if(e.startIndex<t){let s=e.text;(s==="INT_VAR"||s==="STR_VAR"||s==="RET"||s==="RET_ARRAY")&&(s==="INT_VAR"?o={sectionType:"INT_VAR",keywordPosition:e.endIndex,sectionNode:Up(e,"int_var_call",n)??r.sectionNode}:s==="STR_VAR"?o={sectionType:"STR_VAR",keywordPosition:e.endIndex,sectionNode:Up(e,"str_var_call",n,"int_var_call")??r.sectionNode}:s==="RET"?o={sectionType:"RET",keywordPosition:e.endIndex,sectionNode:Up(e,"ret_call",n)??r.sectionNode}:o={sectionType:"RET_ARRAY",keywordPosition:e.endIndex,sectionNode:Up(e,"ret_array_call",n)??r.sectionNode})}for(let s of e.children)o=Vq(s,t,n,o);return o}function Wq(e,t){uC=null;let n=e.childForFieldName("name");if(!n)return;let r=qe(n.text),{sectionType:o,sectionNode:s,keywordPosition:a}=B7(e,t);if(o!==null&&s!==null){let c=j7(s,a);uC={functionName:r,paramSection:o,usedParams:c}}}function j7(e,t){let n=[];for(let r of e.children){if(r.startIndex<=t)continue;let o=r.type;if(o==="int_var_call_item"||o==="str_var_call_item"){let s=r.children[0];s&&(s.type==="identifier"||s.type==="string")&&n.push(s.text)}else if(o==="identifier")n.push(r.text);else if(o==="ret_call_item"||o==="ret_array_call_item"){let s=r.children[0];s&&s.type==="identifier"&&n.push(s.text)}}return n}function Gq(e){if(e.text==="="&&e.type==="=")return e.startIndex;for(let t of e.children){let n=Gq(t);if(n>=0)return n}return-1}function dC(e,t){let n=Gq(e);return n<0?"funcParamName":t<=n?"funcParamName":"funcParamValue"}function fC(e,t){function n(r){let o=r.type;if(o==="int_var_call_item"||o==="str_var_call_item"||o==="ret_call_item"||o==="ret_array_call_item"||o==="int_var_decl"||o==="str_var_decl"||o==="ret_decl"||o==="ret_array_decl")return t>=r.startIndex&&t<=r.endIndex?r:null;for(let a of r.children){let c=n(a);if(c)return c}return null}return n(e)}function zq(e,t){let n=e.type;if(n==="action_launch_function"){if(Uq(t,e))return["lafName"];Wq(e,t);let r=fC(e,t);return r?[dC(r,t)]:["funcParamName"]}if(n==="action_launch_macro")return Hq(t,e)?["lamName"]:null;if(n==="patch_launch_macro")return Hq(t,e)?["lpmName"]:null;if(n==="patch_launch_function"){if(Uq(t,e))return["lpfName"];Wq(e,t);let r=fC(e,t);return r?[dC(r,t)]:["funcParamName"]}return null}function Kq(e,t){let n=e.type;return n==="action_define_patch_function"||n==="action_define_patch_macro"||n==="action_define_function"||n==="action_define_dimorphic_function"||n==="action_define_macro"?W7(e,t):null}function W7(e,t){let n=jq(e,!0),{beginEnd:r,functionNameEnd:o}=n;if(o&&o>0&&t>o&&(r<0||t<r)){let s=fC(e,t);return s?[dC(s,t)]:["funcParamName"]}return null}function Uq(e,t){let n=-1,r=-1;for(let o of t.children){let s=o.text.toUpperCase();if(s==="LAF"||s==="LPF"||s==="LAUNCH_ACTION_FUNCTION"||s==="LAUNCH_PATCH_FUNCTION"){n=o.endIndex;continue}if(o.type==="identifier"){if(e>=o.startIndex&&e<=o.endIndex)return!0;if(e>o.endIndex)return!1}(s==="INT_VAR"||s==="STR_VAR"||s==="RET"||s==="RET_ARRAY"||s==="END")&&r<0&&(r=o.startIndex)}return n>0&&e>n&&(r<0||e<r)}function Hq(e,t){let n=-1;for(let r of t.children){let o=r.text.toUpperCase();if(o==="LAM"||o==="LPM"||o==="LAUNCH_ACTION_MACRO"||o==="LAUNCH_PATCH_MACRO"){n=r.endIndex;continue}if(r.type==="identifier"||r.type==="string"){if(e>=r.startIndex&&e<=r.endIndex)return!0;if(e>r.endIndex)return!1}}return n>0&&e>n}function Yq(e,t){let n=e;for(;n;){let r=zq(n,t)??Kq(n,t);if(r)return r;n=n.parent}return[]}function Xq(e,t){let n=Pr(e,t);return qq.test(n)?"assignment":Bq.test(n)?"definition":!1}function U7(e,t,n){let o=Pr(e,{line:t,character:n}).match(Mq);if(!o||!o[1])return null;switch(o[1].toUpperCase()){case"LAF":case"LAUNCH_ACTION_FUNCTION":return"lafName";case"LPF":case"LAUNCH_PATCH_FUNCTION":return"lpfName";case"LAM":case"LAUNCH_ACTION_MACRO":return"lamName";case"LPM":case"LAUNCH_PATCH_MACRO":return"lpmName";default:return null}}function H7(e,t,n){let r=Pr(e,{line:t,character:n});return $q.test(r)?"funcParamName":null}function Jq(e,t,n){if(!Te())return[];let r=ke(e);if(!r)return[];let o=M$(e,t,n),s=r.rootNode.descendantForPosition({row:t,column:n});if(!s)return[];let a=Ap(r.rootNode,{line:t,character:n},"comment","line_comment");if(a==="jsdoc")return["jsdoc"];if(a==="comment")return["comment"];let c=Yq(s,o);if(c.length===0){let l=U7(e,t,n);if(l!==null)return[l];let u=H7(e,t,n);if(u!==null)return[u]}return c}var V7=new Set([Se.FuncVarKeyword]),tn=["lafName","lpfName","lamName","lpmName"],G7={[Se.ActionFunctions]:["lpfName","lamName","lpmName","funcParamName","funcParamValue"],[Se.PatchFunctions]:["lafName","lamName","lpmName","funcParamName","funcParamValue"],[Se.ActionMacros]:["lafName","lpfName","lpmName","funcParamName","funcParamValue"],[Se.PatchMacros]:["lafName","lpfName","lamName","funcParamName","funcParamValue"],[Se.DimorphicFunctions]:["lamName","lpmName","funcParamName","funcParamValue"],[Se.Prologue]:[...tn,"funcParamName","funcParamValue"],[Se.Flag]:[...tn,"funcParamName","funcParamValue"],[Se.Component]:[...tn,"funcParamName","funcParamValue"],[Se.ComponentFlag]:[...tn,"funcParamName","funcParamValue"],[Se.Language]:[...tn,"funcParamName","funcParamValue"],[Se.Action]:[...tn,"funcParamName","funcParamValue"],[Se.Patch]:[...tn,"funcParamName","funcParamValue"],[Se.Constants]:[...tn,"funcParamName"],[Se.Vars]:[...tn,"funcParamName"],[Se.Value]:[...tn,"funcParamName"],[Se.When]:[...tn,"funcParamName"],[Se.OptGlob]:[...tn,"funcParamName"],[Se.OptCase]:[...tn,"funcParamName"],[Se.OptExact]:[...tn,"funcParamName"],[Se.Caching]:[...tn,"funcParamName"],[Se.ArraySortType]:[...tn,"funcParamName"],[Se.FuncVarKeyword]:[...tn,"funcParamValue"]},mbe=new Set(["lafName","lpfName","lamName","lpmName","funcParamName","funcParamValue"]);function Qq(e,t){return t.length===0?e.filter(n=>n.category===void 0||!V7.has(n.category)):e.filter(n=>!z7(n,t))}function z7(e,t){if(t.length===0||e.category===void 0)return!1;let n=G7[e.category];return!n||n.length===0?!1:t.every(r=>n.includes(r))}var tc=B(le());function Zq(e,t){let{functionName:n,paramSection:r,usedParams:o}=e,s=t?.lookup(n);if(!s||!Ea(s)||!s.callable.params)return[];let a=s.callable.params,c=new Set(o),l=[];switch(r){case"INT_VAR":{for(let u of a.intVar)c.has(u.name)||l.push(Hp(u));break}case"STR_VAR":{for(let u of a.strVar)c.has(u.name)||l.push(Hp(u));break}case"RET":{for(let u of a.ret)c.has(u)||l.push(Hp({name:u,type:"any"}));break}case"RET_ARRAY":{for(let u of a.retArray)c.has(u)||l.push(Hp({name:u,type:"array"}));break}}return l}function Hp(e){let{name:t,type:n,defaultValue:r,description:o,required:s}=e,c=r!==void 0&&!s?`${n??""} ${t} = ${r}`:`${n??""} ${t}`,u=[`\`\`\`${Bi}`,c,"```"];return o&&u.push("",o),{label:t,kind:tc.CompletionItemKind.Field,insertText:`${t} = `,insertTextFormat:tc.InsertTextFormat.PlainText,documentation:{kind:tc.MarkupKind.Markdown,value:u.join(`
341
- `)},category:Se.FuncVarKeyword}}var nc=B(le());var K7=new Set(["action_define_macro","action_define_patch_macro"]),Y7=new Set(["action_define_array","action_define_associative_array","patch_define_array","patch_define_associative_array"]),X7=new Set(["action_outer_set","action_outer_sprint","action_outer_sprintf","action_outer_text_sprint","action_define_array","action_define_associative_array","action_for_each"]),J7=new Set(["action_php_each"]),Q7=new Set(["action_outer_set","patch_set","patch_assignment","local_set","patch_read_byte","patch_read_short","patch_read_long"]),Z7=new Set(["action_define_array","action_define_associative_array","patch_define_array","patch_define_associative_array"]),eZ=new Set(["patch_set","patch_assignment","patch_sprint","patch_sprintf","patch_text_sprint","patch_define_array","patch_define_associative_array","patch_for_each","patch_read_byte","patch_read_short","patch_read_long","patch_read_ascii","patch_read_strref","patch_read_2da_entries_now","patch_read_2da_entry","patch_read_2da_entry_former","action_outer_set","action_outer_sprint","action_outer_sprintf","action_outer_text_sprint","action_define_array","action_define_associative_array","action_for_each","local_set","local_sprint"]),tZ=new Set(["patch_php_each","action_php_each"]);function nZ(e){let t=e.childrenForFieldName("var");for(let n of t)if(n.type==="identifier")return n;return null}function rZ(e,t){return Y7.has(e)?nc.SymbolKind.Array:Jr(t)?nc.SymbolKind.Constant:nc.SymbolKind.Variable}function ys(e,t,n){let r=t.text;return r?{name:r,detail:n,kind:rZ(e.type,r),range:J(e),selectionRange:J(t)}:null}function eB(e){return Q7.has(e.type)?nZ(e):Z7.has(e.type)?e.childForFieldName("name"):e.childForFieldName("var")}function tB(e,t){let n=[];if(!e.hasError&&X7.has(e.type)){let r=eB(e);if(r&&r.text&&!t.has(r.text)){t.add(r.text);let o=ys(e,r);o&&n.push(o)}}else if(!e.hasError&&J7.has(e.type)){let r=e.childForFieldName("key_var"),o=e.childForFieldName("value_var");if(r&&r.text&&!t.has(r.text)){t.add(r.text);let s=ys(e,r);s&&n.push(s)}if(o&&o.text&&!t.has(o.text)){t.add(o.text);let s=ys(e,o);s&&n.push(s)}}for(let r of e.children)$a(r.type)||n.push(...tB(r,t));return n}var iZ=new Set(["int_var_decl","str_var_decl"]);function oZ(e,t,n){let r=[];for(let o of e.children)if(iZ.has(o.type)){for(let s of o.children)if(s.type==="identifier"&&s.text&&!n.has(s.text)){n.add(s.text);let a=ys(s,s,t);a&&r.push(a)}}return r}function nB(e,t,n=new Set){let r=[];if(!e.hasError&&eZ.has(e.type)){let o=eB(e);if(o&&o.text&&!n.has(o.text)){n.add(o.text);let s=ys(e,o,t);s&&r.push(s)}}else if(!e.hasError&&tZ.has(e.type)){let o=e.childForFieldName("key_var"),s=e.childForFieldName("value_var");if(o&&o.text&&!n.has(o.text)){n.add(o.text);let a=ys(e,o,t);a&&r.push(a)}if(s&&s.text&&!n.has(s.text)){n.add(s.text);let a=ys(e,s,t);a&&r.push(a)}}for(let o of e.children)r.push(...nB(o,t,n));return r}function rB(e){if(!Te())return[];let t=ke(e);if(!t)return[];let n=[],r=new Set;for(let o of t.rootNode.children)if($a(o.type)){let s=o.childForFieldName("name");if(s&&s.text){let a=new Set,c=oZ(o,s.text,a),l=nB(o,s.text,a),u=[...c,...l],d=K7.has(o.type)?nc.SymbolKind.Method:nc.SymbolKind.Function;n.push({name:s.text,kind:d,range:J(o),selectionRange:J(s),children:u.length>0?u:void 0})}}else n.push(...tB(o,r));return n}var gu=B(le());var hC=B(le());var iB=80;function gC(e){let t=new Map;if(!e)return t;for(let n of e)n.name&&t.set(n.name,n);return t}function sB(e,t){let n=new Map;if(e.jsdoc?.args)for(let c of e.jsdoc.args)n.set(c.name,{type:c.type,description:c.description,required:c.required});let r=`${e.context} ${e.dtype} ${e.name}`,o=t===null?void 0:t??aB(e.location.uri),s=sZ(e,n),a=Tv({signature:r,langId:Bi,filePath:o,description:e.jsdoc?.desc,paramTable:s||void 0,deprecated:e.jsdoc?.deprecated});return{contents:{kind:hC.MarkupKind.Markdown,value:a}}}function sZ(e,t){if(!e.params)return"";let n=(a,c)=>a.map(l=>{let u=t.get(l.name),d=!u?.required&&l.defaultValue!==void 0;return{type:u?.type??c,name:l.name,...d?{default:l.defaultValue}:{},...oB(u?.description)}}),r=gC(e.jsdoc?.rets),o=a=>a.map(c=>{let l=r.get(c),u=t.get(c);return{type:l?.type??u?.type??"",name:c,...oB(l?.description??u?.description)}}),s=[{label:"INT vars",rows:n(e.params.intVar,"int")},{label:"STR vars",rows:n(e.params.strVar,"string")},{label:"RET vars",rows:o(e.params.ret)},{label:"RET arrays",rows:o(e.params.retArray)}];return Z1(s)}function oB(e){if(!e)return{};let t=aZ(e);return t?{description:t}:{}}function aZ(e){if(e.length<=iB)return e;let t=/\[([^\]]+)\]\([^)]+\)/g,n,r=[];for(;(n=t.exec(e))!==null;)r.push({start:n.index,end:n.index+n[0].length});let o=iB-3;for(let s of r)if(o>s.start&&o<s.end){o=s.start;break}return o<=0?e:e.slice(0,o).trimEnd()+"..."}function aB(e){let t=e.replace(/^file:\/\//,""),n=t.lastIndexOf("/");return n!==-1?t.slice(n+1):t}function cB(e,t){let n=e.jsdoc?.type??e.inferredType,s=Jr(e.name)&&e.value!==void 0?`${n} ${e.name} = ${e.value}`:`${n} ${e.name}`,a=t===null?void 0:t??aB(e.location.uri),c=Tv({signature:s,langId:Bi,filePath:a,description:e.jsdoc?.desc,deprecated:e.jsdoc?.deprecated});return{contents:{kind:hC.MarkupKind.Markdown,value:c}}}var lB=new Set(["action_define_function","action_define_patch_function","action_define_dimorphic_function","action_define_macro","action_define_patch_macro"]),cZ=new Set(["action_outer_set","action_outer_sprint","action_outer_text_sprint","patch_set","patch_sprint","patch_text_sprint","patch_assignment","patch_read_byte","patch_read_short","patch_read_long","patch_read_ascii","patch_read_strref"]),uB={int_var_decl:"intVar",str_var_decl:"strVar",ret_decl:"ret",ret_array_decl:"retArray"};function Vp(e,t){if(!Te())return[];let n=ke(e);return n?lZ(n.rootNode,t):[]}function dB(e,t){let n=[],r=[],o=new Map,s=(c,l)=>{let u=o.get(c);u||(u=[],o.set(c,u)),u.push(l)};for(let c=0;c<e.childCount;c++){let l=e.child(c);if(l&&lB.has(l.type)){let u=uZ(l,t);u&&n.push(u)}}function a(c,l){let u=c.type;if(lB.has(u)){let d=c.childForFieldName("name");if(d){let f=qe(d.text);s(f,{uri:t,range:J(d)})}for(let f of c.children)a(f,!0);return}if(mn.has(u)){let d=c.childForFieldName("name");if(d){let f=qe(d.text);s(f,{uri:t,range:J(d)})}}else if(!l&&cZ.has(u)&&!jp(c)){let d=dZ(c,t);d&&r.push(d)}for(let d of c.children)a(d,l)}return a(e,!1),{functions:n,variables:r,refs:o}}function lZ(e,t){return dB(e,t).functions}function uZ(e,t){let n=e.childForFieldName("name");if(!n)return null;let r=qe(n.text),{context:o,dtype:s}=fZ(e.type),a={uri:t,range:J(n)},c={name:r,context:o,dtype:s,location:a},l=Kt(e);return l&&(c.jsdoc=Yt(l,{returnMode:"named"})),s==="function"&&(c.params=mZ(e)),c}function dZ(e,t){let n=e.childForFieldName("var");if(!n)return null;let r=qe(n.text),o={uri:t,range:J(n)},s,a;switch(e.type){case"action_outer_set":case"patch_set":case"patch_assignment":s="set",a="int";break;case"action_outer_sprint":case"patch_sprint":s="sprint",a="string";break;case"action_outer_text_sprint":case"patch_text_sprint":s="text_sprint",a="string";break;case"patch_read_ascii":case"patch_read_strref":s="sprint",a="string";break;default:s="set",a="int"}let c={name:r,location:o,declarationKind:s,inferredType:a},l=e.childForFieldName("value");if(l){let d=l.text,f=50;d.length>f&&(d=d.slice(0,f)+"..."),c.value=d}let u=Kt(e);return u&&(c.jsdoc=Yt(u,{returnMode:"named"})),c}function fZ(e){let t=e.includes("dimorphic")?"dimorphic":e.includes("patch")?"patch":"action",n=e.includes("macro")?"macro":"function";return{context:t,dtype:n}}function mZ(e){let t={intVar:[],strVar:[],ret:[],retArray:[]};for(let n of e.children){if(!Object.hasOwn(uB,n.type))continue;let r=uB[n.type];if(r==="ret"||r==="retArray")for(let o of n.children)o.type==="identifier"&&t[r].push(o.text);else pZ(n,t[r])}return t}function pZ(e,t){let n=null,r=!1;for(let o of e.children){if(o.type===e.type||o.text==="INT_VAR"||o.text==="STR_VAR")continue;if(o.text==="="){r=!0;continue}if(["identifier","string","number","variable_ref","binary_expr","value"].includes(o.type)){if(r&&n!==null){t.push({name:n,defaultValue:o.text}),n=null,r=!1;continue}n!==null&&t.push({name:n}),n=o.text}}n!==null&&t.push({name:n})}function hZ(e,t){return t==="macro"?e==="action"?Se.ActionMacros:Se.PatchMacros:e==="dimorphic"?Se.DimorphicFunctions:e==="action"?Se.ActionFunctions:Se.PatchFunctions}function fB(e){if(typeof e=="object"&&"kind"in e&&"value"in e)return e}function gZ(e,t){let n=sB(e,t),r=fB(n.contents),o=t===null?void 0:t??aa(e.location.uri),s={label:e.name,kind:e.dtype==="macro"?gu.CompletionItemKind.Snippet:gu.CompletionItemKind.Function,documentation:r,labelDetails:{description:o},category:hZ(e.context,e.dtype)},a=new Map;if(e.jsdoc?.args)for(let l of e.jsdoc.args)a.set(l.name,{type:l.type,description:l.description,required:l.required});let c={context:e.context,dtype:e.dtype,description:e.jsdoc?.desc,params:e.params?{intVar:e.params.intVar.map(l=>{let u=a.get(l.name);return{name:l.name,type:u?.type??"int",defaultValue:l.defaultValue,description:u?.description,required:u?.required}}),strVar:e.params.strVar.map(l=>{let u=a.get(l.name);return{name:l.name,type:u?.type??"string",defaultValue:l.defaultValue,description:u?.description,required:u?.required}}),ret:e.params.ret,retArray:e.params.retArray}:void 0};return{name:e.name,kind:e.dtype==="macro"?K.Macro:K.Function,location:e.location,scope:{level:kt.Workspace},source:{type:Ee.Workspace,uri:e.location.uri,displayPath:t??aa(e.location.uri)},completion:s,hover:n,callable:c}}function _Z(e,t){let n=cB(e,t),r=fB(n.contents),o=t===null?void 0:t??aa(e.location.uri),s=Jr(e.name)?gu.CompletionItemKind.Constant:gu.CompletionItemKind.Variable,a={label:e.name,kind:s,documentation:r,labelDetails:{description:o},category:Se.Vars},c={type:e.jsdoc?.type??e.inferredType,value:e.value,declarationKind:e.declarationKind,description:e.jsdoc?.desc};return{name:e.name,kind:K.Variable,location:e.location,scope:{level:kt.Workspace},source:{type:Ee.Workspace,uri:e.location.uri,displayPath:o},completion:a,hover:n,variable:c}}function Gp(e,t,n){if(!Te())return bi;let r=ke(t);if(!r)return bi;let{functions:o,variables:s,refs:a}=dB(r.rootNode,e),c=n??{},l=c.skipPath?null:ca(e,c.workspaceRoot),u=[...o.map(d=>gZ(d,l)),...s.map(d=>_Z(d,l))];return{symbols:Ym(u,c.sourceType),refs:a}}function _C(e,t,n){return Vp(e,t).find(o=>o.name===n)??null}var pt=B(require("path")),_u=B(require("fs"));var mB=new Set(["itm","spl","eff","cre","baf","d","2da","tra","tp2","tph","tpa","tpp","ids","ini","txt","bmp","png","jpg","jpeg","gif"]),yZ=new Set(["action_copy","action_copy_large"]),bZ=new Set(["action_compile"]),SZ=new Set(["action_include"]),wZ=new Set(["action_copy_existing","action_copy_existing_regexp"]),xZ=new Set(["tilde_string","double_string","five_tilde_string"]),vZ=new Set(["file_pair"]);function pB(e,t,n,r){let o=rt(e,xZ);if(!o)return null;let s=rt(e,yZ),a=s??rt(e,bZ)??rt(e,SZ),c=rt(e,wZ);if(!a&&!c)return null;let l=Pp(o,n);if(c)return l;if(s){let y=rt(e,vZ)?.childForFieldName("to");if(y&&o.startIndex>=y.startIndex&&o.endIndex<=y.endIndex)return l}let u=qe(o.text).trim();if(!u)return l;let d=EZ(t,u);if(d!==null)return{uri:n,range:{start:{line:d,character:0},end:{line:d,character:0}}};let f=TZ(et(n)),m=RZ(u,n,f);if(m)return m;let p=PZ(u,r);if(p)return p;let g=NZ(u,n,f);return g||l}var CZ=new Set(["tra","msg"]);function PZ(e,t){if(t===void 0)return null;let n=e.replaceAll("\\","/");if(!n.includes("%"))return null;let r=n.split("/").pop()??"";if(!r||r.includes("%")||!CZ.has(pt.extname(r).slice(1).toLowerCase()))return null;let o=au(pt.join(t,r));return o?Ga(o):null}function NZ(e,t,n){let r=e.replaceAll("\\","/").split("/").pop()??"";if(!r||r.includes("%"))return null;let o=pt.extname(r).slice(1).toLowerCase();if(!mB.has(o))return null;let s=et(t),c=(n?.modFolder?pt.join(n.gameDir,n.modFolder):null)??(n?n.gameDir:pt.dirname(s)),l=[];if(hB(c,r.toLowerCase(),l,{count:0}),l.length===1){let u=l[0];if(u)return Ga(u)}return null}function hB(e,t,n,r){if(n.length>1||r.count>Cp)return;let o;try{o=_u.readdirSync(e,{withFileTypes:!0})}catch{return}for(let s of o){r.count++;let a=pt.join(e,s.name);if(s.isDirectory()?hB(a,t,n,r):s.name.toLowerCase()===t&&n.push(a),n.length>1||r.count>Cp)return}}function EZ(e,t){let n=t.toLowerCase(),r=e.split(`
342
- `);for(let[o,s]of r.entries())if(/^<<<<<<<<[ \t]*(\S+)/.exec(s)?.[1]?.toLowerCase()===n)return o;return null}function RZ(e,t,n){let r=et(t),o=e.replaceAll("\\","/").trim();if(n?.modFolder&&(o=o.replaceAll(/%MOD_FOLDER%/gi,n.modFolder)),o=o.replaceAll(/%TP2_FILE_NAME%/gi,pt.basename(r)),o.includes("%"))return null;let s=pt.extname(o).slice(1).toLowerCase();if(!mB.has(s))return null;let a=[];n?.gameDir&&a.push(n.gameDir),a.push(pt.dirname(r)),n?.gameDir&&n?.modFolder&&a.push(pt.join(n.gameDir,n.modFolder));for(let c of a){let l=au(pt.resolve(c,o));if(l)return Ga(l)}return null}function TZ(e){let t=AZ(e);if(!t)return null;let n=IZ(pt.basename(t)),r=pt.dirname(t),o=pt.basename(r);return o.toLowerCase()===n.toLowerCase()?{modFolder:o,gameDir:pt.dirname(r)}:{modFolder:DZ(t),gameDir:r}}function AZ(e){let t=pt.dirname(e);for(let n=0;n<16;n++){let r;try{r=_u.readdirSync(t)}catch{return null}let o=r.find(a=>a.toLowerCase().endsWith(".tp2"));if(o)return pt.join(t,o);let s=pt.dirname(t);if(s===t)return null;t=s}return null}function IZ(e){let t=e.replace(/\.tp2$/i,""),n=t.split("-");return n.length>1&&(n[0]??"").toUpperCase()==="SETUP"?n.slice(1).join("-"):t}function DZ(e){let t;try{t=_u.readFileSync(e,"latin1")}catch{return null}let n=t.replaceAll(/\/\*[\s\S]*?\*\//g," ").replaceAll(/\/\/[^\n]*/g," "),r=/\bBACKUP\b\s*[~"]([^~"]+)[~"]/i.exec(n)?.[1];return r&&r.replaceAll("\\","/").split("/")[0]||null}function gB(e,t,n,r,o){if(!Te())return null;let s=ke(e);if(!s)return null;let a=jn(s.rootNode,n);if(!a)return null;let c=kZ(a,e,t,r);if(c)return c;if(!zp(s.rootNode,n)){let d=Rq(e,t,n,r);if(d)return d}let l=FZ(a,e,t,r);if(l)return l;let u=pB(a,e,t,o);return u||null}function zp(e,t){let n=jn(e,t);if(!n)return!1;let r=rt(n,mn);if(!r)return!1;let o=n,s=!1;for(;o&&o!==r;){if(o.type==="int_var_call_item"||o.type==="str_var_call_item"||o.type==="ret_call_item"||o.type==="ret_array_call_item"){s=!0;break}o=o.parent}if(!s||!o)return!1;let a=o.children[0];return!(!a||n.startIndex<a.startIndex||n.endIndex>a.endIndex)}function kZ(e,t,n,r){let o=e;for(;o.parent;)o=o.parent;let s={line:e.startPosition.row,character:e.startPosition.column};if(!zp(o,s))return null;let a=rt(e,mn);if(!a)return null;let c=a.childForFieldName("name");if(!c)return null;let l=c.text,u=_C(t,n,l);if(u)return u.location;let d=r?.lookupDefinition(l);return d||null}function FZ(e,t,n,r){let o=e;for(;o.parent;)o=o.parent;let s={line:e.startPosition.row,character:e.startPosition.column},a=pu(o,s);if(!a)return null;let c=_C(t,n,a.name);if(c)return c.location;let l=r?.lookupDefinition(a.name);return l||null}var LZ=new Set(["SOURCE_FILE","SOURCE_RES","SOURCE_EXT","SOURCE_DIRECTORY","DEST_FILE","DEST_RES","DEST_EXT","DEST_DIRECTORY","COMPONENT_NUMBER","TP2_FILE_NAME","TP2_BASE_NAME","LANGUAGE"]);function yu(e,t){let n=jn(e,t);if(!n)return null;if(n.type==="%"){let o=n.parent;o&&o.type==="percent_string"&&(n=o)}if(xi.has(n.type)){let o=ec(e,t);if(o)return o}if(n.type==="percent_string"||n.type==="percent_content"||n.type==="variable_ref")return ec(e,t);if(xi.has(n.type)){let o=pu(e,t);if(o)return o}if(n.type==="identifier"||n.type==="string"){let o=pu(e,t);if(o)return o;let s=n.text,a=rt(n,_s);if(a){if(rt(n,mn))return null;if(wo.has(a.type)){let f=a.childForFieldName("key_var"),m=a.childForFieldName("value_var"),p=a.childForFieldName("var");if(f&&en(f,n)||m&&en(m,n)||p&&en(p,n))return{name:s,kind:"variable",scope:Ot.Loop,loopNode:a,node:n}}let u=aC(n),d=u?Ot.Function:Ot.File;return{name:s,kind:"variable",scope:d,functionNode:u??void 0,node:n}}let c=rt(n,new Set(["array_access"]));if(c){let l=c.childForFieldName("name");if(l&&en(l,n))return ec(e,t)}if(n.type==="identifier"){let l=rt(n,mn);if(l){let u=n.parent;for(;u&&!en(u,l);){if(u.type==="int_var_call_item"||u.type==="str_var_call_item"||u.type==="ret_call_item"||u.type==="ret_array_call_item"){let d=u.children[0];if(d&&n.startIndex>=d.startIndex&&n.endIndex<=d.endIndex)return null;break}u=u.parent}}return ec(e,t)}}return null}function Kp(e,t,n){let r=cC(e);if(!r||en(r,n))return!1;let o=r;for(;o;){if(en(o,n))return!!lC(r,t);o=o.parent}return!1}function _B(e){let t=e.parent;if(!t)return!1;let n=t.parent;if(n&&(n.type==="action_for_each"||n.type==="patch_for_each")){let r=n.childForFieldName("var");if(r&&r===t)return!0}if(t.type==="action_php_each"||t.type==="patch_php_each"){let r=t.childForFieldName("key_var"),o=t.childForFieldName("value_var");if(r&&en(r,e)||o&&en(o,e))return!0}return!1}function bu(e){return!LZ.has(e.name)}function Su(e,t){let n=[];t.kind==="variable"?OZ(e,t,n):MZ(e,t,n);let r=new Set;return n.filter(o=>{let s=`${o.node.startPosition.row}:${o.node.startPosition.column}-${o.node.endPosition.row}:${o.node.endPosition.column}`;return r.has(s)?!1:(r.add(s),!0)})}function OZ(e,t,n){let r=e;t.scope===Ot.Loop&&t.loopNode?r=t.loopNode:t.scope===Ot.Function&&t.functionNode&&(r=t.functionNode);function o(s){if(s.type==="percent_content"){let a=s.text;if(a&&bt(a,t.name)){if(t.loopNode&&Kp(s,t.name,t.loopNode))return;s.parent&&s.parent.type==="percent_string"&&n.push({node:s.parent,isDefinition:!1})}}if(xi.has(s.type)){let a=$Z(s,t.name),c=t.loopNode?a.filter(l=>!Kp(l,t.name,t.loopNode)):a;n.push(...c.map(l=>({node:l,isDefinition:!1})))}if(s.type==="variable_ref"){let a=s.child(0),c=a?.text;if(c&&bt(c,t.name)&&!_B(s)){if(t.loopNode&&Kp(s,t.name,t.loopNode))return;n.push({node:a,isDefinition:!1})}}if(s.type==="patch_assignment"){let a=s.child(0);if(a&&a.type==="identifier"&&a.text==="FOR_EACH"){let l=s.child(2);if(l){let u=l;u.type==="value"&&(u=u.child(0)),u&&u.type==="variable_ref"&&(u=u.child(0)),u&&u.type==="identifier"&&bt(u.text,t.name)&&n.push({node:u,isDefinition:!0})}}}if(_s.has(s.type)){if(!wo.has(s.type)){let u=s.childForFieldName("var");u&&bt(qe(u.text),t.name)&&n.push({node:u,isDefinition:!0})}let c=s.childrenForFieldName("var");for(let u of c)u.type==="identifier"&&bt(u.text,t.name)&&n.push({node:u,isDefinition:!0});let l=s.childForFieldName("name");if(l){let u=l.child(0);u&&u.type==="variable_ref"&&(u=u.child(0)),u&&u.type==="identifier"&&bt(u.text,t.name)&&n.push({node:u,isDefinition:!0})}if(s.type==="action_php_each"||s.type==="patch_php_each"){let u=!t.loopNode||en(t.loopNode,s),d=s.childForFieldName("key_var");if(d){let p=d;d.type==="variable_ref"&&(p=d.child(0)),p&&p.type==="identifier"&&bt(p.text,t.name)&&u&&n.push({node:p,isDefinition:!0})}let f=s.childForFieldName("value_var");if(f){let p=f;f.type==="variable_ref"&&(p=f.child(0)),p&&p.type==="identifier"&&bt(p.text,t.name)&&u&&n.push({node:p,isDefinition:!0})}let m=s.childForFieldName("array");if(m){let p=m;m.type==="variable_ref"&&(p=m.child(0)),p&&p.type==="identifier"&&bt(p.text,t.name)&&n.push({node:p,isDefinition:!1})}}if(s.type==="action_for_each"||s.type==="patch_for_each"){let u=!t.loopNode||en(t.loopNode,s),d=s.childForFieldName("var");if(d){let f=d.child(0);f&&f.type==="variable_ref"&&(f=f.child(0)),f&&f.type==="identifier"&&bt(f.text,t.name)&&u&&n.push({node:f,isDefinition:!0})}}if(s.type==="int_var_decl"||s.type==="str_var_decl"||s.type==="ret_decl"||s.type==="ret_array_decl")for(let u of s.children)u.type==="identifier"&&bt(u.text,t.name)&&n.push({node:u,isDefinition:!0})}if(s.type==="array_access"){let a=s.childForFieldName("name");a&&a.type==="identifier"&&bt(a.text,t.name)&&n.push({node:a,isDefinition:!1})}for(let a of s.children)o(a)}o(r)}function MZ(e,t,n){function r(o){if(Xn.has(o.type)){let s=o.childForFieldName("name");if(s){let a=qe(s.text);bt(a,t.name)&&n.push({node:s,isDefinition:!0})}}if(mn.has(o.type)){let s=o.childForFieldName("name");if(s){let a=qe(s.text);bt(a,t.name)&&n.push({node:s,isDefinition:!1})}}for(let s of o.children)r(s)}r(e)}function yB(e,t,n){let r=n.row,o=n.column;for(let s=0;s<t;s++)e[s]===`
343
- `?(r++,o=0):o++;return{line:r,character:o}}function $Z(e,t){let n=e.text,r=[],o=/%([a-zA-Z_][a-zA-Z0-9_]*)%/g,s;for(;(s=o.exec(n))!==null;){let a=s[1];if(a!==void 0&&bt(a,t)){let c=s.index,l=s.index+s[0].length,u=yB(n,c,e.startPosition),d=yB(n,l,e.startPosition),f={type:"synthetic_percent_var",text:s[0],startPosition:{row:u.line,column:u.character},endPosition:{row:d.line,column:d.character},children:[],parent:e};r.push(f)}}return r}function bB(e,t,n,r,o){let s=ke(e);if(!s)return[];let a=yu(s.rootNode,t);if(!a||!bu(a))return[];let c=Su(s.rootNode,a);if(c.length===0)return[];let l=c.filter(u=>r||!u.isDefinition).map(u=>({uri:n,range:J(u.node)}));if(a.kind==="function"&&o){let u=o.lookup(a.name).filter(d=>d.uri!==n);return[...l,...u]}return l}function SB(e,t){if(!Te())return null;let n=ke(e);if(!n)return null;let r=yu(n.rootNode,t);return!r||!bu(r)||!Su(n.rootNode,r).some(a=>a.isDefinition)?null:{range:{start:{line:r.node.startPosition.row,character:r.node.startPosition.column},end:{line:r.node.endPosition.row,character:r.node.endPosition.column}},placeholder:r.name}}function wB(e,t,n,r){if(!Te())return null;let o=ke(e);if(!o)return null;let s=yu(o.rootNode,t);if(!s||!bu(s))return null;let a=Su(o.rootNode,s);if(a.length===0||!a.some(u=>u.isDefinition))return null;let l=a.map(u=>{let d=u.node,m=d.type==="synthetic_percent_var",p=d.type==="percent_string",g=m||p,h=(d.type==="string"||d.type==="tilde_string"||d.type==="double_string"||d.type==="five_tilde_string")&&s.kind==="function",y;if(g)y=`%${n}%`;else if(h){let w=d.text,_=w[0],b=w[w.length-1];_==="~"&&b==="~"?y=`~${n}~`:_==='"'&&b==='"'?y=`"${n}"`:y=w}else y=n;return{range:J(d),newText:y}});return{changes:{[r]:l}}}var qZ=new Set(["patch_set","action_outer_set"]),BZ=new Set(["patch_sprint","patch_text_sprint","action_outer_sprint","action_outer_text_sprint"]),jZ=new Map([["SET","patch_set"],["OUTER_SET","action_outer_set"],["SPRINT","patch_sprint"],["TEXT_SPRINT","patch_text_sprint"],["OUTER_SPRINT","action_outer_sprint"],["OUTER_TEXT_SPRINT","action_outer_text_sprint"]]);function CB(e){let t=jZ.get(e);if(t!==void 0){if(qZ.has(t))return`${e} \${1} = \${2}$0`;if(BZ.has(t))return`${e} \${1} "\${2}"$0`}}var yC=" ".repeat(Xr.indentSize),PB=yC,NB=yC.repeat(2);function EB(e,t,n){let r=e.params,o=r!==void 0&&(r.intVar.length>0||r.strVar.length>0||r.ret.length>0||r.retArray.length>0),s=r===void 0||o;if(!n&&!s)return null;if(n==="LAM"||n==="LPM")return`${n} ${t}$0`;let a=n?`${n} ${t}`:t;if(!s)return`${a} END$0`;let c=r?.intVar.filter(f=>f.required)??[],l=r?.strVar.filter(f=>f.required)??[],u=r?.ret??[],d=r?.retArray??[];if(c.length>0||l.length>0||u.length>0||d.length>0){let f=[a],m=1;return m=xB(f,"INT_VAR",c,m),xB(f,"STR_VAR",l,m),vB(f,"RET",u),vB(f,"RET_ARRAY",d),f.push("END"),f.join(`
339
+ `+l.desc;return Gt.found({contents:{kind:bq.MarkupKind.Markdown,value:d}})}function mu(e,t,n){let r=[];return qp(e,(o,s,a)=>{o===t&&s.text===n&&r.push({node:s,isDefinition:a})}),r}function wq(e,t,n,r,o){let s=lt(e);if(!s)return[];let a=wi(s.rootNode,t);if(!a)return[];let c=a.labelNode.text,l=mu(s.rootNode,a.dialogFile,c),u=l.some(f=>f.isDefinition),d=l.filter(f=>r||!f.isDefinition).map(f=>({uri:n,range:J(f.node)}));if(o){let f=`${a.dialogFile}:${c}`,m=o.lookup(f).filter(p=>p.uri!==n);return u?[...d,...m]:m}return u?d:[]}var v7=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function xq(e,t){if(!ct())return null;let n=lt(e);if(!n)return null;let r=wi(n.rootNode,t);if(!r)return null;let o=mu(n.rootNode,r.dialogFile,r.labelNode.text);return o.some(a=>a.isDefinition)?(Bp={text:e,dialogFile:r.dialogFile,labelName:r.labelNode.text,refs:o},{range:J(r.labelNode),placeholder:r.labelNode.text}):(Bp=null,null)}function vq(e,t,n,r){if(!ct()||!v7.test(n))return null;let o=lt(e);if(!o)return null;let s=wi(o.rootNode,t);if(!s)return null;let a=Bp,c=a&&a.text===e&&a.dialogFile===s.dialogFile&&a.labelName===s.labelNode.text?a.refs:mu(o.rootNode,s.dialogFile,s.labelNode.text);if(Bp=null,c.length===0||!c.some(d=>d.isDefinition))return null;let u=c.map(d=>({range:J(d.node),newText:n}));return{changes:{[r]:u}}}var Bp=null;var Cq=B(le());function Pq(e){if(!ct())return[];let t=lt(e);if(!t)return[];let n=[];function r(o){if(o.type==="state"){let s=o.childForFieldName("label");if(s&&s.text){let a=s.startPosition,c=s.endPosition;n.push({name:s.text,kind:Cq.SymbolKind.Function,range:{start:{line:o.startPosition.row,character:o.startPosition.column},end:{line:o.endPosition.row,character:o.endPosition.column}},selectionRange:{start:{line:a.row,character:a.column},end:{line:c.row,character:c.column}}})}}for(let s of o.children)r(s)}return r(t.rootNode),n}var C7=new Set(["begin_action","append_action","chain_action","extend_action","interject_action","interject_copy_trans","replace_action","state","transition"]),P7=ho(ct,lt,C7),N7=go(ct,lt),rC=class{id=At;indexExtensions=[qo];fileIndex;storedContext;async init(t){this.storedContext=t,await lq(),this.fileIndex=new co(this.id);let n=On(At);this.fileIndex.loadStatic(n),dq(),T(`WeiDU D provider initialized with ${n.length} static symbols`)}shouldProvideFeatures(t,n){return!nC(t,n)}resolveSymbol(t,n,r){let o=Ba(t,this.fileIndex?.symbols);return o?.source.type===Ee.Static?o:void 0}format(t,n){return mo({text:t,uri:n,languageName:"D",isInitialized:ct,parse:lt,formatAst:(r,o)=>pv(r,o),getFormatOptions:po,normalizeForCompare:ns})}symbols(t){return Pq(t)}foldingRanges(t){return P7(t)}selectionRanges(t,n){return N7(t,n)}definition(t,n,r){return yq(t,r,n)}references(t,n,r,o,s){return ct()?wq(t,n,r,o,this.fileIndex?.refs):[]}prepareRename(t,n){return xq(t,n)}async rename(t,n,r,o){return vq(t,n,r,o)}hover(t,n,r,o){if(tC(t,o)){let s=fq(n);return s?.hover?Gt.found(s.hover):Gt.notHandled()}return Sq(t,n,r,o)}getCompletions(t){return ja(this.fileIndex?.symbols)}filterCompletions(t,n,r,o,s){let a=tC(n,r);return a?mq(a):nC(n,r)||pq(n,r)?[]:t}workspaceSymbols(t,n){return this.fileIndex?.symbols.searchWorkspaceSymbols(t,500,n)??[]}reloadFileData(t,n){if(ct()&&this.fileIndex){let r=_q(t,n,this.storedContext?.workspaceRoot);this.fileIndex.updateFile(t,r)}}onWatchedFileDeleted(t){this.fileIndex?.removeFile(t)}async compile(t,n,r){if(!this.storedContext){T("WeiDU D provider not initialized, cannot compile");return}await So(t,this.storedContext.settings.weidu,r,n)}},Nq=new rC;var xu=B(le()),UB=require("fs"),CC=require("path"),PC=require("url");var gu=B(le());var Eq=()=>Me.initOne(_n,"tree-sitter-weidu_tp2.wasm","WeiDU TP2");var Te=()=>Me.isInitialized(_n),ke=e=>Me.parseWithCache(_n,e);var Ot={File:"file",Function:"function",Loop:"loop"};function jn(e,t){function n(r){if(!$n(t,r))return null;for(let o of r.children){let s=n(o);if(s)return s}return r}return n(e)}function rt(e,t){let n=e;for(;n;){if(t.has(n.type))return n;n=n.parent}return null}function en(e,t){return e.startPosition.row===t.startPosition.row&&e.startPosition.column===t.startPosition.column&&e.endPosition.row===t.endPosition.row&&e.endPosition.column===t.endPosition.column&&e.text===t.text}function gs(e){return e.type==="variable_ref"?e.child(0)??e:e}function iC(e){if(e.type==="identifier")return e;for(let t of e.children){let n=iC(t);if(n)return n}return null}var E7=new Set(["patch_assignment"]),R7=new Set(["=","+=","-=","*=","/=","|=","&=","||=","&&="]);function jp(e){if(!E7.has(e.type))return!1;for(let t of e.children)if(R7.has(t.type))return t.startIndex===t.endIndex;return!0}function Jr(e){let t=e.split("_",1)[0];return t!==void 0&&t.length>0&&t===t.toUpperCase()&&/[A-Z]/.test(t)}function qe(e){if(e.length<2)return e;let t=e[0],n=e[e.length-1];return t==="~"&&n==="~"||t==='"'&&n==='"'||t==="%"&&n==="%"?e.slice(1,-1):e}var _s=new Set(["action_outer_set","action_outer_text_sprint","action_outer_sprint","patch_set","patch_text_sprint","patch_sprint","patch_sprintf","patch_assignment","int_var_decl","str_var_decl","ret_decl","ret_array_decl","patch_read_long","patch_read_short","patch_read_byte","patch_read_ascii","patch_read_strref","patch_read_2da_entry","patch_read_2da_entry_former","patch_read_2da_entries_now","action_define_array","action_define_associative_array","patch_define_array","patch_define_associative_array","action_php_each","patch_php_each","action_for_each","patch_for_each"]),oC=new Set(["int_var_decl","str_var_decl","ret_decl","ret_array_decl"]),xi=new Set(["tilde_content","double_content","five_tilde_content"]),Xn=new Set(["action_define_function","action_define_patch_function","action_define_dimorphic_function","action_define_macro","action_define_patch_macro"]),wo=new Set(["action_php_each","patch_php_each","action_for_each","patch_for_each"]);function sC(e){return rt(e,Xn)}function aC(e){return rt(e,wo)}function pu(e,t){let n=aC(t);if(n&&cC(n,e))return{scope:Ot.Loop,loopNode:n};let r=sC(t);return r?{scope:Ot.Function,functionNode:r}:{scope:Ot.File}}function cC(e,t){let n=e.childForFieldName("key_var"),r=e.childForFieldName("value_var"),o=e.childForFieldName("var");for(let s of[n,r,o]){if(!s)continue;let a=gs(s);if(a.type==="identifier"&&bt(a.text,t))return!0}return!1}function Rq(e){let t=new Set;for(let n of["key_var","value_var","var"]){let r=e.childForFieldName(n);if(!r)continue;let o=iC(r);o&&t.add(o.text)}return t}function T7(e,t){let n=e.text,r=A7(n,t,e.startPosition);if(r<0||r>n.length)return null;let o=/%([a-zA-Z_][a-zA-Z0-9_]*)%/g,s;for(;(s=o.exec(n))!==null;){let a=s.index,c=s.index+s[0].length;if(r>=a&&r<=c)return s[1]??null}return null}function A7(e,t,n){if(t.line<n.row||t.line===n.row&&t.character<n.column)return-1;let r=0,o=n.row,s=n.column;for(let a of e){if(o===t.line&&s===t.character)return r;a===`
340
+ `?(o++,s=0):s++,r++}return o===t.line&&s===t.character?r:-1}function bt(e,t){return e===t}function Tq(e,t,n,r){if(!Te())return null;let o=ke(e);if(!o)return null;let s=tc(o.rootNode,n);if(!s)return null;if(s.scope===Ot.File){let c=r?.lookupDefinition(s.name);if(c)return c}let a=I7(o.rootNode,s);return a?{uri:t,range:J(a)}:null}function tc(e,t){let n=jn(e,t);if(!n)return null;if(n.type==="%"){let o=n.parent;o&&o.type==="percent_string"&&(n=o)}if(n.type==="percent_string"){let o=n.child(1);if(o&&o.type==="percent_content"){let s=o.text;return s?{name:s,kind:"variable",...pu(s,n),node:n}:null}}if(n.type==="percent_content"){let o=n.text;return o?{name:o,kind:"variable",...pu(o,n),node:n.parent&&n.parent.type==="percent_string"?n.parent:n}:null}if(xi.has(n.type)){let o=T7(n,t);if(o)return{name:o,kind:"variable",...pu(o,n),node:n}}if(n.type==="variable_ref"){let o=n.child(0),s=o?.text;return s?{name:s,kind:"variable",...pu(s,n),node:o}:null}if(n.type==="identifier"){let o=n.text;return{name:o,kind:"variable",...pu(o,n),node:n}}return null}function I7(e,t){let n=e;return t.scope===Ot.Loop&&t.loopNode?n=t.loopNode:t.scope===Ot.Function&&t.functionNode&&(n=t.functionNode),D7(n,t.name,t)}function D7(e,t,n){let r=null;function o(s){if(!r){if(_s.has(s.type)){if(wo.has(s.type)){if(!n.loopNode||en(n.loopNode,s)){let d=s.childForFieldName("key_var"),f=s.childForFieldName("value_var"),m=s.childForFieldName("var");for(let p of[d,f,m]){if(!p)continue;let g=gs(p);if(g.type==="identifier"&&bt(g.text,t)){r=g;return}}}if(n.scope===Ot.Loop)return}let a=s.childForFieldName("var");if(a&&bt(qe(a.text),t)){r=a;return}let c=s.childrenForFieldName("var");for(let u of c)if(u.type==="identifier"&&bt(u.text,t)){r=u;return}let l=s.childForFieldName("name");if(l){let u=l.child(0);if(u){let d=gs(u);if(d.type==="identifier"&&bt(d.text,t)){r=d;return}}}if(s.type==="int_var_decl"||s.type==="str_var_decl"||s.type==="ret_decl"||s.type==="ret_array_decl"){for(let u of s.children)if(u.type==="identifier"&&bt(u.text,t)){r=u;return}}}for(let a of s.children)if(o(a),r)return}}return o(e),r}var mn=new Set(["action_launch_function","action_launch_macro","patch_launch_function","patch_launch_macro"]);function hu(e,t){let n=jn(e,t);if(!n)return null;if(k7(n)){let s=n.parent;return!s||!F7(s)?null:Wp(s,Xn)?{name:n.text,kind:"function",scope:Ot.File,node:s}:Wp(s,mn)?{name:n.text,kind:"function",scope:Ot.File,node:s}:null}return n.type!=="identifier"&&n.type!=="string"?null:Wp(n,Xn)?{name:qe(n.text),kind:"function",scope:Ot.File,node:n}:Wp(n,mn)?{name:qe(n.text),kind:"function",scope:Ot.File,node:n}:null}function Wp(e,t){let n=rt(e,t);if(!n)return null;let r=n.childForFieldName("name");return!r||!en(r,e)?null:qe(r.text)}function k7(e){return e.type==="tilde_content"||e.type==="double_content"||e.type==="five_tilde_content"}function F7(e){return e.type==="string"||e.type==="tilde_string"||e.type==="double_string"||e.type==="five_tilde_string"}var L7=new Set(["component"]),O7=new Set([...Xn,...mn]);function Iq(e,t){for(let n=0;n<e.childCount;n++){let r=e.child(n);if(!r||!Xn.has(r.type))continue;let o=r.childForFieldName("name");if(o&&qe(o.text)===t)return r}return null}function Dq(e,t){let n=e.childForFieldName("name");return n?{name:qe(n.text),kind:gu.SymbolKind.Function,uri:t,range:J(e),selectionRange:J(n)}:null}function M7(e,t){return{name:e,kind:gu.SymbolKind.Function,uri:t.uri,range:t.range,selectionRange:t.range}}function kq(e,t){t(e);for(let n of e.children)kq(n,t)}function Fq(e,t,n,r){let o=Iq(t,e);if(o)return Dq(o,n);let s=r(e);return s?M7(e,s):null}function Lq(e,t,n,r){if(!Te())return null;let o=ke(e);if(!o)return null;let s=jn(o.rootNode,t);if(!s)return null;let a=rt(s,O7);if(!a)return null;let c=a.childForFieldName("name");if(!c||s.startIndex<c.startIndex||s.endIndex>c.endIndex)return null;let l=qe(c.text),u=Fq(l,o.rootNode,n,r);return u?[u]:null}function Oq(e,t,n){if(!Te())return[];let r=t(e.uri);if(!r)return[];let o=ke(r);if(!o)return[];let s=Iq(o.rootNode,e.name);if(!s)return[];let a=new Map;kq(s,l=>{if(!mn.has(l.type))return;let u=l.childForFieldName("name");if(!u)return;let d=qe(u.text),f=a.get(d);f||(f={to:Fq(d,o.rootNode,e.uri,n),ranges:[]},a.set(d,f)),f.ranges.push(J(u))});let c=[];for(let{to:l,ranges:u}of a.values())l&&c.push({to:l,fromRanges:u});return c}var Aq={start:{line:0,character:0},end:{line:0,character:0}};function $7(e){let n=e.split(/[?#]/,1)[0].split("/").pop();return n?decodeURIComponent(n):e}function q7(e,t){let n=rt(e,Xn);if(n){let o=Dq(n,t);if(o)return o}let r=rt(e,L7);if(r){let o=r.childForFieldName("name");return{name:o?qe(o.text):"component",kind:gu.SymbolKind.Module,uri:t,range:J(r),selectionRange:J(o??r)}}return{name:$7(t),kind:gu.SymbolKind.File,uri:t,range:Aq,selectionRange:Aq}}function Mq(e,t,n){if(!Te())return[];let r=Cp(n),o=new Map;for(let s of t){let a=r(s.uri);if(!a)continue;let c=ke(a);if(!c)continue;let l=jn(c.rootNode,s.range.start);if(!l)continue;let u=rt(l,mn);if(!u)continue;let d=u.childForFieldName("name");if(!d||qe(d.text)!==e.name)continue;let f=q7(u,s.uri),m=`${f.uri}\0${f.name}\0${f.range.start.line}:${f.range.start.character}`,p=o.get(m);p||(p={from:f,ranges:[]},o.set(m,p)),p.ranges.push(J(d))}return[...o.values()].map(({from:s,ranges:a})=>({from:s,fromRanges:a}))}var $q=/^\s*(LAF|LPF|LAM|LPM|LAUNCH_ACTION_FUNCTION|LAUNCH_PATCH_FUNCTION|LAUNCH_ACTION_MACRO|LAUNCH_PATCH_MACRO)\s+\S*$/i,qq=/^\s*(?:LAF|LPF|LAUNCH_ACTION_FUNCTION|LAUNCH_PATCH_FUNCTION)\s+\S+\s+/i,Bq=/^\s*(?:OUTER_)?(?:SET|SPRINT|TEXT_SPRINT)\s+(?:(?:EVAL(?:UATE_BUFFER)?|GLOBAL)\s+)?\S*$/i,jq=new RegExp("^\\s*(DEFINE_(?:ACTION|PATCH)_(?:FUNCTION|MACRO)\\s+|(?:ACTION_)?DEFINE_(?:ASSOCIATIVE_)?ARRAY\\s+|(?:PATCH_|ACTION_)?(?:FOR_EACH|PHP_EACH)\\s+)\\S*$","i");function Wq(e,t=!1){let n=-1,r=-1,o=-1;for(let s of e.children)s.type===_e?n=s.endIndex:s.type===be?r=s.startIndex:t&&s.type==="identifier"&&o<0&&(o=s.endIndex);return{beginEnd:n,endStart:r,functionNameEnd:o}}var lC=null;function mC(){return lC}function Up(e,t,n,r){let o=e.parent;for(;o&&o!==n&&o.type!==t;)o=o.parent;if(o&&o!==n)return o;if(r){for(o=e.parent;o&&o!==n&&o.type!==r;)o=o.parent;if(o&&o!==n)return o}return null}function j7(e,t){return Gq(e,t,e,{sectionNode:null,sectionType:null,keywordPosition:-1})}function Gq(e,t,n,r){let o=r;if(e.startIndex<t){let s=e.text;(s==="INT_VAR"||s==="STR_VAR"||s==="RET"||s==="RET_ARRAY")&&(s==="INT_VAR"?o={sectionType:"INT_VAR",keywordPosition:e.endIndex,sectionNode:Up(e,"int_var_call",n)??r.sectionNode}:s==="STR_VAR"?o={sectionType:"STR_VAR",keywordPosition:e.endIndex,sectionNode:Up(e,"str_var_call",n,"int_var_call")??r.sectionNode}:s==="RET"?o={sectionType:"RET",keywordPosition:e.endIndex,sectionNode:Up(e,"ret_call",n)??r.sectionNode}:o={sectionType:"RET_ARRAY",keywordPosition:e.endIndex,sectionNode:Up(e,"ret_array_call",n)??r.sectionNode})}for(let s of e.children)o=Gq(s,t,n,o);return o}function Uq(e,t){lC=null;let n=e.childForFieldName("name");if(!n)return;let r=qe(n.text),{sectionType:o,sectionNode:s,keywordPosition:a}=j7(e,t);if(o!==null&&s!==null){let c=W7(s,a);lC={functionName:r,paramSection:o,usedParams:c}}}function W7(e,t){let n=[];for(let r of e.children){if(r.startIndex<=t)continue;let o=r.type;if(o==="int_var_call_item"||o==="str_var_call_item"){let s=r.children[0];s&&(s.type==="identifier"||s.type==="string")&&n.push(s.text)}else if(o==="identifier")n.push(r.text);else if(o==="ret_call_item"||o==="ret_array_call_item"){let s=r.children[0];s&&s.type==="identifier"&&n.push(s.text)}}return n}function zq(e){if(e.text==="="&&e.type==="=")return e.startIndex;for(let t of e.children){let n=zq(t);if(n>=0)return n}return-1}function uC(e,t){let n=zq(e);return n<0?"funcParamName":t<=n?"funcParamName":"funcParamValue"}function dC(e,t){function n(r){let o=r.type;if(o==="int_var_call_item"||o==="str_var_call_item"||o==="ret_call_item"||o==="ret_array_call_item"||o==="int_var_decl"||o==="str_var_decl"||o==="ret_decl"||o==="ret_array_decl")return t>=r.startIndex&&t<=r.endIndex?r:null;for(let a of r.children){let c=n(a);if(c)return c}return null}return n(e)}function Kq(e,t){let n=e.type;if(n==="action_launch_function"){if(Hq(t,e))return["lafName"];Uq(e,t);let r=dC(e,t);return r?[uC(r,t)]:["funcParamName"]}if(n==="action_launch_macro")return Vq(t,e)?["lamName"]:null;if(n==="patch_launch_macro")return Vq(t,e)?["lpmName"]:null;if(n==="patch_launch_function"){if(Hq(t,e))return["lpfName"];Uq(e,t);let r=dC(e,t);return r?[uC(r,t)]:["funcParamName"]}return null}function Yq(e,t){let n=e.type;return n==="action_define_patch_function"||n==="action_define_patch_macro"||n==="action_define_function"||n==="action_define_dimorphic_function"||n==="action_define_macro"?U7(e,t):null}function U7(e,t){let n=Wq(e,!0),{beginEnd:r,functionNameEnd:o}=n;if(o&&o>0&&t>o&&(r<0||t<r)){let s=dC(e,t);return s?[uC(s,t)]:["funcParamName"]}return null}function Hq(e,t){let n=-1,r=-1;for(let o of t.children){let s=o.text.toUpperCase();if(s==="LAF"||s==="LPF"||s==="LAUNCH_ACTION_FUNCTION"||s==="LAUNCH_PATCH_FUNCTION"){n=o.endIndex;continue}if(o.type==="identifier"){if(e>=o.startIndex&&e<=o.endIndex)return!0;if(e>o.endIndex)return!1}(s==="INT_VAR"||s==="STR_VAR"||s==="RET"||s==="RET_ARRAY"||s==="END")&&r<0&&(r=o.startIndex)}return n>0&&e>n&&(r<0||e<r)}function Vq(e,t){let n=-1;for(let r of t.children){let o=r.text.toUpperCase();if(o==="LAM"||o==="LPM"||o==="LAUNCH_ACTION_MACRO"||o==="LAUNCH_PATCH_MACRO"){n=r.endIndex;continue}if(r.type==="identifier"||r.type==="string"){if(e>=r.startIndex&&e<=r.endIndex)return!0;if(e>r.endIndex)return!1}}return n>0&&e>n}function Xq(e,t){let n=e;for(;n;){let r=Kq(n,t)??Yq(n,t);if(r)return r;n=n.parent}return[]}function Jq(e,t){let n=Pr(e,t);return Bq.test(n)?"assignment":jq.test(n)?"definition":!1}function H7(e,t,n){let o=Pr(e,{line:t,character:n}).match($q);if(!o||!o[1])return null;switch(o[1].toUpperCase()){case"LAF":case"LAUNCH_ACTION_FUNCTION":return"lafName";case"LPF":case"LAUNCH_PATCH_FUNCTION":return"lpfName";case"LAM":case"LAUNCH_ACTION_MACRO":return"lamName";case"LPM":case"LAUNCH_PATCH_MACRO":return"lpmName";default:return null}}function V7(e,t,n){let r=Pr(e,{line:t,character:n});return qq.test(r)?"funcParamName":null}function Qq(e,t,n){if(!Te())return[];let r=ke(e);if(!r)return[];let o=M$(e,t,n),s=r.rootNode.descendantForPosition({row:t,column:n});if(!s)return[];let a=Ip(r.rootNode,{line:t,character:n},"comment","line_comment");if(a==="jsdoc")return["jsdoc"];if(a==="comment")return["comment"];let c=Xq(s,o);if(c.length===0){let l=H7(e,t,n);if(l!==null)return[l];let u=V7(e,t,n);if(u!==null)return[u]}return c}var G7=new Set([Se.FuncVarKeyword]),tn=["lafName","lpfName","lamName","lpmName"],z7={[Se.ActionFunctions]:["lpfName","lamName","lpmName","funcParamName","funcParamValue"],[Se.PatchFunctions]:["lafName","lamName","lpmName","funcParamName","funcParamValue"],[Se.ActionMacros]:["lafName","lpfName","lpmName","funcParamName","funcParamValue"],[Se.PatchMacros]:["lafName","lpfName","lamName","funcParamName","funcParamValue"],[Se.DimorphicFunctions]:["lamName","lpmName","funcParamName","funcParamValue"],[Se.Prologue]:[...tn,"funcParamName","funcParamValue"],[Se.Flag]:[...tn,"funcParamName","funcParamValue"],[Se.Component]:[...tn,"funcParamName","funcParamValue"],[Se.ComponentFlag]:[...tn,"funcParamName","funcParamValue"],[Se.Language]:[...tn,"funcParamName","funcParamValue"],[Se.Action]:[...tn,"funcParamName","funcParamValue"],[Se.Patch]:[...tn,"funcParamName","funcParamValue"],[Se.Constants]:[...tn,"funcParamName"],[Se.Vars]:[...tn,"funcParamName"],[Se.Value]:[...tn,"funcParamName"],[Se.When]:[...tn,"funcParamName"],[Se.OptGlob]:[...tn,"funcParamName"],[Se.OptCase]:[...tn,"funcParamName"],[Se.OptExact]:[...tn,"funcParamName"],[Se.Caching]:[...tn,"funcParamName"],[Se.ArraySortType]:[...tn,"funcParamName"],[Se.FuncVarKeyword]:[...tn,"funcParamValue"]},pbe=new Set(["lafName","lpfName","lamName","lpmName","funcParamName","funcParamValue"]);function Zq(e,t){return t.length===0?e.filter(n=>n.category===void 0||!G7.has(n.category)):e.filter(n=>!K7(n,t))}function K7(e,t){if(t.length===0||e.category===void 0)return!1;let n=z7[e.category];return!n||n.length===0?!1:t.every(r=>n.includes(r))}var nc=B(le());function eB(e,t){let{functionName:n,paramSection:r,usedParams:o}=e,s=t?.lookup(n);if(!s||!Ea(s)||!s.callable.params)return[];let a=s.callable.params,c=new Set(o),l=[];switch(r){case"INT_VAR":{for(let u of a.intVar)c.has(u.name)||l.push(Hp(u));break}case"STR_VAR":{for(let u of a.strVar)c.has(u.name)||l.push(Hp(u));break}case"RET":{for(let u of a.ret)c.has(u)||l.push(Hp({name:u,type:"any"}));break}case"RET_ARRAY":{for(let u of a.retArray)c.has(u)||l.push(Hp({name:u,type:"array"}));break}}return l}function Hp(e){let{name:t,type:n,defaultValue:r,description:o,required:s}=e,c=r!==void 0&&!s?`${n??""} ${t} = ${r}`:`${n??""} ${t}`,u=[`\`\`\`${Bi}`,c,"```"];return o&&u.push("",o),{label:t,kind:nc.CompletionItemKind.Field,insertText:`${t} = `,insertTextFormat:nc.InsertTextFormat.PlainText,documentation:{kind:nc.MarkupKind.Markdown,value:u.join(`
341
+ `)},category:Se.FuncVarKeyword}}var rc=B(le());var Y7=new Set(["action_define_macro","action_define_patch_macro"]),X7=new Set(["action_define_array","action_define_associative_array","patch_define_array","patch_define_associative_array"]),J7=new Set(["action_outer_set","action_outer_sprint","action_outer_sprintf","action_outer_text_sprint","action_define_array","action_define_associative_array","action_for_each"]),Q7=new Set(["action_php_each"]),Z7=new Set(["action_outer_set","patch_set","patch_assignment","local_set","patch_read_byte","patch_read_short","patch_read_long"]),eZ=new Set(["action_define_array","action_define_associative_array","patch_define_array","patch_define_associative_array"]),tZ=new Set(["patch_set","patch_assignment","patch_sprint","patch_sprintf","patch_text_sprint","patch_define_array","patch_define_associative_array","patch_for_each","patch_read_byte","patch_read_short","patch_read_long","patch_read_ascii","patch_read_strref","patch_read_2da_entries_now","patch_read_2da_entry","patch_read_2da_entry_former","action_outer_set","action_outer_sprint","action_outer_sprintf","action_outer_text_sprint","action_define_array","action_define_associative_array","action_for_each","local_set","local_sprint"]),nZ=new Set(["patch_php_each","action_php_each"]);function rZ(e){let t=e.childrenForFieldName("var");for(let n of t)if(n.type==="identifier")return n;return null}function iZ(e,t){return X7.has(e)?rc.SymbolKind.Array:Jr(t)?rc.SymbolKind.Constant:rc.SymbolKind.Variable}function ys(e,t,n){let r=t.text;return r?{name:r,detail:n,kind:iZ(e.type,r),range:J(e),selectionRange:J(t)}:null}function tB(e){return Z7.has(e.type)?rZ(e):eZ.has(e.type)?e.childForFieldName("name"):e.childForFieldName("var")}function nB(e,t){let n=[];if(!e.hasError&&J7.has(e.type)){let r=tB(e);if(r&&r.text&&!t.has(r.text)){t.add(r.text);let o=ys(e,r);o&&n.push(o)}}else if(!e.hasError&&Q7.has(e.type)){let r=e.childForFieldName("key_var"),o=e.childForFieldName("value_var");if(r&&r.text&&!t.has(r.text)){t.add(r.text);let s=ys(e,r);s&&n.push(s)}if(o&&o.text&&!t.has(o.text)){t.add(o.text);let s=ys(e,o);s&&n.push(s)}}for(let r of e.children)$a(r.type)||n.push(...nB(r,t));return n}var oZ=new Set(["int_var_decl","str_var_decl"]);function sZ(e,t,n){let r=[];for(let o of e.children)if(oZ.has(o.type)){for(let s of o.children)if(s.type==="identifier"&&s.text&&!n.has(s.text)){n.add(s.text);let a=ys(s,s,t);a&&r.push(a)}}return r}function rB(e,t,n=new Set){let r=[];if(!e.hasError&&tZ.has(e.type)){let o=tB(e);if(o&&o.text&&!n.has(o.text)){n.add(o.text);let s=ys(e,o,t);s&&r.push(s)}}else if(!e.hasError&&nZ.has(e.type)){let o=e.childForFieldName("key_var"),s=e.childForFieldName("value_var");if(o&&o.text&&!n.has(o.text)){n.add(o.text);let a=ys(e,o,t);a&&r.push(a)}if(s&&s.text&&!n.has(s.text)){n.add(s.text);let a=ys(e,s,t);a&&r.push(a)}}for(let o of e.children)r.push(...rB(o,t,n));return r}function iB(e){if(!Te())return[];let t=ke(e);if(!t)return[];let n=[],r=new Set;for(let o of t.rootNode.children)if($a(o.type)){let s=o.childForFieldName("name");if(s&&s.text){let a=new Set,c=sZ(o,s.text,a),l=rB(o,s.text,a),u=[...c,...l],d=Y7.has(o.type)?rc.SymbolKind.Method:rc.SymbolKind.Function;n.push({name:s.text,kind:d,range:J(o),selectionRange:J(s),children:u.length>0?u:void 0})}}else n.push(...nB(o,r));return n}var _u=B(le());var pC=B(le());var oB=80;function hC(e){let t=new Map;if(!e)return t;for(let n of e)n.name&&t.set(n.name,n);return t}function aB(e,t){let n=new Map;if(e.jsdoc?.args)for(let c of e.jsdoc.args)n.set(c.name,{type:c.type,description:c.description,required:c.required});let r=`${e.context} ${e.dtype} ${e.name}`,o=t===null?void 0:t??cB(e.location.uri),s=aZ(e,n),a=Rv({signature:r,langId:Bi,filePath:o,description:e.jsdoc?.desc,paramTable:s||void 0,deprecated:e.jsdoc?.deprecated});return{contents:{kind:pC.MarkupKind.Markdown,value:a}}}function aZ(e,t){if(!e.params)return"";let n=(a,c)=>a.map(l=>{let u=t.get(l.name),d=!u?.required&&l.defaultValue!==void 0;return{type:u?.type??c,name:l.name,...d?{default:l.defaultValue}:{},...sB(u?.description)}}),r=hC(e.jsdoc?.rets),o=a=>a.map(c=>{let l=r.get(c),u=t.get(c);return{type:l?.type??u?.type??"",name:c,...sB(l?.description??u?.description)}}),s=[{label:"INT vars",rows:n(e.params.intVar,"int")},{label:"STR vars",rows:n(e.params.strVar,"string")},{label:"RET vars",rows:o(e.params.ret)},{label:"RET arrays",rows:o(e.params.retArray)}];return Z1(s)}function sB(e){if(!e)return{};let t=cZ(e);return t?{description:t}:{}}function cZ(e){if(e.length<=oB)return e;let t=/\[([^\]]+)\]\([^)]+\)/g,n,r=[];for(;(n=t.exec(e))!==null;)r.push({start:n.index,end:n.index+n[0].length});let o=oB-3;for(let s of r)if(o>s.start&&o<s.end){o=s.start;break}return o<=0?e:e.slice(0,o).trimEnd()+"..."}function cB(e){let t=e.replace(/^file:\/\//,""),n=t.lastIndexOf("/");return n!==-1?t.slice(n+1):t}function lB(e,t){let n=e.jsdoc?.type??e.inferredType,s=Jr(e.name)&&e.value!==void 0?`${n} ${e.name} = ${e.value}`:`${n} ${e.name}`,a=t===null?void 0:t??cB(e.location.uri),c=Rv({signature:s,langId:Bi,filePath:a,description:e.jsdoc?.desc,deprecated:e.jsdoc?.deprecated});return{contents:{kind:pC.MarkupKind.Markdown,value:c}}}var uB=new Set(["action_define_function","action_define_patch_function","action_define_dimorphic_function","action_define_macro","action_define_patch_macro"]),lZ=new Set(["action_outer_set","action_outer_sprint","action_outer_text_sprint","patch_set","patch_sprint","patch_text_sprint","patch_assignment","patch_read_byte","patch_read_short","patch_read_long","patch_read_ascii","patch_read_strref"]),dB={int_var_decl:"intVar",str_var_decl:"strVar",ret_decl:"ret",ret_array_decl:"retArray"};function Vp(e,t){if(!Te())return[];let n=ke(e);return n?uZ(n.rootNode,t):[]}function fB(e,t){let n=[],r=[],o=new Map,s=(c,l)=>{let u=o.get(c);u||(u=[],o.set(c,u)),u.push(l)};for(let c=0;c<e.childCount;c++){let l=e.child(c);if(l&&uB.has(l.type)){let u=dZ(l,t);u&&n.push(u)}}function a(c,l){let u=c.type;if(uB.has(u)){let d=c.childForFieldName("name");if(d){let f=qe(d.text);s(f,{uri:t,range:J(d)})}for(let f of c.children)a(f,!0);return}if(mn.has(u)){let d=c.childForFieldName("name");if(d){let f=qe(d.text);s(f,{uri:t,range:J(d)})}}else if(!l&&lZ.has(u)&&!jp(c)){let d=fZ(c,t);d&&r.push(d)}for(let d of c.children)a(d,l)}return a(e,!1),{functions:n,variables:r,refs:o}}function uZ(e,t){return fB(e,t).functions}function dZ(e,t){let n=e.childForFieldName("name");if(!n)return null;let r=qe(n.text),{context:o,dtype:s}=mZ(e.type),a={uri:t,range:J(n)},c={name:r,context:o,dtype:s,location:a},l=Kt(e);return l&&(c.jsdoc=Yt(l,{returnMode:"named"})),s==="function"&&(c.params=pZ(e)),c}function fZ(e,t){let n=e.childForFieldName("var");if(!n)return null;let r=qe(n.text),o={uri:t,range:J(n)},s,a;switch(e.type){case"action_outer_set":case"patch_set":case"patch_assignment":s="set",a="int";break;case"action_outer_sprint":case"patch_sprint":s="sprint",a="string";break;case"action_outer_text_sprint":case"patch_text_sprint":s="text_sprint",a="string";break;case"patch_read_ascii":case"patch_read_strref":s="sprint",a="string";break;default:s="set",a="int"}let c={name:r,location:o,declarationKind:s,inferredType:a},l=e.childForFieldName("value");if(l){let d=l.text,f=50;d.length>f&&(d=d.slice(0,f)+"..."),c.value=d}let u=Kt(e);return u&&(c.jsdoc=Yt(u,{returnMode:"named"})),c}function mZ(e){let t=e.includes("dimorphic")?"dimorphic":e.includes("patch")?"patch":"action",n=e.includes("macro")?"macro":"function";return{context:t,dtype:n}}function pZ(e){let t={intVar:[],strVar:[],ret:[],retArray:[]};for(let n of e.children){if(!Object.hasOwn(dB,n.type))continue;let r=dB[n.type];if(r==="ret"||r==="retArray")for(let o of n.children)o.type==="identifier"&&t[r].push(o.text);else hZ(n,t[r])}return t}function hZ(e,t){let n=null,r=!1;for(let o of e.children){if(o.type===e.type||o.text==="INT_VAR"||o.text==="STR_VAR")continue;if(o.text==="="){r=!0;continue}if(["identifier","string","number","variable_ref","binary_expr","value"].includes(o.type)){if(r&&n!==null){t.push({name:n,defaultValue:o.text}),n=null,r=!1;continue}n!==null&&t.push({name:n}),n=o.text}}n!==null&&t.push({name:n})}function gZ(e,t){return t==="macro"?e==="action"?Se.ActionMacros:Se.PatchMacros:e==="dimorphic"?Se.DimorphicFunctions:e==="action"?Se.ActionFunctions:Se.PatchFunctions}function mB(e){if(typeof e=="object"&&"kind"in e&&"value"in e)return e}function _Z(e,t){let n=aB(e,t),r=mB(n.contents),o=t===null?void 0:t??aa(e.location.uri),s={label:e.name,kind:e.dtype==="macro"?_u.CompletionItemKind.Snippet:_u.CompletionItemKind.Function,documentation:r,labelDetails:{description:o},category:gZ(e.context,e.dtype)},a=new Map;if(e.jsdoc?.args)for(let l of e.jsdoc.args)a.set(l.name,{type:l.type,description:l.description,required:l.required});let c={context:e.context,dtype:e.dtype,description:e.jsdoc?.desc,params:e.params?{intVar:e.params.intVar.map(l=>{let u=a.get(l.name);return{name:l.name,type:u?.type??"int",defaultValue:l.defaultValue,description:u?.description,required:u?.required}}),strVar:e.params.strVar.map(l=>{let u=a.get(l.name);return{name:l.name,type:u?.type??"string",defaultValue:l.defaultValue,description:u?.description,required:u?.required}}),ret:e.params.ret,retArray:e.params.retArray}:void 0};return{name:e.name,kind:e.dtype==="macro"?K.Macro:K.Function,location:e.location,scope:{level:kt.Workspace},source:{type:Ee.Workspace,uri:e.location.uri,displayPath:t??aa(e.location.uri)},completion:s,hover:n,callable:c}}function yZ(e,t){let n=lB(e,t),r=mB(n.contents),o=t===null?void 0:t??aa(e.location.uri),s=Jr(e.name)?_u.CompletionItemKind.Constant:_u.CompletionItemKind.Variable,a={label:e.name,kind:s,documentation:r,labelDetails:{description:o},category:Se.Vars},c={type:e.jsdoc?.type??e.inferredType,value:e.value,declarationKind:e.declarationKind,description:e.jsdoc?.desc};return{name:e.name,kind:K.Variable,location:e.location,scope:{level:kt.Workspace},source:{type:Ee.Workspace,uri:e.location.uri,displayPath:o},completion:a,hover:n,variable:c}}function Gp(e,t,n){if(!Te())return bi;let r=ke(t);if(!r)return bi;let{functions:o,variables:s,refs:a}=fB(r.rootNode,e),c=n??{},l=c.skipPath?null:ca(e,c.workspaceRoot),u=[...o.map(d=>_Z(d,l)),...s.map(d=>yZ(d,l))];return{symbols:Xm(u,c.sourceType),refs:a}}function gC(e,t,n){return Vp(e,t).find(o=>o.name===n)??null}var pt=B(require("path")),yu=B(require("fs"));var pB=new Set(["itm","spl","eff","cre","baf","d","2da","tra","tp2","tph","tpa","tpp","ids","ini","txt","bmp","png","jpg","jpeg","gif"]),bZ=new Set(["action_copy","action_copy_large"]),SZ=new Set(["action_compile"]),wZ=new Set(["action_include"]),xZ=new Set(["action_copy_existing","action_copy_existing_regexp"]),vZ=new Set(["tilde_string","double_string","five_tilde_string"]),CZ=new Set(["file_pair"]);function hB(e,t,n,r){let o=rt(e,vZ);if(!o)return null;let s=rt(e,bZ),a=s??rt(e,SZ)??rt(e,wZ),c=rt(e,xZ);if(!a&&!c)return null;let l=Np(o,n);if(c)return l;if(s){let y=rt(e,CZ)?.childForFieldName("to");if(y&&o.startIndex>=y.startIndex&&o.endIndex<=y.endIndex)return l}let u=qe(o.text).trim();if(!u)return l;let d=RZ(t,u);if(d!==null)return{uri:n,range:{start:{line:d,character:0},end:{line:d,character:0}}};let f=AZ(et(n)),m=TZ(u,n,f);if(m)return m;let p=NZ(u,r);if(p)return p;let g=EZ(u,n,f);return g||l}var PZ=new Set(["tra","msg"]);function NZ(e,t){if(t===void 0)return null;let n=e.replaceAll("\\","/");if(!n.includes("%"))return null;let r=n.split("/").pop()??"";if(!r||r.includes("%")||!PZ.has(pt.extname(r).slice(1).toLowerCase()))return null;let o=cu(pt.join(t,r));return o?Ga(o):null}function EZ(e,t,n){let r=e.replaceAll("\\","/").split("/").pop()??"";if(!r||r.includes("%"))return null;let o=pt.extname(r).slice(1).toLowerCase();if(!pB.has(o))return null;let s=et(t),c=(n?.modFolder?pt.join(n.gameDir,n.modFolder):null)??(n?n.gameDir:pt.dirname(s)),l=[];if(gB(c,r.toLowerCase(),l,{count:0}),l.length===1){let u=l[0];if(u)return Ga(u)}return null}function gB(e,t,n,r){if(n.length>1||r.count>Pp)return;let o;try{o=yu.readdirSync(e,{withFileTypes:!0})}catch{return}for(let s of o){r.count++;let a=pt.join(e,s.name);if(s.isDirectory()?gB(a,t,n,r):s.name.toLowerCase()===t&&n.push(a),n.length>1||r.count>Pp)return}}function RZ(e,t){let n=t.toLowerCase(),r=e.split(`
342
+ `);for(let[o,s]of r.entries())if(/^<<<<<<<<[ \t]*(\S+)/.exec(s)?.[1]?.toLowerCase()===n)return o;return null}function TZ(e,t,n){let r=et(t),o=e.replaceAll("\\","/").trim();if(n?.modFolder&&(o=o.replaceAll(/%MOD_FOLDER%/gi,n.modFolder)),o=o.replaceAll(/%TP2_FILE_NAME%/gi,pt.basename(r)),o.includes("%"))return null;let s=pt.extname(o).slice(1).toLowerCase();if(!pB.has(s))return null;let a=[];n?.gameDir&&a.push(n.gameDir),a.push(pt.dirname(r)),n?.gameDir&&n?.modFolder&&a.push(pt.join(n.gameDir,n.modFolder));for(let c of a){let l=cu(pt.resolve(c,o));if(l)return Ga(l)}return null}function AZ(e){let t=IZ(e);if(!t)return null;let n=DZ(pt.basename(t)),r=pt.dirname(t),o=pt.basename(r);return o.toLowerCase()===n.toLowerCase()?{modFolder:o,gameDir:pt.dirname(r)}:{modFolder:kZ(t),gameDir:r}}function IZ(e){let t=pt.dirname(e);for(let n=0;n<16;n++){let r;try{r=yu.readdirSync(t)}catch{return null}let o=r.find(a=>a.toLowerCase().endsWith(".tp2"));if(o)return pt.join(t,o);let s=pt.dirname(t);if(s===t)return null;t=s}return null}function DZ(e){let t=e.replace(/\.tp2$/i,""),n=t.split("-");return n.length>1&&(n[0]??"").toUpperCase()==="SETUP"?n.slice(1).join("-"):t}function kZ(e){let t;try{t=yu.readFileSync(e,"latin1")}catch{return null}let n=t.replaceAll(/\/\*[\s\S]*?\*\//g," ").replaceAll(/\/\/[^\n]*/g," "),r=/\bBACKUP\b\s*[~"]([^~"]+)[~"]/i.exec(n)?.[1];return r&&r.replaceAll("\\","/").split("/")[0]||null}function _B(e,t,n,r,o){if(!Te())return null;let s=ke(e);if(!s)return null;let a=jn(s.rootNode,n);if(!a)return null;let c=FZ(a,e,t,r);if(c)return c;if(!zp(s.rootNode,n)){let d=Tq(e,t,n,r);if(d)return d}let l=LZ(a,e,t,r);if(l)return l;let u=hB(a,e,t,o);return u||null}function zp(e,t){let n=jn(e,t);if(!n)return!1;let r=rt(n,mn);if(!r)return!1;let o=n,s=!1;for(;o&&o!==r;){if(o.type==="int_var_call_item"||o.type==="str_var_call_item"||o.type==="ret_call_item"||o.type==="ret_array_call_item"){s=!0;break}o=o.parent}if(!s||!o)return!1;let a=o.children[0];return!(!a||n.startIndex<a.startIndex||n.endIndex>a.endIndex)}function FZ(e,t,n,r){let o=e;for(;o.parent;)o=o.parent;let s={line:e.startPosition.row,character:e.startPosition.column};if(!zp(o,s))return null;let a=rt(e,mn);if(!a)return null;let c=a.childForFieldName("name");if(!c)return null;let l=c.text,u=gC(t,n,l);if(u)return u.location;let d=r?.lookupDefinition(l);return d||null}function LZ(e,t,n,r){let o=e;for(;o.parent;)o=o.parent;let s={line:e.startPosition.row,character:e.startPosition.column},a=hu(o,s);if(!a)return null;let c=gC(t,n,a.name);if(c)return c.location;let l=r?.lookupDefinition(a.name);return l||null}var OZ=new Set(["SOURCE_FILE","SOURCE_RES","SOURCE_EXT","SOURCE_DIRECTORY","DEST_FILE","DEST_RES","DEST_EXT","DEST_DIRECTORY","COMPONENT_NUMBER","TP2_FILE_NAME","TP2_BASE_NAME","LANGUAGE"]);function bu(e,t){let n=jn(e,t);if(!n)return null;if(n.type==="%"){let o=n.parent;o&&o.type==="percent_string"&&(n=o)}if(xi.has(n.type)){let o=tc(e,t);if(o)return o}if(n.type==="percent_string"||n.type==="percent_content"||n.type==="variable_ref")return tc(e,t);if(xi.has(n.type)){let o=hu(e,t);if(o)return o}if(n.type==="identifier"||n.type==="string"){let o=hu(e,t);if(o)return o;let s=n.text,a=rt(n,_s);if(a){if(rt(n,mn))return null;if(wo.has(a.type)){let f=a.childForFieldName("key_var"),m=a.childForFieldName("value_var"),p=a.childForFieldName("var");if(f&&en(f,n)||m&&en(m,n)||p&&en(p,n))return{name:s,kind:"variable",scope:Ot.Loop,loopNode:a,node:n}}let u=sC(n),d=u?Ot.Function:Ot.File;return{name:s,kind:"variable",scope:d,functionNode:u??void 0,node:n}}let c=rt(n,new Set(["array_access"]));if(c){let l=c.childForFieldName("name");if(l&&en(l,n))return tc(e,t)}if(n.type==="identifier"){let l=rt(n,mn);if(l){let u=n.parent;for(;u&&!en(u,l);){if(u.type==="int_var_call_item"||u.type==="str_var_call_item"||u.type==="ret_call_item"||u.type==="ret_array_call_item"){let d=u.children[0];if(d&&n.startIndex>=d.startIndex&&n.endIndex<=d.endIndex)return null;break}u=u.parent}}return tc(e,t)}}return null}function Kp(e,t,n){let r=aC(e);if(!r||en(r,n))return!1;let o=r;for(;o;){if(en(o,n))return!!cC(r,t);o=o.parent}return!1}function yB(e){let t=e.parent;if(!t)return!1;let n=t.parent;if(n&&(n.type==="action_for_each"||n.type==="patch_for_each")){let r=n.childForFieldName("var");if(r&&r===t)return!0}if(t.type==="action_php_each"||t.type==="patch_php_each"){let r=t.childForFieldName("key_var"),o=t.childForFieldName("value_var");if(r&&en(r,e)||o&&en(o,e))return!0}return!1}function Su(e){return!OZ.has(e.name)}function wu(e,t){let n=[];t.kind==="variable"?MZ(e,t,n):$Z(e,t,n);let r=new Set;return n.filter(o=>{let s=`${o.node.startPosition.row}:${o.node.startPosition.column}-${o.node.endPosition.row}:${o.node.endPosition.column}`;return r.has(s)?!1:(r.add(s),!0)})}function MZ(e,t,n){let r=e;t.scope===Ot.Loop&&t.loopNode?r=t.loopNode:t.scope===Ot.Function&&t.functionNode&&(r=t.functionNode);function o(s){if(s.type==="percent_content"){let a=s.text;if(a&&bt(a,t.name)){if(t.loopNode&&Kp(s,t.name,t.loopNode))return;s.parent&&s.parent.type==="percent_string"&&n.push({node:s.parent,isDefinition:!1})}}if(xi.has(s.type)){let a=qZ(s,t.name),c=t.loopNode?a.filter(l=>!Kp(l,t.name,t.loopNode)):a;n.push(...c.map(l=>({node:l,isDefinition:!1})))}if(s.type==="variable_ref"){let a=s.child(0),c=a?.text;if(c&&bt(c,t.name)&&!yB(s)){if(t.loopNode&&Kp(s,t.name,t.loopNode))return;n.push({node:a,isDefinition:!1})}}if(s.type==="patch_assignment"){let a=s.child(0);if(a&&a.type==="identifier"&&a.text==="FOR_EACH"){let l=s.child(2);if(l){let u=l;u.type==="value"&&(u=u.child(0)),u&&u.type==="variable_ref"&&(u=u.child(0)),u&&u.type==="identifier"&&bt(u.text,t.name)&&n.push({node:u,isDefinition:!0})}}}if(_s.has(s.type)){if(!wo.has(s.type)){let u=s.childForFieldName("var");u&&bt(qe(u.text),t.name)&&n.push({node:u,isDefinition:!0})}let c=s.childrenForFieldName("var");for(let u of c)u.type==="identifier"&&bt(u.text,t.name)&&n.push({node:u,isDefinition:!0});let l=s.childForFieldName("name");if(l){let u=l.child(0);u&&u.type==="variable_ref"&&(u=u.child(0)),u&&u.type==="identifier"&&bt(u.text,t.name)&&n.push({node:u,isDefinition:!0})}if(s.type==="action_php_each"||s.type==="patch_php_each"){let u=!t.loopNode||en(t.loopNode,s),d=s.childForFieldName("key_var");if(d){let p=d;d.type==="variable_ref"&&(p=d.child(0)),p&&p.type==="identifier"&&bt(p.text,t.name)&&u&&n.push({node:p,isDefinition:!0})}let f=s.childForFieldName("value_var");if(f){let p=f;f.type==="variable_ref"&&(p=f.child(0)),p&&p.type==="identifier"&&bt(p.text,t.name)&&u&&n.push({node:p,isDefinition:!0})}let m=s.childForFieldName("array");if(m){let p=m;m.type==="variable_ref"&&(p=m.child(0)),p&&p.type==="identifier"&&bt(p.text,t.name)&&n.push({node:p,isDefinition:!1})}}if(s.type==="action_for_each"||s.type==="patch_for_each"){let u=!t.loopNode||en(t.loopNode,s),d=s.childForFieldName("var");if(d){let f=d.child(0);f&&f.type==="variable_ref"&&(f=f.child(0)),f&&f.type==="identifier"&&bt(f.text,t.name)&&u&&n.push({node:f,isDefinition:!0})}}if(s.type==="int_var_decl"||s.type==="str_var_decl"||s.type==="ret_decl"||s.type==="ret_array_decl")for(let u of s.children)u.type==="identifier"&&bt(u.text,t.name)&&n.push({node:u,isDefinition:!0})}if(s.type==="array_access"){let a=s.childForFieldName("name");a&&a.type==="identifier"&&bt(a.text,t.name)&&n.push({node:a,isDefinition:!1})}for(let a of s.children)o(a)}o(r)}function $Z(e,t,n){function r(o){if(Xn.has(o.type)){let s=o.childForFieldName("name");if(s){let a=qe(s.text);bt(a,t.name)&&n.push({node:s,isDefinition:!0})}}if(mn.has(o.type)){let s=o.childForFieldName("name");if(s){let a=qe(s.text);bt(a,t.name)&&n.push({node:s,isDefinition:!1})}}for(let s of o.children)r(s)}r(e)}function bB(e,t,n){let r=n.row,o=n.column;for(let s=0;s<t;s++)e[s]===`
343
+ `?(r++,o=0):o++;return{line:r,character:o}}function qZ(e,t){let n=e.text,r=[],o=/%([a-zA-Z_][a-zA-Z0-9_]*)%/g,s;for(;(s=o.exec(n))!==null;){let a=s[1];if(a!==void 0&&bt(a,t)){let c=s.index,l=s.index+s[0].length,u=bB(n,c,e.startPosition),d=bB(n,l,e.startPosition),f={type:"synthetic_percent_var",text:s[0],startPosition:{row:u.line,column:u.character},endPosition:{row:d.line,column:d.character},children:[],parent:e};r.push(f)}}return r}function SB(e,t,n,r,o){let s=ke(e);if(!s)return[];let a=bu(s.rootNode,t);if(!a||!Su(a))return[];let c=wu(s.rootNode,a);if(c.length===0)return[];let l=c.filter(u=>r||!u.isDefinition).map(u=>({uri:n,range:J(u.node)}));if(a.kind==="function"&&o){let u=o.lookup(a.name).filter(d=>d.uri!==n);return[...l,...u]}return l}function wB(e,t){if(!Te())return null;let n=ke(e);if(!n)return null;let r=bu(n.rootNode,t);return!r||!Su(r)||!wu(n.rootNode,r).some(a=>a.isDefinition)?null:{range:{start:{line:r.node.startPosition.row,character:r.node.startPosition.column},end:{line:r.node.endPosition.row,character:r.node.endPosition.column}},placeholder:r.name}}function xB(e,t,n,r){if(!Te())return null;let o=ke(e);if(!o)return null;let s=bu(o.rootNode,t);if(!s||!Su(s))return null;let a=wu(o.rootNode,s);if(a.length===0||!a.some(u=>u.isDefinition))return null;let l=a.map(u=>{let d=u.node,m=d.type==="synthetic_percent_var",p=d.type==="percent_string",g=m||p,h=(d.type==="string"||d.type==="tilde_string"||d.type==="double_string"||d.type==="five_tilde_string")&&s.kind==="function",y;if(g)y=`%${n}%`;else if(h){let w=d.text,_=w[0],b=w[w.length-1];_==="~"&&b==="~"?y=`~${n}~`:_==='"'&&b==='"'?y=`"${n}"`:y=w}else y=n;return{range:J(d),newText:y}});return{changes:{[r]:l}}}var BZ=new Set(["patch_set","action_outer_set"]),jZ=new Set(["patch_sprint","patch_text_sprint","action_outer_sprint","action_outer_text_sprint"]),WZ=new Map([["SET","patch_set"],["OUTER_SET","action_outer_set"],["SPRINT","patch_sprint"],["TEXT_SPRINT","patch_text_sprint"],["OUTER_SPRINT","action_outer_sprint"],["OUTER_TEXT_SPRINT","action_outer_text_sprint"]]);function PB(e){let t=WZ.get(e);if(t!==void 0){if(BZ.has(t))return`${e} \${1} = \${2}$0`;if(jZ.has(t))return`${e} \${1} "\${2}"$0`}}var _C=" ".repeat(Xr.indentSize),NB=_C,EB=_C.repeat(2);function RB(e,t,n){let r=e.params,o=r!==void 0&&(r.intVar.length>0||r.strVar.length>0||r.ret.length>0||r.retArray.length>0),s=r===void 0||o;if(!n&&!s)return null;if(n==="LAM"||n==="LPM")return`${n} ${t}$0`;let a=n?`${n} ${t}`:t;if(!s)return`${a} END$0`;let c=r?.intVar.filter(f=>f.required)??[],l=r?.strVar.filter(f=>f.required)??[],u=r?.ret??[],d=r?.retArray??[];if(c.length>0||l.length>0||u.length>0||d.length>0){let f=[a],m=1;return m=vB(f,"INT_VAR",c,m),vB(f,"STR_VAR",l,m),CB(f,"RET",u),CB(f,"RET_ARRAY",d),f.push("END"),f.join(`
344
344
  `)+"$0"}return`${a}
345
- ${yC}$0
346
- END`}function xB(e,t,n,r){if(n.length===0)return r;let o=Math.max(...n.map(s=>s.name.length));e.push(`${PB}${t}`);for(let s of n){let a=" ".repeat(o-s.name.length);e.push(`${NB}${s.name}${a} = \${${r++}}`)}return r}function vB(e,t,n){if(n.length!==0){e.push(`${PB}${t}`);for(let r of n)e.push(`${NB}${r}`)}}var RB=B(le());function TB(e,t,n,r){if(!Te())return null;let o=ke(e);if(!o)return null;let s=Vp(e,""),a=AB(o.rootNode,t,n,s,r);if(!a)return null;let{paramType:c,defaultValue:l,description:u,required:d}=a,m=l!==void 0&&!d?`${c} ${t} = ${l}`:`${c} ${t}`,p=qn(m,Bi);return u&&(p+=`
345
+ ${_C}$0
346
+ END`}function vB(e,t,n,r){if(n.length===0)return r;let o=Math.max(...n.map(s=>s.name.length));e.push(`${NB}${t}`);for(let s of n){let a=" ".repeat(o-s.name.length);e.push(`${EB}${s.name}${a} = \${${r++}}`)}return r}function CB(e,t,n){if(n.length!==0){e.push(`${NB}${t}`);for(let r of n)e.push(`${EB}${r}`)}}var TB=B(le());function AB(e,t,n,r){if(!Te())return null;let o=ke(e);if(!o)return null;let s=Vp(e,""),a=IB(o.rootNode,t,n,s,r);if(!a)return null;let{paramType:c,defaultValue:l,description:u,required:d}=a,m=l!==void 0&&!d?`${c} ${t} = ${l}`:`${c} ${t}`,p=qn(m,Bi);return u&&(p+=`
347
347
 
348
- `+u),{contents:{kind:RB.MarkupKind.Markdown,value:p}}}function AB(e,t,n,r,o){let s=e.type;if(s==="action_launch_function"||s==="patch_launch_function"){let a=e.startPosition,c=e.endPosition;if(n.line>=a.row&&n.line<=c.row&&(n.line>a.row||n.character>=a.column)&&(n.line<c.row||n.character<=c.column)){let u=e.childForFieldName("name");if(u){let d=qe(u.text),f=o?.lookup(d);if(f&&Ea(f)&&f.callable.params){let p=UZ(f.callable,t);if(p)return p}let m=r.find(p=>p.name===d);if(m?.params){let p=WZ(m,t);if(p)return p}}}}for(let a of e.children){let c=AB(a,t,n,r,o);if(c)return c}return null}function WZ(e,t){if(!e.params)return null;let n=J1(e.jsdoc),r=gC(e.jsdoc?.rets),o=n.get(t);for(let s of e.params.intVar)if(s.name===t)return{paramType:"int",defaultValue:s.defaultValue,description:o?.description,required:o?.required};for(let s of e.params.strVar)if(s.name===t)return{paramType:"string",defaultValue:s.defaultValue,description:o?.description,required:o?.required};for(let s of e.params.ret)if(s===t){let a=r.get(t);return a?{paramType:a.type,description:a.description}:{paramType:"any",description:o?.description,required:o?.required}}for(let s of e.params.retArray)if(s===t){let a=r.get(t);return a?{paramType:a.type,description:a.description}:{paramType:"array",description:o?.description,required:o?.required}}return null}function UZ(e,t){if(!e.params)return null;for(let n of e.params.intVar)if(n.name===t)return{paramType:n.type??"int",defaultValue:n.defaultValue,description:n.description,required:n.required};for(let n of e.params.strVar)if(n.name===t)return{paramType:n.type??"string",defaultValue:n.defaultValue,description:n.description,required:n.required};for(let n of e.params.ret)if(n===t)return{paramType:"any"};for(let n of e.params.retArray)if(n===t)return{paramType:"array"};return null}var bC=B(le());function IB(e){if(!Te())return[];let t=ke(e);if(!t)return[];let n=new Set;function r(o){if(_s.has(o.type)&&!jp(o)){let s=o.childForFieldName("var");s&&n.add(qe(s.text));let a=o.childrenForFieldName("var");for(let u of a)u.type==="identifier"&&n.add(u.text);let c=o.childForFieldName("name");if(c){let u=c.child(0);if(u){let d=gs(u);d.type==="identifier"&&n.add(d.text)}}if(new Set(["int_var_decl","str_var_decl","ret_decl","ret_array_decl"]).has(o.type))for(let u of o.children)u.type==="identifier"&&n.add(u.text);for(let u of[o.childForFieldName("key_var"),o.childForFieldName("value_var")]){if(!u)continue;let d=gs(u);d.type==="identifier"&&n.add(d.text)}}for(let s of o.children)r(s)}return r(t.rootNode),[...n].map(o=>({label:o,kind:Jr(o)?bC.CompletionItemKind.Constant:bC.CompletionItemKind.Variable,category:Se.Vars}))}var HZ=new Set(["comment","line_comment"]),DB=Ya(Te,ke,HZ),VZ=new Set(["tilde_string","double_string","five_tilde_string"]),SC=Xa(Te,ke,VZ),GZ=new Set(["action_php_each","patch_php_each","action_for_each","patch_for_each"]),zZ=new Set(["key_var","value_var","var"]);function kB(e,t){let n=jn(e,t);if(!n)return!1;let r=n;for(;r;){if(GZ.has(r.type)){for(let o of zZ){let s=r.childForFieldName(o);if(s&&n.startIndex>=s.startIndex&&n.endIndex<=s.endIndex)return!0}return!1}r=r.parent}return!1}var Yp=new Ka;function wC(e,t){if(!Te())return null;let{symbols:n}=Gp(t,e,{skipPath:!0}),r=new Map;for(let o of n)r.has(o.name)||r.set(o.name,o);return{symbols:n,byName:r}}function FB(e,t,n){return Yp.getOrParse(n,t,e,wC)?.symbols??[]}function LB(e,t,n){return Yp.getOrParse(n,t,e,wC)??{symbols:[],byName:new Map}}function OB(e,t,n,r){return Yp.getOrParse(r,n,t,wC)?.byName.get(e)}function MB(e){Yp.clear(e)}var xC=B(le());function KZ(e){let t=new Set;for(let n of e.children)if(sC.has(n.type))for(let r of n.children)r.type==="identifier"&&t.add(r.text);return t}function YZ(e){let t=e.parent;for(;t;){if(sC.has(t.type))return!0;if(Xn.has(t.type))return!1;t=t.parent}return!1}function Jp(e,t,n){n.push({line:e.startPosition.row,startChar:e.startPosition.column,length:e.endPosition.column-e.startPosition.column,tokenType:t,tokenModifiers:0})}function $B(e,t,n){let r=e.text,o=/%([a-zA-Z_][a-zA-Z0-9_]*)%/g,s;for(;(s=o.exec(r))!==null;){let a=s[1],c=t(a);if(!c)continue;let l=s.index+1,u=e.startPosition.row,d=e.startPosition.column,f=u,m=d;for(let p=0;p<l;p++)r[p]===`
349
- `?(f++,m=0):m++;n.push({line:f,startChar:m,length:a.length,tokenType:c,tokenModifiers:0})}}function vC(e,t,n,r,o){if(e.type==="identifier"&&t.has(e.text)){(!o||!YZ(e))&&Jp(e,n,r);return}if(e.type==="percent_string"){let s=e.child(1);s&&s.type==="percent_content"&&t.has(s.text)&&Jp(s,n,r);return}if(xi.has(e.type)){$B(e,s=>t.has(s)?n:void 0,r);return}for(let s of e.children)vC(s,t,n,r,o)}function Xp(e,t,n){if(Xn.has(e.type)){let r=KZ(e);r.size>0&&vC(e,r,xC.SemanticTokenTypes.parameter,n,!0);for(let o of e.children)Xp(o,t,n);return}if(wo.has(e.type)){let r=Eq(e);r.size>0&&vC(e,r,xC.SemanticTokenTypes.variable,n,!1);for(let o of e.children)Xp(o,t,n);return}if(t.size>0){if(e.type==="identifier"){let r=t.get(e.text);if(r){Jp(e,r,n);return}}if(e.type==="percent_string"){let r=e.child(1);if(r&&r.type==="percent_content"){let o=t.get(r.text);o&&Jp(r,o,n)}return}if(xi.has(e.type)){$B(e,r=>t.get(r),n);return}}for(let r of e.children)Xp(r,t,n)}var XZ=new Map;function qB(e,t){if(!Te())return[];let n=ke(e);if(!n)return[];let r=[];return Xp(n.rootNode,t??XZ,r),r}function BB(e){if(!cO(e)||!Jr(e.name))return;let t=e.variable.type;if(!t)return;let n=t.split(" ",1)[0];return iI.get(n)}var JZ=new Set(["action_define_function","action_define_dimorphic_function","action_define_macro","action_define_patch_function","action_define_patch_macro","action_if","action_try","patch_block","patch_for","patch_for_each","patch_if","patch_while","component","always_block","action_copy","inner_action","inner_patch","inner_patch_file","inner_patch_save"]),QZ=ho(Te,ke,JZ),ZZ=go(Te,ke);function eee(e,t,n){if(!t.includes("funcParamName"))return e;let r=pC();if(!r)return e;let o=Zq(r,n);return o.length===0?e:[...e,...o]}function tee(e,t,n,r,o){let s=t.includes("lafName")||t.includes("lpfName")||t.includes("lamName")||t.includes("lpmName");if(t.includes("funcParamName")||t.includes("funcParamValue"))return e;let c=(0,PC.extname)((0,NC.fileURLToPath)(r)).toLowerCase();return e.map(l=>{let u=l.category;if(u===Se.Action||u===Se.Patch){let g=CB(l.label);return g?{...l,insertText:g,insertTextFormat:wu.InsertTextFormat.Snippet}:l}let d=l.label,f=o?.lookup(d)??n.get(d);if(!f||!Ea(f))return l;let m=s?void 0:nee(f.callable.dtype,f.callable.context,c),p=EB(f.callable,d,m);return p?{...l,insertText:p,insertTextFormat:wu.InsertTextFormat.Snippet}:l})}function nee(e,t,n){let r=e==="macro";if(t==="patch")return r?"LPM":"LPF";if(t==="action")return r?"LAM":"LAF";if(t==="dimorphic")return n===".tpp"?"LPF":"LAF"}function jB(e,t,n){let{variablesOnly:r=!1,excludeWord:o}=n??{},s=new Set,a=[];for(let c of e.symbols)s.has(c.name)||o&&c.name===o||r&&c.completion.kind!==wu.CompletionItemKind.Variable||(s.add(c.name),a.push(c.completion));for(let c of IB(t)){let l=c.label;s.has(l)||o&&l===o||(s.add(l),a.push(c))}return a}function ree(e){return gp(Av,e).map(t=>({...t,category:Se.Jsdoc}))}var CC=class{id=_n;indexExtensions=[...sf];fileIndex;storedContext;async init(t){this.storedContext=t,await Nq(),this.fileIndex=new co(this.id);let n=On(_n);this.fileIndex.loadStatic(n),T(`WeiDU TP2 provider initialized with ${n.length} static symbols`)}resolveSymbol(t,n,r){let o=this.storedContext?.getDocumentVersion?.(r);return O1(t,n,o,r,this.fileIndex?.symbols,OB)}getCompletions(t){return this.fileIndex?this.fileIndex.symbols.query({excludeUri:t}).map(r=>r.completion):[]}filterCompletions(t,n,r,o,s){let a=(0,NC.fileURLToPath)(o),c=(0,PC.extname)(a).toLowerCase(),l=Jq(n,r.line,r.character);if(T(`[tp2] Completion contexts: [${l.join(", ")}] at ${r.line}:${r.character} in ${c}`),l.includes("comment"))return[];if(l.includes("jsdoc"))return ree(Pr(n,r));if(s==="@")return[];let u=Xq(n,r);if(u==="definition")return[];let d=Pr(n,r).match(/(\S+)$/)?.[1]??"",f=this.storedContext?.getDocumentVersion?.(o),m=LB(n,f,o);if(u==="assignment")return jB(m,n,{variablesOnly:!0,excludeWord:d});let p=jB(m,n,{excludeWord:d}),g=[...t,...p];if(SC(n,r))return g.filter(w=>w.category===Se.Vars);let h=eee(g,l,this.fileIndex?.symbols),y=tee(h,l,m.byName,o,this.fileIndex?.symbols);return Qq(y,l)}shouldProvideFeatures(t,n){return!DB(t,n)}isPositionInString(t,n){return SC(t,n)}hover(t,n,r,o){let s=TB(t,n,o,this.fileIndex?.symbols);if(s)return Gt.found(s);if(Te()){let a=ke(t);if(a){let c=zp(a.rootNode,o),l=kB(a.rootNode,o);if(c||l)return Gt.empty()}}return Gt.notHandled()}getSymbolDefinition(t){return this.fileIndex?.symbols.lookupDefinition(t)??null}definition(t,n,r){return gB(t,r,n,this.fileIndex?.symbols,this.storedContext?.getTranslationDir?.())}reloadFileData(t,n){if(Te()&&this.fileIndex){let r=Wo(t)?Ee.Workspace:Ee.Navigation,o=Gp(t,n,{workspaceRoot:this.storedContext?.workspaceRoot,sourceType:r});this.fileIndex.updateFile(t,o)}}onWatchedFileDeleted(t){this.fileIndex?.removeFile(t)}workspaceSymbols(t,n){return this.fileIndex?.symbols.searchWorkspaceSymbols(t,500,n)??[]}onDocumentClosed(t){MB(t)}async compile(t,n,r){if(!this.storedContext){T("WeiDU TP2 provider not initialized, cannot compile");return}await So(t,this.storedContext.settings.weidu,r,n)}format(t,n){return mo({text:t,uri:n,languageName:"TP2",isInitialized:Te,parse:ke,formatAst:(r,o)=>_v(r,o),getFormatOptions:po,normalizeForCompare:ns})}symbols(t){return rB(t)}foldingRanges(t){return QZ(t)}selectionRanges(t,n){return ZZ(t,n)}prepareCallHierarchy(t,n,r){return Fq(t,n,r,o=>this.lookupCallableDefinition(o))}incomingCalls(t){let n=this.fileIndex?.refsOf(t.name)??[];return Oq(t,n,r=>this.readFileText(r))}outgoingCalls(t){return Lq(t,n=>this.readFileText(n),n=>this.lookupCallableDefinition(n))}lookupCallableDefinition(t){return this.fileIndex?.symbols.lookupDefinition(t)??null}readFileText(t){try{return(0,WB.readFileSync)(et(t),"latin1")}catch{return null}}references(t,n,r,o,s){return Te()?bB(t,n,r,o,this.fileIndex?.refs):[]}async rename(t,n,r,o){return wB(t,n,r,o)}prepareRename(t,n){return SB(t,n)}semanticTokens(t,n){return qB(t,this.getTypedNames(t,n))}getTypedNames(t,n){let r=new Map;if(this.fileIndex)for(let s of this.fileIndex.symbols.query({})){let a=BB(s);a&&r.set(s.name,a)}let o=this.storedContext?.getDocumentVersion?.(n);for(let s of FB(t,o,n)){let a=BB(s);a&&r.set(s.name,a)}return r}},UB=new CC;var HB=/\S+/g;function iee(e){let t=[],n;for(HB.lastIndex=0;(n=HB.exec(e))!==null;)t.push({start:n.index,length:n[0].length});return t}function VB(e){let t=Er(e).split(`
350
- `),n=[],r=0,o=t[0]??"";/^2DA\s/i.test(o)&&(r=2);for(let[s,a]of t.entries()){if(s<r||a.length===0||a[0]===" "||a[0]===" ")continue;let c=iee(a);if(c.length!==0)for(let[l,u]of c.slice(1).entries())n.push({line:s,startChar:u.start,length:u.length,tokenType:_b[l%_b.length],tokenModifiers:0})}return n}var EC=class{id=eb;async init(t){T("Infinity 2DA provider initialized")}semanticTokens(t,n){return VB(t)}format(t,n){let r=Sv(t);return r.warning?{edits:[],warning:r.warning}:r.text===t?{edits:[]}:{edits:ka(t,r.text)}}},GB=new EC;var ZB=B(le());var KB=B(le()),zB=30,oee="bgforge-mls-string";function see(e){let t=e.replaceAll("\r","");return t=t.replaceAll(`
351
- `,"\\n"),t=t.replaceAll("*/","*\\/"),t.length>zB&&(t=t.slice(0,zB-3)+"..."),`/* ${t} */`}function xu(e){let t=see(e),n={kind:KB.MarkupKind.Markdown,value:`\`\`\`${oee}
348
+ `+u),{contents:{kind:TB.MarkupKind.Markdown,value:p}}}function IB(e,t,n,r,o){let s=e.type;if(s==="action_launch_function"||s==="patch_launch_function"){let a=e.startPosition,c=e.endPosition;if(n.line>=a.row&&n.line<=c.row&&(n.line>a.row||n.character>=a.column)&&(n.line<c.row||n.character<=c.column)){let u=e.childForFieldName("name");if(u){let d=qe(u.text),f=o?.lookup(d);if(f&&Ea(f)&&f.callable.params){let p=HZ(f.callable,t);if(p)return p}let m=r.find(p=>p.name===d);if(m?.params){let p=UZ(m,t);if(p)return p}}}}for(let a of e.children){let c=IB(a,t,n,r,o);if(c)return c}return null}function UZ(e,t){if(!e.params)return null;let n=J1(e.jsdoc),r=hC(e.jsdoc?.rets),o=n.get(t);for(let s of e.params.intVar)if(s.name===t)return{paramType:"int",defaultValue:s.defaultValue,description:o?.description,required:o?.required};for(let s of e.params.strVar)if(s.name===t)return{paramType:"string",defaultValue:s.defaultValue,description:o?.description,required:o?.required};for(let s of e.params.ret)if(s===t){let a=r.get(t);return a?{paramType:a.type,description:a.description}:{paramType:"any",description:o?.description,required:o?.required}}for(let s of e.params.retArray)if(s===t){let a=r.get(t);return a?{paramType:a.type,description:a.description}:{paramType:"array",description:o?.description,required:o?.required}}return null}function HZ(e,t){if(!e.params)return null;for(let n of e.params.intVar)if(n.name===t)return{paramType:n.type??"int",defaultValue:n.defaultValue,description:n.description,required:n.required};for(let n of e.params.strVar)if(n.name===t)return{paramType:n.type??"string",defaultValue:n.defaultValue,description:n.description,required:n.required};for(let n of e.params.ret)if(n===t)return{paramType:"any"};for(let n of e.params.retArray)if(n===t)return{paramType:"array"};return null}var yC=B(le());function DB(e){if(!Te())return[];let t=ke(e);if(!t)return[];let n=new Set;function r(o){if(_s.has(o.type)&&!jp(o)){let s=o.childForFieldName("var");s&&n.add(qe(s.text));let a=o.childrenForFieldName("var");for(let u of a)u.type==="identifier"&&n.add(u.text);let c=o.childForFieldName("name");if(c){let u=c.child(0);if(u){let d=gs(u);d.type==="identifier"&&n.add(d.text)}}if(new Set(["int_var_decl","str_var_decl","ret_decl","ret_array_decl"]).has(o.type))for(let u of o.children)u.type==="identifier"&&n.add(u.text);for(let u of[o.childForFieldName("key_var"),o.childForFieldName("value_var")]){if(!u)continue;let d=gs(u);d.type==="identifier"&&n.add(d.text)}}for(let s of o.children)r(s)}return r(t.rootNode),[...n].map(o=>({label:o,kind:Jr(o)?yC.CompletionItemKind.Constant:yC.CompletionItemKind.Variable,category:Se.Vars}))}var VZ=new Set(["comment","line_comment"]),kB=Ya(Te,ke,VZ),GZ=new Set(["tilde_string","double_string","five_tilde_string"]),bC=Xa(Te,ke,GZ),zZ=new Set(["action_php_each","patch_php_each","action_for_each","patch_for_each"]),KZ=new Set(["key_var","value_var","var"]);function FB(e,t){let n=jn(e,t);if(!n)return!1;let r=n;for(;r;){if(zZ.has(r.type)){for(let o of KZ){let s=r.childForFieldName(o);if(s&&n.startIndex>=s.startIndex&&n.endIndex<=s.endIndex)return!0}return!1}r=r.parent}return!1}var Yp=new Ka;function SC(e,t){if(!Te())return null;let{symbols:n}=Gp(t,e,{skipPath:!0}),r=new Map;for(let o of n)r.has(o.name)||r.set(o.name,o);return{symbols:n,byName:r}}function LB(e,t,n){return Yp.getOrParse(n,t,e,SC)?.symbols??[]}function OB(e,t,n){return Yp.getOrParse(n,t,e,SC)??{symbols:[],byName:new Map}}function MB(e,t,n,r){return Yp.getOrParse(r,n,t,SC)?.byName.get(e)}function $B(e){Yp.clear(e)}var wC=B(le());function YZ(e){let t=new Set;for(let n of e.children)if(oC.has(n.type))for(let r of n.children)r.type==="identifier"&&t.add(r.text);return t}function XZ(e){let t=e.parent;for(;t;){if(oC.has(t.type))return!0;if(Xn.has(t.type))return!1;t=t.parent}return!1}function Jp(e,t,n){n.push({line:e.startPosition.row,startChar:e.startPosition.column,length:e.endPosition.column-e.startPosition.column,tokenType:t,tokenModifiers:0})}function qB(e,t,n){let r=e.text,o=/%([a-zA-Z_][a-zA-Z0-9_]*)%/g,s;for(;(s=o.exec(r))!==null;){let a=s[1],c=t(a);if(!c)continue;let l=s.index+1,u=e.startPosition.row,d=e.startPosition.column,f=u,m=d;for(let p=0;p<l;p++)r[p]===`
349
+ `?(f++,m=0):m++;n.push({line:f,startChar:m,length:a.length,tokenType:c,tokenModifiers:0})}}function xC(e,t,n,r,o){if(e.type==="identifier"&&t.has(e.text)){(!o||!XZ(e))&&Jp(e,n,r);return}if(e.type==="percent_string"){let s=e.child(1);s&&s.type==="percent_content"&&t.has(s.text)&&Jp(s,n,r);return}if(xi.has(e.type)){qB(e,s=>t.has(s)?n:void 0,r);return}for(let s of e.children)xC(s,t,n,r,o)}function Xp(e,t,n){if(Xn.has(e.type)){let r=YZ(e);r.size>0&&xC(e,r,wC.SemanticTokenTypes.parameter,n,!0);for(let o of e.children)Xp(o,t,n);return}if(wo.has(e.type)){let r=Rq(e);r.size>0&&xC(e,r,wC.SemanticTokenTypes.variable,n,!1);for(let o of e.children)Xp(o,t,n);return}if(t.size>0){if(e.type==="identifier"){let r=t.get(e.text);if(r){Jp(e,r,n);return}}if(e.type==="percent_string"){let r=e.child(1);if(r&&r.type==="percent_content"){let o=t.get(r.text);o&&Jp(r,o,n)}return}if(xi.has(e.type)){qB(e,r=>t.get(r),n);return}}for(let r of e.children)Xp(r,t,n)}var JZ=new Map;function BB(e,t){if(!Te())return[];let n=ke(e);if(!n)return[];let r=[];return Xp(n.rootNode,t??JZ,r),r}function jB(e){if(!cO(e)||!Jr(e.name))return;let t=e.variable.type;if(!t)return;let n=t.split(" ",1)[0];return iI.get(n)}var QZ=new Set(["action_define_function","action_define_dimorphic_function","action_define_macro","action_define_patch_function","action_define_patch_macro","action_if","action_try","patch_block","patch_for","patch_for_each","patch_if","patch_while","component","always_block","action_copy","inner_action","inner_patch","inner_patch_file","inner_patch_save"]),ZZ=ho(Te,ke,QZ),eee=go(Te,ke);function tee(e,t,n){if(!t.includes("funcParamName"))return e;let r=mC();if(!r)return e;let o=eB(r,n);return o.length===0?e:[...e,...o]}function nee(e,t,n,r,o){let s=t.includes("lafName")||t.includes("lpfName")||t.includes("lamName")||t.includes("lpmName");if(t.includes("funcParamName")||t.includes("funcParamValue"))return e;let c=(0,CC.extname)((0,PC.fileURLToPath)(r)).toLowerCase();return e.map(l=>{let u=l.category;if(u===Se.Action||u===Se.Patch){let g=PB(l.label);return g?{...l,insertText:g,insertTextFormat:xu.InsertTextFormat.Snippet}:l}let d=l.label,f=o?.lookup(d)??n.get(d);if(!f||!Ea(f))return l;let m=s?void 0:ree(f.callable.dtype,f.callable.context,c),p=RB(f.callable,d,m);return p?{...l,insertText:p,insertTextFormat:xu.InsertTextFormat.Snippet}:l})}function ree(e,t,n){let r=e==="macro";if(t==="patch")return r?"LPM":"LPF";if(t==="action")return r?"LAM":"LAF";if(t==="dimorphic")return n===".tpp"?"LPF":"LAF"}function WB(e,t,n){let{variablesOnly:r=!1,excludeWord:o}=n??{},s=new Set,a=[];for(let c of e.symbols)s.has(c.name)||o&&c.name===o||r&&c.completion.kind!==xu.CompletionItemKind.Variable||(s.add(c.name),a.push(c.completion));for(let c of DB(t)){let l=c.label;s.has(l)||o&&l===o||(s.add(l),a.push(c))}return a}function iee(e){return _p(Tv,e).map(t=>({...t,category:Se.Jsdoc}))}var vC=class{id=_n;indexExtensions=[...af];fileIndex;storedContext;async init(t){this.storedContext=t,await Eq(),this.fileIndex=new co(this.id);let n=On(_n);this.fileIndex.loadStatic(n),T(`WeiDU TP2 provider initialized with ${n.length} static symbols`)}resolveSymbol(t,n,r){let o=this.storedContext?.getDocumentVersion?.(r);return O1(t,n,o,r,this.fileIndex?.symbols,MB)}getCompletions(t){return this.fileIndex?this.fileIndex.symbols.query({excludeUri:t}).map(r=>r.completion):[]}filterCompletions(t,n,r,o,s){let a=(0,PC.fileURLToPath)(o),c=(0,CC.extname)(a).toLowerCase(),l=Qq(n,r.line,r.character);if(T(`[tp2] Completion contexts: [${l.join(", ")}] at ${r.line}:${r.character} in ${c}`),l.includes("comment"))return[];if(l.includes("jsdoc"))return iee(Pr(n,r));if(s==="@")return[];let u=Jq(n,r);if(u==="definition")return[];let d=Pr(n,r).match(/(\S+)$/)?.[1]??"",f=this.storedContext?.getDocumentVersion?.(o),m=OB(n,f,o);if(u==="assignment")return WB(m,n,{variablesOnly:!0,excludeWord:d});let p=WB(m,n,{excludeWord:d}),g=[...t,...p];if(bC(n,r))return g.filter(w=>w.category===Se.Vars);let h=tee(g,l,this.fileIndex?.symbols),y=nee(h,l,m.byName,o,this.fileIndex?.symbols);return Zq(y,l)}shouldProvideFeatures(t,n){return!kB(t,n)}isPositionInString(t,n){return bC(t,n)}hover(t,n,r,o){let s=AB(t,n,o,this.fileIndex?.symbols);if(s)return Gt.found(s);if(Te()){let a=ke(t);if(a){let c=zp(a.rootNode,o),l=FB(a.rootNode,o);if(c||l)return Gt.empty()}}return Gt.notHandled()}getSymbolDefinition(t){return this.fileIndex?.symbols.lookupDefinition(t)??null}definition(t,n,r){return _B(t,r,n,this.fileIndex?.symbols,this.storedContext?.getTranslationDir?.())}reloadFileData(t,n){if(Te()&&this.fileIndex){let r=Wo(t)?Ee.Workspace:Ee.Navigation,o=Gp(t,n,{workspaceRoot:this.storedContext?.workspaceRoot,sourceType:r});this.fileIndex.updateFile(t,o)}}onWatchedFileDeleted(t){this.fileIndex?.removeFile(t)}workspaceSymbols(t,n){return this.fileIndex?.symbols.searchWorkspaceSymbols(t,500,n)??[]}onDocumentClosed(t){$B(t)}async compile(t,n,r){if(!this.storedContext){T("WeiDU TP2 provider not initialized, cannot compile");return}await So(t,this.storedContext.settings.weidu,r,n)}format(t,n){return mo({text:t,uri:n,languageName:"TP2",isInitialized:Te,parse:ke,formatAst:(r,o)=>gv(r,o),getFormatOptions:po,normalizeForCompare:ns})}symbols(t){return iB(t)}foldingRanges(t){return ZZ(t)}selectionRanges(t,n){return eee(t,n)}prepareCallHierarchy(t,n,r){return Lq(t,n,r,o=>this.lookupCallableDefinition(o))}incomingCalls(t){let n=this.fileIndex?.refsOf(t.name)??[];return Mq(t,n,r=>this.readFileText(r))}outgoingCalls(t){return Oq(t,n=>this.readFileText(n),n=>this.lookupCallableDefinition(n))}lookupCallableDefinition(t){return this.fileIndex?.symbols.lookupDefinition(t)??null}readFileText(t){try{return(0,UB.readFileSync)(et(t),"latin1")}catch{return null}}references(t,n,r,o,s){return Te()?SB(t,n,r,o,this.fileIndex?.refs):[]}async rename(t,n,r,o){return xB(t,n,r,o)}prepareRename(t,n){return wB(t,n)}semanticTokens(t,n){return BB(t,this.getTypedNames(t,n))}getTypedNames(t,n){let r=new Map;if(this.fileIndex)for(let s of this.fileIndex.symbols.query({})){let a=jB(s);a&&r.set(s.name,a)}let o=this.storedContext?.getDocumentVersion?.(n);for(let s of LB(t,o,n)){let a=jB(s);a&&r.set(s.name,a)}return r}},HB=new vC;var VB=/\S+/g;function oee(e){let t=[],n;for(VB.lastIndex=0;(n=VB.exec(e))!==null;)t.push({start:n.index,length:n[0].length});return t}function GB(e){let t=Er(e).split(`
350
+ `),n=[],r=0,o=t[0]??"";/^2DA\s/i.test(o)&&(r=2);for(let[s,a]of t.entries()){if(s<r||a.length===0||a[0]===" "||a[0]===" ")continue;let c=oee(a);if(c.length!==0)for(let[l,u]of c.slice(1).entries())n.push({line:s,startChar:u.start,length:u.length,tokenType:gb[l%gb.length],tokenModifiers:0})}return n}var NC=class{id=Zy;async init(t){T("Infinity 2DA provider initialized")}semanticTokens(t,n){return GB(t)}format(t,n){let r=bv(t);return r.warning?{edits:[],warning:r.warning}:r.text===t?{edits:[]}:{edits:ka(t,r.text)}}},zB=new NC;var ej=B(le());var YB=B(le()),KB=30,see="bgforge-mls-string";function aee(e){let t=e.replaceAll("\r","");return t=t.replaceAll(`
351
+ `,"\\n"),t=t.replaceAll("*/","*\\/"),t.length>KB&&(t=t.slice(0,KB-3)+"..."),`/* ${t} */`}function vu(e){let t=aee(e),n={kind:YB.MarkupKind.Markdown,value:`\`\`\`${see}
352
352
  ${e}
353
353
  \`\`\``},r={markup:n,hover:{contents:n}};return`/* ${e} */`===t?{...r,inlay:t}:{...r,inlay:t,inlayTooltip:e}}function xo(e,t){let n;t==="tra"?n=/@(\d+)\s*=\s*~([^~]*)~/gm:n=/{(\d+)}\s*{\w*}\s*{([^}]*)}/gm;let r=new Map,o=0,s=0,a=n.exec(e);for(;a!==null;){a.index===n.lastIndex&&n.lastIndex++;let c=a[1],l=a[2];if(c===void 0||l===void 0){a=n.exec(e);continue}for(let y=s;y<a.index;y++)e[y]===`
354
354
  `&&(o++,s=y+1);let u=o,d=a.index-s,f=a.index+a[0].length;for(let y=a.index;y<f;y++)e[y]===`
355
- `&&(o++,s=y+1);let m=o,p=f-s,g=xu(l),h={source:l,hover:g.hover,inlay:g.inlay,line:u,character:d,endLine:m,endCharacter:p};g.inlayTooltip!==void 0&&(h.inlayTooltip=g.inlayTooltip),r.set(c,h),a=n.exec(e)}return r}function YB(e,t){if(t==="msg"){let n=Ra.exec(e);if(n)return n[2]}if(t==="tra"){let n=$l.exec(e);return n?n[1]:e.substring(1)}}function XB(e,t){for(let[n,r]of e)if(!(t.line<r.line)&&!(t.line>r.endLine)&&!(t.line===r.line&&t.character<r.character)&&!(t.line===r.endLine&&t.character>r.endCharacter))return n}function JB(e){let t=e.startsWith(".")?e.slice(1).toLowerCase():e.toLowerCase();if(Vc.includes(t))return"tra";if(Gc.includes(t))return"msg"}var QB=60;function aee(e){let t=e.replaceAll("\r","").split(`
356
- `)[0]??"";return t.length>QB?t.slice(0,QB-3)+"...":t}function cee(e,t){return t==="tra"?`@${e}`:`{${e}}`}function ej(e,t){let n=xo(e,t),r=[];for(let[o,s]of n){let a=cee(o,t);r.push({name:a,detail:aee(s.source),kind:ZB.SymbolKind.String,range:{start:{line:s.line,character:s.character},end:{line:s.endLine,character:s.endCharacter}},selectionRange:{start:{line:s.line,character:s.character},end:{line:s.line,character:s.character+a.length}}})}return r}function tj(e,t){let n=xo(e,t),r=[];for(let o of n.values())o.endLine>o.line&&r.push({startLine:o.line,endLine:o.endLine});return r}function Qp(e,t,n){return{id:e,async init(r){T(`${e} provider initialized`)},format(r,o){let s=t(r);return s.warning?{edits:[],warning:s.warning}:s.text===r?{edits:[]}:{edits:ka(r,s.text)}},...n?{symbols:r=>ej(r,n),foldingRanges:r=>tj(r,n)}:{}}}var Zp=B(require("fs/promises")),eh=B(require("path"));async function nj(e,t,n){let o=e.split(`
357
- `)[n.line];if(!o)return null;let s=lee(o,n.character);return s?uee(s,t):null}function lee(e,t){let n=/~([^~]+)~/g,r;for(;(r=n.exec(e))!==null;){let o=r[1];if(!o)continue;let s=r.index+1,a=s+o.length;if(t>=s&&t<a)return o}return null}async function uee(e,t){let n=et(t),r=eh.dirname(n),o=await dee(r,e);return o?{uri:Ye(o),range:{start:{line:0,character:0},end:{line:0,character:0}}}:null}async function dee(e,t){let n=t.split(/[/\\]/),r=e;for(let o of n){let s;try{s=await Zp.readdir(r)}catch{return null}let a=s.find(c=>c.toLowerCase()===o.toLowerCase());if(!a)return null;r=eh.join(r,a)}try{if(!(await Zp.stat(r)).isFile())return null}catch{return null}return r}var RC=class{id=of;async init(t){T(`${of} provider initialized`)}definition(t,n,r){return nj(t,r,n)}},rj=new RC;var Oj=require("url"),sh=B(require("path")),Mj=B(le());var vu=B(require("fs")),Xt=B(require("path"));var uj=B(Bx());var ij=B(require("crypto")),nh=B(require("fs")),rc=B(require("path")),fee=new TextDecoder("utf-8",{fatal:!0}),oj=new TextDecoder("windows-1252"),mee=oj.decode(Uint8Array.from({length:256},(e,t)=>t)),pee=new Map([...mee].map((e,t)=>[e,t])),th=class extends Error{character;encoding;constructor(t,n){super(`Cannot save: character ${JSON.stringify(t)} is not representable in ${n}. Save the file as UTF-8 (or remove the character) to keep this edit.`),this.name="UnsupportedEncodingCharacterError",this.character=t,this.encoding=n}};function bs(e){try{return{text:fee.decode(e),encoding:"utf-8"}}catch{return{text:oj.decode(e),encoding:"windows-1252"}}}function sj(e,t){if(t==="utf-8")return Buffer.from(e,"utf8");let n=[];for(let r of e){let o=pee.get(r);if(o===void 0)throw new th(r,t);n.push(o)}return Buffer.from(n)}function aj(e,t){let n=rc.dirname(e),r=rc.join(n,`.${rc.basename(e)}.${ij.randomBytes(6).toString("hex")}.tmp`);nh.writeFileSync(r,t),nh.renameSync(r,e)}var cj=B(require("fs"));function TC(e){if(e)try{return cj.realpathSync(e)}catch{return}}function lj(e,t,n){return{directory:e.directory,data:new Map,consumers:new Map,consumerToTraKey:new Map,settings:e,workspaceRoot:t,resolvedWsRoot:TC(t),resolvedTraDirCache:null,notifyReload:n}}var hee=["msg","tra"];function Ss(e){let t;if(Xt.isAbsolute(e.directory))t=e.directory;else if(e.workspaceRoot)t=Xt.join(e.workspaceRoot,e.directory);else return;if(e.workspaceRoot){let n=Xt.relative(e.workspaceRoot,t);if(n===".."||n.startsWith(".."+Xt.sep)||Xt.isAbsolute(n)){T(`Translation: ignoring tra directory '${e.directory}' - resolves outside workspace root`,"warn");return}}return t}function gee(e){if(e.resolvedTraDirCache===null){let t=Ss(e);e.resolvedTraDirCache=TC(t)}return e.resolvedTraDirCache}async function dj(e){let t=new Map;if(!Vf(e))return T(`Translation: ${e} is not a directory, skipping`),t;for(let n of hee){let r=await o0(e,n),{results:o,errors:s}=await _ee(e,r,n);s.length>0&&T(`Translation: ${s.length} error(s) loading *.${n} from ${e}: ${s.map(a=>at(a)).join("; ")}`,"warn");for(let a of o)for(let[c,l]of a)t.set(c,l)}return t}async function _ee(e,t,n){let r=Wi(Ko),o=[],s=[];return await Promise.all(t.map(a=>r(async()=>{try{let c=await vu.promises.readFile(Xt.join(e,a)),{text:l}=bs(c),u=xo(l,n),d=new Map([[a,u]]);o.push(d)}catch(c){s.push(c)}}))),{results:o,errors:s}}function fj(e,t){let n=gee(e);if(n&&r0(n,t))return Xt.relative(n,t)}function rh(e,t){let n=Ss(e);if(n)return Xt.join(n,t)}function AC(e,t,n){let r=e.consumers.get(t);r||(r=new Set,e.consumers.set(t,r)),r.add(n),e.consumerToTraKey.set(n,t)}function mj(e,t){let n=e.consumerToTraKey.get(t);n!==void 0&&(e.consumerToTraKey.delete(t),e.consumers.get(n)?.delete(t))}async function pj(e){let t=e.workspaceRoot;if(!t)return;e.consumers=new Map,e.consumerToTraKey=new Map;let n=[...e.data.keys()].some(l=>l.endsWith(".msg")),r=[...e.data.keys()].some(l=>l.endsWith(".tra")),o=[];r&&o.push(...Vc),n&&o.push(...Gc);let s=[...new Set(o)];if(s.length===0)return;let a=await Gf(t,s),c=Wi(Ko);await Promise.all(a.map(l=>c(async()=>{let u=Xt.join(t,l);await yee(e,u,l)}))),T(`Translation: built consumer index with ${e.consumers.size} tra/msg file mappings`)}async function yee(e,t,n){let r;try{let o=await vu.promises.open(t,"r"),s;try{let c=Buffer.alloc(256),{bytesRead:l}=await o.read(c,0,256,0);s=bs(c.subarray(0,l)).text.split(/\r?\n/)[0]??""}finally{await o.close()}let a=Qm.exec(s);a&&a[1]&&(r=a[1])}catch{return}if(!r&&e.settings.auto_tra){let o=Xt.parse(n).name,s=Xt.extname(t).toLowerCase(),a=JB(s);if(a){let c=`${o}.${a}`;e.data.has(c)&&(r=c)}}r&&e.data.has(r)&&AC(e,r,t)}function hj(e,t){if(!e)return;let n=Xt.join(e,".bgforge.yml");try{vu.writeFileSync(n,uj.stringify({mls:{translation:{directory:t}}}),{flag:"wx"}),T(`Translation: created .bgforge.yml (translation.directory: ${t})`)}catch(r){if(r.code==="EEXIST")return;T(`Translation: could not create .bgforge.yml: ${at(r)}`,"warn")}}var gj=B(require("fs")),ic=B(require("path"));var _j=B(le());var ih=new Set([...cf,...lf]);function yj(e,t,n){if(t===qr&&n){let r=ic.extname(n).toLowerCase();return r===zn?Ra.test(e):r===yn||r===Jt?$l.test(e):Ra.test(e)||$l.test(e)}return!!(cf.includes(t)&&e.match(dO)||lf.includes(t)&&e.match(Ra))}function oh(e,t,n,r){if(t===qr&&n){let o=ic.extname(n).toLowerCase();if(o===zn)return"msg";if(o===yn||o===Jt)return"tra";if(r){let s=bee(r);if(s)return s}for(let s of e.data.keys()){if(s.endsWith(".msg"))return"msg";if(s.endsWith(".tra"))return"tra"}return}if(lf.includes(t))return"msg";if(cf.includes(t))return"tra"}function bee(e){let t=e.split(/\r?\n/g)[0];if(!t)return;let r=_O.exec(t)?.[1];if(r==="tra"||r==="msg")return r}function oc(e,t,n,r){let o=n.split(/\r?\n/g)[0];if(!o)return;let s=Qm.exec(o);if(s&&s[1])return s[1];if(e.settings.auto_tra){let a=oh(e,r,t,n);return a?`${ic.parse(t).name}.${a}`:void 0}}function bj(e,t){return`No translation entry ${e} in ${t}.`}function See(e){return`Translation file ${e} not found.`}function IC(e,t,n,r){let o=oh(e,r,t,n);if(!o)return null;let s=oc(e,t,n,r);if(!s)return null;let a=e.data.get(s);return a?{kind:"loaded",traExt:o,fileKey:s,traFile:a}:{kind:"file-missing",fileKey:s}}function Sj(e,t,n,r,o){let s=IC(e,r,n,o);if(!s)return null;if(s.kind==="file-missing")return{kind:"file-missing",fileKey:s.fileKey};let a=YB(t,s.traExt);if(!a)return T(`Translation: line key not found for ${t}`),null;let c=s.traFile.get(a);return c?{kind:"entry",entry:c,fileKey:s.fileKey}:{kind:"entry-missing",fileKey:s.fileKey,lineKey:a}}function wj(e,t,n,r,o){let s=Sj(e,t,n,r,o);return s?s.kind==="file-missing"?{contents:{kind:"plaintext",value:See(s.fileKey)}}:s.kind==="entry-missing"?null:s.entry.hover:null}function xj(e,t,n,r,o){let s=Sj(e,t,n,r,o);if(!s||s.kind!=="entry")return null;let a=rh(e,s.fileKey);return a?{uri:Ye(a),range:{start:{line:s.entry.line,character:s.entry.character},end:{line:s.entry.line,character:s.entry.character}}}:null}function vj(e,t,n){let r=[];if(t==="msg"){for(let o of e.matchAll(Xm)){let s=o[2];s&&r.push({entryNum:s,start:o.index,end:o.index+o[0].length})}for(let o of e.matchAll(Jm)){let s=o[2];if(!s)continue;let a=o.index+o[0].lastIndexOf(s);r.push({entryNum:s,start:a,end:a+s.length})}}else{let o=ic.extname(n).toLowerCase(),s=o===yn||o===Jt||o===".ts"?mO:fO;for(let a of e.matchAll(s)){let c=a[1];c&&r.push({entryNum:c,start:a.index,end:a.index+a[0].length})}}return r.sort((o,s)=>o.start-s.start),r}function Cj(e,t,n,r,o){let s=IC(e,t,n,r);if(s?.kind!=="loaded")return[];let a=[],c=Pj(n).split(`
358
- `),l=Math.min(o.end.line,c.length);for(let u=o.start.line;u<l;u++)for(let d of vj(c[u],s.traExt,t)){let f=s.traFile.get(d.entryNum);f&&a.push({position:{line:u,character:d.end},label:f.inlay,tooltip:f.inlayTooltip?{kind:_j.MarkupKind.Markdown,value:"```bgforge-mls-string\n"+f.inlayTooltip+"\n```"}:void 0,kind:2,paddingLeft:!0,paddingRight:!0})}return a}function Pj(e){let t=[...e],n="code";for(let r=0;r<e.length;r++){let o=e[r],s=e[r+1];n==="code"?o==="/"&&s==="/"?(n="line",t[r]=" ",t[r+1]=" ",r++):o==="/"&&s==="*"&&(n="block",t[r]=" ",t[r+1]=" ",r++):n==="line"?o===`
355
+ `&&(o++,s=y+1);let m=o,p=f-s,g=vu(l),h={source:l,hover:g.hover,inlay:g.inlay,line:u,character:d,endLine:m,endCharacter:p};g.inlayTooltip!==void 0&&(h.inlayTooltip=g.inlayTooltip),r.set(c,h),a=n.exec(e)}return r}function XB(e,t){if(t==="msg"){let n=Ra.exec(e);if(n)return n[2]}if(t==="tra"){let n=ql.exec(e);return n?n[1]:e.substring(1)}}function JB(e,t){for(let[n,r]of e)if(!(t.line<r.line)&&!(t.line>r.endLine)&&!(t.line===r.line&&t.character<r.character)&&!(t.line===r.endLine&&t.character>r.endCharacter))return n}function QB(e){let t=e.startsWith(".")?e.slice(1).toLowerCase():e.toLowerCase();if(Gc.includes(t))return"tra";if(zc.includes(t))return"msg"}var ZB=60;function cee(e){let t=e.replaceAll("\r","").split(`
356
+ `)[0]??"";return t.length>ZB?t.slice(0,ZB-3)+"...":t}function lee(e,t){return t==="tra"?`@${e}`:`{${e}}`}function tj(e,t){let n=xo(e,t),r=[];for(let[o,s]of n){let a=lee(o,t);r.push({name:a,detail:cee(s.source),kind:ej.SymbolKind.String,range:{start:{line:s.line,character:s.character},end:{line:s.endLine,character:s.endCharacter}},selectionRange:{start:{line:s.line,character:s.character},end:{line:s.line,character:s.character+a.length}}})}return r}function nj(e,t){let n=xo(e,t),r=[];for(let o of n.values())o.endLine>o.line&&r.push({startLine:o.line,endLine:o.endLine});return r}function Qp(e,t,n){return{id:e,async init(r){T(`${e} provider initialized`)},format(r,o){let s=t(r);return s.warning?{edits:[],warning:s.warning}:s.text===r?{edits:[]}:{edits:ka(r,s.text)}},...n?{symbols:r=>tj(r,n),foldingRanges:r=>nj(r,n)}:{}}}var Zp=B(require("fs/promises")),eh=B(require("path"));async function rj(e,t,n){let o=e.split(`
357
+ `)[n.line];if(!o)return null;let s=uee(o,n.character);return s?dee(s,t):null}function uee(e,t){let n=/~([^~]+)~/g,r;for(;(r=n.exec(e))!==null;){let o=r[1];if(!o)continue;let s=r.index+1,a=s+o.length;if(t>=s&&t<a)return o}return null}async function dee(e,t){let n=et(t),r=eh.dirname(n),o=await fee(r,e);return o?{uri:Ye(o),range:{start:{line:0,character:0},end:{line:0,character:0}}}:null}async function fee(e,t){let n=t.split(/[/\\]/),r=e;for(let o of n){let s;try{s=await Zp.readdir(r)}catch{return null}let a=s.find(c=>c.toLowerCase()===o.toLowerCase());if(!a)return null;r=eh.join(r,a)}try{if(!(await Zp.stat(r)).isFile())return null}catch{return null}return r}var EC=class{id=sf;async init(t){T(`${sf} provider initialized`)}definition(t,n,r){return rj(t,r,n)}},ij=new EC;var Mj=require("url"),sh=B(require("path")),$j=B(le());var Cu=B(require("fs")),Xt=B(require("path"));var dj=B(qx());var oj=B(require("crypto")),nh=B(require("fs")),ic=B(require("path")),mee=new TextDecoder("utf-8",{fatal:!0}),sj=new TextDecoder("windows-1252"),pee=sj.decode(Uint8Array.from({length:256},(e,t)=>t)),hee=new Map([...pee].map((e,t)=>[e,t])),th=class extends Error{character;encoding;constructor(t,n){super(`Cannot save: character ${JSON.stringify(t)} is not representable in ${n}. Save the file as UTF-8 (or remove the character) to keep this edit.`),this.name="UnsupportedEncodingCharacterError",this.character=t,this.encoding=n}};function bs(e){try{return{text:mee.decode(e),encoding:"utf-8"}}catch{return{text:sj.decode(e),encoding:"windows-1252"}}}function aj(e,t){if(t==="utf-8")return Buffer.from(e,"utf8");let n=[];for(let r of e){let o=hee.get(r);if(o===void 0)throw new th(r,t);n.push(o)}return Buffer.from(n)}function cj(e,t){let n=ic.dirname(e),r=ic.join(n,`.${ic.basename(e)}.${oj.randomBytes(6).toString("hex")}.tmp`);nh.writeFileSync(r,t),nh.renameSync(r,e)}var lj=B(require("fs"));function RC(e){if(e)try{return lj.realpathSync(e)}catch{return}}function uj(e,t,n){return{directory:e.directory,data:new Map,consumers:new Map,consumerToTraKey:new Map,settings:e,workspaceRoot:t,resolvedWsRoot:RC(t),resolvedTraDirCache:null,notifyReload:n}}var gee=["msg","tra"];function Ss(e){let t;if(Xt.isAbsolute(e.directory))t=e.directory;else if(e.workspaceRoot)t=Xt.join(e.workspaceRoot,e.directory);else return;if(e.workspaceRoot){let n=Xt.relative(e.workspaceRoot,t);if(n===".."||n.startsWith(".."+Xt.sep)||Xt.isAbsolute(n)){T(`Translation: ignoring tra directory '${e.directory}' - resolves outside workspace root`,"warn");return}}return t}function _ee(e){if(e.resolvedTraDirCache===null){let t=Ss(e);e.resolvedTraDirCache=RC(t)}return e.resolvedTraDirCache}async function fj(e){let t=new Map;if(!Gf(e))return T(`Translation: ${e} is not a directory, skipping`),t;for(let n of gee){let r=await o0(e,n),{results:o,errors:s}=await yee(e,r,n);s.length>0&&T(`Translation: ${s.length} error(s) loading *.${n} from ${e}: ${s.map(a=>at(a)).join("; ")}`,"warn");for(let a of o)for(let[c,l]of a)t.set(c,l)}return t}async function yee(e,t,n){let r=Wi(Ko),o=[],s=[];return await Promise.all(t.map(a=>r(async()=>{try{let c=await Cu.promises.readFile(Xt.join(e,a)),{text:l}=bs(c),u=xo(l,n),d=new Map([[a,u]]);o.push(d)}catch(c){s.push(c)}}))),{results:o,errors:s}}function mj(e,t){let n=_ee(e);if(n&&r0(n,t))return Xt.relative(n,t)}function rh(e,t){let n=Ss(e);if(n)return Xt.join(n,t)}function TC(e,t,n){let r=e.consumers.get(t);r||(r=new Set,e.consumers.set(t,r)),r.add(n),e.consumerToTraKey.set(n,t)}function pj(e,t){let n=e.consumerToTraKey.get(t);n!==void 0&&(e.consumerToTraKey.delete(t),e.consumers.get(n)?.delete(t))}async function hj(e){let t=e.workspaceRoot;if(!t)return;e.consumers=new Map,e.consumerToTraKey=new Map;let n=[...e.data.keys()].some(l=>l.endsWith(".msg")),r=[...e.data.keys()].some(l=>l.endsWith(".tra")),o=[];r&&o.push(...Gc),n&&o.push(...zc);let s=[...new Set(o)];if(s.length===0)return;let a=await zf(t,s),c=Wi(Ko);await Promise.all(a.map(l=>c(async()=>{let u=Xt.join(t,l);await bee(e,u,l)}))),T(`Translation: built consumer index with ${e.consumers.size} tra/msg file mappings`)}async function bee(e,t,n){let r;try{let o=await Cu.promises.open(t,"r"),s;try{let c=Buffer.alloc(256),{bytesRead:l}=await o.read(c,0,256,0);s=bs(c.subarray(0,l)).text.split(/\r?\n/)[0]??""}finally{await o.close()}let a=Zm.exec(s);a&&a[1]&&(r=a[1])}catch{return}if(!r&&e.settings.auto_tra){let o=Xt.parse(n).name,s=Xt.extname(t).toLowerCase(),a=QB(s);if(a){let c=`${o}.${a}`;e.data.has(c)&&(r=c)}}r&&e.data.has(r)&&TC(e,r,t)}function gj(e,t){if(!e)return;let n=Xt.join(e,".bgforge.yml");try{Cu.writeFileSync(n,dj.stringify({mls:{translation:{directory:t}}}),{flag:"wx"}),T(`Translation: created .bgforge.yml (translation.directory: ${t})`)}catch(r){if(r.code==="EEXIST")return;T(`Translation: could not create .bgforge.yml: ${at(r)}`,"warn")}}var _j=B(require("fs")),oc=B(require("path"));var yj=B(le());var ih=new Set([...lf,...uf]);function bj(e,t,n){if(t===qr&&n){let r=oc.extname(n).toLowerCase();return r===zn?Ra.test(e):r===yn||r===Jt?ql.test(e):Ra.test(e)||ql.test(e)}return!!(lf.includes(t)&&e.match(dO)||uf.includes(t)&&e.match(Ra))}function oh(e,t,n,r){if(t===qr&&n){let o=oc.extname(n).toLowerCase();if(o===zn)return"msg";if(o===yn||o===Jt)return"tra";if(r){let s=See(r);if(s)return s}for(let s of e.data.keys()){if(s.endsWith(".msg"))return"msg";if(s.endsWith(".tra"))return"tra"}return}if(uf.includes(t))return"msg";if(lf.includes(t))return"tra"}function See(e){let t=e.split(/\r?\n/g)[0];if(!t)return;let r=_O.exec(t)?.[1];if(r==="tra"||r==="msg")return r}function sc(e,t,n,r){let o=n.split(/\r?\n/g)[0];if(!o)return;let s=Zm.exec(o);if(s&&s[1])return s[1];if(e.settings.auto_tra){let a=oh(e,r,t,n);return a?`${oc.parse(t).name}.${a}`:void 0}}function Sj(e,t){return`No translation entry ${e} in ${t}.`}function wee(e){return`Translation file ${e} not found.`}function AC(e,t,n,r){let o=oh(e,r,t,n);if(!o)return null;let s=sc(e,t,n,r);if(!s)return null;let a=e.data.get(s);return a?{kind:"loaded",traExt:o,fileKey:s,traFile:a}:{kind:"file-missing",fileKey:s}}function wj(e,t,n,r,o){let s=AC(e,r,n,o);if(!s)return null;if(s.kind==="file-missing")return{kind:"file-missing",fileKey:s.fileKey};let a=XB(t,s.traExt);if(!a)return T(`Translation: line key not found for ${t}`),null;let c=s.traFile.get(a);return c?{kind:"entry",entry:c,fileKey:s.fileKey}:{kind:"entry-missing",fileKey:s.fileKey,lineKey:a}}function xj(e,t,n,r,o){let s=wj(e,t,n,r,o);return s?s.kind==="file-missing"?{contents:{kind:"plaintext",value:wee(s.fileKey)}}:s.kind==="entry-missing"?null:s.entry.hover:null}function vj(e,t,n,r,o){let s=wj(e,t,n,r,o);if(!s||s.kind!=="entry")return null;let a=rh(e,s.fileKey);return a?{uri:Ye(a),range:{start:{line:s.entry.line,character:s.entry.character},end:{line:s.entry.line,character:s.entry.character}}}:null}function Cj(e,t,n){let r=[];if(t==="msg"){for(let o of e.matchAll(Jm)){let s=o[2];s&&r.push({entryNum:s,start:o.index,end:o.index+o[0].length})}for(let o of e.matchAll(Qm)){let s=o[2];if(!s)continue;let a=o.index+o[0].lastIndexOf(s);r.push({entryNum:s,start:a,end:a+s.length})}}else{let o=oc.extname(n).toLowerCase(),s=o===yn||o===Jt||o===".ts"?mO:fO;for(let a of e.matchAll(s)){let c=a[1];c&&r.push({entryNum:c,start:a.index,end:a.index+a[0].length})}}return r.sort((o,s)=>o.start-s.start),r}function Pj(e,t,n,r,o){let s=AC(e,t,n,r);if(s?.kind!=="loaded")return[];let a=[],c=Nj(n).split(`
358
+ `),l=Math.min(o.end.line,c.length);for(let u=o.start.line;u<l;u++)for(let d of Cj(c[u],s.traExt,t)){let f=s.traFile.get(d.entryNum);f&&a.push({position:{line:u,character:d.end},label:f.inlay,tooltip:f.inlayTooltip?{kind:yj.MarkupKind.Markdown,value:"```bgforge-mls-string\n"+f.inlayTooltip+"\n```"}:void 0,kind:2,paddingLeft:!0,paddingRight:!0})}return a}function Nj(e){let t=[...e],n="code";for(let r=0;r<e.length;r++){let o=e[r],s=e[r+1];n==="code"?o==="/"&&s==="/"?(n="line",t[r]=" ",t[r+1]=" ",r++):o==="/"&&s==="*"&&(n="block",t[r]=" ",t[r+1]=" ",r++):n==="line"?o===`
359
359
  `?n="code":t[r]=" ":o==="*"&&s==="/"?(t[r]=" ",t[r+1]=" ",n="code",r++):o!==`
360
- `&&(t[r]=" ")}return t.join("")}function Nj(e,t,n,r){let o=IC(e,n,t,r);if(o?.kind!=="loaded")return[];let s=[];return Pj(t).split(`
361
- `).forEach((a,c)=>{for(let l of vj(a,o.traExt,n))o.traFile.has(l.entryNum)||s.push({range:{start:{line:c,character:l.start},end:{line:c,character:l.end}},entryNum:l.entryNum,fileKey:o.fileKey})}),s}function wee(e,t,n){let r=[],o=e.split(`
362
- `),s=n==="tra"?hO(t):gO(t);for(let a=0;a<o.length;a++){let c=o[a];for(let l of c.matchAll(s))r.push({line:a,character:l.index,endCharacter:l.index+l[0].length})}return r}async function Ej(e,t,n,r,o,s){let a=[];if(s){let d=e.data.get(t)?.get(n);d&&a.push({uri:Ye(o),range:{start:{line:d.line,character:d.character},end:{line:d.endLine,character:d.endCharacter}}})}let c=e.consumers.get(t);if(!c)return a;let l=Wi(Ko),u=await Promise.all([...c].map(d=>l(async()=>{try{let f=await gj.promises.readFile(d),{text:m}=bs(f);return{absPath:d,text:m}}catch{return}})));for(let d of u){if(!d)continue;let{absPath:f,text:m}=d,p=wee(m,n,r),g=Ye(f);for(let h of p)a.push({uri:g,range:{start:{line:h.line,character:h.character},end:{line:h.line,character:h.endCharacter}}})}return a}var vi=B(require("fs")),St=B(require("path"));var vo=B(require("path"),1);function Rj(e,t){return e.replaceAll(/@(\d+)(\s*=\s*~)([^~]*)(~)/g,(n,r,o,s,a)=>{let c=t[r];return c===void 0?n:`@${r}${o}${c}${a}`})}function Tj(e,t){return e.replaceAll(/({(\d+)}\s*{\w*}\s*{)([^}]*)(})/g,(n,r,o,s,a)=>{let c=t[o];return c===void 0?n:`${r}${c}${a}`})}function Aj(e,t){let n=new Set;for(let s of e.matchAll(/{(\d+)}\s*{\w*}\s*{[^}]*}/g))n.add(s[1]);let r=Object.entries(t).filter(([s])=>!n.has(s));return r.length===0?e:(e.length>0&&!e.endsWith(`
360
+ `&&(t[r]=" ")}return t.join("")}function Ej(e,t,n,r){let o=AC(e,n,t,r);if(o?.kind!=="loaded")return[];let s=[];return Nj(t).split(`
361
+ `).forEach((a,c)=>{for(let l of Cj(a,o.traExt,n))o.traFile.has(l.entryNum)||s.push({range:{start:{line:c,character:l.start},end:{line:c,character:l.end}},entryNum:l.entryNum,fileKey:o.fileKey})}),s}function xee(e,t,n){let r=[],o=e.split(`
362
+ `),s=n==="tra"?hO(t):gO(t);for(let a=0;a<o.length;a++){let c=o[a];for(let l of c.matchAll(s))r.push({line:a,character:l.index,endCharacter:l.index+l[0].length})}return r}async function Rj(e,t,n,r,o,s){let a=[];if(s){let d=e.data.get(t)?.get(n);d&&a.push({uri:Ye(o),range:{start:{line:d.line,character:d.character},end:{line:d.endLine,character:d.endCharacter}}})}let c=e.consumers.get(t);if(!c)return a;let l=Wi(Ko),u=await Promise.all([...c].map(d=>l(async()=>{try{let f=await _j.promises.readFile(d),{text:m}=bs(f);return{absPath:d,text:m}}catch{return}})));for(let d of u){if(!d)continue;let{absPath:f,text:m}=d,p=xee(m,n,r),g=Ye(f);for(let h of p)a.push({uri:g,range:{start:{line:h.line,character:h.character},end:{line:h.line,character:h.endCharacter}}})}return a}var vi=B(require("fs")),St=B(require("path"));var vo=B(require("path"),1);function Tj(e,t){return e.replaceAll(/@(\d+)(\s*=\s*~)([^~]*)(~)/g,(n,r,o,s,a)=>{let c=t[r];return c===void 0?n:`@${r}${o}${c}${a}`})}function Aj(e,t){return e.replaceAll(/({(\d+)}\s*{\w*}\s*{)([^}]*)(})/g,(n,r,o,s,a)=>{let c=t[o];return c===void 0?n:`${r}${c}${a}`})}function Ij(e,t){let n=new Set;for(let s of e.matchAll(/{(\d+)}\s*{\w*}\s*{[^}]*}/g))n.add(s[1]);let r=Object.entries(t).filter(([s])=>!n.has(s));return r.length===0?e:(e.length>0&&!e.endsWith(`
363
363
  `)?e+`
364
364
  `:e)+r.map(([s,a])=>`{${s}}{}{${a}}
365
- `).join("")}function Ij(e,t){let n=new Set;for(let s of e.matchAll(/@(\d+)\s*=\s*~/g))n.add(s[1]);let r=Object.entries(t).filter(([s])=>!n.has(s));return r.length===0?e:(e.length>0&&!e.endsWith(`
365
+ `).join("")}function Dj(e,t){let n=new Set;for(let s of e.matchAll(/@(\d+)\s*=\s*~/g))n.add(s[1]);let r=Object.entries(t).filter(([s])=>!n.has(s));return r.length===0?e:(e.length>0&&!e.endsWith(`
366
366
  `)?e+`
367
367
  `:e)+r.map(([s,a])=>`@${s} = ~${a}~
368
- `).join("")}function Dj(e,t){let n=vo.dirname(e),r=vo.basename(n),o=vo.dirname(n),s=vo.basename(e);return t.filter(a=>a!==r).map(a=>vo.join(o,a,s))}var xee="data/text/english/dialog",vee="tra",Cu={changed:!1,staleSiblingLanguages:[]};function Cee(e){let t=St.dirname(St.dirname(e)),n;try{n=vi.readdirSync(t,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name)}catch(r){return r.code!=="ENOENT"&&T(`cannot scan ${t} for sibling translations: ${r.message}`),[]}return Dj(e,n).filter(r=>vi.existsSync(r)).map(r=>St.basename(St.dirname(r)))}function kj(e,t,n,r,o){let s=oh(e,r,t,n),a=oc(e,t,n,r);if(!s||!a)return Cu;let c=rh(e,a),l;if(c&&vi.existsSync(St.dirname(c)))l=c;else if(e.workspaceRoot){let p=s==="msg"?xee:vee,g=St.join(e.workspaceRoot,p);vi.mkdirSync(g,{recursive:!0}),hj(e.workspaceRoot,p),l=St.join(g,a)}else l=St.join(St.dirname(t),a);let u,d="utf-8";try{let p=vi.readFileSync(l);({text:u,encoding:d}=bs(p))}catch(p){if(p.code!=="ENOENT")return Cu;u=""}let f=s==="msg"?Aj(Tj(u,o),o):Ij(Rj(u,o),o);if(f===u)return Cu;let m=sj(f,d);return aj(l,m),e.data.set(a,xo(f,s)),{changed:!0,staleSiblingLanguages:Cee(l)}}function Pee(e,t){let n=Ss(e);if(n===void 0||e.workspaceRoot===void 0)return;let r=St.resolve(e.workspaceRoot,t),o=St.relative(n,r);if(!(o===""||o===".."||o.startsWith(".."+St.sep)||St.isAbsolute(o)))return o}function Fj(e,t,n){let r=Pee(e,t);if(!r){T(`Translation: can't detect tra path for ${t}, skipping reload`);return}let o=St.parse(r).ext.slice(-3);if(o!=="tra"&&o!=="msg"){T(`Translation: unknown extension ${o}`);return}let s=xo(n,o);e.data.set(r,s),T(`Translation: reloaded ${r}`),e.notifyReload?.()}var Lj=dA,ah=class{state;initialized;constructor(t,n,r){T("Translation: initializing"),this.state=lj(t,n,r),this.initialized=!1}async init(){let t=Ss(this.state);this.state.data=t?await dj(t):new Map,await pj(this.state),this.initialized=!0,T("Translation: initialized")}directory(){return Ss(this.state)}getHover(t,n,r,o){let s=this.resolveRelPath(t,n,r);return s?wj(this.state,r,o,s,n):null}getDefinition(t,n,r,o){let s=this.resolveRelPath(t,n,r);return s?xj(this.state,r,o,s,n):null}getInlayHints(t,n,r,o){return this.initialized?this.state.data.size===0?[]:Cj(this.state,this.uriToPath(t),r,n,o):[]}getDiagnostics(t,n,r){if(!this.initialized)return[];if(this.state.data.size===0)return[];if(!ih.has(n))return[];let o=this.uriToPath(t);return Nj(this.state,r,o,n).map(s=>({severity:Mj.DiagnosticSeverity.Information,range:s.range,message:bj(s.entryNum,s.fileKey),source:"BGforge MLS (translation)"}))}reloadFile(t,n,r){if(!this.initialized||!Lj.includes(n))return;let o=this.state.resolvedWsRoot;if(o===void 0)return;let s=this.uriToPath(t),a=Hf(s);if(a===void 0||!Uf(o,a))return;let c=sh.relative(o,s);Fj(this.state,c,r)}async getReferences(t,n,r,o){if(!this.initialized)return[];if(!Lj.includes(n))return[];let s=this.uriToPath(t),a=fj(this.state,s);if(!a)return[];let c=this.state.data.get(a);if(!c)return[];let l=XB(c,r);if(l===void 0)return[];let u=a.endsWith(".msg")?"msg":"tra";return Ej(this.state,a,l,u,s,o)}reloadConsumer(t,n,r){if(!this.initialized||!ih.has(r))return;let o=this.state.resolvedWsRoot;if(o===void 0)return;let s=this.uriToPath(t),a=Hf(s);if(a===void 0||!Uf(o,a))return;let c=sh.relative(o,s);mj(this.state,s);let l=oc(this.state,c,n,r);l&&this.state.data.has(l)&&AC(this.state,l,s)}getMessages(t,n,r=mt){let o={};if(!this.initialized)return o;let s=this.uriToPath(t),a=oc(this.state,s,n,r);if(!a)return o;let c=this.state.data.get(a);if(!c)return o;for(let[l,u]of c)o[l]=u.source;return o}writeMessages(t,n,r,o){if(!this.initialized)return Cu;let s=this.uriToPath(t);return kj(this.state,s,n,r,o)}uriToPath(t){return t.startsWith("file://")?(0,Oj.fileURLToPath)(t):t}resolveRelPath(t,n,r){if(!this.initialized||this.state.data.size===0||!ih.has(n))return null;let o=this.state.resolvedWsRoot;if(o===void 0)return null;let s=this.uriToPath(t);if(!yj(r,n,s))return null;let a=Hf(s);return a===void 0||!Uf(o,a)?null:sh.relative(o,s)}};var $j=Object.defineProperty,Nee=(e,t,n)=>t in e?$j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Eee=(e,t)=>{for(var n in t)$j(e,n,{get:t[n],enumerable:!0})},Pe=(e,t,n)=>Nee(e,typeof t!="symbol"?t+"":t,n),Ree={};Eee(Ree,{BufferReader:()=>Po,BufferWriter:()=>Ste,MaxValue:()=>Et,Measurer:()=>We,UnresolvedReferenceError:()=>ws,ValidationError:()=>ch,arrayOf:()=>lh,bool:()=>Fee,byte:()=>qee,chars:()=>Yee,concat:()=>Qee,dynamicArrayOf:()=>ete,f16:()=>Vee,f32:()=>zee,f32Array:()=>gte,f64Array:()=>_te,generic:()=>Xee,genericEnum:()=>Jee,i16:()=>kC,i16Array:()=>pte,i32:()=>FC,i32Array:()=>hte,i8:()=>DC,i8Array:()=>mte,keyed:()=>rte,object:()=>OC,optional:()=>ote,string:()=>Oee,tupleOf:()=>cte,u16:()=>Wn,u16Array:()=>dte,u32:()=>ze,u32Array:()=>fte,u8:()=>uh,u8Array:()=>lte,u8ClampedArray:()=>ute});var ws=class qj extends Error{constructor(t){super(t),Object.setPrototypeOf(this,qj.prototype)}},ch=class Bj extends Error{constructor(t){super(t),Object.setPrototypeOf(this,Bj.prototype)}},Tee=class{constructor(){Pe(this,"size",Number.NaN),Pe(this,"unbounded",this),Pe(this,"isUnbounded",!0)}add(){return this}fork(){return this}},Aee=new Tee,We=class jj{constructor(){Pe(this,"size",0),Pe(this,"unbounded",Aee),Pe(this,"isUnbounded",!1)}add(t){return this.size+=t,this}fork(){let t=new jj;return t.size=this.size,t}},Et=Symbol("The biggest (in amount of bytes needed) value a schema can represent"),it=class{constructor(){Pe(this,"__unwrapped")}resolveReferences(e){}seekProperty(e,t){return null}},Iee=class{constructor(e){this.key=e}},Nu={STRING:"string",ENUM:"enum"},Dee=class extends it{constructor(e,t){super(),this._unstableElementSchema=e,this.length=t,Pe(this,"elementSchema"),this.elementSchema=e}resolveReferences(e){this.elementSchema=e.resolve(this._unstableElementSchema)}write(e,t){if(t.length!==this.length)throw new ch(`Expected array of length ${this.length}, got ${t.length}`);for(let n of t)this.elementSchema.write(e,n)}read(e){let t=[];for(let n=0;n<this.length;++n)t.push(this.elementSchema.read(e));return t}get maxSize(){return this.elementSchema.measure(Et).size*this.length}measure(e,t=new We){for(let n=0;n<this.length;++n)this.elementSchema.measure(e===Et?Et:e[n],t);return t}};function lh(e,t){return new Dee(e,t)}var kee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",1)}read(e){return e.readBool()}write(e,t){e.writeBool(t)}measure(e,t=new We){return t.add(1)}},Fee=new kee,Wj=class Pu extends it{static get _encoder(){return Pu._cachedEncoder||(Pu._cachedEncoder=new TextEncoder),Pu._cachedEncoder}read(t){return t.readString()}write(t,n){t.writeString(n)}measure(t,n=new We){if(t===Et)return n.unbounded;let r=Pu._encoder.encode(t);return n.add(r.byteLength+1)}};Pe(Wj,"_cachedEncoder");var Lee=Wj,Oee=new Lee,Mee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",1)}read(e){return e.readInt8()}write(e,t){e.writeInt8(t)}measure(e,t=new We){return t.add(1)}},DC=new Mee,$ee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",1)}read(e){return e.readUint8()}write(e,t){e.writeUint8(t)}measure(e,t=new We){return t.add(1)}},uh=new $ee,qee=uh,Bee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",2)}read(e){return e.readInt16()}write(e,t){e.writeInt16(t)}measure(e,t=new We){return t.add(2)}},kC=new Bee,jee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",2)}read(e){return e.readUint16()}write(e,t){e.writeUint16(t)}measure(e,t=new We){return t.add(2)}},Wn=new jee,Wee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",4)}read(e){return e.readInt32()}write(e,t){e.writeInt32(t)}measure(e,t=new We){return t.add(4)}},FC=new Wee,Uee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",4)}read(e){return e.readUint32()}write(e,t){e.writeUint32(t)}measure(e,t=new We){return t.add(4)}},ze=new Uee,Hee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",2)}read(e){return e.readFloat16()}write(e,t){e.writeFloat16(t)}measure(e,t=new We){return t.add(2)}},Vee=new Hee,Gee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",4)}read(e){return e.readFloat32()}write(e,t){e.writeFloat32(t)}measure(e,t=new We){return t.add(4)}},zee=new Gee,Kee=class extends it{constructor(e){super(),this.length=e}write(e,t){if(t.length!==this.length)throw new ch(`Expected char-string of length ${this.length}, got ${t.length}`);for(let n=0;n<t.length;++n)e.writeUint8(t.charCodeAt(n))}read(e){let t="";for(let n=0;n<this.length;++n)t+=String.fromCharCode(e.readByte());return t}measure(e,t=new We){return t.add(this.length)}};function Yee(e){return new Kee(e)}function Co(e){return Object.entries(e)}function Uj(e,t){let n={};for(let[r,o]of Co(t))n[r]=e.resolve(o);return n}var LC=class extends it{constructor(e){super(),this._properties=e,Pe(this,"properties"),this.properties=e}resolveReferences(e){this.properties=Uj(e,this._properties)}write(e,t){for(let[n,r]of Co(this.properties))r.write(e,t[n])}read(e){let t={};for(let[n,r]of Co(this.properties))t[n]=r.read(e);return t}get maxSize(){let e=new We;for(let t of Object.values(this.properties))t.measure(Et,e);return e.size}measure(e,t=new We){for(let[n,r]of Co(this.properties))r.measure(e===Et?Et:e[n],t);return t}seekProperty(e,t){let n=0;for(let[r,o]of Co(this.properties)){if(r===t)return{bufferOffset:n,schema:o};n+=o.measure(e).size}return null}};function OC(e){return new LC(e)}var Hj=class extends it{constructor(e,t,n){super(),this.keyedBy=e,this._subTypeMap=n,Pe(this,"_baseObject"),Pe(this,"subTypeMap"),this._baseObject=new LC(t),this.subTypeMap=n}resolveReferences(e){this._baseObject.resolveReferences(e),this.subTypeMap=Uj(e,this._subTypeMap)}write(e,t){let n=t.type,r=this.subTypeMap[n]||null;if(r===null)throw new Error(`Unknown sub-type '${n.toString()}' in among '${JSON.stringify(Object.keys(this.subTypeMap))}'`);this.keyedBy===Nu.ENUM?e.writeUint8(t.type):e.writeString(t.type),this._baseObject.write(e,t);for(let[o,s]of Co(r.properties))s.write(e,t[o])}read(e){let t=this.keyedBy===Nu.ENUM?e.readByte():e.readString(),n=this.subTypeMap[t]||null;if(n===null)throw new Error(`Unknown sub-type '${t}' in among '${JSON.stringify(Object.keys(this.subTypeMap))}'`);let r=this._baseObject.read(e);if(r.type=t,n!==null)for(let[o,s]of Co(n.properties))r[o]=s.read(e);return r}measure(e,t=new We){if(this._baseObject.measure(e,t),this.keyedBy===Nu.ENUM)t.add(1);else if(e!==Et)t.add(e.type.length+1);else return t.unbounded;if(e===Et){let n=Object.values(this.subTypeMap).map(r=>{let o=t.fork();for(let s of Object.values(r.properties))s.measure(Et,o);return[r,o.size]}).reduce((r,o)=>r[1]>o[1]?r:o)[0];for(let r of Object.values(n.properties))r.measure(Et,t)}else{let n=e.type,r=this.subTypeMap[n]||null;if(r===null)throw new Error(`Unknown sub-type '${n.toString()}', expected one of '${JSON.stringify(Object.keys(this.subTypeMap))}'`);for(let[o,s]of Co(r.properties))s.measure(e[o],t)}return t}};function Xee(e,t){return new Hj(Nu.STRING,e,t)}function Jee(e,t){return new Hj(Nu.ENUM,e,t)}function Qee(e){return new LC(Object.fromEntries(e.flatMap(({properties:t})=>Object.entries(t))))}var Zee=class extends it{constructor(e){super(),this._unstableElementType=e,Pe(this,"elementType"),this.elementType=e}resolveReferences(e){this.elementType=e.resolve(this._unstableElementType)}write(e,t){e.writeUint32(t.length);for(let n of t)this.elementType.write(e,n)}read(e){let t=[],n=e.readUint32();for(let r=0;r<n;++r)t.push(this.elementType.read(e));return t}get maxSize(){return this.measure(Et).size}measure(e,t=new We){if(e===Et)return t.unbounded;t.add(4);for(let n of e)this.elementType.measure(n,t);return t}seekProperty(e,t){if(typeof t=="symbol")return null;let n=Number.parseInt(String(t),10);if(Number.isNaN(n))return null;if(e===Et)return{bufferOffset:this.elementType.measure(Et).size*n,schema:this.elementType};if(n>=e.length)return null;let r=new We;for(let o=0;o<n;++o)this.elementType.measure(e[o],r);return{bufferOffset:r.size,schema:this.elementType}}};function ete(e){return new Zee(e)}var Vj=class{constructor(e){Pe(this,"__unwrapped"),Pe(this,"ref"),this.ref=new Iee(e)}resolveReferences(){throw new ws("Tried to resolve a reference directly. Do it through a RefResolver instead.")}read(){throw new ws("Tried to read a reference directly. Resolve it instead.")}write(){throw new ws("Tried to write a reference directly. Resolve it instead.")}measure(){throw new ws("Tried to measure size of a reference directly. Resolve it instead.")}seekProperty(){throw new ws("Tried to seek property of a reference directly. Resolve it instead.")}},tte=class{constructor(){Pe(this,"registry",{})}hasKey(e){return this.registry[e]!==void 0}register(e,t){this.registry[e]=t}resolve(e){if(e instanceof Vj){let n=e.ref.key;if(this.registry[n]!==void 0)return this.registry[n];throw new ws(`Couldn't resolve reference to ${n}. Unknown key.`)}return e.resolveReferences(this),e}},nte=class{constructor(e,t){this.key=e,Pe(this,"__unwrapped"),Pe(this,"__keyDefinition"),Pe(this,"innerType"),this.innerType=t(new Vj(e)),this.resolveReferences(new tte)}resolveReferences(e){e.hasKey(this.key)||(e.register(this.key,this.innerType),this.innerType.resolveReferences(e))}read(e){return this.innerType.read(e)}write(e,t){this.innerType.write(e,t)}get maxSize(){return this.measure(Et).size}measure(e,t=new We){return this.innerType.measure(e,t)}seekProperty(e,t){return this.innerType.seekProperty(e,t)}};function rte(e,t){return new nte(e,t)}var ite=class extends it{constructor(e){super(),this._innerUnstableSchema=e,Pe(this,"innerSchema"),this.innerSchema=e}resolveReferences(e){this.innerSchema=e.resolve(this._innerUnstableSchema)}write(e,t){t!=null?(e.writeBool(!0),this.innerSchema.write(e,t)):e.writeBool(!1)}read(e){if(e.readBool())return this.innerSchema.read(e)}get maxSize(){return this.measure(Et).size}measure(e,t=new We){return e!==void 0&&this.innerSchema.measure(e,t),t.add(1)}};function ote(e){return new ite(e)}function ste(e,t){return t.map(n=>e.resolve(n))}var ate=class extends it{constructor(e){super(),this._unstableSchemas=e,Pe(this,"schemas"),this.schemas=e}resolveReferences(e){this.schemas=ste(e,this._unstableSchemas)}write(e,t){if(t.length!==this.schemas.length)throw new ch(`Expected tuple of length ${this.schemas.length}, got ${t.length}`);for(let n=0;n<this.schemas.length;++n)this.schemas[n].write(e,t[n])}read(e){let t=[];for(let n=0;n<this.schemas.length;++n)t.push(this.schemas[n].read(e));return t}get maxSize(){return this.measure(Et).size}measure(e,t=new We){for(let n=0;n<this.schemas.length;++n)this.schemas[n].measure(e===Et?Et:e[n],t);return t}};function cte(e){return new ate(e)}var Ci=class extends it{constructor(e,t){super(),this.length=e,this._arrayConstructor=t,Pe(this,"byteLength"),this.byteLength=e*t.BYTES_PER_ELEMENT}write(e,t){e.writeSlice(t)}read(e){let t=new ArrayBuffer(this.byteLength),n=new this._arrayConstructor(t,0,this.length);return e.readSlice(n,0,this.byteLength),n}measure(e,t=new We){return t.add(this.byteLength)}},lte=e=>new Ci(e,Uint8Array),ute=e=>new Ci(e,Uint8ClampedArray),dte=e=>new Ci(e,Uint16Array),fte=e=>new Ci(e,Uint32Array),mte=e=>new Ci(e,Int8Array),pte=e=>new Ci(e,Int16Array),hte=e=>new Ci(e,Int32Array),gte=e=>new Ci(e,Float32Array),_te=e=>new Ci(e,Float64Array);function yte(){let e=new Uint8Array(4),t=new Uint32Array(e.buffer);return t[0]=1,e[0]===0}function bte(){return yte()?"big":"little"}function MC(e){let t=0,n=e;return n&&"buffer"in n&&"byteOffset"in n&&(t+=n.byteOffset,n=n.buffer),{buffer:n,byteOffset:t,byteLength:e.byteLength}}var Gj=class{constructor(e,t){Pe(this,"dataView"),Pe(this,"littleEndian"),Pe(this,"needsByteSwap"),Pe(this,"byteOffset",0),Pe(this,"endianness");let{byteOffset:n=0,endianness:r="system"}=t??{};this.byteOffset=n;let o=bte();this.endianness=r==="system"?o:r,this.littleEndian=this.endianness==="little",this.needsByteSwap=this.endianness!==o;let s=MC(e);this.byteOffset+=s.byteOffset,this.dataView=new DataView(s.buffer)}get currentByteOffset(){return this.byteOffset}seekTo(e){this.byteOffset=e}skipBytes(e){this.byteOffset+=e}},Po=class extends Gj{constructor(){super(...arguments),Pe(this,"_cachedTextDecoder")}get _textDecoder(){return this._cachedTextDecoder||(this._cachedTextDecoder=new TextDecoder(void 0,{fatal:!0})),this._cachedTextDecoder}readBool(){return this.dataView.getUint8(this.byteOffset++)!==0}readByte(){return this.dataView.getUint8(this.byteOffset++)}readInt8(){return this.dataView.getInt8(this.byteOffset++)}readUint8(){return this.dataView.getUint8(this.byteOffset++)}readInt16(){let e=this.dataView.getInt16(this.byteOffset,this.littleEndian);return this.byteOffset+=2,e}readUint16(){let e=this.dataView.getUint16(this.byteOffset,this.littleEndian);return this.byteOffset+=2,e}readInt32(){let e=this.dataView.getInt32(this.byteOffset,this.littleEndian);return this.byteOffset+=4,e}readUint32(){let e=this.dataView.getUint32(this.byteOffset,this.littleEndian);return this.byteOffset+=4,e}readFloat16(){let e=this.dataView.getFloat16(this.byteOffset,this.littleEndian);return this.byteOffset+=2,e}readFloat32(){let e=this.dataView.getFloat32(this.byteOffset,this.littleEndian);return this.byteOffset+=4,e}readString(){let e=0;for(;this.byteOffset+e<this.dataView.byteLength&&this.dataView.getUint8(this.byteOffset+e++)!==0;);let t=this._textDecoder.decode(new Uint8Array(this.dataView.buffer,this.byteOffset,e-1));return this.byteOffset+=e,t}readSlice(e,t,n){let r=MC(e),o=new Uint8Array(r.buffer,r.byteOffset+t),s=e.BYTES_PER_ELEMENT;if(this.needsByteSwap&&s>1)for(let a=0;a<n;a+=s)for(let c=s-1;c>=0;c--)o[a+c]=this.dataView.getUint8(this.byteOffset++);else o.set(new Uint8Array(this.dataView.buffer,this.byteOffset,n)),this.byteOffset+=n}},Ste=class extends Gj{constructor(){super(...arguments),Pe(this,"_cachedTextEncoder")}get _textEncoder(){return this._cachedTextEncoder||(this._cachedTextEncoder=new TextEncoder),this._cachedTextEncoder}writeBool(e){this.dataView.setUint8(this.byteOffset++,e?1:0)}writeByte(e){this.dataView.setUint8(this.byteOffset++,e)}writeInt8(e){this.dataView.setInt8(this.byteOffset++,e)}writeUint8(e){this.dataView.setUint8(this.byteOffset++,e)}writeInt16(e){this.dataView.setInt16(this.byteOffset,e,this.littleEndian),this.byteOffset+=2}writeUint16(e){this.dataView.setUint16(this.byteOffset,e,this.littleEndian),this.byteOffset+=2}writeInt32(e){this.dataView.setInt32(this.byteOffset,e,this.littleEndian),this.byteOffset+=4}writeUint32(e){this.dataView.setUint32(this.byteOffset,e,this.littleEndian),this.byteOffset+=4}writeFloat16(e){this.dataView.setFloat16(this.byteOffset,e,this.littleEndian),this.byteOffset+=2}writeFloat32(e){this.dataView.setFloat32(this.byteOffset,e,this.littleEndian),this.byteOffset+=4}writeString(e){let t=this._textEncoder.encodeInto(e,new Uint8Array(this.dataView.buffer,this.byteOffset));this.byteOffset+=t.written,this.dataView.setUint8(this.byteOffset++,0)}writeSlice(e){let t=MC(e),n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),r=e.BYTES_PER_ELEMENT;if(this.needsByteSwap&&r>1)for(let o=0;o<n.length;o+=r)for(let s=r-1;s>=0;s--)this.dataView.setUint8(this.byteOffset++,n[o+s]);else new Uint8Array(this.dataView.buffer,this.byteOffset).set(n),this.byteOffset+=n.length}};function Eu(e){return e.kind==="array"}function Ru(e){return e.kind==="chars"}function Qr(e){if(!Number.isInteger(e)||e<1)throw new Error(`charsSpec requires a positive integer count; got ${e}`);return{kind:"chars",count:e}}function zj(e){return typeof e=="object"&&"fromField"in e}function Kj(e){return typeof e=="object"&&"fromCtx"in e}var $C=class extends it{maxSize=3;read(t){let n=t.readUint8(),r=t.readUint8(),o=t.readUint8();return n<<16|r<<8|o}write(t,n){t.writeUint8(n>>16&255),t.writeUint8(n>>8&255),t.writeUint8(n&255)}measure(t,n){return(n??new We).add(3)}},wte=new $C,qC=class extends it{maxSize=3;read(t){let n=t.readUint8(),r=t.readUint8(),o=t.readUint8(),s=n<<16|r<<8|o;return s&8388608?s|-16777216:s}write(t,n){t.writeUint8(n>>16&255),t.writeUint8(n>>8&255),t.writeUint8(n&255)}measure(t,n){return(n??new We).add(3)}},xte=new qC,vte=new Map([[uh,{name:"uint8",bytes:1}],[Wn,{name:"uint16",bytes:2}],[wte,{name:"uint24",bytes:3}],[ze,{name:"uint32",bytes:4}],[DC,{name:"int8",bytes:1}],[kC,{name:"int16",bytes:2}],[xte,{name:"int24",bytes:3}],[FC,{name:"int32",bytes:4}]]);function Cte(e){let t=vte.get(e);if(!t)throw new Error("Unknown typed-binary numeric codec; not registered in codec-meta.");return t}function No(e){return Cte(e).bytes}var Pte=/^[A-Za-z_][A-Za-z0-9_]*$/,Yj=new Map;function Nte(e){let t=Yj.get(e);if(t!==void 0)return t;let n=e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[^A-Za-z0-9]+/g," ").trim();if(!n)throw new Error(`slugifyCodedName: name "${e}" produces an empty key`);let o=n.split(/\s+/).map((s,a)=>a===0?s[0].toLowerCase()+s.slice(1):s[0].toUpperCase()+s.slice(1)).join("");if(!Pte.test(o))throw new Error(`slugifyCodedName: name "${e}" produced "${o}" which is not a valid JS identifier`);if(Jj.test(o))throw new Error(`slugifyCodedName: name "${e}" produced reserved sentinel "${o}"; flag display names must not slugify to bit<N>`);return Yj.set(e,o),o}var Jj=/^bit\d+$/,Xj=new WeakMap;function Qj(e){let t=Xj.get(e);if(t!==void 0)return t;let n=[],r=0;for(let[s,a]of Object.entries(e)){let c=Number(s);if(!Number.isFinite(c)||c<0||!Number.isInteger(c))throw new Error(`compileFlagTable: non-integer mask "${s}"`);let l=Nte(a);n.push({key:l,mask:c,displayName:a}),r=(r|c)>>>0}n.sort((s,a)=>s.key.localeCompare(a.key));let o={entries:Object.freeze(n),namedMask:r};return Xj.set(e,o),o}function Zj(e,t,n){let{entries:r,namedMask:o}=Qj(e),s=[];for(let u of r)(t&u.mask)!==0&&s.push(u.key);let a=n>=32?4294967295:(1<<n)-1,c=(t&~o&a)>>>0,l=[];for(let u=0;u<n;u++)(c&1<<u)!==0&&l.push(`bit${u}`);return[...s,...l]}function eW(e,t,n){let{entries:r,namedMask:o}=Qj(e),s=new Map(r.map(l=>[l.key,l.mask])),a=new Set,c=0;for(let l of t){if(a.has(l))throw new Error(`flagArrayToInt: duplicate flag name "${l}"`);a.add(l);let u=s.get(l);if(u!==void 0){c=(c|u)>>>0;continue}let d=Jj.exec(l);if(!d)throw new Error(`flagArrayToInt: unknown flag "${l}" (known: ${r.map(p=>p.key).join(", ")})`);let f=Number(d[0].slice(3));if(f>=n)throw new Error(`flagArrayToInt: bit position ${f} exceeds codec width ${n} for "${l}"`);let m=1<<f>>>0;if((m&o)!==0)throw new Error(`flagArrayToInt: bit position ${f} overlaps named-bit mask; named bits must be set by their canonical name, not "${l}"`);c=(c|m)>>>0}return c}var dh=class extends it{maxSize;inner;table;codecBitWidth;constructor(t){if(super(),!t.flags)throw new TypeError("FlagArraySchema requires a `flags` annotation on the spec entry");this.inner=t.codec,this.table=t.flags,this.codecBitWidth=No(t.codec)*8,this.maxSize=No(t.codec)}read(t){let n=this.inner.read(t);return Zj(this.table,n,this.codecBitWidth)}write(t,n){let r=eW(this.table,n,this.codecBitWidth);this.inner.write(t,r)}measure(t,n){return(n??new We).add(this.maxSize)}},fh=class extends it{maxSize;count;constructor(t){super(),this.count=t,this.maxSize=t}read(t){let n=[];for(let r=0;r<this.count;r++)n.push(t.readByte());return String.fromCodePoint(...n)}write(t,n){let r=Math.min(n.length,this.count);for(let o=0;o<r;o++){let s=n.codePointAt(o);if(s>255)throw new RangeError(`Chars value contains non-Latin-1 char code 0x${s.toString(16)} at index ${o}`);t.writeByte(s)}for(let o=r;o<this.count;o++)t.writeByte(0)}measure(t,n){return(n??new We).add(this.count)}},tW=new WeakMap;function Zr(e){let t=tW.get(e);if(t)return t;let n=Object.values(e).some(o=>Eu(o)?typeof o.count!="number":Ru(o)?!1:o.packedAs!==void 0),r;if(n)r=new BC(e);else{let o={};for(let s of Object.keys(e))o[s]=Rte(e[s]);r=Ete(OC(o))}return tW.set(e,r),r}function Ete(e){let t=e;return{get maxSize(){return t.maxSize??0},read(n){return t.read(n)},write(n,r){t.write(n,r)},measure(n,r){return t.measure(n,r)}}}function Rte(e){if(Eu(e)){if(typeof e.count!="number")throw new TypeError("Variable-length arrays must be derived via SpecStructSchema, not the object({...}) path.");return lh(e.element.codec,e.count)}return Ru(e)?new fh(e.count):e.flags?new dh(e):e.codec}var BC=class extends it{maxSize;entries;constructor(t){super(),this.entries=Tte(t),this.maxSize=this.entries.reduce((n,r)=>n+(r.kind==="fromFieldArray"||r.kind==="fromCtxArray"?0:r.bytes),0)}read(t,n){let r={};for(let o of this.entries)if(o.kind==="plain")r[o.key]=o.codec.read(t);else if(o.kind==="packed"){let s=o.codec.read(t);for(let a of o.parts){let c=nW(a.bitWidth);r[a.key]=s>>>a.bitOffset&c}}else{let s=(()=>{if(o.kind==="fromFieldArray"){let c=r[o.fromField];if(typeof c!="number")throw new TypeError(`lengthFrom array "${o.key}" references field "${o.fromField}" which has not been read as a number.`);return c}if(n==null)throw new TypeError(`fromCtx array "${o.key}" requires a ctx argument; pass one to spec.read(view, ctx).`);let a=o.fromCtx(n);if(typeof a!="number"||!Number.isFinite(a)||a<0)throw new TypeError(`fromCtx array "${o.key}" produced a non-numeric or negative count (${String(a)}).`);return a})();r[o.key]=Array.from({length:s},()=>o.elementCodec.read(t))}return r}write(t,n,r){let o=n;for(let s of this.entries)if(s.kind==="plain")s.codec.write(t,o[s.key]);else if(s.kind==="packed"){let a=0;for(let c of s.parts){let l=nW(c.bitWidth),u=o[c.key]&l;a|=u<<c.bitOffset}s.codec.write(t,a>>>0)}else{let a=o[s.key];if(!Array.isArray(a))throw new TypeError(`lengthFrom array "${s.key}" expected an array, got ${typeof a}.`);for(let c of a)s.elementCodec.write(t,c)}}measure(t,n){let r=n??new We,o=0;for(let s of this.entries)if(!(s.kind!=="fromFieldArray"&&s.kind!=="fromCtxArray")&&typeof t=="object"&&t!==null){let a=t[s.key];Array.isArray(a)&&(o+=a.length*s.elementBytes)}return r.add(this.maxSize+o)}};function nW(e){return e>=32?4294967295:(1<<e)-1}function Tte(e){let t=Object.keys(e),n=[],r=0;for(;r<t.length;){let o=t[r],s=e[o];if(Ru(s)){n.push({kind:"plain",key:o,codec:new fh(s.count),bytes:s.count}),r++;continue}if(Eu(s)){typeof s.count=="number"?n.push({kind:"plain",key:o,codec:lh(s.element.codec,s.count),bytes:s.count*No(s.element.codec)}):zj(s.count)?n.push({kind:"fromFieldArray",key:o,elementCodec:s.element.codec,elementBytes:No(s.element.codec),fromField:s.count.fromField}):Kj(s.count)&&n.push({kind:"fromCtxArray",key:o,elementCodec:s.element.codec,elementBytes:No(s.element.codec),fromCtx:s.count.fromCtx}),r++;continue}if(s.packedAs===void 0){let p=s.flags?new dh(s):s.codec;n.push({kind:"plain",key:o,codec:p,bytes:No(s.codec)}),r++;continue}let a=s.packedAs,c=s.codec,l=No(c),u=l*8,d=[],f=r;for(;f<t.length;){let p=t[f],g=e[p];if(Eu(g)||Ru(g)||g.packedAs!==a)break;if(g.codec!==c)throw new Error(`packed-field group "${a}": part "${p}" codec does not match the group's wire codec.`);if(!g.bitRange)throw new Error(`packed-field group "${a}": part "${p}" is missing bitRange.`);let[h,y]=g.bitRange;if(!Number.isInteger(h)||!Number.isInteger(y)||h<0||y<=0)throw new Error(`packed-field group "${a}": part "${p}" has invalid bitRange [${h}, ${y}].`);if(h+y>u)throw new Error(`packed-field group "${a}": part "${p}" bitRange [${h}, ${y}] exceeds ${u}-bit wire codec.`);d.push({key:p,bitOffset:h,bitWidth:y}),f++}if(d.length<2)throw new Error(`packed-field group "${a}" must have at least two consecutive parts; found ${d.length}.`);let m=[...d].sort((p,g)=>p.bitOffset-g.bitOffset);for(let p=1;p<m.length;p++){let g=m[p-1],h=m[p];if(g.bitOffset+g.bitWidth>h.bitOffset)throw new Error(`packed-field group "${a}": parts "${g.key}" and "${h.key}" overlap.`)}n.push({kind:"packed",slot:a,codec:c,bytes:l,parts:d}),r=f}return n}var rW={1:"bmp",2:"mve",4:"wav",5:"wfx",6:"plt",1e3:"bam",1001:"wed",1002:"chu",1003:"tis",1004:"mos",1005:"itm",1006:"spl",1007:"bcs",1008:"ids",1009:"cre",1010:"are",1011:"dlg",1012:"2da",1013:"gam",1014:"sto",1015:"wmp",1016:"eff",1017:"bs",1018:"chr",1019:"vvc",1020:"vef",1021:"pro",1022:"bio",1023:"wbm",1024:"fnt",1026:"gui",1027:"sql",1028:"pvrz",1029:"glsl",1030:"tot",1031:"toh",1032:"menu",1033:"lua",1034:"ttf",1035:"png",1100:"bah",2050:"ini",2051:"src",2052:"maze"},Ate=Object.fromEntries(Object.entries(rW).map(([e,t])=>[t,Number(e)]));function sc(e){return rW[e]}function ac(e){return Ate[e.replace(/^\./,"").toLowerCase()]}var Ite={signature:Qr(4),version:Qr(4),bifCount:{codec:ze},resCount:{codec:ze},bifOffset:{codec:ze},resOffset:{codec:ze}},Dte={fileLength:{codec:ze},nameOffset:{codec:ze},nameLength:{codec:Wn},locationFlags:{codec:Wn}},kte=24,Fte=12,iW=14,Lte=8,Ote=8,Mte=10,$te=Zr(Ite),qte=Zr(Dte);function Bte(e){let t=e.indexOf("\0");return t===-1?e:e.slice(0,t)}function oW(e,t){return new Po(e.buffer,{byteOffset:e.byteOffset+t})}function mh(e,t,n,r){if(t<0||t+n>e.byteLength)throw new RangeError(`KEY ${r} region [${t}, ${t+n}) exceeds file size ${e.byteLength}`)}function jte(e,t,n){let r="";for(let o=0;o<n;o++)r+=String.fromCodePoint(e[t+o]);return r}function jC(e){mh(e,0,kte,"header");let t=$te.read(oW(e,0));if(t.signature!=="KEY "||!t.version.startsWith("V1"))throw new Error(`Not a KEY V1 file (signature="${t.signature}" version="${t.version}")`);mh(e,t.bifOffset,t.bifCount*Fte,"BIF entries");let n=oW(e,t.bifOffset),r=[];for(let u=0;u<t.bifCount;u++){let d=qte.read(n);mh(e,d.nameOffset,d.nameLength,`BIF ${u} name`),r.push({name:Bte(jte(e,d.nameOffset,d.nameLength)).replaceAll("\\","/"),fileLength:d.fileLength,locationFlags:d.locationFlags})}mh(e,t.resOffset,t.resCount*iW,"resource entries");let o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=[];for(let u=0;u<t.resCount;u++){let d=t.resOffset+u*iW,f="";for(let g=0;g<Lte;g++){let h=o.getUint8(d+g);if(h===0)break;f+=String.fromCodePoint(h)}let m=o.getUint16(d+Ote,!0),p=o.getUint32(d+Mte,!0)>>>0;s.push({resref:f.toUpperCase(),type:m,ext:sc(m),bifIndex:p>>>20&4095,tilesetIndex:p>>>14&63,fileIndex:p&16383})}let a;function c(){if(a!==void 0)return a;let u=new Map;for(let d of s){let f=u.get(d.resref);f?f.push(d):u.set(d.resref,[d])}return a=u,u}let l=(u,d)=>{let f=c().get(u.toUpperCase())??[];return d===void 0?f:f.filter(m=>m.type===d)};return{bifs:r,resources:s,lookup(u,d){return l(u,d).at(-1)},lookupAll(u,d){return l(u,d)}}}var lW=B(require("zlib"),1);var sW=B(require("crypto"),1),Jn=B(require("fs"),1),cc=B(require("path"),1);function aW(e,t,n){if(!Number.isInteger(e)||!Number.isInteger(t)||e<0||t<0)throw new RangeError(`Invalid read: offset=${e} length=${t}`);if(e+t>n)throw new RangeError(`Read out of bounds: offset=${e} length=${t} exceeds size=${n}`)}function ph(e){return{size:e.byteLength,read(t,n){return aW(t,n,e.byteLength),e.subarray(t,t+n)},close(){}}}function WC(e,t){let n=cc.dirname(e),r=cc.join(n,`.${cc.basename(e)}.${sW.randomBytes(6).toString("hex")}.tmp`);Jn.writeFileSync(r,t),Jn.renameSync(r,e)}function hh(e){let t=Jn.openSync(e,"r"),n;try{n=Jn.fstatSync(t).size}catch(r){throw Jn.closeSync(t),r}return{size:n,read(r,o){aW(r,o,n);let s=Buffer.allocUnsafe(o),a=0;for(;a<o;){let c=Jn.readSync(t,s,a,o-a,r+a);if(c===0)throw new RangeError(`Unexpected EOF reading ${o} bytes at ${r}`);a+=c}return s},close(){Jn.closeSync(t)}}}var Wte={signature:Qr(4),version:Qr(4),fileCount:{codec:ze},tilesetCount:{codec:ze},fileEntriesOffset:{codec:ze}},Ute={locator:{codec:ze},dataOffset:{codec:ze},size:{codec:ze},type:{codec:Wn},unknown:{codec:Wn}},Hte={locator:{codec:ze},dataOffset:{codec:ze},tileCount:{codec:ze},tileSize:{codec:ze},type:{codec:Wn},unknown:{codec:Wn}},Vte=20,Gte=16,zte=20,Kte=Zr(Wte),Yte=Zr(Ute),Xte=Zr(Hte);function Jte(e){let t=e.read(0,4);return String.fromCodePoint(t[0],t[1],t[2],t[3])}function UC(e){let t=Jte(e);if(t==="BIFF")return uW(e);if(t==="BIF ")return cW(Zte(e),e);if(t==="BIFC")return cW(ene(e),e);throw e.close(),new Error(`Unrecognized BIF signature "${t}"`)}function cW(e,t){return t.close(),{...uW(ph(e)),compressed:!0}}function uW(e){let t=e.read(0,Vte),n=Kte.read(new Po(t.buffer,{byteOffset:t.byteOffset}));if(n.signature!=="BIFF")throw e.close(),new Error(`Not a BIFF V1 archive (signature="${n.signature}")`);let r=n.fileCount*Gte,o=n.tilesetCount*zte,s=e.read(n.fileEntriesOffset,r+o),a=new Po(s.buffer,{byteOffset:s.byteOffset}),c=new Map;for(let u=0;u<n.fileCount;u++){let d=Yte.read(a),f=d.locator>>>0&16383;c.set(f,{fileIndex:f,offset:d.dataOffset,size:d.size,type:d.type})}let l=new Map;for(let u=0;u<n.tilesetCount;u++){let d=Xte.read(a),f=d.locator>>>0>>>14&63;l.set(f,{tilesetIndex:f,offset:d.dataOffset,tileCount:d.tileCount,tileSize:d.tileSize,type:d.type})}return{compressed:!1,files:c,tilesets:l,readFile(u){let d=c.get(u);if(!d)throw new Error(`No file index ${u} in BIF`);return e.read(d.offset,d.size)},readTileset(u){let d=l.get(u);if(!d)throw new Error(`No tileset index ${u} in BIF`);return e.read(d.offset,d.tileCount*d.tileSize)},close(){e.close()}}}var Qte=1032;function dW(e){return lW.inflateSync(e,{maxOutputLength:e.byteLength*Qte})}function Zte(e){let t=e.read(0,e.size),r=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(8,!0);return dW(t.subarray(12+r+8))}function ene(e){let t=e.read(0,e.size),n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=n.getUint32(8,!0),o=[],s=12,a=0;for(;s+8<=t.byteLength&&a<r;){let c=n.getUint32(s+4,!0);s+=8;let l=dW(t.subarray(s,s+c));o.push(l),a+=l.byteLength,s+=c}return Buffer.concat(o)}var fW=Uint8Array.from([136,168,143,186,138,211,185,245,237,177,207,234,170,228,181,251,235,130,249,144,202,201,181,231,220,142,183,172,238,247,224,202,142,234,202,128,206,197,173,183,196,208,132,147,213,240,235,200,180,157,204,175,165,149,186,153,135,210,157,227,145,186,144,202]);function Tu(e){if(e[0]!==255||e[1]!==255)return new TextDecoder("latin1").decode(e);let t=e.subarray(2),n=new Uint8Array(t.length);for(let[r,o]of t.entries())n[r]=o^fW[r%fW.length];return new TextDecoder("latin1").decode(n)}function HC(e){let t=new Map;for(let[n,r]of mW(e)){let o=t.get(n);o===void 0?t.set(n,[r]):o.push(r)}return t}function VC(e){return new Map(mW(e))}function*mW(e){let t=Tu(e);for(let n of t.split(/\r?\n/)){let r=n.trim(),o=/^(\S+)\s+(\S.*)$/.exec(r),s=o?.[2];if(o===null||s===void 0)continue;let a=Number(o[1]);Number.isInteger(a)&&(yield[a,s])}}var GC=3;function zC(e){let t=new Map,n=0;for(let r of Tu(e).split(/\r?\n/).slice(GC)){let o=r.trim().split(/\s+/)[0];o===void 0||o===""||(t.set(n,o),n++)}return t}function KC(e){let t=Tu(e).split(/\r?\n/),n=(t[GC-1]??"").trim().split(/\s+/).filter(Boolean),r=[];for(let o of t.slice(GC)){let s=o.trim().split(/\s+/).filter(Boolean),[a,...c]=s;a!==void 0&&r.push({name:a,cells:c})}return{columns:n,rows:r}}var tne={signature:Qr(4),version:Qr(4),languageId:{codec:Wn},stringCount:{codec:ze},stringsOffset:{codec:ze}},nne={flags:{codec:Wn},soundResref:Qr(8),volumeVariance:{codec:ze},pitchVariance:{codec:ze},stringOffset:{codec:ze},stringLength:{codec:ze}},YC=18,gh=26,pW=1,rne=Zr(tne),hW=Zr(nne),ine=new TextDecoder("utf-8",{fatal:!0}),one=new TextDecoder("windows-1252"),gW=new Map;function bW(e){let t=gW.get(e);return t||(t=new TextDecoder(e),gW.set(e,t)),t}function XC(e){let t=e.indexOf("\0");return t===-1?e:e.slice(0,t)}function _W(e,t){if(t!==void 0)return XC(bW(t).decode(e));try{return XC(ine.decode(e))}catch{return XC(one.decode(e))}}var sne=100,ane=2048;function yW(){return new Promise(e=>{setTimeout(e,0)})}function QC(e,t={}){let n=rne.read(JC(e.read(0,YC)));if(n.signature!=="TLK "||!n.version.startsWith("V1"))throw e.close(),new Error(`Not a TLK V1 file (signature="${n.signature}" version="${n.version}")`);let{encoding:r}=t;r!==void 0&&bW(r);let o=n.stringCount,s=n.stringsOffset,a=new Map,c,l,u;async function d(){let m=e.read(YC,o*gh),p=e.read(s,e.size-s);await yW();let g=[],h=[];for(let y=0;y<o;y++){y>0&&y%ane===0&&await yW();let w=hW.read(JC(m.subarray(y*gh))),_=(w.flags&pW)===0||w.stringLength===0?void 0:_W(p.subarray(w.stringOffset,w.stringOffset+w.stringLength),r);g.push(_),h.push(_?.toLowerCase())}c=g,l=h}function f(){return u??=d(),u}return{count:o,languageId:n.languageId,async search(m,p={}){let g=p.limit??sne;await f();let h=c??[],y=l??[],w=m.toLowerCase(),_=[];for(let b=0;b<o&&_.length<g;b++){let S=y[b];S===void 0||S===""||S.includes(w)&&_.push({strref:b,text:h[b]})}return _},get(m){if(!Number.isInteger(m)||m<0||m>=o)return;let p=a.get(m);if(p!==void 0)return p;let g=hW.read(JC(e.read(YC+m*gh,gh))),h=(g.flags&pW)===0||g.stringLength===0?"":_W(e.read(s+g.stringOffset,g.stringLength),r);return a.set(m,h),h},close(){e.close()}}}function JC(e){return new Po(e.buffer,{byteOffset:e.byteOffset})}var pn=B(require("fs"),1),Ir=B(require("path"),1);var Un=1010,_h=1012,cne=[["SUBRACE",1008,"generic","iwd2"],["BONES",1008,"generic","pst"],["CLOWNRAN",1008,"generic","iwd1"],["FLYTHR01",2,"generic","bg2"],["OH1000",Un,"bgee","bg2"],["OH6000",Un,"bg2ee","bg2"],["PSTCHAR",_h,"pstee","bg2"],["HOWPARTY",_h,"iwdee","bg2"]],lne=[["pstee","PSTCHAR",_h],["iwdee","HOWPARTY",_h],["bg2ee","OH6000",Un],["bgee","OH1000",Un],["iwd2","AR6050",Un],["pst","AR0104A",Un],["tob","AR6111",Un],["bg2","AR0083",Un],["totlm","AR9715",Un],["how","AR9109",Un],["iwd","AR2116",Un],["totsc","AR2003",Un],["bg1","AR0125",Un]],SW={bg1:"Baldur's Gate",totsc:"Baldur's Gate: Tales of the Sword Coast",bg2:"Baldur's Gate II: Shadows of Amn",tob:"Baldur's Gate II: Throne of Bhaal",bgt:"Baldur's Gate Trilogy",iwd:"Icewind Dale",how:"Icewind Dale: Heart of Winter",totlm:"Icewind Dale: Trials of the Luremaster",iwd2:"Icewind Dale II",pst:"Planescape: Torment",bgee:"Baldur's Gate: Enhanced Edition",sod:"Baldur's Gate: Siege of Dragonspear",bg2ee:"Baldur's Gate II: Enhanced Edition",iwdee:"Icewind Dale: Enhanced Edition",pstee:"Planescape: Torment: Enhanced Edition",eet:"Enhanced Edition Trilogy"},wW={bg1:"BG1",totsc:"BG1: TotSC",bg2:"BG2: SoA",tob:"BG2: ToB",bgt:"BGT",iwd:"IWD",how:"IWD: HoW",totlm:"IWD: TotLM",iwd2:"IWD2",pst:"PST",bgee:"BGEE",sod:"BGEE: SoD",bg2ee:"BG2EE",iwdee:"IWDEE",pstee:"PSTEE",eet:"EET"},une={bg1:"bg1",bg2:"bg2",iwd1:"iwd",iwd2:"iwd2",pst:"pst"};function ZC(e){let t="generic",n="bg1";for(let[a,c,l,u]of cne)e.lookup(a,c)!==void 0&&(t=l,n=u);let r=t==="generic"?"classic":"ee",s=lne.find(([,a,c])=>e.lookup(a,c)!==void 0)?.[0]??(t==="generic"?une[n]:t);return{variant:t,scriptStyle:n,edition:r,flavour:s,label:SW[s],shortLabel:wW[s]}}function xW(e,t,n){let r;return n("override/eet.flag")||n("data/eetTU00.bif")?r="eet":e.flavour==="bgee"&&n("movies/sodcin01.wbm")?r="sod":(e.flavour==="bg2"||e.flavour==="tob")&&t("AR7200",Un)&&(r="bgt"),r===void 0||r===e.flavour?e:{...e,flavour:r,label:SW[r],shortLabel:wW[r]}}var CW=1008,PW=1012,dne=["override"];function RW(e){return[...e?[`lang/${e}/movies`]:[],"movies","characters","portraits","portrait",...e?[`lang/${e}/sounds`]:[],"sounds","scripts","override"]}function vs(e,t){let n=Ir.join(e,t);if(pn.existsSync(n))return n;let r;try{r=pn.readdirSync(e)}catch{return}let o=t.toLowerCase(),s=r.find(a=>a.toLowerCase()===o);return s?Ir.join(e,s):void 0}function fne(e){let t=vs(e,"weidu.conf");if(t)try{return/^\s*lang_dir\s*=\s*(.+?)\s*$/im.exec(pn.readFileSync(t,"utf8"))?.[1]}catch{return}}function mne(e,t,n){if(n)return n;if(t!=="ee")return;let r=vs(e,"lang");if(!r)return;let o=c=>{let l=vs(r,c);return l!==void 0&&vs(l,"dialog.tlk")!==void 0},s=fne(e);if(s&&o(s))return s;let a;try{a=pn.readdirSync(r)}catch{return}return a.filter(c=>o(c)).sort()[0]}function eP(e){return Ir.isAbsolute(e)||/^[a-z]:/i.test(e)?!0:e.split("/").some(t=>t==="..")}function NW(e){if(e===""||e==="."||e===".."||/[\\/]/.test(e)||eP(e))throw new Error(`Refusing to write "${e}": not a plain file name`)}function xs(e,t){if(eP(t))return;let n=e;for(let r of t.split("/").filter(o=>o!=="")){let o=vs(n,r);if(!o)return;n=o}return n===e?void 0:n}function pne(e){let t=new Set([""]),n=vs(e,"baldur.ini");if(n)try{let r=pn.readFileSync(n,"latin1"),o={},s=!1;for(let l of r.split(/\r?\n/)){let u=/^\s*\[(.+?)\]\s*$/.exec(l);if(u)s=u[1].toLowerCase()==="alias";else if(s){let d=/^\s*([A-Za-z0-9]+)\s*:?=\s*(.+?)\s*$/.exec(l);d&&(o[d[1].toUpperCase()]=d[2])}}let a=l=>l.replaceAll("\\","/").replace(/\/+$/,"").toLowerCase(),c=o.HD0?a(o.HD0):void 0;for(let[l,u]of Object.entries(o)){if(l==="HD0")continue;let d=a(u);c&&d.startsWith(`${c}/`)?t.add(d.slice(c.length+1)):c&&d===c&&t.add("")}}catch{}for(let r of["data","cache","CD1","CD2","CD3","CD4","CD5","CD6"])t.add(r);return[...t]}function tP(e,t={}){let n=vs(e,"chitin.key");if(!n)throw new Error(`chitin.key not found in ${e}`);let r=jC(pn.readFileSync(n)),o=new Map,s=pne(e),a=ZC(r),c=t.encoding??(a.edition==="ee"?"utf-8":"windows-1252"),l=new Map,u=new Map,d=new Map,f=new Map,m=new Map;function p(D,j,z,ie){let se=j.toLowerCase(),xt=D.get(se);if(xt===void 0){xt=null;try{xt=ie(wt(j,z))}catch{}D.set(se,xt)}return xt??void 0}let g=mne(e,a.edition,t.lang),h=t.overrideFolders??(t.mode==="engine"?RW(g):dne),y=new Map(h.map((D,j)=>[D,j])),w=h.length,_=new Map,b=(D,j)=>`${D.toUpperCase()}\0${j}`;for(let D of r.resources){let j=b(D.resref,D.type),z={kind:"bif",bifIndex:D.bifIndex,fileIndex:D.fileIndex,tilesetIndex:D.tilesetIndex,type:D.type,rank:w},ie=_.get(j);ie?(ie.sources=ie.sources.filter(se=>se.kind!=="bif"),ie.sources.push(z)):_.set(j,{resref:D.resref.toUpperCase(),type:D.type,sources:[z]})}function S(){h.forEach((D,j)=>{let z=xs(e,D);if(!z)return;let ie;try{ie=pn.readdirSync(z)}catch{return}for(let se of ie){let xt=se.lastIndexOf(".");if(xt<=0)continue;let vt=ac(se.slice(xt+1));if(vt===void 0)continue;let Mt=se.slice(0,xt).toUpperCase(),ce=b(Mt,vt),vn={kind:"file",folder:D,path:Ir.join(z,se),rank:j},ei=_.get(ce);ei?ei.sources.push(vn):_.set(ce,{resref:Mt,type:vt,sources:[vn]})}})}function N(){for(let D of _.values())D.sources.sort((j,z)=>j.rank-z.rank)}S(),N();let R=xW(a,(D,j)=>_.has(b(D,j)),D=>xs(e,D)!==void 0||g!==void 0&&xs(e,`lang/${g}/${D}`)!==void 0),$=new Map;function I(D){let j=$.get(D);if(j!==void 0)return j??void 0;let z=r.bifs[D],ie=z?s.map(se=>xs(e,se?`${se}/${z.name}`:z.name)).find(se=>se!==void 0):void 0;return $.set(D,ie??null),ie}function U(D){let j=o.get(D);if(j)return j;let z=r.bifs[D];if(!z)throw new Error(`BIF index ${D} out of range`);let ie=I(D);if(!ie)throw new Error(eP(z.name)?`Refusing to load BIF outside the game directory: ${z.name}`:`BIF file not found: ${z.name}`);let se=UC(hh(ie));return o.set(D,se),se}function de(D){if(D.kind==="file")return pn.readFileSync(D.path);let j=U(D.bifIndex);return D.type===1003?j.readTileset(D.tilesetIndex):j.readFile(D.fileIndex)}function F(D){let j=typeof D=="string"?ac(D):D;if(j===void 0)throw new Error(`Unknown resource extension "${D}"`);return j}function Q(D){let j=y.get(D);if(j===void 0)throw new Error(`Folder "${D}" is not one of the override folders (${h.join(", ")})`);return j}function pe(D){return xs(e,`override/${D}`)}function ot(D,j,z){return _.get(b(D,j))?.sources.find(se=>se.kind==="file"&&se.folder===z)}function M(D,j){if(j===void 0)return r.lookup(D)?.type;let z=typeof j=="string"?ac(j):j;if(typeof j=="string"&&z===void 0)throw new Error(`Unknown resource extension "${j}"`);return z}function O(D,j){let z=M(D,j);return(z===void 0?void 0:_.get(b(D,z)))?.sources[0]}function wt(D,j){let z=O(D,j);if(z===void 0){let ie=M(D,j),se=ie!==void 0?` (type 0x${ie.toString(16)})`:"";throw new Error(`Resource not found: ${D}${se}`)}return de(z)}return{key:r,identity:R,list(){let D=[];for(let j of _.values()){let z=j.sources[0];D.push({resref:j.resref,type:j.type,ext:sc(j.type),bif:z.kind==="file"?`${z.folder}/${Ir.basename(z.path)}`:r.bifs[z.bifIndex]?.name??""})}return D},read:wt,canRead(D,j){let z=typeof j=="string"?ac(j):j,se=(z===void 0?void 0:_.get(b(D,z)))?.sources[0];return se!==void 0&&(se.kind==="file"||I(se.bifIndex)!==void 0)},locate(D,j){let z=O(D,j);if(z===void 0)return;if(z.kind==="file")return{kind:"file",path:z.path};let ie=I(z.bifIndex);if(ie===void 0)return;let se=z.type===1003;return{kind:"bif",archivePath:ie,entry:se?z.tilesetIndex:z.fileIndex,tileset:se}},write(D,j,z,ie){NW(D);let se=F(j),xt=sc(se);if(!xt)throw new Error(`No file extension known for resType 0x${se.toString(16)}`);let vt=ie?.folder??"override",Mt=Q(vt),ce=b(D,se),vn=_.get(ce)??{resref:D.toUpperCase(),type:se,sources:[]},ei=ot(D,se,vt),V=ei!==void 0?ei.path:Ir.join(EW(e,vt),`${D.toLowerCase()}.${xt}`);WC(V,z);let Be={kind:"file",folder:vt,path:V,rank:Mt};vn.sources=[...vn.sources.filter(W=>!(W.kind==="file"&&W.folder===vt)),Be].sort((W,he)=>W.rank-he.rank),_.set(ce,vn)},remove(D,j,z){let ie=F(j),se=z?.folder??"override";Q(se);let xt=b(D,ie),vt=_.get(xt),Mt=ot(D,ie,se);return!vt||!Mt?!1:(pn.rmSync(Mt.path,{force:!0}),vt.sources=vt.sources.filter(ce=>ce!==Mt),vt.sources.length===0&&_.delete(xt),!0)},rescan(){let D=[];for(let[j,z]of _)z.sources=z.sources.filter(ie=>ie.kind!=="file"),z.sources.length===0&&D.push(j);for(let j of D)_.delete(j);S(),N()},looseFile(D,j,z){let ie=z?.folder??"override";return Q(ie),ot(D,F(j),ie)?.path},writeAuxFile(D,j){NW(D);let z=Ir.join(EW(e,"override"),D.toLowerCase());return WC(z,j),z},auxFile:pe,readAuxFile(D){let j=pe(D);return j?pn.readFileSync(j):void 0},tlk(D="male"){let j=l.get(D);if(j===void 0){let z=D==="female"?"dialogF.tlk":"dialog.tlk",ie=[...g?[`lang/${g}/${z}`]:[],z],se;for(let xt of ie)if(se=xs(e,xt),se)break;j=se?QC(hh(se),{encoding:c}):null,l.set(D,j)}return j??void 0},ids(D){return p(u,D,CW,VC)},idsAll(D){return p(d,D,CW,HC)},twoDa(D){return p(f,D,PW,zC)},twoDaTable(D){return p(m,D,PW,KC)},close(){for(let D of o.values())D.close();o.clear();for(let D of l.values())D&&D.close();l.clear()}}}function EW(e,t){let n=xs(e,t);if(n)return n;let r=Ir.join(e,t);return pn.mkdirSync(r,{recursive:!0}),r}var hne=(e,t)=>tP(e,{mode:"engine",...t===void 0?{}:{encoding:t}}),yh=class{opener;open;failedKey;constructor(t=hne){this.opener=t}resolve(t,n){return this.game(n)?.tlk()?.get(t)}tables(t){return this.game(t)}scriptStyle(t){return this.game(t)?.identity.scriptStyle}game(t){let{gamePath:n}=t;if(n==="")return;let r=`${n} ${t.tlkEncoding}`;if(this.open?.key===r)return this.open.game;if(this.failedKey!==r){this.dispose();try{let o=this.opener(n,t.tlkEncoding===""?void 0:t.tlkEncoding);return this.open={key:r,game:o},o}catch(o){this.failedKey=r,T(`Cannot open the configured IE game at ${n}: ${at(o)}`,"warn");return}}}dispose(){this.open?.game.close(),this.open=void 0,this.failedKey=void 0}};var bh=B(le());var Iu=B(require("fs")),Au=B(require("path"));var nP=class extends Error{constructor(t){super(`Unknown transpile extension for "${t}". Accepted: ${yn}, ${Jt}`),this.name="UnknownTranspileExtensionError"}};function rP(e){let t=e.toLowerCase();if(t.endsWith(yn))return e.slice(0,-yn.length)+af;if(t.endsWith(Jt))return e.slice(0,-Jt.length)+qo;throw new nP(e)}var Eo=class e extends Error{location;constructor(t,n={},r){super(t),this.name="TranspileError",this.location=n,r!==void 0&&(this.cause=r)}static fromNode(t,n,r){return new e(n,{file:r,line:t.getStartLineNumber()})}static wrap(t,n){if(t instanceof e){let o={file:t.location.file??n.file,line:t.location.line??n.line,column:t.location.column??n.column};return new e(t.message,o,t)}let r=t instanceof Error?t.message:String(t);return new e(r,n,t)}static remap(t,n){if(!(t instanceof e)||t.location.line===void 0)return t;let r=n[t.location.line-1];return r===void 0?new e(t.message,{file:t.location.file},t):new e(t.message,{file:r.file,line:r.line+1},t)}};var gne=6e4,iP=Da({fileName:"ts-morph-worker.js",label:"transpiler",timeoutMs:gne});async function TW(e){let t=await iP.send(e);if(t===null)throw new Error("The transpiler request was cancelled.");return t}function AW(e){if(!e.failure)return;let{message:t,...n}=e.failure;throw new Eo(t,n)}function IW(){iP.start()}async function oP(e){let t=await TW(e);return AW(t),t.result}async function sP(e){let t=await TW(e);return AW(t),t.parsed}async function DW(){await iP.stop()}var kW=B(require("path"));var _ne=6e4,FW=Da({fileName:"ts-morph-worker.js",label:"TSSL compiler",timeoutMs:_ne}),aP=!1,yne=`function start() {}
369
- `,bne=kW.join(__dirname,"__prewarm__.tssl");async function cP(e,t){let n=await FW.send({...e,kind:"compile"},t);if(n===null)return!1;if(n.failure){let{message:r,...o}=n.failure;throw new Eo(r,o)}return!0}function LW(){aP||(aP=!0,cP({text:yne,filepath:bne,intPath:null,sslPath:null,level:0,shortCircuit:!1}).catch(e=>{T(`TSSL compile worker prewarm failed: ${e instanceof Error?e.message:String(e)}`)}))}async function OW(){aP=!1,await FW.stop()}var MW=new Map;function $W(){Aa(MW)}async function qW(e,t,n,r,o){let s=tp(r.falloutSSL.compileOptions.split(/\s+/).filter(Boolean)),a=o||r.falloutSSL.compileOnValidate,c=op(t,r.falloutSSL.outputDirectory,e,a),l=r.tssl.emitSsl?t.slice(0,-zn.length)+".ssl":null,u=!1;return await jl({uri:Ne(e),activeCompiles:MW,run:async d=>{u=await cP({text:n,filepath:t,intPath:a?c:null,sslPath:l,level:s.level,shortCircuit:s.shortCircuit},d)}}),u?l===null?{intPath:c}:{intPath:c,sslPath:l}:null}function lP(e,t){let n=BA(e,"compiler");if(n.length===0)return;let r=[],o=new Map;for(let s of n){let a=t[s.range.start.line];if(a===void 0){r.push(s);continue}let c=Ye(a.file),l=o.get(c);l||(l=[],o.set(c,l)),l.push({...s,range:{start:{line:a.line,character:0},end:{line:a.line,character:0}}})}jr(e,"compiler",r);for(let[s,a]of o)jr(s,"compiler",a)}function uP(e,t,n,r){let o=e instanceof Eo?e.location:{},s=o.file!==void 0&&o.file!==et(t),a=s?`${o.file}:${o.line??1}: ${at(e)}`:at(e),c=s?1:o.line??1,l=s?0:o.column??0;Wr({errors:[{uri:t,line:c,columnStart:l,columnEnd:l,message:a}],warnings:[]},t,t),r&&ir(`${n}: ${a}`)}async function Du(e,t,n,r){if(!e.startsWith("file://")){T(`Not compiling ${e}: not a file on disk`,"debug");return}let o=await Zs(e);if(Vf(Ji)||Iu.mkdirSync(Ji),!(Y.has(t)&&(Jc(e),await Y.compile(t,e,r,n)))){if(t==="typescript"){if(e.toLowerCase().endsWith(Jt)){Jc(e);try{let s=et(e),{output:a,warnings:c,sourceMap:l}=await oP({kind:"td",filepath:s,text:r}),u=rP(s);await Iu.promises.writeFile(u,a,"utf-8");let d=Au.basename(u);if(n)if(c.length>0){let f=c.map(m=>m.message.match(/^Function "(.+)" /)?.[1]??"?");Sr(`Transpiled to ${d}. Orphan states: ${f.join(", ")}`)}else bn(`Transpiled to ${d}`);if(o.weidu.path&&o.weidu.gamePath){let f=Ye(u);await So(f,o.weidu,n,a),lP(f,l)}}catch(s){uP(s,e,"TD",n)}return}if(e.toLowerCase().endsWith(yn)){Jc(e);try{let s=et(e),{output:a,sourceMap:c}=await oP({kind:"tbaf",filepath:s,text:r}),l=rP(s);await Iu.promises.writeFile(l,a,"utf-8");let u=Au.basename(l);n&&bn(`Transpiled to ${u}`);let d=Ye(l);await Op(d,a,o,n)&&lP(d,c)}catch(s){uP(s,e,"TBAF",n)}return}if(e.toLowerCase().endsWith(zn)){Jc(e);try{let s=et(e),a=await qW(e,s,r,o,n);if(a===null)return;let{intPath:c,sslPath:l}=a;if(n){let u=l?` and ${Au.basename(l)}`:"";bn(`Compiled ${Au.basename(c)}${u}`)}}catch(s){uP(s,e,"TSSL",n)}}return}T(`Don't know how to compile ${t} - ${e}`),n&&bn(`Don't know how to compile ${t} - ${e}`)}}function BW(){return{textDocumentSync:bh.TextDocumentSyncKind.Incremental,completionProvider:{resolveProvider:!0,completionItem:{labelDetailsSupport:!0},triggerCharacters:["@"]},hoverProvider:!0,signatureHelpProvider:{triggerCharacters:["("]},semanticTokensProvider:{legend:yb,full:!0},inlayHintProvider:!0,definitionProvider:!0,referencesProvider:!0,renameProvider:{prepareProvider:!0},documentFormattingProvider:!0,documentSymbolProvider:!0,workspaceSymbolProvider:!0,foldingRangeProvider:!0,selectionRangeProvider:!0,callHierarchyProvider:!0,codeActionProvider:{codeActionKinds:[bh.CodeActionKind.QuickFix]},executeCommandProvider:{commands:[al,Kf,Yf,...d0.map(e=>f0(e))]}}}function lc(e){e().catch(()=>{})}var Pi={configuration:!1,workspaceFolders:!1,fileWatching:!1},uc,dP=Promise.resolve();function WW(e){e.connection.onInitialize(async t=>{T("onInitialize started");let n=t.capabilities;Pi.configuration=!!n.workspace?.configuration,Pi.workspaceFolders=!!n.workspace?.workspaceFolders,Pi.fileWatching=!!n.workspace?.didChangeWatchedFiles?.dynamicRegistration,t.workspaceFolders?.[0]&&(uc=(0,jW.fileURLToPath)(t.workspaceFolders[0].uri),T(`workspace_root = ${uc}`));let r=aO(uc),o=new ah(r.translation,uc,()=>{lc(()=>e.connection.languages.inlayHint.refresh())});dP=o.init().then(()=>{for(let a of e.documents.all()){let c=a.getText();o.reloadFile(a.uri,a.languageId,c),o.reloadConsumer(a.uri,c,a.languageId)}}).catch(a=>T(`Translation load failed: ${a}`,"error")),qA({info:a=>T(a),error:a=>T(a,"error")}),Me.register(mt,"tree-sitter-ssl.wasm","SSL"),Me.register(Tt,"tree-sitter-baf.wasm","BAF"),Me.register(At,"tree-sitter-weidu_d.wasm","WeiDU D"),Me.register(_n,"tree-sitter-weidu_tp2.wasm","WeiDU TP2"),Me.register(ta,"tree-sitter-fallout_msg.wasm","Fallout MSG"),Me.register(na,"tree-sitter-weidu_tra.wasm","WeiDU TRA"),await Me.initAll(),Y.register(W$),Y.register(U$),Y.register(aq),Y.register(Pq),Y.register(UB),Y.register(rj),Y.register(GB),Y.register(Qp(na,yv,"tra")),Y.register(Qp(ta,bv,"msg")),Y.register(Qp(tb,wv)),Y.registerAlias(Zy,Tt),Y.registerAlias(Hc,Tt),await Y.init({workspaceRoot:uc,settings:Fn,getDocumentText:a=>e.documents.get(a)?.getText(),getDocumentVersion:a=>e.documents.get(a)?.version,getTranslationDir:()=>o.directory(),scanAfter:dP}),Z$({capabilities:{configuration:Pi.configuration,workspaceFolders:Pi.workspaceFolders,fileWatching:Pi.fileWatching},workspaceRoot:uc,projectSettings:r,settings:Fn,translation:o,configuredGame:new yh});let s={capabilities:BW()};return Pi.workspaceFolders&&(s.capabilities.workspace={workspaceFolders:{supported:!0}}),T("onInitialize completed"),s}),e.connection.onInitialized(async()=>{T("onInitialized started"),Pi.configuration&&await e.connection.client.register(Sh.DidChangeConfigurationNotification.type);let t=ts(await e.connection.workspace.getConfiguration({section:"bgforge"}));if(Lp(t),Y.updateSettings(t),Pi.fileWatching){let n=Y.getWatchPatterns();n.length>0&&(await e.connection.client.register(Sh.DidChangeWatchedFilesNotification.type,{watchers:n}),T(`Registered file watchers for ${n.length} patterns`))}else Y.getWatchPatterns().length>0&&T("Client did not advertise didChangeWatchedFiles dynamicRegistration; header reload on out-of-band edit is disabled.","warn");dP.then(()=>lc(()=>e.connection.languages.inlayHint.refresh())),T("onInitialized completed")})}var qPe=B(le());function UW(e){e.connection.onCompletion(xe("onCompletion",t=>{let n=t.textDocument.uri,r=e.documents.get(n);if(!r)return[];let o=r.languageId,s=r.getText();return Y.completion(o,s,n,t.position,t.context?.triggerCharacter)},e.timingOpts)),e.connection.onCompletionResolve(t=>t)}var VW=B(le());var fP="BGforge MLS (syntax)",HW=32;function GW(e){return ap(e).map(t=>Cne(t,t.isMissing?`missing '${t.type}'`:xne(t)))}function xne(e){let t=vne(e);return t?`Syntax error near '${t}'`:"Syntax error"}function vne(e){let t=(e.children[0]?.text??e.text).trim();if(t.length===0)return"";let n=t.split(`
370
- `,1)[0]??t,r=n.split(/\s+/,1)[0]??n;return r.length>HW?`${r.slice(0,HW)}...`:r}function Cne(e,t){let n={line:e.startPosition.row,character:e.startPosition.column},r=e.startIndex===e.endIndex?{line:e.startPosition.row,character:e.startPosition.column+1}:{line:e.endPosition.row,character:e.endPosition.column};return{severity:VW.DiagnosticSeverity.Error,range:{start:n,end:r},message:t,source:fP}}function mP(e,t,n){if(!Me.isInitialized(t))return;let r=Me.parseWithCache(t,n);r&&jr(e,"tree-sitter",GW(r.rootNode))}function zW(e,t,n,r){if(t.length<1e5){r();return}n.schedule(e,r)}function ku(e,t){let n=e instanceof Error?e.message:String(e);T(`Compilation error: ${n}`,"error"),t&&ir(`Compilation failed: ${n}`)}var wh=new Map;function Pne(e){let t=e.toLowerCase();t.endsWith(zn)?LW():(t.endsWith(yn)||t.endsWith(Jt))&&IW()}function KW(e){return t=>{let n=Si();if(!n?.capabilities.configuration)return Promise.resolve(n?.settings??Fn);let r=Ne(t),o=wh.get(r);return o||(o=e.workspace.getConfiguration({scopeUri:t,section:"bgforge"}).then(ts),wh.set(r,o)),o}}function YW(){wh.clear()}function pP(e,t,n){let r=Si()?.translation.getDiagnostics(e,t,n)??[];jr(e,"translation",r)}function XW(e){e.documents.onDidClose(xe("onDidClose",t=>{wh.delete(Ne(t.document.uri)),Y.handleDocumentClosed(t.document.languageId,t.document.uri)},e.timingOpts)),e.documents.onDidOpen(xe("onDidOpen",async t=>{let n=await xn(),r=t.document.uri,o=t.document.languageId,s=t.document.getText();Pne(r),Y.reloadFileData(o,r,s),n.translation.reloadFile(r,o,s),n.translation.reloadConsumer(r,s,o),(await e.getDocumentSettings(r)).diagnostics&&pP(r,o,s)},e.timingOpts)),e.documents.onDidSave(xe("onDidSave",async t=>{let n=t.document.uri,r=t.document.languageId,o=t.document.getText();Y.reloadFileData(r,n,o),Wo(n)&&lc(()=>e.connection.languages.semanticTokens.refresh()),Si()?.translation.reloadFile(n,r,o),Si()?.translation.reloadConsumer(n,o,r);let s=Ne(n);if(e.renameSuppression.consumeAffected(s))return;let a=await e.getDocumentSettings(n);a.diagnostics&&(e.parseDebouncer.cancel(s),mP(n,r,o),pP(n,r,o)),oO(a.validate)&&(e.compileDebouncer.cancel(s),Du(n,r,!1,o).catch(c=>ku(c,!1)))},e.timingOpts)),e.documents.onDidChangeContent(xe("onDidChangeContent",async t=>{let n=t.document.uri,r=t.document.languageId,o=t.document.getText(),s=Ne(n);if(e.fileReloadDebouncer.schedule(s,()=>{Y.reloadFileData(r,n,o),Si()?.translation.reloadFile(n,r,o),Si()?.translation.reloadConsumer(n,o,r),Wo(n)&&lc(()=>e.connection.languages.semanticTokens.refresh())}),e.renameSuppression.isAffected(s))return;jA(n);let a=await e.getDocumentSettings(n);a.diagnostics&&zW(s,o,e.parseDebouncer,()=>{mP(n,r,o),pP(n,r,o)}),sO(a.validate)&&e.compileDebouncer.schedule(s,()=>{Du(n,r,!1,o).catch(c=>ku(c,!1))})},e.timingOpts))}function QW(e){e.connection.onDidChangeConfiguration(xe("onDidChangeConfiguration",async t=>{T("did change configuration");let n=Si();if(!n)return;let r;if(n.capabilities.configuration)YW(),r=ts(await e.connection.workspace.getConfiguration({section:"bgforge"}));else{let o=t.settings?.bgforge;r=ts(o??Fn)}Lp(r),Y.updateSettings(r)},e.timingOpts)),e.connection.onDidChangeWatchedFiles(xe("onDidChangeWatchedFiles",t=>{for(let n of t.changes)Y.handleWatchedFileChange(n.uri,n.type).catch(r=>{T(`handleWatchedFileChange rejected: ${r instanceof Error?r.message:String(r)}`,"warn")})},e.timingOpts))}function ZW(e){e.connection.onDefinition(xe("onDefinition",async t=>{let n=e.documents.get(t.textDocument.uri);if(!n)return;let r=t.textDocument.uri,o=n.languageId,s=n.getText();if(!Y.shouldProvideFeatures(o,s,t.position))return;let a=await Y.definition(o,s,t.position,r);if(a)return a;let c=Zm(s,t.position,Y.identifierExtraChars(o)),l=await xn();if(c){let u=l.translation.getDefinition(r,o,c,s);if(u)return u}return c&&!Y.isPositionInString(o,s,t.position)?Y.symbolDefinition(o,c):null},e.timingOpts))}function eU(e){e.connection.onFoldingRanges(xe("onFoldingRanges",t=>{let n=e.documents.get(t.textDocument.uri);return n?Y.foldingRanges(n.languageId,n.getText()):[]},e.timingOpts))}function tU(e){e.connection.onSelectionRanges(xe("onSelectionRanges",t=>{let n=e.documents.get(t.textDocument.uri);return n?Y.selectionRanges(n.languageId,n.getText(),t.positions):[]},e.timingOpts))}function nU(e){let t=e.data;return t&&typeof t.langId=="string"?t.langId:null}function hP(e,t){return{...e,data:{langId:t}}}function rU(e){let t=e.connection.languages.callHierarchy;t.onPrepare(xe("onPrepareCallHierarchy",n=>{let r=e.documents.get(n.textDocument.uri);if(!r)return null;let o=r.languageId;return Y.prepareCallHierarchy(o,r.getText(),n.position,n.textDocument.uri)?.map(a=>hP(a,o))??null},e.timingOpts)),t.onIncomingCalls(xe("onCallHierarchyIncomingCalls",n=>{let r=nU(n.item);return r?Y.incomingCalls(r,n.item).map(o=>({...o,from:hP(o.from,r)})):[]},e.timingOpts)),t.onOutgoingCalls(xe("onCallHierarchyOutgoingCalls",n=>{let r=nU(n.item);return r?Y.outgoingCalls(r,n.item).map(o=>({...o,to:hP(o.to,r)})):[]},e.timingOpts))}var Ro=B(le());var Ine=/^missing '(.+)'$/,Dne=/^[^\p{L}\p{N}_\s]+$/u;function kne(e){if(e.source!==fP)return;let t=typeof e.message=="string"?e.message:e.message.value,n=Ine.exec(t)?.[1];return n!==void 0&&Dne.test(n)?n:void 0}function Fne(e,t,n){return{title:`Insert missing '${t}'`,kind:Ro.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{documentChanges:[Ro.TextDocumentEdit.create(Ro.OptionalVersionedTextDocumentIdentifier.create(n.uri,n.version),[Ro.TextEdit.insert(e.range.start,t)])]}}}function iU(e){e.connection.onCodeAction(xe("onCodeAction",t=>{let n=e.documents.get(t.textDocument.uri);if(!n)return[];let r=[];for(let o of t.context.diagnostics){let s=kne(o);s!==void 0&&r.push(Fne(o,s,n))}return r},e.timingOpts))}var oU=B(le());function sU(e){e.connection.onDocumentFormatting(xe("onDocumentFormatting",t=>{let n=e.documents.get(t.textDocument.uri);if(!n)return[];let r=t.textDocument.uri,o=n.languageId,s=n.getText(),a=Y.format(o,s,r);return a.warning&&e.connection.sendNotification("window/showMessage",{type:oU.MessageType.Warning,message:sa(a.warning)}),a.edits},e.timingOpts))}var aU=B(le());function cU(e,t,n){let r=[];for(let o of e){let s=o.range.end.line;if(s<n.start.line||s>n.end.line)continue;let a=t(o.strref);if(a===void 0)continue;let c=xu(a);r.push({position:o.range.end,label:c.inlay,...c.inlayTooltip===void 0?{}:{tooltip:c.markup},kind:aU.InlayHintKind.Parameter,paddingLeft:!0,paddingRight:!0})}return r}function lU(e,t,n){let r=e.find(s=>Mne(s.range,n));if(!r)return;let o=t(r.strref);return o===void 0?void 0:xu(o).hover}function Mne(e,t){return t.line===e.start.line&&t.character>=e.start.character&&t.character<=e.end.character}function uU(e){e.connection.onHover(xe("onHover",async t=>{let n=t.textDocument.uri,r=e.documents.get(n);if(!r)return;let o=r.languageId,s=r.getText(),a=Zm(s,t.position,Y.identifierExtraChars(o)),c=await xn(),{debug:l}=c.settings;if(!a){l&&T(`[hover] no symbol at position in ${n}`);return}if(l&&T(`[hover] symbol="${a}" langId="${o}" uri="${n}"`),!Y.shouldProvideFeatures(o,s,t.position)){l&&T("[hover] suppressed (shouldProvideFeatures=false)");return}let u=Y.strRefs(o,s,n);if(u.length>0){let{weidu:p}=await Zs(n),g=lU(u,h=>c.configuredGame.resolve(h,p),t.position);if(g)return l&&T("[hover] strref hover returned"),g}let d=c.translation.getHover(n,o,a,s);if(d)return l&&T("[hover] translation hover returned"),d;let f=Y.localHover(o,s,a,n,t.position);if(f.handled)return l&&T(`[hover] localHover handled, result=${f.hover?"found":"null"}`),f.hover;if(Y.isPositionInString(o,s,t.position))return l&&T("[hover] suppressed (cursor in string)"),null;let m=Y.hover(o,n,a,s);return l&&T(`[hover] dataHover result=${m?"found":"null"}`),m},e.timingOpts))}function dU(e){e.connection.languages.inlayHint.on(async t=>{let n=t.textDocument.uri,r=e.documents.get(n);if(!r)return;let o=r.getText(),s=r.languageId,a=await xn(),c=Y.strRefs(s,o,n),l=[];if(c.length>0){let{weidu:u}=await Zs(n);l=cU(c,d=>a.configuredGame.resolve(d,u),t.range)}return[...Y.inlayHints(s,o,n,t.range),...l,...a.translation.getInlayHints(n,s,o,t.range)]})}function fU(e){e.connection.onReferences(xe("onReferences",async(t,n)=>{let r=e.documents.get(t.textDocument.uri);if(!r)return[];let o=t.textDocument.uri,s=r.languageId,a=r.getText();if(!Y.shouldProvideFeatures(s,a,t.position))return[];let c=Y.references(s,a,t.position,o,t.context.includeDeclaration,n);if(c.length>0)return c;let u=await(await xn()).translation.getReferences(o,s,t.position,t.context.includeDeclaration);return u&&u.length>0?u:[]},e.timingOpts))}function mU(e){e.connection.languages.semanticTokens.on(xe("semanticTokens",t=>{let n=e.documents.get(t.textDocument.uri);return n?Y.semanticTokens(n.languageId,n.getText(),t.textDocument.uri):{data:[]}},e.timingOpts))}function pU(e){e.connection.onSignatureHelp(t=>{let n=t.textDocument.uri,r=e.documents.get(n);if(!r)return null;let o=r.getText(),s=r.languageId,a=z1(o,t.position);return a?Y.signature(s,o,n,a.symbol,a.parameter):null})}function hU(e){e.connection.onDocumentSymbol(xe("onDocumentSymbol",t=>{let n=e.documents.get(t.textDocument.uri);return n?Y.symbols(n.languageId,n.getText()):[]},e.timingOpts)),e.connection.onWorkspaceSymbol(xe("onWorkspaceSymbol",(t,n)=>Y.workspaceSymbols(t.query,n),e.timingOpts))}var gU=B(le());function _U(e){e.connection.onPrepareRename(xe("onPrepareRename",t=>{let n=e.documents.get(t.textDocument.uri);if(!n)return null;let r=n.languageId,o=n.getText();return Y.prepareRename(r,o,t.position)},e.timingOpts)),e.connection.onRenameRequest(xe("onRenameRequest",async t=>{let n=e.documents.get(t.textDocument.uri);if(!n)return null;let r=t.textDocument.uri,o=n.languageId,s=n.getText(),a=await Y.rename(o,s,t.position,t.newName,r);if(a?.documentChanges&&a.documentChanges.length>0){let c=[];for(let l of a.documentChanges)gU.TextDocumentEdit.is(l)&&c.push(Ne(l.textDocument.uri));e.renameSuppression.markAffected(c)}return a},e.timingOpts))}var Vne=new Set(["NOption","NLowOption","GOption","GLowOption","BOption","BLowOption"]),Gne=new Set(["NMessage","GMessage","BMessage"]);function gP(e){return Vne.has(e)}function _P(e){return Gne.has(e)}var zne=new Set;async function vU(e,t=zne){we()||await _p();let n=De(e);if(!n)return T("parseDialog: fallout-ssl parse produced no tree; returning empty dialog","warn"),{nodes:[],entryPoints:[]};let r=n.rootNode,o=[],s=[],a,c,l,u=[],d=new Map,f=new Map;for(let S of r.children){if(S.type!=="procedure_forward")continue;let N=S.childForFieldName("name");if(!N)continue;let R=Lt(N.text);d.has(R)||(d.set(R,{start:N.startIndex,end:N.endIndex}),f.set(R,{start:S.startIndex,end:S.endIndex}))}let m=new Map;for(let S of r.children){if(S.type!=="procedure")continue;let N=S.childForFieldName("name");if(!N)continue;let R=N.text;if(Lt(R)==="talk_p_proc"){Kne(S,s),a=S.startIndex,c=Yne(S),l=Xne(S);continue}let $=Jne(S,R,t,e);$.procRange={start:S.startIndex,end:S.endIndex};let I=d.get(Lt(R));I&&($.forwardDeclRange=I);let U=f.get(Lt(R));U&&($.forwardDeclStmtRange=U),m.set(R,$)}dc(r,S=>{if(S.type!=="call_expr")return;let N=S.childForFieldName("func")?.text;if(N!=="force_dialog_start"&&N!=="start_dialog_at_node")return;let R=vP(S)[0];if(!R)return;let $=R.type==="call_expr"?R.childForFieldName("func")?.text:R.text;$&&(s.includes($)||s.push($),R.type!=="call_expr"&&u.push({name:$,targetRange:{start:R.startIndex,end:R.endIndex}}))});let p=new Map;for(let S of m.keys())p.set(Lt(S),S);let g=S=>p.get(Lt(S))??S;s.splice(0,s.length,...new Set(s.map(S=>g(S))));for(let S of c??[])S.name=g(S.name);for(let S of u)S.name=g(S.name);for(let S of m.values()){for(let N of S.options)N.target&&(N.target=g(N.target));S.callTargets=[...new Set(S.callTargets.map(g))];for(let N of S.callTransitions??[])N.name=g(N.name)}let h=new Set,y=[...s];for(;y.length>0;){let S=y.shift();if(h.has(S))continue;h.add(S);let N=m.get(S);if(N){for(let R of N.options)R.target&&y.push(R.target);for(let R of N.callTargets)y.push(R)}}let w=S=>Lt(S).endsWith("_p_proc"),_=S=>/^node\d+$/.test(Lt(S)),b=S=>{let N=/^node0*(\d+)$/.exec(Lt(S));return N!==null&&(N[1]==="998"||N[1]==="999")};for(let[S,N]of m){let R=N.replies.length>0||N.options.length>0,$=!w(S)&&!b(S)&&(R||_(S));(h.has(S)||$)&&o.push(N)}return{nodes:o,entryPoints:s,procNames:[...m.keys()],...a!==void 0?{newProcAnchor:a}:{},...c!==void 0?{entryCalls:c}:{},...l!==void 0?{entryCallAnchor:l}:{},...u.length>0?{outOfBandCalls:u}:{}}}function Kne(e,t){dc(e,n=>{if(n.type==="call_stmt"){let r=n.childForFieldName("target");if(r){let o=r.type==="call_expr"?r.childForFieldName("func")?.text:r.text;o&&!t.includes(o)&&t.push(o)}}else if(n.type==="call_expr"){let r=n.childForFieldName("func");r!==null&&Lt(r.text).startsWith("node")&&!t.includes(r.text)&&t.push(r.text)}})}function Yne(e){let t=[];return dc(e,n=>{if(n.type!=="call_stmt")return;let r=n.childForFieldName("target");if(!r||r.type!=="identifier")return;let o=r.text;t.push({name:o,stmtRange:{start:n.startIndex,end:n.endIndex},targetRange:{start:r.startIndex,end:r.endIndex},topLevel:CU(e,n)})}),t}function Xne(e){return e.childrenForFieldName("body").at(-1)?.endIndex}function CU(e,t){return e.childrenForFieldName("body").some(n=>n.startIndex===t.startIndex&&n.endIndex===t.endIndex)}function Jne(e,t,n,r){let o=[],s=[],a=[],c=[],l=[],u;dc(e,w=>{u||w.type==="call_expr"&&w.childForFieldName("func")?.text==="Reply"&&vP(w)[0]&&(u=w)});let d=u?ire(u):void 0;dc(e,w=>{if(w.type==="call_expr"){let _=w.childForFieldName("func");if(!_)return;let b=_.text,S=vP(w),N=w.startPosition.row+1;n.has(b)&&!l.includes(b)&&l.push(b);let R=S[0],$=S[1],I=S[2];if(b==="Reply"&&R){let U=SP(w);o.push({msgId:yP(R),line:N,conditional:Fu(w),msgKind:bP(R),...U?{condRange:U.condRange,ifRange:U.ifRange,ifPure:U.ifPure}:{}})}if(gP(b)&&R&&$){let U=$.text,de=SP(w);s.push({type:b,msgId:yP(R),target:U,skill:I?parseInt(I.text,10):void 0,line:N,conditional:Fu(w),scopedConditional:Fu(w,d),msgKind:bP(R),callRange:{start:w.startIndex,end:w.endIndex},targetRange:{start:$.startIndex,end:$.endIndex},stmtRange:yU(w),...de?{condRange:de.condRange,ifRange:de.ifRange,ifPure:de.ifPure}:{}})}if(_P(b)&&R){let U=SP(w);s.push({type:b,msgId:yP(R),target:"",line:N,conditional:Fu(w),scopedConditional:Fu(w,d),msgKind:bP(R),stmtRange:yU(w),...U?{condRange:U.condRange,ifRange:U.ifRange,ifPure:U.ifPure}:{}})}}if(w.type==="call_stmt"){let _=w.childForFieldName("target");if(_){let b=_.type==="call_expr"?_.childForFieldName("func")?.text:_.text;if(b){let S=_.type==="identifier"?{start:_.startIndex,end:_.endIndex}:void 0,N=CU(e,w);c.push({name:b,stmtRange:{start:w.startIndex,end:w.endIndex},...S!==void 0?{targetRange:S}:{},topLevel:N}),a.includes(b)||a.push(b)}}}});let f=e.childForFieldName("name"),m=f?{start:f.startIndex,end:f.endIndex}:void 0,p=ere(e),g=!p&&tre(e),h=!p&&!g&&nre(e),y=!p&&!g&&!h;return{name:t,line:e.startPosition.row+1,replies:o,options:s,callTargets:a,faithful:p,...g?{bundleFaithful:!0,branches:rre(e,r)}:{},...h?{structured:!0,block:xP(e.childrenForFieldName("body"),r,{reply:0,opt:0,trans:0})}:{},...y?{approximate:!0}:{},insertAnchor:Qne(e,r),...l.length>0?{sideEffects:l}:{},...c.length>0?{callTransitions:c}:{},...m!==void 0?{nameRange:m}:{}}}function yU(e){let t=e;for(;t;){if(t.type==="expression_stmt")return{start:t.startIndex,end:t.endIndex};t=t.parent}return{start:e.startIndex,end:e.endIndex}}function Qne(e,t){let r=e.childrenForFieldName("body").at(-1);if(r){let s=t.lastIndexOf(`
371
- `,r.startIndex-1)+1,a=/^[ \t]*/.exec(t.slice(s,r.startIndex))?.[0]??" ";return{offset:r.endIndex,indent:a}}let o=e.children.find(s=>s.type==="begin");return{offset:o?o.endIndex:e.startIndex,indent:" "}}function Lu(e){let t=e.childForFieldName("func")?.text;return t?t==="Reply"||gP(t)||_P(t):!1}function wP(e,t){switch(e.type){case"expression_stmt":{let n=e.namedChildren[0];return n!=null&&n.type==="call_expr"&&Lu(n)}case"call_stmt":return!0;case"if_stmt":{if(!t||e.childForFieldName("else")!==null)return!1;let n=e.childForFieldName("then");return n?Zne(n):!1}default:return!1}}function Zne(e){return e.type==="block"?e.children.filter(t=>t.isNamed).every(t=>wP(t,!1)):wP(e,!1)}function ere(e){return e.childrenForFieldName("body").every(t=>wP(t,!0))}function PU(e){if(e.type==="assignment")return!0;if(e.type==="expression_stmt"){let t=e.namedChildren[0];return t!=null&&t.type==="call_expr"&&!Lu(t)}return!1}function NU(e){if(e.type==="expression_stmt"){let t=e.namedChildren[0];return t!=null&&t.type==="call_expr"&&Lu(t)}return e.type==="call_stmt"}function bU(e){return(e.type==="block"?e.children.filter(n=>n.isNamed):[e]).every(n=>NU(n)||PU(n))}function tre(e){let t=e.childrenForFieldName("body");if(t.length===0)return!1;for(let n of t){if(n.type!=="if_stmt")return!1;let r=n.childForFieldName("then");if(!r||!bU(r))return!1;let o=n.childForFieldName("else");if(o&&!bU(o))return!1}return!0}function EU(e){if(NU(e)||PU(e))return!0;if(e.type==="if_stmt"){let t=e.childForFieldName("then");if(!t||!SU(t))return!1;let n=e.childForFieldName("else");return!(n&&!SU(n))}return!1}function SU(e){return(e.type==="block"?e.children.filter(n=>n.isNamed):[e]).every(n=>EU(n))}function nre(e){let t=e.childrenForFieldName("body");return t.length===0?!1:t.every(n=>EU(n))}function xP(e,t,n){let r=[];for(let o of e){if(o.type==="if_stmt"){let a=o.childForFieldName("cond"),c=o.childForFieldName("then"),l=o.childForFieldName("else"),u={kind:"group",condition:a?.text??"",...a?{conditionRange:{start:a.startIndex,end:a.endIndex}}:{},thenBlock:c?xP(wU(c),t,n):[],...l?{elseBlock:xP(wU(l),t,n)}:{}};r.push(u);continue}let s=o.type==="expression_stmt"?o.namedChildren[0]:void 0;if(s&&s.type==="call_expr"&&Lu(s)){s.childForFieldName("func")?.text==="Reply"?r.push({kind:"line",replyIndex:n.reply++}):r.push({kind:"choice",optionIndex:n.opt++});continue}if(o.type==="call_stmt"){r.push({kind:"transition",transitionIndex:n.trans++});continue}r.push({kind:"opaque",text:t.slice(o.startIndex,o.endIndex),textRange:{start:o.startIndex,end:o.endIndex}})}return r}function wU(e){return e.type==="block"?e.children.filter(t=>t.isNamed):[e]}function xU(e,t){let r=e.children.filter(a=>a.isNamed).at(-1);if(!r)return{offset:e.startIndex+1,indent:" "};let o=t.lastIndexOf(`
372
- `,r.startIndex-1)+1,s=/^[ \t]*/.exec(t.slice(o,r.startIndex))?.[0]??" ";return{offset:r.endIndex,indent:s}}function rre(e,t){let n=[],r=0,o=0,s=(a,c)=>{let l=c.type==="block"?c.children.filter(u=>u.isNamed):[c];for(let u of l){let d=u.type==="expression_stmt"?u.namedChildren[0]:void 0;d&&d.type==="call_expr"&&Lu(d)?d.childForFieldName("func")?.text==="Reply"?a.replyIndices.push(r++):a.optionIndices.push(o++):a.opaque.push({text:t.slice(u.startIndex,u.endIndex),textRange:{start:u.startIndex,end:u.endIndex}})}};for(let a of e.childrenForFieldName("body")){let c=a.childForFieldName("cond"),l=a.childForFieldName("then"),u={kind:"if",condition:c?.text,...c?{conditionRange:{start:c.startIndex,end:c.endIndex}}:{},stmtRange:{start:a.startIndex,end:a.endIndex},replyIndices:[],optionIndices:[],opaque:[]};l&&(s(u,l),l.type==="block"&&(u.insertAnchor=xU(l,t),u.thenBlockEnd=l.endIndex)),n.push(u);let d=a.childForFieldName("else");if(d){let f={kind:"else",replyIndices:[],optionIndices:[],opaque:[]};s(f,d),d.type==="block"&&(f.insertAnchor=xU(d,t));let m=t.indexOf("else",l?l.endIndex:a.startIndex);f.elseClauseRange={start:m,end:d.endIndex},n.push(f)}}return n}function vP(e){return e.namedChildren.slice(1)}function yP(e){return e.type==="number"?parseInt(e.text,10):e.text}function bP(e){if(e.type!=="number")return e.type==="call_expr"&&e.childForFieldName("func")?.text==="random"?"random":"computed"}function Fu(e,t){let n=[],r=e,o=e.parent;for(;o;){if(o.type==="if_stmt"&&!t?.has(`${o.startIndex}:${o.endIndex}`)){let s=o.childForFieldName("cond")?.text;if(s!==void 0){let a=o.childForFieldName("else"),c=a!==null&&r.startIndex===a.startIndex&&r.endIndex===a.endIndex;n.push(c?`not ${s}`:s)}}r=o,o=o.parent}if(n.length!==0)return n.reverse(),n.length===1?n[0]:n.join(" and ")}function ire(e){let t=new Set,n=e.parent;for(;n;)n.type==="if_stmt"&&t.add(`${n.startIndex}:${n.endIndex}`),n=n.parent;return t}function SP(e){let t=e,n=e.parent,r;for(;n;){if(n.type==="if_stmt"){if(r)return;let o=n.childForFieldName("cond"),s=n.childForFieldName("then");if(!o||!s||!(t.startIndex===s.startIndex&&t.endIndex===s.endIndex))return;r={condRange:{start:o.startIndex,end:o.endIndex},ifRange:{start:n.startIndex,end:n.endIndex},ifPure:ore(s)===1}}t=n,n=n.parent}return r}function ore(e){return e.type==="block"?e.namedChildren.filter(t=>t.type!=="comment"&&t.type!=="line_comment").length:1}function dc(e,t){t(e);for(let n of e.children)dc(n,t)}var sre=new Set(["display_msg","debug_msg","float_msg","display","display_stats"]),are=new RegExp("```"+$r+"\\n(.+)");function cre(e){let t=new Set;for(let{name:n,markdown:r}of e)r.match(are)?.[1]?.startsWith("void ")&&!sre.has(n)&&t.add(n);return t}function lre(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>typeof t=="string"?t:t.value).join(`
373
- `):e.value}var RU;function CP(){return RU??=cre(On(mt).map(e=>({name:e.name,markdown:lre(e.hover.contents)}))),RU}function TU(e){let t=e.childForFieldName("say");return t?Ou(t):""}var PP=new Set(["tilde_string","string","tra_ref","tlk_ref","at_var_ref","double_string"]);function Ou(e){for(let t of e.children)if(PP.has(t.type))return mc(t);return e.text.trim()}function AU(e){let t=e.childForFieldName("say");return t?t.children.filter(n=>PP.has(n.type)).map(n=>({text:mc(n),range:{start:n.startIndex,end:n.endIndex}})):[]}function NP(e){for(let n of e.children)if(n.type==="tilde_content")return n.text;let t=e.text;return t.startsWith("~")&&t.endsWith("~")?t.slice(1,-1):t}function fc(e){for(let t of e.children){if(t.type==="tilde_string")return NP(t);if(t.type==="double_string")return IU(t)}return e.text}function IU(e){for(let n of e.children)if(n.type==="double_content")return n.text;let t=e.text;return t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function mc(e){switch(e.type){case"tilde_string":return NP(e);case"string":return fc(e);case"tra_ref":case"tlk_ref":case"at_var_ref":return e.text;case"double_string":return IU(e);default:return Ou(e)}}function EP(e){for(let t of e.children)if(t.type==="say_text")return Ou(t);for(let t of e.children)switch(t.type){case"tilde_string":return NP(t);case"string":return fc(t);case"tra_ref":case"tlk_ref":case"at_var_ref":return t.text}return e.text.trim()}function DU(e){let r=(e.children.find(s=>s.type==="say_text")??e).children.filter(s=>PP.has(s.type)).map(s=>({text:mc(s),range:{start:s.startIndex,end:s.endIndex}}));if(r.length>0)return r;let o=EP(e);return o?[{text:o,range:{start:e.startIndex,end:e.endIndex}}]:[]}function kU(e){let t=e.childForFieldName("trigger");if(t)return fc(t)||void 0}function FU(e){let t=e.childForFieldName("trigger");if(!t)return;let n=fc(t);if(n.trim())return n}function LU(e){let t=!1,n=!1;for(let r of e.children)if(r.type==="WEIGHT")t=!0;else if(t){if(r.type==="-")n=!0;else if(r.type==="number"){let o=parseInt(r.text,10);return Number.isNaN(o)?void 0:n?-o:o}else if(r.type!=="#")break}else continue}function RP(e){let t=e.childForFieldName("trigger");if(!t)return;let n=fc(t);if(n.trim())return n}function TP(e){for(let t of e.children)if(t.type==="do_feature"){let n=t.childForFieldName("action");if(n)return fc(n)}}function OU(e){for(let t of e.children)if(t.type==="reply_feature"){let n=t.childForFieldName("text");if(n)return mc(n)}}function pc(e){for(let t of e.children){switch(t.type){case"goto_next":{let r=t.childForFieldName("label");if(r)return{kind:"goto",label:r.text};break}case"short_goto":{let r=t.childForFieldName("label");if(r)return{kind:"goto",label:r.text};break}case"extern_next":{let r=t.childForFieldName("file"),o=t.childForFieldName("label");if(r&&o)return{kind:"extern",file:r.text,label:o.text};break}case"exit_next":return{kind:"exit"};case"copy_trans":{let r=t.childForFieldName("file"),o=t.childForFieldName("state");if(r&&o)return{kind:"copy_trans",file:r.text,label:o.text};break}}let n=pc(t);if(n)return n}}function xh(e){for(let t of e.children){if(t.type==="goto_next"||t.type==="short_goto"){let r=t.childForFieldName("label");if(r)return{start:r.startIndex,end:r.endIndex}}let n=xh(t);if(n)return n}}function MU(e){let t=[];for(let n of e.children)n.type==="alter_trans_change"&&t.push(Qn(n.text,60));return t.length>0?t.join("; "):""}function Mu(e){let t=[],n=!1,r=0;for(let o of e.children){if(o.type==="BEGIN"){r===0&&(n=!0);continue}if(o.type==="END"){n&&(n=!1,r++);continue}n&&t.push(o.text)}return t}function Fe(e,t){let n=e.childForFieldName(t);if(!n)return;let r=n.text;return r.startsWith("~")&&r.endsWith("~")||r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):r}function Qn(e,t){let n=e.replaceAll(/\s+/g," ").trim();return n.length<=t?n:n.slice(0,t-1)+"\u2026"}function $U(e,t){let n=Fe(e,"file");if(!n)return;let r=Mu(e),o=MU(e);t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"ALTER_TRANS",description:o||void 0,stateRefs:r.length>0?r:void 0})}function qU(e,t){let n=Fe(e,"file");if(!n)return;let r=Fe(e,"state")??"?",o=Fe(e,"trigger")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"ADD_STATE_TRIGGER",description:Qn(o,80)||void 0,stateRefs:[r]})}function BU(e,t){let n=Fe(e,"file");if(!n)return;let r=Mu(e),o=Fe(e,"action")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"ADD_TRANS_ACTION",description:Qn(o,80)||void 0,stateRefs:r.length>0?r:void 0})}function jU(e,t){let n=Fe(e,"file");if(!n)return;let r=Fe(e,"state")??"?",o=Fe(e,"trigger")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"ADD_TRANS_TRIGGER",description:Qn(o,80)||void 0,stateRefs:[r]})}function WU(e,t){let n=Fe(e,"file");if(!n)return;let r=Fe(e,"state")??"?",o=e.childForFieldName("text"),s=o?mc(o):"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"REPLACE_SAY",description:Qn(s,80)||void 0,stateRefs:[r]})}function UU(e,t){let n=Fe(e,"file");if(!n)return;let r=Fe(e,"state")??"?",o=Fe(e,"trigger")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"REPLACE_STATE_TRIGGER",description:Qn(o,80)||void 0,stateRefs:[r]})}function HU(e,t){let n=Fe(e,"file");if(!n)return;let r=Mu(e),o=Fe(e,"old_text")??"",s=Fe(e,"new_text")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"REPLACE_TRANS_ACTION",description:`${Qn(o,40)} -> ${Qn(s,40)}`,stateRefs:r.length>0?r:void 0})}function VU(e,t){let n=Fe(e,"file");if(!n)return;let r=Mu(e),o=Fe(e,"old_text")??"",s=Fe(e,"new_text")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"REPLACE_TRANS_TRIGGER",description:`${Qn(o,40)} -> ${Qn(s,40)}`,stateRefs:r.length>0?r:void 0})}function GU(e,t){let n=Fe(e,"file");if(!n)return;let r=Fe(e,"state")??"?",s=e.childrenForFieldName("weight").map(a=>a.text).join("");t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"SET_WEIGHT",description:s||void 0,stateRefs:[r]})}function AP(e,t,n){let r=Fe(e,"file");if(!r)return;let o=Fe(e,"old_text")??"",s=Fe(e,"new_text")??"";t.push({kind:"modify",file:r,line:e.startPosition.row+1,actionName:n,description:`${Qn(o,40)} -> ${Qn(s,40)}`})}function KU(e){if(!ct())return T("parseDDialog: weidu-d parser not initialized; returning empty dialog","warn"),{blocks:[],states:[]};let t=lt(e);if(!t)return T("parseDDialog: weidu-d parse produced no tree; returning empty dialog","warn"),{blocks:[],states:[]};let n=[],r=[];for(let o of t.rootNode.children)switch(o.type){case"begin_action":IP(o,n,r,"begin");break;case"append_action":IP(o,n,r,"append");break;case"chain_action":ure(o,n,r);break;case"extend_action":dre(o,n,r);break;case"interject_action":case"interject_copy_trans":fre(o,n,r);break;case"replace_action":IP(o,n,r,"replace");break;case"alter_trans":$U(o,n);break;case"add_state_trigger":qU(o,n);break;case"add_trans_action":BU(o,n);break;case"add_trans_trigger":jU(o,n);break;case"replace_say":WU(o,n);break;case"replace_state_trigger":UU(o,n);break;case"replace_trans_action":HU(o,n);break;case"replace_trans_trigger":VU(o,n);break;case"set_weight":GU(o,n);break;case"replace_action_text":case"replace_action_text_process":case"replace_action_text_regexp":AP(o,n,"REPLACE_ACTION_TEXT");break;case"replace_trigger_text":case"replace_trigger_text_regexp":AP(o,n,"REPLACE_TRIGGER_TEXT");break}return{blocks:n,states:r}}function IP(e,t,n,r){let o=Fe(e,"file");if(o){t.push({kind:r,file:o,line:e.startPosition.row+1});for(let s of e.children)if(s.type==="state"){let a=mre(s,o);a&&n.push(a)}}}function ure(e,t,n){let r=Fe(e,"file");if(!r)return;let o=e.childForFieldName("label"),s=o?o.text:void 0;t.push({kind:"chain",file:r,line:e.startPosition.row+1,label:s}),YU(e,r,s,n,"CHAIN")}function dre(e,t,n){let r=Fe(e,"file");if(!r)return;let s=e.childrenForFieldName("states").map(l=>l.text).join(", "),a=e.startPosition.row+1;t.push({kind:"extend",file:r,line:a,label:s||void 0});let c=[];for(let l of e.children)l.type==="transition"&&c.push(...vh(l));c.length>0&&n.push({label:s||"extended",line:a,sayText:"",speaker:r,blockFile:r,transitions:c,blockLabel:`extend_${a}`,derivedFrom:"EXTEND"})}function fre(e,t,n){let r=Fe(e,"file");if(!r)return;let o=e.childForFieldName("label"),s=o?o.text:void 0;t.push({kind:"interject",file:r,line:e.startPosition.row+1,label:s}),YU(e,r,s,n,"INTERJECT")}function mre(e,t){let n=e.childForFieldName("label");if(!n)return;let r=n.text,o=TU(e),s=AU(e),a=FU(e),c=LU(e),l=[];for(let f of e.children)f.type==="transition"&&l.push(...vh(f));let u=e.childForFieldName("say"),d=e.childForFieldName("trigger");return{label:r,line:e.startPosition.row+1,sayText:o,sayTexts:s,trigger:a||void 0,weight:c,speaker:t,blockFile:t,transitions:l,range:{start:e.startIndex,end:e.endIndex},sayRange:u?{start:u.startIndex,end:u.endIndex}:void 0,triggerRange:d?{start:d.startIndex,end:d.endIndex}:void 0}}function vh(e){let t=[];for(let n of e.children)switch(n.type){case"transition_full":t.push(pre(n));break;case"transition_short":t.push(hre(n));break;case"copy_trans":t.push(gre(n));break}if(t.length===0){let n=pc(e);n&&t.push({line:e.startPosition.row+1,target:n})}return t}function pre(e){let t=RP(e),n=OU(e),r=TP(e),o=pc(e)??{kind:"exit"};return{line:e.startPosition.row+1,replyText:n,trigger:t||void 0,action:r||void 0,target:o,range:{start:e.startIndex,end:e.endIndex},targetRange:xh(e)}}function hre(e){let t=e.childForFieldName("reply"),n=t?Ou(t):void 0,r=RP(e),o=TP(e),s=pc(e)??{kind:"exit"};return{line:e.startPosition.row+1,replyText:n,trigger:r||void 0,action:o||void 0,target:s,range:{start:e.startIndex,end:e.endIndex},targetRange:xh(e)}}function gre(e){let t=Fe(e,"file")??"",n=e.childForFieldName("state"),r=n?n.text:"";return{line:e.startPosition.row+1,target:{kind:"copy_trans",file:t,label:r},range:{start:e.startIndex,end:e.endIndex}}}function YU(e,t,n,r,o){let s=[],a=t,c=0,l=d=>{let f=DU(d),m=f[0]?.text??EP(d),p=kU(d),g=c===0&&n?n:`${n??"chain"}_${c}`;s.push({label:g,line:d.startPosition.row+1,sayText:m,...f.length>0?{sayTexts:f}:{},trigger:p||void 0,speaker:a,blockFile:t,transitions:[],blockLabel:n,derivedFrom:o}),c++},u=d=>{s.length>0&&s[s.length-1].transitions.push(...d)};for(let d of e.children)if(d.type==="chain_text"){l(d);for(let f of d.children)if(f.type==="chain_speaker"){let m=Fe(f,"file");m&&(a=m),l(f)}else f.type==="chain_branch"&&u(zU(f))}else d.type==="chain_epilogue"?u(_re(d)):d.type==="chain_branch"&&u(zU(d));for(let d=0;d<s.length-1;d++){let f=s[d],m=s[d+1];f.transitions.length===0&&f.transitions.push({line:f.line,target:{kind:"goto",label:m.label}})}r.push(...s)}function _re(e){let t=[];for(let n of e.children)n.type==="transition"&&t.push(...vh(n));if(t.length===0){let n=pc(e);n&&t.push({line:e.startPosition.row+1,target:n})}return t}function zU(e){let t=[];for(let n of e.children)n.type==="transition"&&t.push(...vh(n));return t}var XU=[{match:(e,t)=>e===mt,parse:(e,t)=>vU(t,CP()),translationLangId:mt},{match:(e,t)=>e===At,parse:(e,t)=>Promise.resolve(KU(t)),translationLangId:At},{match:(e,t)=>e===qr&&t.endsWith(Jt),parse:(e,t)=>sP({kind:"parse-td",filepath:et(e),text:t}),translationLangId:At},{match:(e,t)=>e===qr&&t.endsWith(zn),parse:(e,t)=>sP({kind:"parse-tssl",filepath:et(e),text:t,sideEffectFns:[...CP()]}),translationLangId:mt}];function JU(e){e.connection.onExecuteCommand(xe("onExecuteCommand",async(t,n)=>{let r=t.command;if(r.startsWith(Xf)){let u=r.slice(Xf.length),d=t.arguments?.[0],f=typeof d?.query=="string"?d.query:"";return Y.workspaceSymbols(f,n,u)}if(!t.arguments)return;let o=t.arguments[0];if(r===Kf){if(typeof o?.uri!="string")return T(`parseDialog: invalid uri '${String(o?.uri)}'`,"warn"),null;let u=o.uri,d=e.documents.get(u);if(!d)return T(`parseDialog: NO open document for ${u} (not synced to the server)`,"warn"),null;try{let f=d.languageId,m=d.getText(),p=u.toLowerCase(),g=XU.find(_=>_.match(f,p));if(!g)return T(`parseDialog: NO handler for languageId='${f}'`,"warn"),null;let h=await g.parse(u,m),w=(await xn()).translation.getMessages(u,m,g.translationLangId);return{...h,messages:w}}catch(f){return T(`parseDialog error: ${f instanceof Error?f.message:String(f)}`,"error"),f instanceof Error&&f.stack&&T(f.stack,"debug"),null}}if(r===Yf){if(typeof o?.uri!="string")return T(`saveTra: invalid uri '${String(o?.uri)}'`,"warn"),null;let u=o.uri,d=o.messages,f=e.documents.get(u);if(!f||!d)return null;let p=XU.find(y=>y.match(f.languageId,u.toLowerCase()))?.translationLangId??At,h=(await xn()).translation.writeMessages(u,f.getText(),p,d);return h.staleSiblingLanguages.length>0&&Sr(`Saved @N translation edits to the active language only. These other language(s) still have the previous text and need updating: ${h.staleSiblingLanguages.join(", ")}.`),{changed:h.changed}}if(r!==al&&r!==m0)return;let s=typeof o.uri=="string"?o.uri:void 0;if(!s||!s.startsWith("file://")){T(`Compile: invalid non-file uri '${String(s)}'`),bn("Focus a valid file to run commands!");return}let a=e.documents.get(s);if(!a)return;let c=a.languageId,l=a.getText();Du(s,c,!0,l).catch(u=>ku(u,!0))},e.timingOpts))}var Cs=(0,hc.createConnection)(hc.ProposedFeatures.all),bre=oA(Cs.console),DP=new hc.TextDocuments(Bu);sA(Cs,DP);var Sre=300,QU=new ea(Sre),wre=300,ZU=new ea(wre),xre=120,eH=new ea(xre),tH=KW(Cs);cA(tH);var vre=lA(),Bt={connection:Cs,documents:DP,timingOpts:bre,fileReloadDebouncer:QU,compileDebouncer:ZU,parseDebouncer:eH,renameSuppression:vre,getDocumentSettings:tH};WW(Bt);QW(Bt);XW(Bt);JU(Bt);UW(Bt);ZW(Bt);eU(Bt);sU(Bt);uU(Bt);dU(Bt);fU(Bt);_U(Bt);tU(Bt);rU(Bt);iU(Bt);mU(Bt);pU(Bt);hU(Bt);Cs.onShutdown(()=>{Bt.renameSuppression.dispose(),QU.dispose(),ZU.dispose(),eH.dispose(),YO(),nq(),$W(),OW(),DW()});DP.listen(Cs);Cs.listen();
368
+ `).join("")}function kj(e,t){let n=vo.dirname(e),r=vo.basename(n),o=vo.dirname(n),s=vo.basename(e);return t.filter(a=>a!==r).map(a=>vo.join(o,a,s))}var vee="data/text/english/dialog",Cee="tra",Pu={changed:!1,staleSiblingLanguages:[]};function Pee(e){let t=St.dirname(St.dirname(e)),n;try{n=vi.readdirSync(t,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name)}catch(r){return r.code!=="ENOENT"&&T(`cannot scan ${t} for sibling translations: ${r.message}`),[]}return kj(e,n).filter(r=>vi.existsSync(r)).map(r=>St.basename(St.dirname(r)))}function Fj(e,t,n,r,o){let s=oh(e,r,t,n),a=sc(e,t,n,r);if(!s||!a)return Pu;let c=rh(e,a),l;if(c&&vi.existsSync(St.dirname(c)))l=c;else if(e.workspaceRoot){let p=s==="msg"?vee:Cee,g=St.join(e.workspaceRoot,p);vi.mkdirSync(g,{recursive:!0}),gj(e.workspaceRoot,p),l=St.join(g,a)}else l=St.join(St.dirname(t),a);let u,d="utf-8";try{let p=vi.readFileSync(l);({text:u,encoding:d}=bs(p))}catch(p){if(p.code!=="ENOENT")return Pu;u=""}let f=s==="msg"?Ij(Aj(u,o),o):Dj(Tj(u,o),o);if(f===u)return Pu;let m=aj(f,d);return cj(l,m),e.data.set(a,xo(f,s)),{changed:!0,staleSiblingLanguages:Pee(l)}}function Nee(e,t){let n=Ss(e);if(n===void 0||e.workspaceRoot===void 0)return;let r=St.resolve(e.workspaceRoot,t),o=St.relative(n,r);if(!(o===""||o===".."||o.startsWith(".."+St.sep)||St.isAbsolute(o)))return o}function Lj(e,t,n){let r=Nee(e,t);if(!r){T(`Translation: can't detect tra path for ${t}, skipping reload`);return}let o=St.parse(r).ext.slice(-3);if(o!=="tra"&&o!=="msg"){T(`Translation: unknown extension ${o}`);return}let s=xo(n,o);e.data.set(r,s),T(`Translation: reloaded ${r}`),e.notifyReload?.()}var Oj=dA,ah=class{state;initialized;constructor(t,n,r){T("Translation: initializing"),this.state=uj(t,n,r),this.initialized=!1}async init(){let t=Ss(this.state);this.state.data=t?await fj(t):new Map,await hj(this.state),this.initialized=!0,T("Translation: initialized")}directory(){return Ss(this.state)}getHover(t,n,r,o){let s=this.resolveRelPath(t,n,r);return s?xj(this.state,r,o,s,n):null}getDefinition(t,n,r,o){let s=this.resolveRelPath(t,n,r);return s?vj(this.state,r,o,s,n):null}getInlayHints(t,n,r,o){return this.initialized?this.state.data.size===0?[]:Pj(this.state,this.uriToPath(t),r,n,o):[]}getDiagnostics(t,n,r){if(!this.initialized)return[];if(this.state.data.size===0)return[];if(!ih.has(n))return[];let o=this.uriToPath(t);return Ej(this.state,r,o,n).map(s=>({severity:$j.DiagnosticSeverity.Information,range:s.range,message:Sj(s.entryNum,s.fileKey),source:"BGforge MLS (translation)"}))}reloadFile(t,n,r){if(!this.initialized||!Oj.includes(n))return;let o=this.state.resolvedWsRoot;if(o===void 0)return;let s=this.uriToPath(t),a=Vf(s);if(a===void 0||!Hf(o,a))return;let c=sh.relative(o,s);Lj(this.state,c,r)}async getReferences(t,n,r,o){if(!this.initialized)return[];if(!Oj.includes(n))return[];let s=this.uriToPath(t),a=mj(this.state,s);if(!a)return[];let c=this.state.data.get(a);if(!c)return[];let l=JB(c,r);if(l===void 0)return[];let u=a.endsWith(".msg")?"msg":"tra";return Rj(this.state,a,l,u,s,o)}reloadConsumer(t,n,r){if(!this.initialized||!ih.has(r))return;let o=this.state.resolvedWsRoot;if(o===void 0)return;let s=this.uriToPath(t),a=Vf(s);if(a===void 0||!Hf(o,a))return;let c=sh.relative(o,s);pj(this.state,s);let l=sc(this.state,c,n,r);l&&this.state.data.has(l)&&TC(this.state,l,s)}getMessages(t,n,r=mt){let o={};if(!this.initialized)return o;let s=this.uriToPath(t),a=sc(this.state,s,n,r);if(!a)return o;let c=this.state.data.get(a);if(!c)return o;for(let[l,u]of c)o[l]=u.source;return o}writeMessages(t,n,r,o){if(!this.initialized)return Pu;let s=this.uriToPath(t);return Fj(this.state,s,n,r,o)}uriToPath(t){return t.startsWith("file://")?(0,Mj.fileURLToPath)(t):t}resolveRelPath(t,n,r){if(!this.initialized||this.state.data.size===0||!ih.has(n))return null;let o=this.state.resolvedWsRoot;if(o===void 0)return null;let s=this.uriToPath(t);if(!bj(r,n,s))return null;let a=Vf(s);return a===void 0||!Hf(o,a)?null:sh.relative(o,s)}};var qj=Object.defineProperty,Eee=(e,t,n)=>t in e?qj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ree=(e,t)=>{for(var n in t)qj(e,n,{get:t[n],enumerable:!0})},Pe=(e,t,n)=>Eee(e,typeof t!="symbol"?t+"":t,n),Tee={};Ree(Tee,{BufferReader:()=>Po,BufferWriter:()=>wte,MaxValue:()=>Et,Measurer:()=>We,UnresolvedReferenceError:()=>ws,ValidationError:()=>ch,arrayOf:()=>lh,bool:()=>Lee,byte:()=>Bee,chars:()=>Xee,concat:()=>Zee,dynamicArrayOf:()=>tte,f16:()=>Gee,f32:()=>Kee,f32Array:()=>_te,f64Array:()=>yte,generic:()=>Jee,genericEnum:()=>Qee,i16:()=>DC,i16Array:()=>hte,i32:()=>kC,i32Array:()=>gte,i8:()=>IC,i8Array:()=>pte,keyed:()=>ite,object:()=>LC,optional:()=>ste,string:()=>Mee,tupleOf:()=>lte,u16:()=>Wn,u16Array:()=>fte,u32:()=>ze,u32Array:()=>mte,u8:()=>uh,u8Array:()=>ute,u8ClampedArray:()=>dte});var ws=class Bj extends Error{constructor(t){super(t),Object.setPrototypeOf(this,Bj.prototype)}},ch=class jj extends Error{constructor(t){super(t),Object.setPrototypeOf(this,jj.prototype)}},Aee=class{constructor(){Pe(this,"size",Number.NaN),Pe(this,"unbounded",this),Pe(this,"isUnbounded",!0)}add(){return this}fork(){return this}},Iee=new Aee,We=class Wj{constructor(){Pe(this,"size",0),Pe(this,"unbounded",Iee),Pe(this,"isUnbounded",!1)}add(t){return this.size+=t,this}fork(){let t=new Wj;return t.size=this.size,t}},Et=Symbol("The biggest (in amount of bytes needed) value a schema can represent"),it=class{constructor(){Pe(this,"__unwrapped")}resolveReferences(e){}seekProperty(e,t){return null}},Dee=class{constructor(e){this.key=e}},Eu={STRING:"string",ENUM:"enum"},kee=class extends it{constructor(e,t){super(),this._unstableElementSchema=e,this.length=t,Pe(this,"elementSchema"),this.elementSchema=e}resolveReferences(e){this.elementSchema=e.resolve(this._unstableElementSchema)}write(e,t){if(t.length!==this.length)throw new ch(`Expected array of length ${this.length}, got ${t.length}`);for(let n of t)this.elementSchema.write(e,n)}read(e){let t=[];for(let n=0;n<this.length;++n)t.push(this.elementSchema.read(e));return t}get maxSize(){return this.elementSchema.measure(Et).size*this.length}measure(e,t=new We){for(let n=0;n<this.length;++n)this.elementSchema.measure(e===Et?Et:e[n],t);return t}};function lh(e,t){return new kee(e,t)}var Fee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",1)}read(e){return e.readBool()}write(e,t){e.writeBool(t)}measure(e,t=new We){return t.add(1)}},Lee=new Fee,Uj=class Nu extends it{static get _encoder(){return Nu._cachedEncoder||(Nu._cachedEncoder=new TextEncoder),Nu._cachedEncoder}read(t){return t.readString()}write(t,n){t.writeString(n)}measure(t,n=new We){if(t===Et)return n.unbounded;let r=Nu._encoder.encode(t);return n.add(r.byteLength+1)}};Pe(Uj,"_cachedEncoder");var Oee=Uj,Mee=new Oee,$ee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",1)}read(e){return e.readInt8()}write(e,t){e.writeInt8(t)}measure(e,t=new We){return t.add(1)}},IC=new $ee,qee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",1)}read(e){return e.readUint8()}write(e,t){e.writeUint8(t)}measure(e,t=new We){return t.add(1)}},uh=new qee,Bee=uh,jee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",2)}read(e){return e.readInt16()}write(e,t){e.writeInt16(t)}measure(e,t=new We){return t.add(2)}},DC=new jee,Wee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",2)}read(e){return e.readUint16()}write(e,t){e.writeUint16(t)}measure(e,t=new We){return t.add(2)}},Wn=new Wee,Uee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",4)}read(e){return e.readInt32()}write(e,t){e.writeInt32(t)}measure(e,t=new We){return t.add(4)}},kC=new Uee,Hee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",4)}read(e){return e.readUint32()}write(e,t){e.writeUint32(t)}measure(e,t=new We){return t.add(4)}},ze=new Hee,Vee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",2)}read(e){return e.readFloat16()}write(e,t){e.writeFloat16(t)}measure(e,t=new We){return t.add(2)}},Gee=new Vee,zee=class extends it{constructor(){super(...arguments),Pe(this,"maxSize",4)}read(e){return e.readFloat32()}write(e,t){e.writeFloat32(t)}measure(e,t=new We){return t.add(4)}},Kee=new zee,Yee=class extends it{constructor(e){super(),this.length=e}write(e,t){if(t.length!==this.length)throw new ch(`Expected char-string of length ${this.length}, got ${t.length}`);for(let n=0;n<t.length;++n)e.writeUint8(t.charCodeAt(n))}read(e){let t="";for(let n=0;n<this.length;++n)t+=String.fromCharCode(e.readByte());return t}measure(e,t=new We){return t.add(this.length)}};function Xee(e){return new Yee(e)}function Co(e){return Object.entries(e)}function Hj(e,t){let n={};for(let[r,o]of Co(t))n[r]=e.resolve(o);return n}var FC=class extends it{constructor(e){super(),this._properties=e,Pe(this,"properties"),this.properties=e}resolveReferences(e){this.properties=Hj(e,this._properties)}write(e,t){for(let[n,r]of Co(this.properties))r.write(e,t[n])}read(e){let t={};for(let[n,r]of Co(this.properties))t[n]=r.read(e);return t}get maxSize(){let e=new We;for(let t of Object.values(this.properties))t.measure(Et,e);return e.size}measure(e,t=new We){for(let[n,r]of Co(this.properties))r.measure(e===Et?Et:e[n],t);return t}seekProperty(e,t){let n=0;for(let[r,o]of Co(this.properties)){if(r===t)return{bufferOffset:n,schema:o};n+=o.measure(e).size}return null}};function LC(e){return new FC(e)}var Vj=class extends it{constructor(e,t,n){super(),this.keyedBy=e,this._subTypeMap=n,Pe(this,"_baseObject"),Pe(this,"subTypeMap"),this._baseObject=new FC(t),this.subTypeMap=n}resolveReferences(e){this._baseObject.resolveReferences(e),this.subTypeMap=Hj(e,this._subTypeMap)}write(e,t){let n=t.type,r=this.subTypeMap[n]||null;if(r===null)throw new Error(`Unknown sub-type '${n.toString()}' in among '${JSON.stringify(Object.keys(this.subTypeMap))}'`);this.keyedBy===Eu.ENUM?e.writeUint8(t.type):e.writeString(t.type),this._baseObject.write(e,t);for(let[o,s]of Co(r.properties))s.write(e,t[o])}read(e){let t=this.keyedBy===Eu.ENUM?e.readByte():e.readString(),n=this.subTypeMap[t]||null;if(n===null)throw new Error(`Unknown sub-type '${t}' in among '${JSON.stringify(Object.keys(this.subTypeMap))}'`);let r=this._baseObject.read(e);if(r.type=t,n!==null)for(let[o,s]of Co(n.properties))r[o]=s.read(e);return r}measure(e,t=new We){if(this._baseObject.measure(e,t),this.keyedBy===Eu.ENUM)t.add(1);else if(e!==Et)t.add(e.type.length+1);else return t.unbounded;if(e===Et){let n=Object.values(this.subTypeMap).map(r=>{let o=t.fork();for(let s of Object.values(r.properties))s.measure(Et,o);return[r,o.size]}).reduce((r,o)=>r[1]>o[1]?r:o)[0];for(let r of Object.values(n.properties))r.measure(Et,t)}else{let n=e.type,r=this.subTypeMap[n]||null;if(r===null)throw new Error(`Unknown sub-type '${n.toString()}', expected one of '${JSON.stringify(Object.keys(this.subTypeMap))}'`);for(let[o,s]of Co(r.properties))s.measure(e[o],t)}return t}};function Jee(e,t){return new Vj(Eu.STRING,e,t)}function Qee(e,t){return new Vj(Eu.ENUM,e,t)}function Zee(e){return new FC(Object.fromEntries(e.flatMap(({properties:t})=>Object.entries(t))))}var ete=class extends it{constructor(e){super(),this._unstableElementType=e,Pe(this,"elementType"),this.elementType=e}resolveReferences(e){this.elementType=e.resolve(this._unstableElementType)}write(e,t){e.writeUint32(t.length);for(let n of t)this.elementType.write(e,n)}read(e){let t=[],n=e.readUint32();for(let r=0;r<n;++r)t.push(this.elementType.read(e));return t}get maxSize(){return this.measure(Et).size}measure(e,t=new We){if(e===Et)return t.unbounded;t.add(4);for(let n of e)this.elementType.measure(n,t);return t}seekProperty(e,t){if(typeof t=="symbol")return null;let n=Number.parseInt(String(t),10);if(Number.isNaN(n))return null;if(e===Et)return{bufferOffset:this.elementType.measure(Et).size*n,schema:this.elementType};if(n>=e.length)return null;let r=new We;for(let o=0;o<n;++o)this.elementType.measure(e[o],r);return{bufferOffset:r.size,schema:this.elementType}}};function tte(e){return new ete(e)}var Gj=class{constructor(e){Pe(this,"__unwrapped"),Pe(this,"ref"),this.ref=new Dee(e)}resolveReferences(){throw new ws("Tried to resolve a reference directly. Do it through a RefResolver instead.")}read(){throw new ws("Tried to read a reference directly. Resolve it instead.")}write(){throw new ws("Tried to write a reference directly. Resolve it instead.")}measure(){throw new ws("Tried to measure size of a reference directly. Resolve it instead.")}seekProperty(){throw new ws("Tried to seek property of a reference directly. Resolve it instead.")}},nte=class{constructor(){Pe(this,"registry",{})}hasKey(e){return this.registry[e]!==void 0}register(e,t){this.registry[e]=t}resolve(e){if(e instanceof Gj){let n=e.ref.key;if(this.registry[n]!==void 0)return this.registry[n];throw new ws(`Couldn't resolve reference to ${n}. Unknown key.`)}return e.resolveReferences(this),e}},rte=class{constructor(e,t){this.key=e,Pe(this,"__unwrapped"),Pe(this,"__keyDefinition"),Pe(this,"innerType"),this.innerType=t(new Gj(e)),this.resolveReferences(new nte)}resolveReferences(e){e.hasKey(this.key)||(e.register(this.key,this.innerType),this.innerType.resolveReferences(e))}read(e){return this.innerType.read(e)}write(e,t){this.innerType.write(e,t)}get maxSize(){return this.measure(Et).size}measure(e,t=new We){return this.innerType.measure(e,t)}seekProperty(e,t){return this.innerType.seekProperty(e,t)}};function ite(e,t){return new rte(e,t)}var ote=class extends it{constructor(e){super(),this._innerUnstableSchema=e,Pe(this,"innerSchema"),this.innerSchema=e}resolveReferences(e){this.innerSchema=e.resolve(this._innerUnstableSchema)}write(e,t){t!=null?(e.writeBool(!0),this.innerSchema.write(e,t)):e.writeBool(!1)}read(e){if(e.readBool())return this.innerSchema.read(e)}get maxSize(){return this.measure(Et).size}measure(e,t=new We){return e!==void 0&&this.innerSchema.measure(e,t),t.add(1)}};function ste(e){return new ote(e)}function ate(e,t){return t.map(n=>e.resolve(n))}var cte=class extends it{constructor(e){super(),this._unstableSchemas=e,Pe(this,"schemas"),this.schemas=e}resolveReferences(e){this.schemas=ate(e,this._unstableSchemas)}write(e,t){if(t.length!==this.schemas.length)throw new ch(`Expected tuple of length ${this.schemas.length}, got ${t.length}`);for(let n=0;n<this.schemas.length;++n)this.schemas[n].write(e,t[n])}read(e){let t=[];for(let n=0;n<this.schemas.length;++n)t.push(this.schemas[n].read(e));return t}get maxSize(){return this.measure(Et).size}measure(e,t=new We){for(let n=0;n<this.schemas.length;++n)this.schemas[n].measure(e===Et?Et:e[n],t);return t}};function lte(e){return new cte(e)}var Ci=class extends it{constructor(e,t){super(),this.length=e,this._arrayConstructor=t,Pe(this,"byteLength"),this.byteLength=e*t.BYTES_PER_ELEMENT}write(e,t){e.writeSlice(t)}read(e){let t=new ArrayBuffer(this.byteLength),n=new this._arrayConstructor(t,0,this.length);return e.readSlice(n,0,this.byteLength),n}measure(e,t=new We){return t.add(this.byteLength)}},ute=e=>new Ci(e,Uint8Array),dte=e=>new Ci(e,Uint8ClampedArray),fte=e=>new Ci(e,Uint16Array),mte=e=>new Ci(e,Uint32Array),pte=e=>new Ci(e,Int8Array),hte=e=>new Ci(e,Int16Array),gte=e=>new Ci(e,Int32Array),_te=e=>new Ci(e,Float32Array),yte=e=>new Ci(e,Float64Array);function bte(){let e=new Uint8Array(4),t=new Uint32Array(e.buffer);return t[0]=1,e[0]===0}function Ste(){return bte()?"big":"little"}function OC(e){let t=0,n=e;return n&&"buffer"in n&&"byteOffset"in n&&(t+=n.byteOffset,n=n.buffer),{buffer:n,byteOffset:t,byteLength:e.byteLength}}var zj=class{constructor(e,t){Pe(this,"dataView"),Pe(this,"littleEndian"),Pe(this,"needsByteSwap"),Pe(this,"byteOffset",0),Pe(this,"endianness");let{byteOffset:n=0,endianness:r="system"}=t??{};this.byteOffset=n;let o=Ste();this.endianness=r==="system"?o:r,this.littleEndian=this.endianness==="little",this.needsByteSwap=this.endianness!==o;let s=OC(e);this.byteOffset+=s.byteOffset,this.dataView=new DataView(s.buffer)}get currentByteOffset(){return this.byteOffset}seekTo(e){this.byteOffset=e}skipBytes(e){this.byteOffset+=e}},Po=class extends zj{constructor(){super(...arguments),Pe(this,"_cachedTextDecoder")}get _textDecoder(){return this._cachedTextDecoder||(this._cachedTextDecoder=new TextDecoder(void 0,{fatal:!0})),this._cachedTextDecoder}readBool(){return this.dataView.getUint8(this.byteOffset++)!==0}readByte(){return this.dataView.getUint8(this.byteOffset++)}readInt8(){return this.dataView.getInt8(this.byteOffset++)}readUint8(){return this.dataView.getUint8(this.byteOffset++)}readInt16(){let e=this.dataView.getInt16(this.byteOffset,this.littleEndian);return this.byteOffset+=2,e}readUint16(){let e=this.dataView.getUint16(this.byteOffset,this.littleEndian);return this.byteOffset+=2,e}readInt32(){let e=this.dataView.getInt32(this.byteOffset,this.littleEndian);return this.byteOffset+=4,e}readUint32(){let e=this.dataView.getUint32(this.byteOffset,this.littleEndian);return this.byteOffset+=4,e}readFloat16(){let e=this.dataView.getFloat16(this.byteOffset,this.littleEndian);return this.byteOffset+=2,e}readFloat32(){let e=this.dataView.getFloat32(this.byteOffset,this.littleEndian);return this.byteOffset+=4,e}readString(){let e=0;for(;this.byteOffset+e<this.dataView.byteLength&&this.dataView.getUint8(this.byteOffset+e++)!==0;);let t=this._textDecoder.decode(new Uint8Array(this.dataView.buffer,this.byteOffset,e-1));return this.byteOffset+=e,t}readSlice(e,t,n){let r=OC(e),o=new Uint8Array(r.buffer,r.byteOffset+t),s=e.BYTES_PER_ELEMENT;if(this.needsByteSwap&&s>1)for(let a=0;a<n;a+=s)for(let c=s-1;c>=0;c--)o[a+c]=this.dataView.getUint8(this.byteOffset++);else o.set(new Uint8Array(this.dataView.buffer,this.byteOffset,n)),this.byteOffset+=n}},wte=class extends zj{constructor(){super(...arguments),Pe(this,"_cachedTextEncoder")}get _textEncoder(){return this._cachedTextEncoder||(this._cachedTextEncoder=new TextEncoder),this._cachedTextEncoder}writeBool(e){this.dataView.setUint8(this.byteOffset++,e?1:0)}writeByte(e){this.dataView.setUint8(this.byteOffset++,e)}writeInt8(e){this.dataView.setInt8(this.byteOffset++,e)}writeUint8(e){this.dataView.setUint8(this.byteOffset++,e)}writeInt16(e){this.dataView.setInt16(this.byteOffset,e,this.littleEndian),this.byteOffset+=2}writeUint16(e){this.dataView.setUint16(this.byteOffset,e,this.littleEndian),this.byteOffset+=2}writeInt32(e){this.dataView.setInt32(this.byteOffset,e,this.littleEndian),this.byteOffset+=4}writeUint32(e){this.dataView.setUint32(this.byteOffset,e,this.littleEndian),this.byteOffset+=4}writeFloat16(e){this.dataView.setFloat16(this.byteOffset,e,this.littleEndian),this.byteOffset+=2}writeFloat32(e){this.dataView.setFloat32(this.byteOffset,e,this.littleEndian),this.byteOffset+=4}writeString(e){let t=this._textEncoder.encodeInto(e,new Uint8Array(this.dataView.buffer,this.byteOffset));this.byteOffset+=t.written,this.dataView.setUint8(this.byteOffset++,0)}writeSlice(e){let t=OC(e),n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),r=e.BYTES_PER_ELEMENT;if(this.needsByteSwap&&r>1)for(let o=0;o<n.length;o+=r)for(let s=r-1;s>=0;s--)this.dataView.setUint8(this.byteOffset++,n[o+s]);else new Uint8Array(this.dataView.buffer,this.byteOffset).set(n),this.byteOffset+=n.length}};function Ru(e){return e.kind==="array"}function Tu(e){return e.kind==="chars"}function Qr(e){if(!Number.isInteger(e)||e<1)throw new Error(`charsSpec requires a positive integer count; got ${e}`);return{kind:"chars",count:e}}function Kj(e){return typeof e=="object"&&"fromField"in e}function Yj(e){return typeof e=="object"&&"fromCtx"in e}var MC=class extends it{maxSize=3;read(t){let n=t.readUint8(),r=t.readUint8(),o=t.readUint8();return n<<16|r<<8|o}write(t,n){t.writeUint8(n>>16&255),t.writeUint8(n>>8&255),t.writeUint8(n&255)}measure(t,n){return(n??new We).add(3)}},xte=new MC,$C=class extends it{maxSize=3;read(t){let n=t.readUint8(),r=t.readUint8(),o=t.readUint8(),s=n<<16|r<<8|o;return s&8388608?s|-16777216:s}write(t,n){t.writeUint8(n>>16&255),t.writeUint8(n>>8&255),t.writeUint8(n&255)}measure(t,n){return(n??new We).add(3)}},vte=new $C,Cte=new Map([[uh,{name:"uint8",bytes:1}],[Wn,{name:"uint16",bytes:2}],[xte,{name:"uint24",bytes:3}],[ze,{name:"uint32",bytes:4}],[IC,{name:"int8",bytes:1}],[DC,{name:"int16",bytes:2}],[vte,{name:"int24",bytes:3}],[kC,{name:"int32",bytes:4}]]);function Pte(e){let t=Cte.get(e);if(!t)throw new Error("Unknown typed-binary numeric codec; not registered in codec-meta.");return t}function No(e){return Pte(e).bytes}var Nte=/^[A-Za-z_][A-Za-z0-9_]*$/,Xj=new Map;function Ete(e){let t=Xj.get(e);if(t!==void 0)return t;let n=e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[^A-Za-z0-9]+/g," ").trim();if(!n)throw new Error(`slugifyCodedName: name "${e}" produces an empty key`);let o=n.split(/\s+/).map((s,a)=>a===0?s[0].toLowerCase()+s.slice(1):s[0].toUpperCase()+s.slice(1)).join("");if(!Nte.test(o))throw new Error(`slugifyCodedName: name "${e}" produced "${o}" which is not a valid JS identifier`);if(Qj.test(o))throw new Error(`slugifyCodedName: name "${e}" produced reserved sentinel "${o}"; flag display names must not slugify to bit<N>`);return Xj.set(e,o),o}var Qj=/^bit\d+$/,Jj=new WeakMap;function Zj(e){let t=Jj.get(e);if(t!==void 0)return t;let n=[],r=0;for(let[s,a]of Object.entries(e)){let c=Number(s);if(!Number.isFinite(c)||c<0||!Number.isInteger(c))throw new Error(`compileFlagTable: non-integer mask "${s}"`);let l=Ete(a);n.push({key:l,mask:c,displayName:a}),r=(r|c)>>>0}n.sort((s,a)=>s.key.localeCompare(a.key));let o={entries:Object.freeze(n),namedMask:r};return Jj.set(e,o),o}function eW(e,t,n){let{entries:r,namedMask:o}=Zj(e),s=[];for(let u of r)(t&u.mask)!==0&&s.push(u.key);let a=n>=32?4294967295:(1<<n)-1,c=(t&~o&a)>>>0,l=[];for(let u=0;u<n;u++)(c&1<<u)!==0&&l.push(`bit${u}`);return[...s,...l]}function tW(e,t,n){let{entries:r,namedMask:o}=Zj(e),s=new Map(r.map(l=>[l.key,l.mask])),a=new Set,c=0;for(let l of t){if(a.has(l))throw new Error(`flagArrayToInt: duplicate flag name "${l}"`);a.add(l);let u=s.get(l);if(u!==void 0){c=(c|u)>>>0;continue}let d=Qj.exec(l);if(!d)throw new Error(`flagArrayToInt: unknown flag "${l}" (known: ${r.map(p=>p.key).join(", ")})`);let f=Number(d[0].slice(3));if(f>=n)throw new Error(`flagArrayToInt: bit position ${f} exceeds codec width ${n} for "${l}"`);let m=1<<f>>>0;if((m&o)!==0)throw new Error(`flagArrayToInt: bit position ${f} overlaps named-bit mask; named bits must be set by their canonical name, not "${l}"`);c=(c|m)>>>0}return c}var dh=class extends it{maxSize;inner;table;codecBitWidth;constructor(t){if(super(),!t.flags)throw new TypeError("FlagArraySchema requires a `flags` annotation on the spec entry");this.inner=t.codec,this.table=t.flags,this.codecBitWidth=No(t.codec)*8,this.maxSize=No(t.codec)}read(t){let n=this.inner.read(t);return eW(this.table,n,this.codecBitWidth)}write(t,n){let r=tW(this.table,n,this.codecBitWidth);this.inner.write(t,r)}measure(t,n){return(n??new We).add(this.maxSize)}},fh=class extends it{maxSize;count;constructor(t){super(),this.count=t,this.maxSize=t}read(t){let n=[];for(let r=0;r<this.count;r++)n.push(t.readByte());return String.fromCodePoint(...n)}write(t,n){let r=Math.min(n.length,this.count);for(let o=0;o<r;o++){let s=n.codePointAt(o);if(s>255)throw new RangeError(`Chars value contains non-Latin-1 char code 0x${s.toString(16)} at index ${o}`);t.writeByte(s)}for(let o=r;o<this.count;o++)t.writeByte(0)}measure(t,n){return(n??new We).add(this.count)}},nW=new WeakMap;function Zr(e){let t=nW.get(e);if(t)return t;let n=Object.values(e).some(o=>Ru(o)?typeof o.count!="number":Tu(o)?!1:o.packedAs!==void 0),r;if(n)r=new qC(e);else{let o={};for(let s of Object.keys(e))o[s]=Tte(e[s]);r=Rte(LC(o))}return nW.set(e,r),r}function Rte(e){let t=e;return{get maxSize(){return t.maxSize??0},read(n){return t.read(n)},write(n,r){t.write(n,r)},measure(n,r){return t.measure(n,r)}}}function Tte(e){if(Ru(e)){if(typeof e.count!="number")throw new TypeError("Variable-length arrays must be derived via SpecStructSchema, not the object({...}) path.");return lh(e.element.codec,e.count)}return Tu(e)?new fh(e.count):e.flags?new dh(e):e.codec}var qC=class extends it{maxSize;entries;constructor(t){super(),this.entries=Ate(t),this.maxSize=this.entries.reduce((n,r)=>n+(r.kind==="fromFieldArray"||r.kind==="fromCtxArray"?0:r.bytes),0)}read(t,n){let r={};for(let o of this.entries)if(o.kind==="plain")r[o.key]=o.codec.read(t);else if(o.kind==="packed"){let s=o.codec.read(t);for(let a of o.parts){let c=rW(a.bitWidth);r[a.key]=s>>>a.bitOffset&c}}else{let s=(()=>{if(o.kind==="fromFieldArray"){let c=r[o.fromField];if(typeof c!="number")throw new TypeError(`lengthFrom array "${o.key}" references field "${o.fromField}" which has not been read as a number.`);return c}if(n==null)throw new TypeError(`fromCtx array "${o.key}" requires a ctx argument; pass one to spec.read(view, ctx).`);let a=o.fromCtx(n);if(typeof a!="number"||!Number.isFinite(a)||a<0)throw new TypeError(`fromCtx array "${o.key}" produced a non-numeric or negative count (${String(a)}).`);return a})();r[o.key]=Array.from({length:s},()=>o.elementCodec.read(t))}return r}write(t,n,r){let o=n;for(let s of this.entries)if(s.kind==="plain")s.codec.write(t,o[s.key]);else if(s.kind==="packed"){let a=0;for(let c of s.parts){let l=rW(c.bitWidth),u=o[c.key]&l;a|=u<<c.bitOffset}s.codec.write(t,a>>>0)}else{let a=o[s.key];if(!Array.isArray(a))throw new TypeError(`lengthFrom array "${s.key}" expected an array, got ${typeof a}.`);for(let c of a)s.elementCodec.write(t,c)}}measure(t,n){let r=n??new We,o=0;for(let s of this.entries)if(!(s.kind!=="fromFieldArray"&&s.kind!=="fromCtxArray")&&typeof t=="object"&&t!==null){let a=t[s.key];Array.isArray(a)&&(o+=a.length*s.elementBytes)}return r.add(this.maxSize+o)}};function rW(e){return e>=32?4294967295:(1<<e)-1}function Ate(e){let t=Object.keys(e),n=[],r=0;for(;r<t.length;){let o=t[r],s=e[o];if(Tu(s)){n.push({kind:"plain",key:o,codec:new fh(s.count),bytes:s.count}),r++;continue}if(Ru(s)){typeof s.count=="number"?n.push({kind:"plain",key:o,codec:lh(s.element.codec,s.count),bytes:s.count*No(s.element.codec)}):Kj(s.count)?n.push({kind:"fromFieldArray",key:o,elementCodec:s.element.codec,elementBytes:No(s.element.codec),fromField:s.count.fromField}):Yj(s.count)&&n.push({kind:"fromCtxArray",key:o,elementCodec:s.element.codec,elementBytes:No(s.element.codec),fromCtx:s.count.fromCtx}),r++;continue}if(s.packedAs===void 0){let p=s.flags?new dh(s):s.codec;n.push({kind:"plain",key:o,codec:p,bytes:No(s.codec)}),r++;continue}let a=s.packedAs,c=s.codec,l=No(c),u=l*8,d=[],f=r;for(;f<t.length;){let p=t[f],g=e[p];if(Ru(g)||Tu(g)||g.packedAs!==a)break;if(g.codec!==c)throw new Error(`packed-field group "${a}": part "${p}" codec does not match the group's wire codec.`);if(!g.bitRange)throw new Error(`packed-field group "${a}": part "${p}" is missing bitRange.`);let[h,y]=g.bitRange;if(!Number.isInteger(h)||!Number.isInteger(y)||h<0||y<=0)throw new Error(`packed-field group "${a}": part "${p}" has invalid bitRange [${h}, ${y}].`);if(h+y>u)throw new Error(`packed-field group "${a}": part "${p}" bitRange [${h}, ${y}] exceeds ${u}-bit wire codec.`);d.push({key:p,bitOffset:h,bitWidth:y}),f++}if(d.length<2)throw new Error(`packed-field group "${a}" must have at least two consecutive parts; found ${d.length}.`);let m=[...d].sort((p,g)=>p.bitOffset-g.bitOffset);for(let p=1;p<m.length;p++){let g=m[p-1],h=m[p];if(g.bitOffset+g.bitWidth>h.bitOffset)throw new Error(`packed-field group "${a}": parts "${g.key}" and "${h.key}" overlap.`)}n.push({kind:"packed",slot:a,codec:c,bytes:l,parts:d}),r=f}return n}var iW={1:"bmp",2:"mve",4:"wav",5:"wfx",6:"plt",1e3:"bam",1001:"wed",1002:"chu",1003:"tis",1004:"mos",1005:"itm",1006:"spl",1007:"bcs",1008:"ids",1009:"cre",1010:"are",1011:"dlg",1012:"2da",1013:"gam",1014:"sto",1015:"wmp",1016:"eff",1017:"bs",1018:"chr",1019:"vvc",1020:"vef",1021:"pro",1022:"bio",1023:"wbm",1024:"fnt",1026:"gui",1027:"sql",1028:"pvrz",1029:"glsl",1030:"tot",1031:"toh",1032:"menu",1033:"lua",1034:"ttf",1035:"png",1100:"bah",2050:"ini",2051:"src",2052:"maze"},Ite=Object.fromEntries(Object.entries(iW).map(([e,t])=>[t,Number(e)]));function ac(e){return iW[e]}function cc(e){return Ite[e.replace(/^\./,"").toLowerCase()]}var Dte={signature:Qr(4),version:Qr(4),bifCount:{codec:ze},resCount:{codec:ze},bifOffset:{codec:ze},resOffset:{codec:ze}},kte={fileLength:{codec:ze},nameOffset:{codec:ze},nameLength:{codec:Wn},locationFlags:{codec:Wn}},Fte=24,Lte=12,oW=14,Ote=8,Mte=8,$te=10,qte=Zr(Dte),Bte=Zr(kte);function jte(e){let t=e.indexOf("\0");return t===-1?e:e.slice(0,t)}function sW(e,t){return new Po(e.buffer,{byteOffset:e.byteOffset+t})}function mh(e,t,n,r){if(t<0||t+n>e.byteLength)throw new RangeError(`KEY ${r} region [${t}, ${t+n}) exceeds file size ${e.byteLength}`)}function Wte(e,t,n){let r="";for(let o=0;o<n;o++)r+=String.fromCodePoint(e[t+o]);return r}function BC(e){mh(e,0,Fte,"header");let t=qte.read(sW(e,0));if(t.signature!=="KEY "||!t.version.startsWith("V1"))throw new Error(`Not a KEY V1 file (signature="${t.signature}" version="${t.version}")`);mh(e,t.bifOffset,t.bifCount*Lte,"BIF entries");let n=sW(e,t.bifOffset),r=[];for(let u=0;u<t.bifCount;u++){let d=Bte.read(n);mh(e,d.nameOffset,d.nameLength,`BIF ${u} name`),r.push({name:jte(Wte(e,d.nameOffset,d.nameLength)).replaceAll("\\","/"),fileLength:d.fileLength,locationFlags:d.locationFlags})}mh(e,t.resOffset,t.resCount*oW,"resource entries");let o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=[];for(let u=0;u<t.resCount;u++){let d=t.resOffset+u*oW,f="";for(let g=0;g<Ote;g++){let h=o.getUint8(d+g);if(h===0)break;f+=String.fromCodePoint(h)}let m=o.getUint16(d+Mte,!0),p=o.getUint32(d+$te,!0)>>>0;s.push({resref:f.toUpperCase(),type:m,ext:ac(m),bifIndex:p>>>20&4095,tilesetIndex:p>>>14&63,fileIndex:p&16383})}let a;function c(){if(a!==void 0)return a;let u=new Map;for(let d of s){let f=u.get(d.resref);f?f.push(d):u.set(d.resref,[d])}return a=u,u}let l=(u,d)=>{let f=c().get(u.toUpperCase())??[];return d===void 0?f:f.filter(m=>m.type===d)};return{bifs:r,resources:s,lookup(u,d){return l(u,d).at(-1)},lookupAll(u,d){return l(u,d)}}}var uW=B(require("zlib"),1);var aW=B(require("crypto"),1),Jn=B(require("fs"),1),lc=B(require("path"),1);function cW(e,t,n){if(!Number.isInteger(e)||!Number.isInteger(t)||e<0||t<0)throw new RangeError(`Invalid read: offset=${e} length=${t}`);if(e+t>n)throw new RangeError(`Read out of bounds: offset=${e} length=${t} exceeds size=${n}`)}function ph(e){return{size:e.byteLength,read(t,n){return cW(t,n,e.byteLength),e.subarray(t,t+n)},close(){}}}function jC(e,t){let n=lc.dirname(e),r=lc.join(n,`.${lc.basename(e)}.${aW.randomBytes(6).toString("hex")}.tmp`);Jn.writeFileSync(r,t),Jn.renameSync(r,e)}function hh(e){let t=Jn.openSync(e,"r"),n;try{n=Jn.fstatSync(t).size}catch(r){throw Jn.closeSync(t),r}return{size:n,read(r,o){cW(r,o,n);let s=Buffer.allocUnsafe(o),a=0;for(;a<o;){let c=Jn.readSync(t,s,a,o-a,r+a);if(c===0)throw new RangeError(`Unexpected EOF reading ${o} bytes at ${r}`);a+=c}return s},close(){Jn.closeSync(t)}}}var Ute={signature:Qr(4),version:Qr(4),fileCount:{codec:ze},tilesetCount:{codec:ze},fileEntriesOffset:{codec:ze}},Hte={locator:{codec:ze},dataOffset:{codec:ze},size:{codec:ze},type:{codec:Wn},unknown:{codec:Wn}},Vte={locator:{codec:ze},dataOffset:{codec:ze},tileCount:{codec:ze},tileSize:{codec:ze},type:{codec:Wn},unknown:{codec:Wn}},Gte=20,zte=16,Kte=20,Yte=Zr(Ute),Xte=Zr(Hte),Jte=Zr(Vte);function Qte(e){let t=e.read(0,4);return String.fromCodePoint(t[0],t[1],t[2],t[3])}function WC(e){let t=Qte(e);if(t==="BIFF")return dW(e);if(t==="BIF ")return lW(ene(e),e);if(t==="BIFC")return lW(tne(e),e);throw e.close(),new Error(`Unrecognized BIF signature "${t}"`)}function lW(e,t){return t.close(),{...dW(ph(e)),compressed:!0}}function dW(e){let t=e.read(0,Gte),n=Yte.read(new Po(t.buffer,{byteOffset:t.byteOffset}));if(n.signature!=="BIFF")throw e.close(),new Error(`Not a BIFF V1 archive (signature="${n.signature}")`);let r=n.fileCount*zte,o=n.tilesetCount*Kte,s=e.read(n.fileEntriesOffset,r+o),a=new Po(s.buffer,{byteOffset:s.byteOffset}),c=new Map;for(let u=0;u<n.fileCount;u++){let d=Xte.read(a),f=d.locator>>>0&16383;c.set(f,{fileIndex:f,offset:d.dataOffset,size:d.size,type:d.type})}let l=new Map;for(let u=0;u<n.tilesetCount;u++){let d=Jte.read(a),f=d.locator>>>0>>>14&63;l.set(f,{tilesetIndex:f,offset:d.dataOffset,tileCount:d.tileCount,tileSize:d.tileSize,type:d.type})}return{compressed:!1,files:c,tilesets:l,readFile(u){let d=c.get(u);if(!d)throw new Error(`No file index ${u} in BIF`);return e.read(d.offset,d.size)},readTileset(u){let d=l.get(u);if(!d)throw new Error(`No tileset index ${u} in BIF`);return e.read(d.offset,d.tileCount*d.tileSize)},close(){e.close()}}}var Zte=1032;function fW(e){return uW.inflateSync(e,{maxOutputLength:e.byteLength*Zte})}function ene(e){let t=e.read(0,e.size),r=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(8,!0);return fW(t.subarray(12+r+8))}function tne(e){let t=e.read(0,e.size),n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=n.getUint32(8,!0),o=[],s=12,a=0;for(;s+8<=t.byteLength&&a<r;){let c=n.getUint32(s+4,!0);s+=8;let l=fW(t.subarray(s,s+c));o.push(l),a+=l.byteLength,s+=c}return Buffer.concat(o)}var mW=Uint8Array.from([136,168,143,186,138,211,185,245,237,177,207,234,170,228,181,251,235,130,249,144,202,201,181,231,220,142,183,172,238,247,224,202,142,234,202,128,206,197,173,183,196,208,132,147,213,240,235,200,180,157,204,175,165,149,186,153,135,210,157,227,145,186,144,202]);function Au(e){if(e[0]!==255||e[1]!==255)return new TextDecoder("latin1").decode(e);let t=e.subarray(2),n=new Uint8Array(t.length);for(let[r,o]of t.entries())n[r]=o^mW[r%mW.length];return new TextDecoder("latin1").decode(n)}function UC(e){let t=new Map;for(let[n,r]of pW(e)){let o=t.get(n);o===void 0?t.set(n,[r]):o.push(r)}return t}function HC(e){return new Map(pW(e))}function*pW(e){let t=Au(e);for(let n of t.split(/\r?\n/)){let r=n.trim(),o=/^(\S+)\s+(\S.*)$/.exec(r),s=o?.[2];if(o===null||s===void 0)continue;let a=Number(o[1]);Number.isInteger(a)&&(yield[a,s])}}var VC=3;function GC(e){let t=new Map,n=0;for(let r of Au(e).split(/\r?\n/).slice(VC)){let o=r.trim().split(/\s+/)[0];o===void 0||o===""||(t.set(n,o),n++)}return t}function zC(e){let t=Au(e).split(/\r?\n/),n=(t[VC-1]??"").trim().split(/\s+/).filter(Boolean),r=[];for(let o of t.slice(VC)){let s=o.trim().split(/\s+/).filter(Boolean),[a,...c]=s;a!==void 0&&r.push({name:a,cells:c})}return{columns:n,rows:r}}var nne={signature:Qr(4),version:Qr(4),languageId:{codec:Wn},stringCount:{codec:ze},stringsOffset:{codec:ze}},rne={flags:{codec:Wn},soundResref:Qr(8),volumeVariance:{codec:ze},pitchVariance:{codec:ze},stringOffset:{codec:ze},stringLength:{codec:ze}},KC=18,gh=26,hW=1,ine=Zr(nne),gW=Zr(rne),one=new TextDecoder("utf-8",{fatal:!0}),sne=new TextDecoder("windows-1252"),_W=new Map;function SW(e){let t=_W.get(e);return t||(t=new TextDecoder(e),_W.set(e,t)),t}function YC(e){let t=e.indexOf("\0");return t===-1?e:e.slice(0,t)}function yW(e,t){if(t!==void 0)return YC(SW(t).decode(e));try{return YC(one.decode(e))}catch{return YC(sne.decode(e))}}var ane=100,cne=2048;function bW(){return new Promise(e=>{setTimeout(e,0)})}function JC(e,t={}){let n=ine.read(XC(e.read(0,KC)));if(n.signature!=="TLK "||!n.version.startsWith("V1"))throw e.close(),new Error(`Not a TLK V1 file (signature="${n.signature}" version="${n.version}")`);let{encoding:r}=t;r!==void 0&&SW(r);let o=n.stringCount,s=n.stringsOffset,a=new Map,c,l,u;async function d(){let m=e.read(KC,o*gh),p=e.read(s,e.size-s);await bW();let g=[],h=[];for(let y=0;y<o;y++){y>0&&y%cne===0&&await bW();let w=gW.read(XC(m.subarray(y*gh))),_=(w.flags&hW)===0||w.stringLength===0?void 0:yW(p.subarray(w.stringOffset,w.stringOffset+w.stringLength),r);g.push(_),h.push(_?.toLowerCase())}c=g,l=h}function f(){return u??=d(),u}return{count:o,languageId:n.languageId,async search(m,p={}){let g=p.limit??ane;await f();let h=c??[],y=l??[],w=m.toLowerCase(),_=[];for(let b=0;b<o&&_.length<g;b++){let S=y[b];S===void 0||S===""||S.includes(w)&&_.push({strref:b,text:h[b]})}return _},get(m){if(!Number.isInteger(m)||m<0||m>=o)return;let p=a.get(m);if(p!==void 0)return p;let g=gW.read(XC(e.read(KC+m*gh,gh))),h=(g.flags&hW)===0||g.stringLength===0?"":yW(e.read(s+g.stringOffset,g.stringLength),r);return a.set(m,h),h},close(){e.close()}}}function XC(e){return new Po(e.buffer,{byteOffset:e.byteOffset})}var pn=B(require("fs"),1),Ir=B(require("path"),1);var Un=1010,_h=1012,lne=[["SUBRACE",1008,"generic","iwd2"],["BONES",1008,"generic","pst"],["CLOWNRAN",1008,"generic","iwd1"],["FLYTHR01",2,"generic","bg2"],["OH1000",Un,"bgee","bg2"],["OH6000",Un,"bg2ee","bg2"],["PSTCHAR",_h,"pstee","bg2"],["HOWPARTY",_h,"iwdee","bg2"]],une=[["pstee","PSTCHAR",_h],["iwdee","HOWPARTY",_h],["bg2ee","OH6000",Un],["bgee","OH1000",Un],["iwd2","AR6050",Un],["pst","AR0104A",Un],["tob","AR6111",Un],["bg2","AR0083",Un],["totlm","AR9715",Un],["how","AR9109",Un],["iwd","AR2116",Un],["totsc","AR2003",Un],["bg1","AR0125",Un]],wW={bg1:"Baldur's Gate",totsc:"Baldur's Gate: Tales of the Sword Coast",bg2:"Baldur's Gate II: Shadows of Amn",tob:"Baldur's Gate II: Throne of Bhaal",bgt:"Baldur's Gate Trilogy",iwd:"Icewind Dale",how:"Icewind Dale: Heart of Winter",totlm:"Icewind Dale: Trials of the Luremaster",iwd2:"Icewind Dale II",pst:"Planescape: Torment",bgee:"Baldur's Gate: Enhanced Edition",sod:"Baldur's Gate: Siege of Dragonspear",bg2ee:"Baldur's Gate II: Enhanced Edition",iwdee:"Icewind Dale: Enhanced Edition",pstee:"Planescape: Torment: Enhanced Edition",eet:"Enhanced Edition Trilogy"},xW={bg1:"BG1",totsc:"BG1: TotSC",bg2:"BG2: SoA",tob:"BG2: ToB",bgt:"BGT",iwd:"IWD",how:"IWD: HoW",totlm:"IWD: TotLM",iwd2:"IWD2",pst:"PST",bgee:"BGEE",sod:"BGEE: SoD",bg2ee:"BG2EE",iwdee:"IWDEE",pstee:"PSTEE",eet:"EET"},dne={bg1:"bg1",bg2:"bg2",iwd1:"iwd",iwd2:"iwd2",pst:"pst"};function QC(e){let t="generic",n="bg1";for(let[a,c,l,u]of lne)e.lookup(a,c)!==void 0&&(t=l,n=u);let r=t==="generic"?"classic":"ee",s=une.find(([,a,c])=>e.lookup(a,c)!==void 0)?.[0]??(t==="generic"?dne[n]:t);return{variant:t,scriptStyle:n,edition:r,flavour:s,label:wW[s],shortLabel:xW[s]}}function vW(e,t,n){let r;return n("override/eet.flag")||n("data/eetTU00.bif")?r="eet":e.flavour==="bgee"&&n("movies/sodcin01.wbm")?r="sod":(e.flavour==="bg2"||e.flavour==="tob")&&t("AR7200",Un)&&(r="bgt"),r===void 0||r===e.flavour?e:{...e,flavour:r,label:wW[r],shortLabel:xW[r]}}var PW=1008,NW=1012,fne=["override"];function TW(e){return[...e?[`lang/${e}/movies`]:[],"movies","characters","portraits","portrait",...e?[`lang/${e}/sounds`]:[],"sounds","scripts","override"]}function vs(e,t){let n=Ir.join(e,t);if(pn.existsSync(n))return n;let r;try{r=pn.readdirSync(e)}catch{return}let o=t.toLowerCase(),s=r.find(a=>a.toLowerCase()===o);return s?Ir.join(e,s):void 0}function mne(e){let t=vs(e,"weidu.conf");if(t)try{return/^\s*lang_dir\s*=\s*(.+?)\s*$/im.exec(pn.readFileSync(t,"utf8"))?.[1]}catch{return}}function pne(e,t,n){if(n)return n;if(t!=="ee")return;let r=vs(e,"lang");if(!r)return;let o=c=>{let l=vs(r,c);return l!==void 0&&vs(l,"dialog.tlk")!==void 0},s=mne(e);if(s&&o(s))return s;let a;try{a=pn.readdirSync(r)}catch{return}return a.filter(c=>o(c)).sort()[0]}function ZC(e){return Ir.isAbsolute(e)||/^[a-z]:/i.test(e)?!0:e.split("/").some(t=>t==="..")}function EW(e){if(e===""||e==="."||e===".."||/[\\/]/.test(e)||ZC(e))throw new Error(`Refusing to write "${e}": not a plain file name`)}function xs(e,t){if(ZC(t))return;let n=e;for(let r of t.split("/").filter(o=>o!=="")){let o=vs(n,r);if(!o)return;n=o}return n===e?void 0:n}function hne(e){let t=new Set([""]),n=vs(e,"baldur.ini");if(n)try{let r=pn.readFileSync(n,"latin1"),o={},s=!1;for(let l of r.split(/\r?\n/)){let u=/^\s*\[(.+?)\]\s*$/.exec(l);if(u)s=u[1].toLowerCase()==="alias";else if(s){let d=/^\s*([A-Za-z0-9]+)\s*:?=\s*(.+?)\s*$/.exec(l);d&&(o[d[1].toUpperCase()]=d[2])}}let a=l=>l.replaceAll("\\","/").replace(/\/+$/,"").toLowerCase(),c=o.HD0?a(o.HD0):void 0;for(let[l,u]of Object.entries(o)){if(l==="HD0")continue;let d=a(u);c&&d.startsWith(`${c}/`)?t.add(d.slice(c.length+1)):c&&d===c&&t.add("")}}catch{}for(let r of["data","cache","CD1","CD2","CD3","CD4","CD5","CD6"])t.add(r);return[...t]}function eP(e,t={}){let n=vs(e,"chitin.key");if(!n)throw new Error(`chitin.key not found in ${e}`);let r=BC(pn.readFileSync(n)),o=new Map,s=hne(e),a=QC(r),c=t.encoding??(a.edition==="ee"?"utf-8":"windows-1252"),l=new Map,u=new Map,d=new Map,f=new Map,m=new Map;function p(D,j,z,ie){let se=j.toLowerCase(),xt=D.get(se);if(xt===void 0){xt=null;try{xt=ie(wt(j,z))}catch{}D.set(se,xt)}return xt??void 0}let g=pne(e,a.edition,t.lang),h=t.overrideFolders??(t.mode==="engine"?TW(g):fne),y=new Map(h.map((D,j)=>[D,j])),w=h.length,_=new Map,b=(D,j)=>`${D.toUpperCase()}\0${j}`;for(let D of r.resources){let j=b(D.resref,D.type),z={kind:"bif",bifIndex:D.bifIndex,fileIndex:D.fileIndex,tilesetIndex:D.tilesetIndex,type:D.type,rank:w},ie=_.get(j);ie?(ie.sources=ie.sources.filter(se=>se.kind!=="bif"),ie.sources.push(z)):_.set(j,{resref:D.resref.toUpperCase(),type:D.type,sources:[z]})}function S(){h.forEach((D,j)=>{let z=xs(e,D);if(!z)return;let ie;try{ie=pn.readdirSync(z)}catch{return}for(let se of ie){let xt=se.lastIndexOf(".");if(xt<=0)continue;let vt=cc(se.slice(xt+1));if(vt===void 0)continue;let Mt=se.slice(0,xt).toUpperCase(),ce=b(Mt,vt),vn={kind:"file",folder:D,path:Ir.join(z,se),rank:j},ei=_.get(ce);ei?ei.sources.push(vn):_.set(ce,{resref:Mt,type:vt,sources:[vn]})}})}function N(){for(let D of _.values())D.sources.sort((j,z)=>j.rank-z.rank)}S(),N();let R=vW(a,(D,j)=>_.has(b(D,j)),D=>xs(e,D)!==void 0||g!==void 0&&xs(e,`lang/${g}/${D}`)!==void 0),$=new Map;function I(D){let j=$.get(D);if(j!==void 0)return j??void 0;let z=r.bifs[D],ie=z?s.map(se=>xs(e,se?`${se}/${z.name}`:z.name)).find(se=>se!==void 0):void 0;return $.set(D,ie??null),ie}function U(D){let j=o.get(D);if(j)return j;let z=r.bifs[D];if(!z)throw new Error(`BIF index ${D} out of range`);let ie=I(D);if(!ie)throw new Error(ZC(z.name)?`Refusing to load BIF outside the game directory: ${z.name}`:`BIF file not found: ${z.name}`);let se=WC(hh(ie));return o.set(D,se),se}function de(D){if(D.kind==="file")return pn.readFileSync(D.path);let j=U(D.bifIndex);return D.type===1003?j.readTileset(D.tilesetIndex):j.readFile(D.fileIndex)}function F(D){let j=typeof D=="string"?cc(D):D;if(j===void 0)throw new Error(`Unknown resource extension "${D}"`);return j}function Q(D){let j=y.get(D);if(j===void 0)throw new Error(`Folder "${D}" is not one of the override folders (${h.join(", ")})`);return j}function pe(D){return xs(e,`override/${D}`)}function ot(D,j,z){return _.get(b(D,j))?.sources.find(se=>se.kind==="file"&&se.folder===z)}function M(D,j){if(j===void 0)return r.lookup(D)?.type;let z=typeof j=="string"?cc(j):j;if(typeof j=="string"&&z===void 0)throw new Error(`Unknown resource extension "${j}"`);return z}function O(D,j){let z=M(D,j);return(z===void 0?void 0:_.get(b(D,z)))?.sources[0]}function wt(D,j){let z=O(D,j);if(z===void 0){let ie=M(D,j),se=ie!==void 0?` (type 0x${ie.toString(16)})`:"";throw new Error(`Resource not found: ${D}${se}`)}return de(z)}return{key:r,identity:R,list(){let D=[];for(let j of _.values()){let z=j.sources[0];D.push({resref:j.resref,type:j.type,ext:ac(j.type),bif:z.kind==="file"?`${z.folder}/${Ir.basename(z.path)}`:r.bifs[z.bifIndex]?.name??""})}return D},read:wt,canRead(D,j){let z=typeof j=="string"?cc(j):j,se=(z===void 0?void 0:_.get(b(D,z)))?.sources[0];return se!==void 0&&(se.kind==="file"||I(se.bifIndex)!==void 0)},locate(D,j){let z=O(D,j);if(z===void 0)return;if(z.kind==="file")return{kind:"file",path:z.path};let ie=I(z.bifIndex);if(ie===void 0)return;let se=z.type===1003;return{kind:"bif",archivePath:ie,entry:se?z.tilesetIndex:z.fileIndex,tileset:se}},write(D,j,z,ie){EW(D);let se=F(j),xt=ac(se);if(!xt)throw new Error(`No file extension known for resType 0x${se.toString(16)}`);let vt=ie?.folder??"override",Mt=Q(vt),ce=b(D,se),vn=_.get(ce)??{resref:D.toUpperCase(),type:se,sources:[]},ei=ot(D,se,vt),V=ei!==void 0?ei.path:Ir.join(RW(e,vt),`${D.toLowerCase()}.${xt}`);jC(V,z);let Be={kind:"file",folder:vt,path:V,rank:Mt};vn.sources=[...vn.sources.filter(W=>!(W.kind==="file"&&W.folder===vt)),Be].sort((W,he)=>W.rank-he.rank),_.set(ce,vn)},remove(D,j,z){let ie=F(j),se=z?.folder??"override";Q(se);let xt=b(D,ie),vt=_.get(xt),Mt=ot(D,ie,se);return!vt||!Mt?!1:(pn.rmSync(Mt.path,{force:!0}),vt.sources=vt.sources.filter(ce=>ce!==Mt),vt.sources.length===0&&_.delete(xt),!0)},rescan(){let D=[];for(let[j,z]of _)z.sources=z.sources.filter(ie=>ie.kind!=="file"),z.sources.length===0&&D.push(j);for(let j of D)_.delete(j);S(),N()},looseFile(D,j,z){let ie=z?.folder??"override";return Q(ie),ot(D,F(j),ie)?.path},writeAuxFile(D,j){EW(D);let z=Ir.join(RW(e,"override"),D.toLowerCase());return jC(z,j),z},auxFile:pe,readAuxFile(D){let j=pe(D);return j?pn.readFileSync(j):void 0},tlk(D="male"){let j=l.get(D);if(j===void 0){let z=D==="female"?"dialogF.tlk":"dialog.tlk",ie=[...g?[`lang/${g}/${z}`]:[],z],se;for(let xt of ie)if(se=xs(e,xt),se)break;j=se?JC(hh(se),{encoding:c}):null,l.set(D,j)}return j??void 0},ids(D){return p(u,D,PW,HC)},idsAll(D){return p(d,D,PW,UC)},twoDa(D){return p(f,D,NW,GC)},twoDaTable(D){return p(m,D,NW,zC)},close(){for(let D of o.values())D.close();o.clear();for(let D of l.values())D&&D.close();l.clear()}}}function RW(e,t){let n=xs(e,t);if(n)return n;let r=Ir.join(e,t);return pn.mkdirSync(r,{recursive:!0}),r}var gne=(e,t)=>eP(e,{mode:"engine",...t===void 0?{}:{encoding:t}}),yh=class{opener;open;failedKey;constructor(t=gne){this.opener=t}resolve(t,n){return this.game(n)?.tlk()?.get(t)}tables(t){return this.game(t)}scriptStyle(t){return this.game(t)?.identity.scriptStyle}game(t){let{gamePath:n}=t;if(n==="")return;let r=`${n} ${t.tlkEncoding}`;if(this.open?.key===r)return this.open.game;if(this.failedKey!==r){this.dispose();try{let o=this.opener(n,t.tlkEncoding===""?void 0:t.tlkEncoding);return this.open={key:r,game:o},o}catch(o){this.failedKey=r,T(`Cannot open the configured IE game at ${n}: ${at(o)}`,"warn");return}}}dispose(){this.open?.game.close(),this.open=void 0,this.failedKey=void 0}};var bh=B(le());var Du=B(require("fs")),Iu=B(require("path"));var tP=class extends Error{constructor(t){super(`Unknown transpile extension for "${t}". Accepted: ${yn}, ${Jt}`),this.name="UnknownTranspileExtensionError"}};function nP(e){let t=e.toLowerCase();if(t.endsWith(yn))return e.slice(0,-yn.length)+cf;if(t.endsWith(Jt))return e.slice(0,-Jt.length)+qo;throw new tP(e)}var Eo=class e extends Error{location;constructor(t,n={},r){super(t),this.name="TranspileError",this.location=n,r!==void 0&&(this.cause=r)}static fromNode(t,n,r){return new e(n,{file:r,line:t.getStartLineNumber()})}static wrap(t,n){if(t instanceof e){let o={file:t.location.file??n.file,line:t.location.line??n.line,column:t.location.column??n.column};return new e(t.message,o,t)}let r=t instanceof Error?t.message:String(t);return new e(r,n,t)}static remap(t,n){if(!(t instanceof e)||t.location.line===void 0)return t;let r=n[t.location.line-1];return r===void 0?new e(t.message,{file:t.location.file},t):new e(t.message,{file:r.file,line:r.line+1},t)}};var _ne=6e4,rP=Da({fileName:"ts-morph-worker.js",label:"transpiler",timeoutMs:_ne});async function AW(e){let t=await rP.send(e);if(t===null)throw new Error("The transpiler request was cancelled.");return t}function IW(e){if(!e.failure)return;let{message:t,...n}=e.failure;throw new Eo(t,n)}function DW(){rP.start()}async function iP(e){let t=await AW(e);return IW(t),t.result}async function oP(e){let t=await AW(e);return IW(t),t.parsed}async function kW(){await rP.stop()}var FW=B(require("path"));var yne=6e4,LW=Da({fileName:"ts-morph-worker.js",label:"TSSL compiler",timeoutMs:yne}),sP=!1,bne=`function start() {}
369
+ `,Sne=FW.join(__dirname,"__prewarm__.tssl");async function aP(e,t){let n=await LW.send({...e,kind:"compile"},t);if(n===null)return!1;if(n.failure){let{message:r,...o}=n.failure;throw new Eo(r,o)}return!0}function OW(){sP||(sP=!0,aP({text:bne,filepath:Sne,intPath:null,sslPath:null,level:0,shortCircuit:!1}).catch(e=>{T(`TSSL compile worker prewarm failed: ${e instanceof Error?e.message:String(e)}`)}))}async function MW(){sP=!1,await LW.stop()}var $W=new Map;function qW(){Aa($W)}async function BW(e,t,n,r,o){let s=np(r.falloutSSL.compileOptions.split(/\s+/).filter(Boolean)),a=o||r.falloutSSL.compileOnValidate,c=sp(t,r.falloutSSL.outputDirectory,e,a),l=r.tssl.emitSsl?t.slice(0,-zn.length)+".ssl":null,u=!1;return await Wl({uri:Ne(e),activeCompiles:$W,run:async d=>{u=await aP({text:n,filepath:t,intPath:a?c:null,sslPath:l,level:s.level,shortCircuit:s.shortCircuit},d)}}),u?l===null?{intPath:c}:{intPath:c,sslPath:l}:null}function cP(e,t){let n=BA(e,"compiler");if(n.length===0)return;let r=[],o=new Map;for(let s of n){let a=t[s.range.start.line];if(a===void 0){r.push(s);continue}let c=Ye(a.file),l=o.get(c);l||(l=[],o.set(c,l)),l.push({...s,range:{start:{line:a.line,character:0},end:{line:a.line,character:0}}})}jr(e,"compiler",r);for(let[s,a]of o)jr(s,"compiler",a)}function lP(e,t,n,r){let o=e instanceof Eo?e.location:{},s=o.file!==void 0&&o.file!==et(t),a=s?`${o.file}:${o.line??1}: ${at(e)}`:at(e),c=s?1:o.line??1,l=s?0:o.column??0;Wr({errors:[{uri:t,line:c,columnStart:l,columnEnd:l,message:a}],warnings:[]},t,t),r&&ir(`${n}: ${a}`)}async function ku(e,t,n,r){if(!e.startsWith("file://")){T(`Not compiling ${e}: not a file on disk`,"debug");return}let o=await Zs(e);if(Gf(Ji)||Du.mkdirSync(Ji),!(Y.has(t)&&(Qc(e),await Y.compile(t,e,r,n)))){if(t==="typescript"){if(e.toLowerCase().endsWith(Jt)){Qc(e);try{let s=et(e),{output:a,warnings:c,sourceMap:l}=await iP({kind:"td",filepath:s,text:r}),u=nP(s);await Du.promises.writeFile(u,a,"utf-8");let d=Iu.basename(u);if(n)if(c.length>0){let f=c.map(m=>m.message.match(/^Function "(.+)" /)?.[1]??"?");Sr(`Transpiled to ${d}. Orphan states: ${f.join(", ")}`)}else bn(`Transpiled to ${d}`);if(o.weidu.path&&o.weidu.gamePath){let f=Ye(u);await So(f,o.weidu,n,a),cP(f,l)}}catch(s){lP(s,e,"TD",n)}return}if(e.toLowerCase().endsWith(yn)){Qc(e);try{let s=et(e),{output:a,sourceMap:c}=await iP({kind:"tbaf",filepath:s,text:r}),l=nP(s);await Du.promises.writeFile(l,a,"utf-8");let u=Iu.basename(l);n&&bn(`Transpiled to ${u}`);let d=Ye(l);await Op(d,a,o,n)&&cP(d,c)}catch(s){lP(s,e,"TBAF",n)}return}if(e.toLowerCase().endsWith(zn)){Qc(e);try{let s=et(e),a=await BW(e,s,r,o,n);if(a===null)return;let{intPath:c,sslPath:l}=a;if(n){let u=l?` and ${Iu.basename(l)}`:"";bn(`Compiled ${Iu.basename(c)}${u}`)}}catch(s){lP(s,e,"TSSL",n)}}return}T(`Don't know how to compile ${t} - ${e}`),n&&bn(`Don't know how to compile ${t} - ${e}`)}}function jW(){return{textDocumentSync:bh.TextDocumentSyncKind.Incremental,completionProvider:{resolveProvider:!0,completionItem:{labelDetailsSupport:!0},triggerCharacters:["@"]},hoverProvider:!0,signatureHelpProvider:{triggerCharacters:["("]},semanticTokensProvider:{legend:_b,full:!0},inlayHintProvider:!0,definitionProvider:!0,referencesProvider:!0,renameProvider:{prepareProvider:!0},documentFormattingProvider:!0,documentSymbolProvider:!0,workspaceSymbolProvider:!0,foldingRangeProvider:!0,selectionRangeProvider:!0,callHierarchyProvider:!0,codeActionProvider:{codeActionKinds:[bh.CodeActionKind.QuickFix]},executeCommandProvider:{commands:[cl,Yf,Xf,...d0.map(e=>f0(e))]}}}function uc(e){e().catch(()=>{})}var Pi={configuration:!1,workspaceFolders:!1,fileWatching:!1},dc,uP=Promise.resolve();function UW(e){e.connection.onInitialize(async t=>{T("onInitialize started");let n=t.capabilities;Pi.configuration=!!n.workspace?.configuration,Pi.workspaceFolders=!!n.workspace?.workspaceFolders,Pi.fileWatching=!!n.workspace?.didChangeWatchedFiles?.dynamicRegistration,t.workspaceFolders?.[0]&&(dc=(0,WW.fileURLToPath)(t.workspaceFolders[0].uri),T(`workspace_root = ${dc}`));let r=aO(dc),o=new ah(r.translation,dc,()=>{uc(()=>e.connection.languages.inlayHint.refresh())});uP=o.init().then(()=>{for(let a of e.documents.all()){let c=a.getText();o.reloadFile(a.uri,a.languageId,c),o.reloadConsumer(a.uri,c,a.languageId)}}).catch(a=>T(`Translation load failed: ${a}`,"error")),qA({info:a=>T(a),error:a=>T(a,"error")}),Me.register(mt,"tree-sitter-ssl.wasm","SSL"),Me.register(Tt,"tree-sitter-baf.wasm","BAF"),Me.register(At,"tree-sitter-weidu_d.wasm","WeiDU D"),Me.register(_n,"tree-sitter-weidu_tp2.wasm","WeiDU TP2"),Me.register(ta,"tree-sitter-fallout_msg.wasm","Fallout MSG"),Me.register(na,"tree-sitter-weidu_tra.wasm","WeiDU TRA"),await Me.initAll(),Y.register(W$),Y.register(U$),Y.register(cq),Y.register(Nq),Y.register(HB),Y.register(ij),Y.register(zB),Y.register(Qp(na,_v,"tra")),Y.register(Qp(ta,yv,"msg")),Y.register(Qp(eb,Sv)),Y.registerAlias(Qy,Tt),Y.registerAlias(Vc,Tt),await Y.init({workspaceRoot:dc,settings:Fn,getDocumentText:a=>e.documents.get(a)?.getText(),getDocumentVersion:a=>e.documents.get(a)?.version,getTranslationDir:()=>o.directory(),scanAfter:uP}),Z$({capabilities:{configuration:Pi.configuration,workspaceFolders:Pi.workspaceFolders,fileWatching:Pi.fileWatching},client:{info:t.clientInfo,capabilities:n},workspaceRoot:dc,projectSettings:r,settings:Fn,translation:o,configuredGame:new yh});let s={capabilities:jW()};return Pi.workspaceFolders&&(s.capabilities.workspace={workspaceFolders:{supported:!0}}),T("onInitialize completed"),s}),e.connection.onInitialized(async()=>{T("onInitialized started"),Pi.configuration&&await e.connection.client.register(Sh.DidChangeConfigurationNotification.type);let t=ts(await e.connection.workspace.getConfiguration({section:"bgforge"}));if(Lp(t),Y.updateSettings(t),Pi.fileWatching){let n=Y.getWatchPatterns();n.length>0&&(await e.connection.client.register(Sh.DidChangeWatchedFilesNotification.type,{watchers:n}),T(`Registered file watchers for ${n.length} patterns`))}else Y.getWatchPatterns().length>0&&T("Client did not advertise didChangeWatchedFiles dynamicRegistration; header reload on out-of-band edit is disabled.","warn");uP.then(()=>uc(()=>e.connection.languages.inlayHint.refresh())),T("onInitialized completed")})}var BPe=B(le());function HW(e){e.connection.onCompletion(xe("onCompletion",t=>{let n=t.textDocument.uri,r=e.documents.get(n);if(!r)return[];let o=r.languageId,s=r.getText();return Y.completion(o,s,n,t.position,t.context?.triggerCharacter)},e.timingOpts)),e.connection.onCompletionResolve(t=>t)}var GW=B(le());var dP="BGforge MLS (syntax)",VW=32;function zW(e){return cp(e).map(t=>Pne(t,t.isMissing?`missing '${t.type}'`:vne(t)))}function vne(e){let t=Cne(e);return t?`Syntax error near '${t}'`:"Syntax error"}function Cne(e){let t=(e.children[0]?.text??e.text).trim();if(t.length===0)return"";let n=t.split(`
370
+ `,1)[0]??t,r=n.split(/\s+/,1)[0]??n;return r.length>VW?`${r.slice(0,VW)}...`:r}function Pne(e,t){let n={line:e.startPosition.row,character:e.startPosition.column},r=e.startIndex===e.endIndex?{line:e.startPosition.row,character:e.startPosition.column+1}:{line:e.endPosition.row,character:e.endPosition.column};return{severity:GW.DiagnosticSeverity.Error,range:{start:n,end:r},message:t,source:dP}}function fP(e,t,n){if(!Me.isInitialized(t))return;let r=Me.parseWithCache(t,n);r&&jr(e,"tree-sitter",zW(r.rootNode))}function KW(e,t,n,r){if(t.length<1e5){r();return}n.schedule(e,r)}function Fu(e,t){let n=e instanceof Error?e.message:String(e);T(`Compilation error: ${n}`,"error"),t&&ir(`Compilation failed: ${n}`)}var wh=new Map;function Nne(e){let t=e.toLowerCase();t.endsWith(zn)?OW():(t.endsWith(yn)||t.endsWith(Jt))&&DW()}function YW(e){return t=>{let n=Si();if(!n?.capabilities.configuration)return Promise.resolve(n?.settings??Fn);let r=Ne(t),o=wh.get(r);return o||(o=e.workspace.getConfiguration({scopeUri:t,section:"bgforge"}).then(ts),wh.set(r,o)),o}}function XW(){wh.clear()}function mP(e,t,n){let r=Si()?.translation.getDiagnostics(e,t,n)??[];jr(e,"translation",r)}function JW(e){e.documents.onDidClose(xe("onDidClose",t=>{wh.delete(Ne(t.document.uri)),Y.handleDocumentClosed(t.document.languageId,t.document.uri)},e.timingOpts)),e.documents.onDidOpen(xe("onDidOpen",async t=>{let n=await xn(),r=t.document.uri,o=t.document.languageId,s=t.document.getText();Nne(r),Y.reloadFileData(o,r,s),n.translation.reloadFile(r,o,s),n.translation.reloadConsumer(r,s,o),(await e.getDocumentSettings(r)).diagnostics&&mP(r,o,s)},e.timingOpts)),e.documents.onDidSave(xe("onDidSave",async t=>{let n=t.document.uri,r=t.document.languageId,o=t.document.getText();Y.reloadFileData(r,n,o),Wo(n)&&uc(()=>e.connection.languages.semanticTokens.refresh()),Si()?.translation.reloadFile(n,r,o),Si()?.translation.reloadConsumer(n,o,r);let s=Ne(n);if(e.renameSuppression.consumeAffected(s))return;let a=await e.getDocumentSettings(n);a.diagnostics&&(e.parseDebouncer.cancel(s),fP(n,r,o),mP(n,r,o)),oO(a.validate)&&(e.compileDebouncer.cancel(s),ku(n,r,!1,o).catch(c=>Fu(c,!1)))},e.timingOpts)),e.documents.onDidChangeContent(xe("onDidChangeContent",async t=>{let n=t.document.uri,r=t.document.languageId,o=t.document.getText(),s=Ne(n);if(e.fileReloadDebouncer.schedule(s,()=>{Y.reloadFileData(r,n,o),Si()?.translation.reloadFile(n,r,o),Si()?.translation.reloadConsumer(n,o,r),Wo(n)&&uc(()=>e.connection.languages.semanticTokens.refresh())}),e.renameSuppression.isAffected(s))return;jA(n);let a=await e.getDocumentSettings(n);a.diagnostics&&KW(s,o,e.parseDebouncer,()=>{fP(n,r,o),mP(n,r,o)}),sO(a.validate)&&e.compileDebouncer.schedule(s,()=>{ku(n,r,!1,o).catch(c=>Fu(c,!1))})},e.timingOpts))}function ZW(e){e.connection.onDidChangeConfiguration(xe("onDidChangeConfiguration",async t=>{T("did change configuration");let n=Si();if(!n)return;let r;if(n.capabilities.configuration)XW(),r=ts(await e.connection.workspace.getConfiguration({section:"bgforge"}));else{let o=t.settings?.bgforge;r=ts(o??Fn)}Lp(r),Y.updateSettings(r)},e.timingOpts)),e.connection.onDidChangeWatchedFiles(xe("onDidChangeWatchedFiles",t=>{for(let n of t.changes)Y.handleWatchedFileChange(n.uri,n.type).catch(r=>{T(`handleWatchedFileChange rejected: ${r instanceof Error?r.message:String(r)}`,"warn")})},e.timingOpts))}function eU(e){e.connection.onDefinition(xe("onDefinition",async t=>{let n=e.documents.get(t.textDocument.uri);if(!n)return;let r=t.textDocument.uri,o=n.languageId,s=n.getText();if(!Y.shouldProvideFeatures(o,s,t.position))return;let a=await Y.definition(o,s,t.position,r);if(a)return a;let c=ep(s,t.position,Y.identifierExtraChars(o)),l=await xn();if(c){let u=l.translation.getDefinition(r,o,c,s);if(u)return u}return c&&!Y.isPositionInString(o,s,t.position)?Y.symbolDefinition(o,c):null},e.timingOpts))}function tU(e){e.connection.onFoldingRanges(xe("onFoldingRanges",t=>{let n=e.documents.get(t.textDocument.uri);return n?Y.foldingRanges(n.languageId,n.getText()):[]},e.timingOpts))}function nU(e){e.connection.onSelectionRanges(xe("onSelectionRanges",t=>{let n=e.documents.get(t.textDocument.uri);return n?Y.selectionRanges(n.languageId,n.getText(),t.positions):[]},e.timingOpts))}function rU(e){let t=e.data;return t&&typeof t.langId=="string"?t.langId:null}function pP(e,t){return{...e,data:{langId:t}}}function iU(e){let t=e.connection.languages.callHierarchy;t.onPrepare(xe("onPrepareCallHierarchy",n=>{let r=e.documents.get(n.textDocument.uri);if(!r)return null;let o=r.languageId;return Y.prepareCallHierarchy(o,r.getText(),n.position,n.textDocument.uri)?.map(a=>pP(a,o))??null},e.timingOpts)),t.onIncomingCalls(xe("onCallHierarchyIncomingCalls",n=>{let r=rU(n.item);return r?Y.incomingCalls(r,n.item).map(o=>({...o,from:pP(o.from,r)})):[]},e.timingOpts)),t.onOutgoingCalls(xe("onCallHierarchyOutgoingCalls",n=>{let r=rU(n.item);return r?Y.outgoingCalls(r,n.item).map(o=>({...o,to:pP(o.to,r)})):[]},e.timingOpts))}var Ro=B(le());var Dne=/^missing '(.+)'$/,kne=/^[^\p{L}\p{N}_\s]+$/u;function Fne(e){if(e.source!==dP)return;let t=typeof e.message=="string"?e.message:e.message.value,n=Dne.exec(t)?.[1];return n!==void 0&&kne.test(n)?n:void 0}function Lne(e,t,n){return{title:`Insert missing '${t}'`,kind:Ro.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{documentChanges:[Ro.TextDocumentEdit.create(Ro.OptionalVersionedTextDocumentIdentifier.create(n.uri,n.version),[Ro.TextEdit.insert(e.range.start,t)])]}}}function oU(e){e.connection.onCodeAction(xe("onCodeAction",t=>{let n=e.documents.get(t.textDocument.uri);if(!n)return[];let r=[];for(let o of t.context.diagnostics){let s=Fne(o);s!==void 0&&r.push(Lne(o,s,n))}return r},e.timingOpts))}var sU=B(le());function aU(e){e.connection.onDocumentFormatting(xe("onDocumentFormatting",t=>{let n=e.documents.get(t.textDocument.uri);if(!n)return[];let r=t.textDocument.uri,o=n.languageId,s=n.getText(),a=Y.format(o,s,r);return a.warning&&e.connection.sendNotification("window/showMessage",{type:sU.MessageType.Warning,message:sa(a.warning)}),a.edits},e.timingOpts))}var cU=B(le());function lU(e,t,n){let r=[];for(let o of e){let s=o.range.end.line;if(s<n.start.line||s>n.end.line)continue;let a=t(o.strref);if(a===void 0)continue;let c=vu(a);r.push({position:o.range.end,label:c.inlay,...c.inlayTooltip===void 0?{}:{tooltip:c.markup},kind:cU.InlayHintKind.Parameter,paddingLeft:!0,paddingRight:!0})}return r}function uU(e,t,n){let r=e.find(s=>$ne(s.range,n));if(!r)return;let o=t(r.strref);return o===void 0?void 0:vu(o).hover}function $ne(e,t){return t.line===e.start.line&&t.character>=e.start.character&&t.character<=e.end.character}function dU(e){e.connection.onHover(xe("onHover",async t=>{let n=t.textDocument.uri,r=e.documents.get(n);if(!r)return;let o=r.languageId,s=r.getText(),a=ep(s,t.position,Y.identifierExtraChars(o)),c=await xn(),{debug:l}=c.settings;if(!a){l&&T(`[hover] no symbol at position in ${n}`);return}if(l&&T(`[hover] symbol="${a}" langId="${o}" uri="${n}"`),!Y.shouldProvideFeatures(o,s,t.position)){l&&T("[hover] suppressed (shouldProvideFeatures=false)");return}let u=Y.strRefs(o,s,n);if(u.length>0){let{weidu:p}=await Zs(n),g=uU(u,h=>c.configuredGame.resolve(h,p),t.position);if(g)return l&&T("[hover] strref hover returned"),g}let d=c.translation.getHover(n,o,a,s);if(d)return l&&T("[hover] translation hover returned"),d;let f=Y.localHover(o,s,a,n,t.position);if(f.handled)return l&&T(`[hover] localHover handled, result=${f.hover?"found":"null"}`),f.hover;if(Y.isPositionInString(o,s,t.position))return l&&T("[hover] suppressed (cursor in string)"),null;let m=Y.hover(o,n,a,s);return l&&T(`[hover] dataHover result=${m?"found":"null"}`),m},e.timingOpts))}function fU(e){e.connection.languages.inlayHint.on(async t=>{let n=t.textDocument.uri,r=e.documents.get(n);if(!r)return;let o=r.getText(),s=r.languageId,a=await xn(),c=Y.strRefs(s,o,n),l=[];if(c.length>0){let{weidu:u}=await Zs(n);l=lU(c,d=>a.configuredGame.resolve(d,u),t.range)}return[...Y.inlayHints(s,o,n,t.range),...l,...a.translation.getInlayHints(n,s,o,t.range)]})}function mU(e){e.connection.onReferences(xe("onReferences",async(t,n)=>{let r=e.documents.get(t.textDocument.uri);if(!r)return[];let o=t.textDocument.uri,s=r.languageId,a=r.getText();if(!Y.shouldProvideFeatures(s,a,t.position))return[];let c=Y.references(s,a,t.position,o,t.context.includeDeclaration,n);if(c.length>0)return c;let u=await(await xn()).translation.getReferences(o,s,t.position,t.context.includeDeclaration);return u&&u.length>0?u:[]},e.timingOpts))}function pU(e){e.connection.languages.semanticTokens.on(xe("semanticTokens",t=>{let n=e.documents.get(t.textDocument.uri);return n?Y.semanticTokens(n.languageId,n.getText(),t.textDocument.uri):{data:[]}},e.timingOpts))}function hU(e){e.connection.onSignatureHelp(t=>{let n=t.textDocument.uri,r=e.documents.get(n);if(!r)return null;let o=r.getText(),s=r.languageId,a=z1(o,t.position);return a?Y.signature(s,o,n,a.symbol,a.parameter):null})}function gU(e){e.connection.onDocumentSymbol(xe("onDocumentSymbol",t=>{let n=e.documents.get(t.textDocument.uri);return n?Y.symbols(n.languageId,n.getText()):[]},e.timingOpts)),e.connection.onWorkspaceSymbol(xe("onWorkspaceSymbol",(t,n)=>Y.workspaceSymbols(t.query,n),e.timingOpts))}var _U=B(le());function yU(e){e.connection.onPrepareRename(xe("onPrepareRename",t=>{let n=e.documents.get(t.textDocument.uri);if(!n)return null;let r=n.languageId,o=n.getText();return Y.prepareRename(r,o,t.position)},e.timingOpts)),e.connection.onRenameRequest(xe("onRenameRequest",async t=>{let n=e.documents.get(t.textDocument.uri);if(!n)return null;let r=t.textDocument.uri,o=n.languageId,s=n.getText(),a=await Y.rename(o,s,t.position,t.newName,r);if(a?.documentChanges&&a.documentChanges.length>0){let c=[];for(let l of a.documentChanges)_U.TextDocumentEdit.is(l)&&c.push(Ne(l.textDocument.uri));e.renameSuppression.markAffected(c)}return a},e.timingOpts))}var Gne=new Set(["NOption","NLowOption","GOption","GLowOption","BOption","BLowOption"]),zne=new Set(["NMessage","GMessage","BMessage"]);function hP(e){return Gne.has(e)}function gP(e){return zne.has(e)}var Kne=new Set;async function CU(e,t=Kne){we()||await yp();let n=De(e);if(!n)return T("parseDialog: fallout-ssl parse produced no tree; returning empty dialog","warn"),{nodes:[],entryPoints:[]};let r=n.rootNode,o=[],s=[],a,c,l,u=[],d=new Map,f=new Map;for(let S of r.children){if(S.type!=="procedure_forward")continue;let N=S.childForFieldName("name");if(!N)continue;let R=Lt(N.text);d.has(R)||(d.set(R,{start:N.startIndex,end:N.endIndex}),f.set(R,{start:S.startIndex,end:S.endIndex}))}let m=new Map;for(let S of r.children){if(S.type!=="procedure")continue;let N=S.childForFieldName("name");if(!N)continue;let R=N.text;if(Lt(R)==="talk_p_proc"){Yne(S,s),a=S.startIndex,c=Xne(S),l=Jne(S);continue}let $=Qne(S,R,t,e);$.procRange={start:S.startIndex,end:S.endIndex};let I=d.get(Lt(R));I&&($.forwardDeclRange=I);let U=f.get(Lt(R));U&&($.forwardDeclStmtRange=U),m.set(R,$)}fc(r,S=>{if(S.type!=="call_expr")return;let N=S.childForFieldName("func")?.text;if(N!=="force_dialog_start"&&N!=="start_dialog_at_node")return;let R=xP(S)[0];if(!R)return;let $=R.type==="call_expr"?R.childForFieldName("func")?.text:R.text;$&&(s.includes($)||s.push($),R.type!=="call_expr"&&u.push({name:$,targetRange:{start:R.startIndex,end:R.endIndex}}))});let p=new Map;for(let S of m.keys())p.set(Lt(S),S);let g=S=>p.get(Lt(S))??S;s.splice(0,s.length,...new Set(s.map(S=>g(S))));for(let S of c??[])S.name=g(S.name);for(let S of u)S.name=g(S.name);for(let S of m.values()){for(let N of S.options)N.target&&(N.target=g(N.target));S.callTargets=[...new Set(S.callTargets.map(g))];for(let N of S.callTransitions??[])N.name=g(N.name)}let h=new Set,y=[...s];for(;y.length>0;){let S=y.shift();if(h.has(S))continue;h.add(S);let N=m.get(S);if(N){for(let R of N.options)R.target&&y.push(R.target);for(let R of N.callTargets)y.push(R)}}let w=S=>Lt(S).endsWith("_p_proc"),_=S=>/^node\d+$/.test(Lt(S)),b=S=>{let N=/^node0*(\d+)$/.exec(Lt(S));return N!==null&&(N[1]==="998"||N[1]==="999")};for(let[S,N]of m){let R=N.replies.length>0||N.options.length>0,$=!w(S)&&!b(S)&&(R||_(S));(h.has(S)||$)&&o.push(N)}return{nodes:o,entryPoints:s,procNames:[...m.keys()],...a!==void 0?{newProcAnchor:a}:{},...c!==void 0?{entryCalls:c}:{},...l!==void 0?{entryCallAnchor:l}:{},...u.length>0?{outOfBandCalls:u}:{}}}function Yne(e,t){fc(e,n=>{if(n.type==="call_stmt"){let r=n.childForFieldName("target");if(r){let o=r.type==="call_expr"?r.childForFieldName("func")?.text:r.text;o&&!t.includes(o)&&t.push(o)}}else if(n.type==="call_expr"){let r=n.childForFieldName("func");r!==null&&Lt(r.text).startsWith("node")&&!t.includes(r.text)&&t.push(r.text)}})}function Xne(e){let t=[];return fc(e,n=>{if(n.type!=="call_stmt")return;let r=n.childForFieldName("target");if(!r||r.type!=="identifier")return;let o=r.text;t.push({name:o,stmtRange:{start:n.startIndex,end:n.endIndex},targetRange:{start:r.startIndex,end:r.endIndex},topLevel:PU(e,n)})}),t}function Jne(e){return e.childrenForFieldName("body").at(-1)?.endIndex}function PU(e,t){return e.childrenForFieldName("body").some(n=>n.startIndex===t.startIndex&&n.endIndex===t.endIndex)}function Qne(e,t,n,r){let o=[],s=[],a=[],c=[],l=[],u;fc(e,w=>{u||w.type==="call_expr"&&w.childForFieldName("func")?.text==="Reply"&&xP(w)[0]&&(u=w)});let d=u?ore(u):void 0;fc(e,w=>{if(w.type==="call_expr"){let _=w.childForFieldName("func");if(!_)return;let b=_.text,S=xP(w),N=w.startPosition.row+1;n.has(b)&&!l.includes(b)&&l.push(b);let R=S[0],$=S[1],I=S[2];if(b==="Reply"&&R){let U=bP(w);o.push({msgId:_P(R),line:N,conditional:Lu(w),msgKind:yP(R),...U?{condRange:U.condRange,ifRange:U.ifRange,ifPure:U.ifPure}:{}})}if(hP(b)&&R&&$){let U=$.text,de=bP(w);s.push({type:b,msgId:_P(R),target:U,skill:I?parseInt(I.text,10):void 0,line:N,conditional:Lu(w),scopedConditional:Lu(w,d),msgKind:yP(R),callRange:{start:w.startIndex,end:w.endIndex},targetRange:{start:$.startIndex,end:$.endIndex},stmtRange:bU(w),...de?{condRange:de.condRange,ifRange:de.ifRange,ifPure:de.ifPure}:{}})}if(gP(b)&&R){let U=bP(w);s.push({type:b,msgId:_P(R),target:"",line:N,conditional:Lu(w),scopedConditional:Lu(w,d),msgKind:yP(R),stmtRange:bU(w),...U?{condRange:U.condRange,ifRange:U.ifRange,ifPure:U.ifPure}:{}})}}if(w.type==="call_stmt"){let _=w.childForFieldName("target");if(_){let b=_.type==="call_expr"?_.childForFieldName("func")?.text:_.text;if(b){let S=_.type==="identifier"?{start:_.startIndex,end:_.endIndex}:void 0,N=PU(e,w);c.push({name:b,stmtRange:{start:w.startIndex,end:w.endIndex},...S!==void 0?{targetRange:S}:{},topLevel:N}),a.includes(b)||a.push(b)}}}});let f=e.childForFieldName("name"),m=f?{start:f.startIndex,end:f.endIndex}:void 0,p=tre(e),g=!p&&nre(e),h=!p&&!g&&rre(e),y=!p&&!g&&!h;return{name:t,line:e.startPosition.row+1,replies:o,options:s,callTargets:a,faithful:p,...g?{bundleFaithful:!0,branches:ire(e,r)}:{},...h?{structured:!0,block:wP(e.childrenForFieldName("body"),r,{reply:0,opt:0,trans:0})}:{},...y?{approximate:!0}:{},insertAnchor:Zne(e,r),...l.length>0?{sideEffects:l}:{},...c.length>0?{callTransitions:c}:{},...m!==void 0?{nameRange:m}:{}}}function bU(e){let t=e;for(;t;){if(t.type==="expression_stmt")return{start:t.startIndex,end:t.endIndex};t=t.parent}return{start:e.startIndex,end:e.endIndex}}function Zne(e,t){let r=e.childrenForFieldName("body").at(-1);if(r){let s=t.lastIndexOf(`
371
+ `,r.startIndex-1)+1,a=/^[ \t]*/.exec(t.slice(s,r.startIndex))?.[0]??" ";return{offset:r.endIndex,indent:a}}let o=e.children.find(s=>s.type==="begin");return{offset:o?o.endIndex:e.startIndex,indent:" "}}function Ou(e){let t=e.childForFieldName("func")?.text;return t?t==="Reply"||hP(t)||gP(t):!1}function SP(e,t){switch(e.type){case"expression_stmt":{let n=e.namedChildren[0];return n!=null&&n.type==="call_expr"&&Ou(n)}case"call_stmt":return!0;case"if_stmt":{if(!t||e.childForFieldName("else")!==null)return!1;let n=e.childForFieldName("then");return n?ere(n):!1}default:return!1}}function ere(e){return e.type==="block"?e.children.filter(t=>t.isNamed).every(t=>SP(t,!1)):SP(e,!1)}function tre(e){return e.childrenForFieldName("body").every(t=>SP(t,!0))}function NU(e){if(e.type==="assignment")return!0;if(e.type==="expression_stmt"){let t=e.namedChildren[0];return t!=null&&t.type==="call_expr"&&!Ou(t)}return!1}function EU(e){if(e.type==="expression_stmt"){let t=e.namedChildren[0];return t!=null&&t.type==="call_expr"&&Ou(t)}return e.type==="call_stmt"}function SU(e){return(e.type==="block"?e.children.filter(n=>n.isNamed):[e]).every(n=>EU(n)||NU(n))}function nre(e){let t=e.childrenForFieldName("body");if(t.length===0)return!1;for(let n of t){if(n.type!=="if_stmt")return!1;let r=n.childForFieldName("then");if(!r||!SU(r))return!1;let o=n.childForFieldName("else");if(o&&!SU(o))return!1}return!0}function RU(e){if(EU(e)||NU(e))return!0;if(e.type==="if_stmt"){let t=e.childForFieldName("then");if(!t||!wU(t))return!1;let n=e.childForFieldName("else");return!(n&&!wU(n))}return!1}function wU(e){return(e.type==="block"?e.children.filter(n=>n.isNamed):[e]).every(n=>RU(n))}function rre(e){let t=e.childrenForFieldName("body");return t.length===0?!1:t.every(n=>RU(n))}function wP(e,t,n){let r=[];for(let o of e){if(o.type==="if_stmt"){let a=o.childForFieldName("cond"),c=o.childForFieldName("then"),l=o.childForFieldName("else"),u={kind:"group",condition:a?.text??"",...a?{conditionRange:{start:a.startIndex,end:a.endIndex}}:{},thenBlock:c?wP(xU(c),t,n):[],...l?{elseBlock:wP(xU(l),t,n)}:{}};r.push(u);continue}let s=o.type==="expression_stmt"?o.namedChildren[0]:void 0;if(s&&s.type==="call_expr"&&Ou(s)){s.childForFieldName("func")?.text==="Reply"?r.push({kind:"line",replyIndex:n.reply++}):r.push({kind:"choice",optionIndex:n.opt++});continue}if(o.type==="call_stmt"){r.push({kind:"transition",transitionIndex:n.trans++});continue}r.push({kind:"opaque",text:t.slice(o.startIndex,o.endIndex),textRange:{start:o.startIndex,end:o.endIndex}})}return r}function xU(e){return e.type==="block"?e.children.filter(t=>t.isNamed):[e]}function vU(e,t){let r=e.children.filter(a=>a.isNamed).at(-1);if(!r)return{offset:e.startIndex+1,indent:" "};let o=t.lastIndexOf(`
372
+ `,r.startIndex-1)+1,s=/^[ \t]*/.exec(t.slice(o,r.startIndex))?.[0]??" ";return{offset:r.endIndex,indent:s}}function ire(e,t){let n=[],r=0,o=0,s=(a,c)=>{let l=c.type==="block"?c.children.filter(u=>u.isNamed):[c];for(let u of l){let d=u.type==="expression_stmt"?u.namedChildren[0]:void 0;d&&d.type==="call_expr"&&Ou(d)?d.childForFieldName("func")?.text==="Reply"?a.replyIndices.push(r++):a.optionIndices.push(o++):a.opaque.push({text:t.slice(u.startIndex,u.endIndex),textRange:{start:u.startIndex,end:u.endIndex}})}};for(let a of e.childrenForFieldName("body")){let c=a.childForFieldName("cond"),l=a.childForFieldName("then"),u={kind:"if",condition:c?.text,...c?{conditionRange:{start:c.startIndex,end:c.endIndex}}:{},stmtRange:{start:a.startIndex,end:a.endIndex},replyIndices:[],optionIndices:[],opaque:[]};l&&(s(u,l),l.type==="block"&&(u.insertAnchor=vU(l,t),u.thenBlockEnd=l.endIndex)),n.push(u);let d=a.childForFieldName("else");if(d){let f={kind:"else",replyIndices:[],optionIndices:[],opaque:[]};s(f,d),d.type==="block"&&(f.insertAnchor=vU(d,t));let m=t.indexOf("else",l?l.endIndex:a.startIndex);f.elseClauseRange={start:m,end:d.endIndex},n.push(f)}}return n}function xP(e){return e.namedChildren.slice(1)}function _P(e){return e.type==="number"?parseInt(e.text,10):e.text}function yP(e){if(e.type!=="number")return e.type==="call_expr"&&e.childForFieldName("func")?.text==="random"?"random":"computed"}function Lu(e,t){let n=[],r=e,o=e.parent;for(;o;){if(o.type==="if_stmt"&&!t?.has(`${o.startIndex}:${o.endIndex}`)){let s=o.childForFieldName("cond")?.text;if(s!==void 0){let a=o.childForFieldName("else"),c=a!==null&&r.startIndex===a.startIndex&&r.endIndex===a.endIndex;n.push(c?`not ${s}`:s)}}r=o,o=o.parent}if(n.length!==0)return n.reverse(),n.length===1?n[0]:n.join(" and ")}function ore(e){let t=new Set,n=e.parent;for(;n;)n.type==="if_stmt"&&t.add(`${n.startIndex}:${n.endIndex}`),n=n.parent;return t}function bP(e){let t=e,n=e.parent,r;for(;n;){if(n.type==="if_stmt"){if(r)return;let o=n.childForFieldName("cond"),s=n.childForFieldName("then");if(!o||!s||!(t.startIndex===s.startIndex&&t.endIndex===s.endIndex))return;r={condRange:{start:o.startIndex,end:o.endIndex},ifRange:{start:n.startIndex,end:n.endIndex},ifPure:sre(s)===1}}t=n,n=n.parent}return r}function sre(e){return e.type==="block"?e.namedChildren.filter(t=>t.type!=="comment"&&t.type!=="line_comment").length:1}function fc(e,t){t(e);for(let n of e.children)fc(n,t)}var are=new Set(["display_msg","debug_msg","float_msg","display","display_stats"]),cre=new RegExp("```"+$r+"\\n(.+)");function lre(e){let t=new Set;for(let{name:n,markdown:r}of e)r.match(cre)?.[1]?.startsWith("void ")&&!are.has(n)&&t.add(n);return t}function ure(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>typeof t=="string"?t:t.value).join(`
373
+ `):e.value}var TU;function vP(){return TU??=lre(On(mt).map(e=>({name:e.name,markdown:ure(e.hover.contents)}))),TU}function AU(e){let t=e.childForFieldName("say");return t?Mu(t):""}var CP=new Set(["tilde_string","string","tra_ref","tlk_ref","at_var_ref","double_string"]);function Mu(e){for(let t of e.children)if(CP.has(t.type))return pc(t);return e.text.trim()}function IU(e){let t=e.childForFieldName("say");return t?t.children.filter(n=>CP.has(n.type)).map(n=>({text:pc(n),range:{start:n.startIndex,end:n.endIndex}})):[]}function PP(e){for(let n of e.children)if(n.type==="tilde_content")return n.text;let t=e.text;return t.startsWith("~")&&t.endsWith("~")?t.slice(1,-1):t}function mc(e){for(let t of e.children){if(t.type==="tilde_string")return PP(t);if(t.type==="double_string")return DU(t)}return e.text}function DU(e){for(let n of e.children)if(n.type==="double_content")return n.text;let t=e.text;return t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function pc(e){switch(e.type){case"tilde_string":return PP(e);case"string":return mc(e);case"tra_ref":case"tlk_ref":case"at_var_ref":return e.text;case"double_string":return DU(e);default:return Mu(e)}}function NP(e){for(let t of e.children)if(t.type==="say_text")return Mu(t);for(let t of e.children)switch(t.type){case"tilde_string":return PP(t);case"string":return mc(t);case"tra_ref":case"tlk_ref":case"at_var_ref":return t.text}return e.text.trim()}function kU(e){let r=(e.children.find(s=>s.type==="say_text")??e).children.filter(s=>CP.has(s.type)).map(s=>({text:pc(s),range:{start:s.startIndex,end:s.endIndex}}));if(r.length>0)return r;let o=NP(e);return o?[{text:o,range:{start:e.startIndex,end:e.endIndex}}]:[]}function FU(e){let t=e.childForFieldName("trigger");if(t)return mc(t)||void 0}function LU(e){let t=e.childForFieldName("trigger");if(!t)return;let n=mc(t);if(n.trim())return n}function OU(e){let t=!1,n=!1;for(let r of e.children)if(r.type==="WEIGHT")t=!0;else if(t){if(r.type==="-")n=!0;else if(r.type==="number"){let o=parseInt(r.text,10);return Number.isNaN(o)?void 0:n?-o:o}else if(r.type!=="#")break}else continue}function EP(e){let t=e.childForFieldName("trigger");if(!t)return;let n=mc(t);if(n.trim())return n}function RP(e){for(let t of e.children)if(t.type==="do_feature"){let n=t.childForFieldName("action");if(n)return mc(n)}}function MU(e){for(let t of e.children)if(t.type==="reply_feature"){let n=t.childForFieldName("text");if(n)return pc(n)}}function hc(e){for(let t of e.children){switch(t.type){case"goto_next":{let r=t.childForFieldName("label");if(r)return{kind:"goto",label:r.text};break}case"short_goto":{let r=t.childForFieldName("label");if(r)return{kind:"goto",label:r.text};break}case"extern_next":{let r=t.childForFieldName("file"),o=t.childForFieldName("label");if(r&&o)return{kind:"extern",file:r.text,label:o.text};break}case"exit_next":return{kind:"exit"};case"copy_trans":{let r=t.childForFieldName("file"),o=t.childForFieldName("state");if(r&&o)return{kind:"copy_trans",file:r.text,label:o.text};break}}let n=hc(t);if(n)return n}}function xh(e){for(let t of e.children){if(t.type==="goto_next"||t.type==="short_goto"){let r=t.childForFieldName("label");if(r)return{start:r.startIndex,end:r.endIndex}}let n=xh(t);if(n)return n}}function $U(e){let t=[];for(let n of e.children)n.type==="alter_trans_change"&&t.push(Qn(n.text,60));return t.length>0?t.join("; "):""}function $u(e){let t=[],n=!1,r=0;for(let o of e.children){if(o.type==="BEGIN"){r===0&&(n=!0);continue}if(o.type==="END"){n&&(n=!1,r++);continue}n&&t.push(o.text)}return t}function Fe(e,t){let n=e.childForFieldName(t);if(!n)return;let r=n.text;return r.startsWith("~")&&r.endsWith("~")||r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):r}function Qn(e,t){let n=e.replaceAll(/\s+/g," ").trim();return n.length<=t?n:n.slice(0,t-1)+"\u2026"}function qU(e,t){let n=Fe(e,"file");if(!n)return;let r=$u(e),o=$U(e);t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"ALTER_TRANS",description:o||void 0,stateRefs:r.length>0?r:void 0})}function BU(e,t){let n=Fe(e,"file");if(!n)return;let r=Fe(e,"state")??"?",o=Fe(e,"trigger")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"ADD_STATE_TRIGGER",description:Qn(o,80)||void 0,stateRefs:[r]})}function jU(e,t){let n=Fe(e,"file");if(!n)return;let r=$u(e),o=Fe(e,"action")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"ADD_TRANS_ACTION",description:Qn(o,80)||void 0,stateRefs:r.length>0?r:void 0})}function WU(e,t){let n=Fe(e,"file");if(!n)return;let r=Fe(e,"state")??"?",o=Fe(e,"trigger")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"ADD_TRANS_TRIGGER",description:Qn(o,80)||void 0,stateRefs:[r]})}function UU(e,t){let n=Fe(e,"file");if(!n)return;let r=Fe(e,"state")??"?",o=e.childForFieldName("text"),s=o?pc(o):"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"REPLACE_SAY",description:Qn(s,80)||void 0,stateRefs:[r]})}function HU(e,t){let n=Fe(e,"file");if(!n)return;let r=Fe(e,"state")??"?",o=Fe(e,"trigger")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"REPLACE_STATE_TRIGGER",description:Qn(o,80)||void 0,stateRefs:[r]})}function VU(e,t){let n=Fe(e,"file");if(!n)return;let r=$u(e),o=Fe(e,"old_text")??"",s=Fe(e,"new_text")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"REPLACE_TRANS_ACTION",description:`${Qn(o,40)} -> ${Qn(s,40)}`,stateRefs:r.length>0?r:void 0})}function GU(e,t){let n=Fe(e,"file");if(!n)return;let r=$u(e),o=Fe(e,"old_text")??"",s=Fe(e,"new_text")??"";t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"REPLACE_TRANS_TRIGGER",description:`${Qn(o,40)} -> ${Qn(s,40)}`,stateRefs:r.length>0?r:void 0})}function zU(e,t){let n=Fe(e,"file");if(!n)return;let r=Fe(e,"state")??"?",s=e.childrenForFieldName("weight").map(a=>a.text).join("");t.push({kind:"modify",file:n,line:e.startPosition.row+1,actionName:"SET_WEIGHT",description:s||void 0,stateRefs:[r]})}function TP(e,t,n){let r=Fe(e,"file");if(!r)return;let o=Fe(e,"old_text")??"",s=Fe(e,"new_text")??"";t.push({kind:"modify",file:r,line:e.startPosition.row+1,actionName:n,description:`${Qn(o,40)} -> ${Qn(s,40)}`})}function YU(e){if(!ct())return T("parseDDialog: weidu-d parser not initialized; returning empty dialog","warn"),{blocks:[],states:[]};let t=lt(e);if(!t)return T("parseDDialog: weidu-d parse produced no tree; returning empty dialog","warn"),{blocks:[],states:[]};let n=[],r=[];for(let o of t.rootNode.children)switch(o.type){case"begin_action":AP(o,n,r,"begin");break;case"append_action":AP(o,n,r,"append");break;case"chain_action":dre(o,n,r);break;case"extend_action":fre(o,n,r);break;case"interject_action":case"interject_copy_trans":mre(o,n,r);break;case"replace_action":AP(o,n,r,"replace");break;case"alter_trans":qU(o,n);break;case"add_state_trigger":BU(o,n);break;case"add_trans_action":jU(o,n);break;case"add_trans_trigger":WU(o,n);break;case"replace_say":UU(o,n);break;case"replace_state_trigger":HU(o,n);break;case"replace_trans_action":VU(o,n);break;case"replace_trans_trigger":GU(o,n);break;case"set_weight":zU(o,n);break;case"replace_action_text":case"replace_action_text_process":case"replace_action_text_regexp":TP(o,n,"REPLACE_ACTION_TEXT");break;case"replace_trigger_text":case"replace_trigger_text_regexp":TP(o,n,"REPLACE_TRIGGER_TEXT");break}return{blocks:n,states:r}}function AP(e,t,n,r){let o=Fe(e,"file");if(o){t.push({kind:r,file:o,line:e.startPosition.row+1});for(let s of e.children)if(s.type==="state"){let a=pre(s,o);a&&n.push(a)}}}function dre(e,t,n){let r=Fe(e,"file");if(!r)return;let o=e.childForFieldName("label"),s=o?o.text:void 0;t.push({kind:"chain",file:r,line:e.startPosition.row+1,label:s}),XU(e,r,s,n,"CHAIN")}function fre(e,t,n){let r=Fe(e,"file");if(!r)return;let s=e.childrenForFieldName("states").map(l=>l.text).join(", "),a=e.startPosition.row+1;t.push({kind:"extend",file:r,line:a,label:s||void 0});let c=[];for(let l of e.children)l.type==="transition"&&c.push(...vh(l));c.length>0&&n.push({label:s||"extended",line:a,sayText:"",speaker:r,blockFile:r,transitions:c,blockLabel:`extend_${a}`,derivedFrom:"EXTEND"})}function mre(e,t,n){let r=Fe(e,"file");if(!r)return;let o=e.childForFieldName("label"),s=o?o.text:void 0;t.push({kind:"interject",file:r,line:e.startPosition.row+1,label:s}),XU(e,r,s,n,"INTERJECT")}function pre(e,t){let n=e.childForFieldName("label");if(!n)return;let r=n.text,o=AU(e),s=IU(e),a=LU(e),c=OU(e),l=[];for(let f of e.children)f.type==="transition"&&l.push(...vh(f));let u=e.childForFieldName("say"),d=e.childForFieldName("trigger");return{label:r,line:e.startPosition.row+1,sayText:o,sayTexts:s,trigger:a||void 0,weight:c,speaker:t,blockFile:t,transitions:l,range:{start:e.startIndex,end:e.endIndex},sayRange:u?{start:u.startIndex,end:u.endIndex}:void 0,triggerRange:d?{start:d.startIndex,end:d.endIndex}:void 0}}function vh(e){let t=[];for(let n of e.children)switch(n.type){case"transition_full":t.push(hre(n));break;case"transition_short":t.push(gre(n));break;case"copy_trans":t.push(_re(n));break}if(t.length===0){let n=hc(e);n&&t.push({line:e.startPosition.row+1,target:n})}return t}function hre(e){let t=EP(e),n=MU(e),r=RP(e),o=hc(e)??{kind:"exit"};return{line:e.startPosition.row+1,replyText:n,trigger:t||void 0,action:r||void 0,target:o,range:{start:e.startIndex,end:e.endIndex},targetRange:xh(e)}}function gre(e){let t=e.childForFieldName("reply"),n=t?Mu(t):void 0,r=EP(e),o=RP(e),s=hc(e)??{kind:"exit"};return{line:e.startPosition.row+1,replyText:n,trigger:r||void 0,action:o||void 0,target:s,range:{start:e.startIndex,end:e.endIndex},targetRange:xh(e)}}function _re(e){let t=Fe(e,"file")??"",n=e.childForFieldName("state"),r=n?n.text:"";return{line:e.startPosition.row+1,target:{kind:"copy_trans",file:t,label:r},range:{start:e.startIndex,end:e.endIndex}}}function XU(e,t,n,r,o){let s=[],a=t,c=0,l=d=>{let f=kU(d),m=f[0]?.text??NP(d),p=FU(d),g=c===0&&n?n:`${n??"chain"}_${c}`;s.push({label:g,line:d.startPosition.row+1,sayText:m,...f.length>0?{sayTexts:f}:{},trigger:p||void 0,speaker:a,blockFile:t,transitions:[],blockLabel:n,derivedFrom:o}),c++},u=d=>{s.length>0&&s[s.length-1].transitions.push(...d)};for(let d of e.children)if(d.type==="chain_text"){l(d);for(let f of d.children)if(f.type==="chain_speaker"){let m=Fe(f,"file");m&&(a=m),l(f)}else f.type==="chain_branch"&&u(KU(f))}else d.type==="chain_epilogue"?u(yre(d)):d.type==="chain_branch"&&u(KU(d));for(let d=0;d<s.length-1;d++){let f=s[d],m=s[d+1];f.transitions.length===0&&f.transitions.push({line:f.line,target:{kind:"goto",label:m.label}})}r.push(...s)}function yre(e){let t=[];for(let n of e.children)n.type==="transition"&&t.push(...vh(n));if(t.length===0){let n=hc(e);n&&t.push({line:e.startPosition.row+1,target:n})}return t}function KU(e){let t=[];for(let n of e.children)n.type==="transition"&&t.push(...vh(n));return t}var JU=[{match:(e,t)=>e===mt,parse:(e,t)=>CU(t,vP()),translationLangId:mt},{match:(e,t)=>e===At,parse:(e,t)=>Promise.resolve(YU(t)),translationLangId:At},{match:(e,t)=>e===qr&&t.endsWith(Jt),parse:(e,t)=>oP({kind:"parse-td",filepath:et(e),text:t}),translationLangId:At},{match:(e,t)=>e===qr&&t.endsWith(zn),parse:(e,t)=>oP({kind:"parse-tssl",filepath:et(e),text:t,sideEffectFns:[...vP()]}),translationLangId:mt}];function QU(e){e.connection.onExecuteCommand(xe("onExecuteCommand",async(t,n)=>{let r=t.command;if(r.startsWith(Jf)){let u=r.slice(Jf.length),d=t.arguments?.[0],f=typeof d?.query=="string"?d.query:"";return Y.workspaceSymbols(f,n,u)}if(!t.arguments)return;let o=t.arguments[0];if(r===Yf){if(typeof o?.uri!="string")return T(`parseDialog: invalid uri '${String(o?.uri)}'`,"warn"),null;let u=o.uri,d=e.documents.get(u);if(!d)return T(`parseDialog: NO open document for ${u} (not synced to the server)`,"warn"),null;try{let f=d.languageId,m=d.getText(),p=u.toLowerCase(),g=JU.find(_=>_.match(f,p));if(!g)return T(`parseDialog: NO handler for languageId='${f}'`,"warn"),null;let h=await g.parse(u,m),w=(await xn()).translation.getMessages(u,m,g.translationLangId);return{...h,messages:w}}catch(f){return T(`parseDialog error: ${f instanceof Error?f.message:String(f)}`,"error"),f instanceof Error&&f.stack&&T(f.stack,"debug"),null}}if(r===Xf){if(typeof o?.uri!="string")return T(`saveTra: invalid uri '${String(o?.uri)}'`,"warn"),null;let u=o.uri,d=o.messages,f=e.documents.get(u);if(!f||!d)return null;let p=JU.find(y=>y.match(f.languageId,u.toLowerCase()))?.translationLangId??At,h=(await xn()).translation.writeMessages(u,f.getText(),p,d);return h.staleSiblingLanguages.length>0&&Sr(`Saved @N translation edits to the active language only. These other language(s) still have the previous text and need updating: ${h.staleSiblingLanguages.join(", ")}.`),{changed:h.changed}}if(r!==cl&&r!==m0)return;let s=typeof o.uri=="string"?o.uri:void 0;if(!s||!s.startsWith("file://")){T(`Compile: invalid non-file uri '${String(s)}'`),bn("Focus a valid file to run commands!");return}let a=e.documents.get(s);if(!a)return;let c=a.languageId,l=a.getText();ku(s,c,!0,l).catch(u=>Fu(u,!0))},e.timingOpts))}var Cs=(0,gc.createConnection)(gc.ProposedFeatures.all),Sre=iA(Cs.console),IP=new gc.TextDocuments(ju);oA(Cs,IP);var wre=300,ZU=new ea(wre),xre=300,eH=new ea(xre),vre=120,tH=new ea(vre),nH=YW(Cs);aA(nH);var Cre=cA(),Bt={connection:Cs,documents:IP,timingOpts:Sre,fileReloadDebouncer:ZU,compileDebouncer:eH,parseDebouncer:tH,renameSuppression:Cre,getDocumentSettings:nH};UW(Bt);ZW(Bt);JW(Bt);QU(Bt);HW(Bt);eU(Bt);tU(Bt);aU(Bt);dU(Bt);fU(Bt);mU(Bt);yU(Bt);nU(Bt);iU(Bt);oU(Bt);pU(Bt);hU(Bt);gU(Bt);Cs.onShutdown(()=>{Bt.renameSuppression.dispose(),ZU.dispose(),eH.dispose(),tH.dispose(),YO(),rq(),qW(),MW(),kW()});IP.listen(Cs);Cs.listen();
374
374
  /*! Bundled license information:
375
375
 
376
376
  is-extglob/index.js: