monaco-editor11 1.2.4 → 1.2.5

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.
@@ -0,0 +1,31 @@
1
+ "use strict";const Xe=require("./initialize-BQMKx5pJ.js"),o=require("./index-idtXKE3T.js");function ve(t,e=!1){const n=t.length;let r=0,s="",i=0,l=16,a=0,h=0,c=0,g=0,f=0;function p(u,v){let d=0,S=0;for(;d<u;){let A=t.charCodeAt(r);if(A>=48&&A<=57)S=S*16+A-48;else if(A>=65&&A<=70)S=S*16+A-65+10;else if(A>=97&&A<=102)S=S*16+A-97+10;else break;r++,d++}return d<u&&(S=-1),S}function k(u){r=u,s="",i=0,l=16,f=0}function m(){let u=r;if(t.charCodeAt(r)===48)r++;else for(r++;r<t.length&&G(t.charCodeAt(r));)r++;if(r<t.length&&t.charCodeAt(r)===46)if(r++,r<t.length&&G(t.charCodeAt(r)))for(r++;r<t.length&&G(t.charCodeAt(r));)r++;else return f=3,t.substring(u,r);let v=r;if(r<t.length&&(t.charCodeAt(r)===69||t.charCodeAt(r)===101))if(r++,(r<t.length&&t.charCodeAt(r)===43||t.charCodeAt(r)===45)&&r++,r<t.length&&G(t.charCodeAt(r))){for(r++;r<t.length&&G(t.charCodeAt(r));)r++;v=r}else f=3;return t.substring(u,v)}function b(){let u="",v=r;for(;;){if(r>=n){u+=t.substring(v,r),f=2;break}const d=t.charCodeAt(r);if(d===34){u+=t.substring(v,r),r++;break}if(d===92){if(u+=t.substring(v,r),r++,r>=n){f=2;break}switch(t.charCodeAt(r++)){case 34:u+='"';break;case 92:u+="\\";break;case 47:u+="/";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
2
+ `;break;case 114:u+="\r";break;case 116:u+=" ";break;case 117:const A=p(4);A>=0?u+=String.fromCharCode(A):f=4;break;default:f=5}v=r;continue}if(d>=0&&d<=31)if(Y(d)){u+=t.substring(v,r),f=2;break}else f=6;r++}return u}function y(){if(s="",f=0,i=r,h=a,g=c,r>=n)return i=n,l=17;let u=t.charCodeAt(r);if(fe(u)){do r++,s+=String.fromCharCode(u),u=t.charCodeAt(r);while(fe(u));return l=15}if(Y(u))return r++,s+=String.fromCharCode(u),u===13&&t.charCodeAt(r)===10&&(r++,s+=`
3
+ `),a++,c=r,l=14;switch(u){case 123:return r++,l=1;case 125:return r++,l=2;case 91:return r++,l=3;case 93:return r++,l=4;case 58:return r++,l=6;case 44:return r++,l=5;case 34:return r++,s=b(),l=10;case 47:const v=r-1;if(t.charCodeAt(r+1)===47){for(r+=2;r<n&&!Y(t.charCodeAt(r));)r++;return s=t.substring(v,r),l=12}if(t.charCodeAt(r+1)===42){r+=2;const d=n-1;let S=!1;for(;r<d;){const A=t.charCodeAt(r);if(A===42&&t.charCodeAt(r+1)===47){r+=2,S=!0;break}r++,Y(A)&&(A===13&&t.charCodeAt(r)===10&&r++,a++,c=r)}return S||(r++,f=1),s=t.substring(v,r),l=13}return s+=String.fromCharCode(u),r++,l=16;case 45:if(s+=String.fromCharCode(u),r++,r===n||!G(t.charCodeAt(r)))return l=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return s+=m(),l=11;default:for(;r<n&&T(u);)r++,u=t.charCodeAt(r);if(i!==r){switch(s=t.substring(i,r),s){case"true":return l=8;case"false":return l=9;case"null":return l=7}return l=16}return s+=String.fromCharCode(u),r++,l=16}}function T(u){if(fe(u)||Y(u))return!1;switch(u){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function N(){let u;do u=y();while(u>=12&&u<=15);return u}return{setPosition:k,getPosition:()=>r,scan:e?N:y,getToken:()=>l,getTokenValue:()=>s,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>h,getTokenStartCharacter:()=>i-g,getTokenError:()=>f}}function fe(t){return t===32||t===9}function Y(t){return t===10||t===13}function G(t){return t>=48&&t<=57}var Ae;(function(t){t[t.lineFeed=10]="lineFeed",t[t.carriageReturn=13]="carriageReturn",t[t.space=32]="space",t[t._0=48]="_0",t[t._1=49]="_1",t[t._2=50]="_2",t[t._3=51]="_3",t[t._4=52]="_4",t[t._5=53]="_5",t[t._6=54]="_6",t[t._7=55]="_7",t[t._8=56]="_8",t[t._9=57]="_9",t[t.a=97]="a",t[t.b=98]="b",t[t.c=99]="c",t[t.d=100]="d",t[t.e=101]="e",t[t.f=102]="f",t[t.g=103]="g",t[t.h=104]="h",t[t.i=105]="i",t[t.j=106]="j",t[t.k=107]="k",t[t.l=108]="l",t[t.m=109]="m",t[t.n=110]="n",t[t.o=111]="o",t[t.p=112]="p",t[t.q=113]="q",t[t.r=114]="r",t[t.s=115]="s",t[t.t=116]="t",t[t.u=117]="u",t[t.v=118]="v",t[t.w=119]="w",t[t.x=120]="x",t[t.y=121]="y",t[t.z=122]="z",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.asterisk=42]="asterisk",t[t.backslash=92]="backslash",t[t.closeBrace=125]="closeBrace",t[t.closeBracket=93]="closeBracket",t[t.colon=58]="colon",t[t.comma=44]="comma",t[t.dot=46]="dot",t[t.doubleQuote=34]="doubleQuote",t[t.minus=45]="minus",t[t.openBrace=123]="openBrace",t[t.openBracket=91]="openBracket",t[t.plus=43]="plus",t[t.slash=47]="slash",t[t.formFeed=12]="formFeed",t[t.tab=9]="tab"})(Ae||(Ae={}));const _=new Array(20).fill(0).map((t,e)=>" ".repeat(e)),Z=200,Ne={" ":{"\n":new Array(Z).fill(0).map((t,e)=>`
4
+ `+" ".repeat(e)),"\r":new Array(Z).fill(0).map((t,e)=>"\r"+" ".repeat(e)),"\r\n":new Array(Z).fill(0).map((t,e)=>`\r
5
+ `+" ".repeat(e))}," ":{"\n":new Array(Z).fill(0).map((t,e)=>`
6
+ `+" ".repeat(e)),"\r":new Array(Z).fill(0).map((t,e)=>"\r"+" ".repeat(e)),"\r\n":new Array(Z).fill(0).map((t,e)=>`\r
7
+ `+" ".repeat(e))}},Qe=[`
8
+ `,"\r",`\r
9
+ `];function Ye(t,e,n){let r,s,i,l,a;if(e){for(l=e.offset,a=l+e.length,i=l;i>0&&!xe(t,i-1);)i--;let d=a;for(;d<t.length&&!xe(t,d);)d++;s=t.substring(i,d),r=Ce(s,n)}else s=t,r=0,i=0,l=0,a=t.length;const h=et(n,t),c=Qe.includes(h);let g=0,f=0,p;n.insertSpaces?p=_[n.tabSize||4]??X(_[1],n.tabSize||4):p=" ";const k=p===" "?" ":" ";let m=ve(s,!1),b=!1;function y(){if(g>1)return X(h,g)+X(p,r+f);const d=p.length*(r+f);return!c||d>Ne[k][h].length?h+X(p,r+f):d<=0?h:Ne[k][h][d]}function T(){let d=m.scan();for(g=0;d===15||d===14;)d===14&&n.keepLines?g+=1:d===14&&(g=1),d=m.scan();return b=d===16||m.getTokenError()!==0,d}const N=[];function u(d,S,A){!b&&(!e||S<a&&A>l)&&t.substring(S,A)!==d&&N.push({offset:S,length:A-S,content:d})}let v=T();if(n.keepLines&&g>0&&u(X(h,g),0,0),v!==17){let d=m.getTokenOffset()+i,S=p.length*r<20&&n.insertSpaces?_[p.length*r]:X(p,r);u(S,i,d)}for(;v!==17;){let d=m.getTokenOffset()+m.getTokenLength()+i,S=T(),A="",x=!1;for(;g===0&&(S===12||S===13);){let L=m.getTokenOffset()+i;u(_[1],d,L),d=m.getTokenOffset()+m.getTokenLength()+i,x=S===12,A=x?y():"",S=T()}if(S===2)v!==1&&f--,n.keepLines&&g>0||!n.keepLines&&v!==1?A=y():n.keepLines&&(A=_[1]);else if(S===4)v!==3&&f--,n.keepLines&&g>0||!n.keepLines&&v!==3?A=y():n.keepLines&&(A=_[1]);else{switch(v){case 3:case 1:f++,n.keepLines&&g>0||!n.keepLines?A=y():A=_[1];break;case 5:n.keepLines&&g>0||!n.keepLines?A=y():A=_[1];break;case 12:A=y();break;case 13:g>0?A=y():x||(A=_[1]);break;case 6:n.keepLines&&g>0?A=y():x||(A=_[1]);break;case 10:n.keepLines&&g>0?A=y():S===6&&!x&&(A="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&g>0?A=y():(S===12||S===13)&&!x?A=_[1]:S!==5&&S!==17&&(b=!0);break;case 16:b=!0;break}g>0&&(S===12||S===13)&&(A=y())}S===17&&(n.keepLines&&g>0?A=y():A=n.insertFinalNewline?h:"");const w=m.getTokenOffset()+i;u(A,d,w),v=S}return N}function X(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}function Ce(t,e){let n=0,r=0;const s=e.tabSize||4;for(;n<t.length;){let i=t.charAt(n);if(i===_[1])r++;else if(i===" ")r+=s;else break;n++}return Math.floor(r/s)}function et(t,e){for(let n=0;n<e.length;n++){const r=e.charAt(n);if(r==="\r")return n+1<e.length&&e.charAt(n+1)===`
10
+ `?`\r
11
+ `:"\r";if(r===`
12
+ `)return`
13
+ `}return t&&t.eol||`
14
+ `}function xe(t,e){return`\r
15
+ `.indexOf(t.charAt(e))!==-1}var ae;(function(t){t.DEFAULT={allowTrailingComma:!1}})(ae||(ae={}));function tt(t,e=[],n=ae.DEFAULT){let r=null,s=[];const i=[];function l(h){Array.isArray(s)?s.push(h):r!==null&&(s[r]=h)}return rt(t,{onObjectBegin:()=>{const h={};l(h),i.push(s),s=h,r=null},onObjectProperty:h=>{r=h},onObjectEnd:()=>{s=i.pop()},onArrayBegin:()=>{const h=[];l(h),i.push(s),s=h,r=null},onArrayEnd:()=>{s=i.pop()},onLiteralValue:l,onError:(h,c,g)=>{e.push({error:h,offset:c,length:g})}},n),s[0]}function _e(t){if(!t.parent||!t.parent.children)return[];const e=_e(t.parent);if(t.parent.type==="property"){const n=t.parent.children[0].value;e.push(n)}else if(t.parent.type==="array"){const n=t.parent.children.indexOf(t);n!==-1&&e.push(n)}return e}function me(t){switch(t.type){case"array":return t.children.map(me);case"object":const e=Object.create(null);for(let n of t.children){const r=n.children[1];r&&(e[n.children[0].value]=me(r))}return e;case"null":case"string":case"number":case"boolean":return t.value;default:return}}function nt(t,e,n=!1){return e>=t.offset&&e<t.offset+t.length||n&&e===t.offset+t.length}function Re(t,e,n=!1){if(nt(t,e,n)){const r=t.children;if(Array.isArray(r))for(let s=0;s<r.length&&r[s].offset<=e;s++){const i=Re(r[s],e,n);if(i)return i}return t}}function rt(t,e,n=ae.DEFAULT){const r=ve(t,!1),s=[];function i(I){return I?()=>I(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function l(I){return I?()=>I(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>s.slice()):()=>!0}function a(I){return I?V=>I(V,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function h(I){return I?V=>I(V,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>s.slice()):()=>!0}const c=l(e.onObjectBegin),g=h(e.onObjectProperty),f=i(e.onObjectEnd),p=l(e.onArrayBegin),k=i(e.onArrayEnd),m=h(e.onLiteralValue),b=a(e.onSeparator),y=i(e.onComment),T=a(e.onError),N=n&&n.disallowComments,u=n&&n.allowTrailingComma;function v(){for(;;){const I=r.scan();switch(r.getTokenError()){case 4:d(14);break;case 5:d(15);break;case 3:d(13);break;case 1:N||d(11);break;case 2:d(12);break;case 6:d(16);break}switch(I){case 12:case 13:N?d(10):y();break;case 16:d(1);break;case 15:case 14:break;default:return I}}}function d(I,V=[],Te=[]){if(T(I),V.length+Te.length>0){let re=r.getToken();for(;re!==17;){if(V.indexOf(re)!==-1){v();break}else if(Te.indexOf(re)!==-1)break;re=v()}}}function S(I){const V=r.getTokenValue();return I?m(V):(g(V),s.push(V)),v(),!0}function A(){switch(r.getToken()){case 11:const I=r.getTokenValue();let V=Number(I);isNaN(V)&&(d(2),V=0),m(V);break;case 7:m(null);break;case 8:m(!0);break;case 9:m(!1);break;default:return!1}return v(),!0}function x(){return r.getToken()!==10?(d(3,[],[2,5]),!1):(S(!1),r.getToken()===6?(b(":"),v(),P()||d(4,[],[2,5])):d(5,[],[2,5]),s.pop(),!0)}function w(){c(),v();let I=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(I||d(4,[],[]),b(","),v(),r.getToken()===2&&u)break}else I&&d(6,[],[]);x()||d(4,[],[2,5]),I=!0}return f(),r.getToken()!==2?d(7,[2],[]):v(),!0}function L(){p(),v();let I=!0,V=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(V||d(4,[],[]),b(","),v(),r.getToken()===4&&u)break}else V&&d(6,[],[]);I?(s.push(0),I=!1):s[s.length-1]++,P()||d(4,[],[4,5]),V=!0}return k(),I||s.pop(),r.getToken()!==4?d(8,[4],[]):v(),!0}function P(){switch(r.getToken()){case 3:return L();case 1:return w();case 10:return S(!0);default:return A()}}return v(),r.getToken()===17?n.allowEmptyContent?!0:(d(4,[],[]),!1):P()?(r.getToken()!==17&&d(9,[],[]),!0):(d(4,[],[]),!1)}const W=ve;var we;(function(t){t[t.None=0]="None",t[t.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=2]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",t[t.InvalidUnicode=4]="InvalidUnicode",t[t.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",t[t.InvalidCharacter=6]="InvalidCharacter"})(we||(we={}));var Oe;(function(t){t[t.OpenBraceToken=1]="OpenBraceToken",t[t.CloseBraceToken=2]="CloseBraceToken",t[t.OpenBracketToken=3]="OpenBracketToken",t[t.CloseBracketToken=4]="CloseBracketToken",t[t.CommaToken=5]="CommaToken",t[t.ColonToken=6]="ColonToken",t[t.NullKeyword=7]="NullKeyword",t[t.TrueKeyword=8]="TrueKeyword",t[t.FalseKeyword=9]="FalseKeyword",t[t.StringLiteral=10]="StringLiteral",t[t.NumericLiteral=11]="NumericLiteral",t[t.LineCommentTrivia=12]="LineCommentTrivia",t[t.BlockCommentTrivia=13]="BlockCommentTrivia",t[t.LineBreakTrivia=14]="LineBreakTrivia",t[t.Trivia=15]="Trivia",t[t.Unknown=16]="Unknown",t[t.EOF=17]="EOF"})(Oe||(Oe={}));const it=tt,st=Re,ot=_e,at=me;var Ie;(function(t){t[t.InvalidSymbol=1]="InvalidSymbol",t[t.InvalidNumberFormat=2]="InvalidNumberFormat",t[t.PropertyNameExpected=3]="PropertyNameExpected",t[t.ValueExpected=4]="ValueExpected",t[t.ColonExpected=5]="ColonExpected",t[t.CommaExpected=6]="CommaExpected",t[t.CloseBraceExpected=7]="CloseBraceExpected",t[t.CloseBracketExpected=8]="CloseBracketExpected",t[t.EndOfFileExpected=9]="EndOfFileExpected",t[t.InvalidCommentToken=10]="InvalidCommentToken",t[t.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=12]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",t[t.InvalidUnicode=14]="InvalidUnicode",t[t.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",t[t.InvalidCharacter=16]="InvalidCharacter"})(Ie||(Ie={}));function lt(t,e,n){return Ye(t,e,n)}function Q(t,e){if(t===e)return!0;if(t==null||e===null||e===void 0||typeof t!=typeof e||typeof t!="object"||Array.isArray(t)!==Array.isArray(e))return!1;let n,r;if(Array.isArray(t)){if(t.length!==e.length)return!1;for(n=0;n<t.length;n++)if(!Q(t[n],e[n]))return!1}else{const s=[];for(r in t)s.push(r);s.sort();const i=[];for(r in e)i.push(r);if(i.sort(),!Q(s,i))return!1;for(n=0;n<s.length;n++)if(!Q(t[s[n]],e[s[n]]))return!1}return!0}function E(t){return typeof t=="number"}function R(t){return typeof t<"u"}function B(t){return typeof t=="boolean"}function Ue(t){return typeof t=="string"}function K(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ft(t,e){if(t.length<e.length)return!1;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function te(t,e){const n=t.length-e.length;return n>0?t.lastIndexOf(e)===n:n===0?t===e:!1}function le(t){let e="";ft(t,"(?i)")&&(t=t.substring(4),e="i");try{return new RegExp(t,e+"u")}catch{try{return new RegExp(t,e)}catch{return}}}function Pe(t){let e=0;for(let n=0;n<t.length;n++){e++;const r=t.charCodeAt(n);55296<=r&&r<=56319&&n++}return e}var O;(function(t){t[t.Undefined=0]="Undefined",t[t.EnumValueMismatch=1]="EnumValueMismatch",t[t.Deprecated=2]="Deprecated",t[t.UnexpectedEndOfComment=257]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=258]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=259]="UnexpectedEndOfNumber",t[t.InvalidUnicode=260]="InvalidUnicode",t[t.InvalidEscapeCharacter=261]="InvalidEscapeCharacter",t[t.InvalidCharacter=262]="InvalidCharacter",t[t.PropertyExpected=513]="PropertyExpected",t[t.CommaExpected=514]="CommaExpected",t[t.ColonExpected=515]="ColonExpected",t[t.ValueExpected=516]="ValueExpected",t[t.CommaOrCloseBacketExpected=517]="CommaOrCloseBacketExpected",t[t.CommaOrCloseBraceExpected=518]="CommaOrCloseBraceExpected",t[t.TrailingComma=519]="TrailingComma",t[t.DuplicateKey=520]="DuplicateKey",t[t.CommentNotPermitted=521]="CommentNotPermitted",t[t.PropertyKeysMustBeDoublequoted=528]="PropertyKeysMustBeDoublequoted",t[t.SchemaResolveError=768]="SchemaResolveError",t[t.SchemaUnsupportedFeature=769]="SchemaUnsupportedFeature"})(O||(O={}));var U;(function(t){t[t.v3=3]="v3",t[t.v4=4]="v4",t[t.v6=6]="v6",t[t.v7=7]="v7",t[t.v2019_09=19]="v2019_09",t[t.v2020_12=20]="v2020_12"})(U||(U={}));var he;(function(t){t.LATEST={textDocument:{completion:{completionItem:{documentationFormat:[o.MarkupKind.Markdown,o.MarkupKind.PlainText],commitCharactersSupport:!0,labelDetailsSupport:!0}}}}})(he||(he={}));const ct={"color-hex":{errorMessage:o.t("Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA."),pattern:/^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/},"date-time":{errorMessage:o.t("String is not a RFC3339 date-time."),pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},date:{errorMessage:o.t("String is not a RFC3339 date."),pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i},time:{errorMessage:o.t("String is not a RFC3339 time."),pattern:/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},email:{errorMessage:o.t("String is not an e-mail address."),pattern:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}))$/},hostname:{errorMessage:o.t("String is not a hostname."),pattern:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i},ipv4:{errorMessage:o.t("String is not an IPv4 address."),pattern:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/},ipv6:{errorMessage:o.t("String is not an IPv6 address."),pattern:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i}};class H{constructor(e,n,r=0){this.offset=n,this.length=r,this.parent=e}get children(){return[]}toString(){return"type: "+this.type+" ("+this.offset+"/"+this.length+")"+(this.parent?" parent: {"+this.parent.toString()+"}":"")}}class ut extends H{constructor(e,n){super(e,n),this.type="null",this.value=null}}class Le extends H{constructor(e,n,r){super(e,r),this.type="boolean",this.value=n}}class pt extends H{constructor(e,n){super(e,n),this.type="array",this.items=[]}get children(){return this.items}}class mt extends H{constructor(e,n){super(e,n),this.type="number",this.isInteger=!0,this.value=Number.NaN}}class ce extends H{constructor(e,n,r){super(e,n,r),this.type="string",this.value=""}}class ht extends H{constructor(e,n,r){super(e,n),this.type="property",this.colonOffset=-1,this.keyNode=r}get children(){return this.valueNode?[this.keyNode,this.valueNode]:[this.keyNode]}}class gt extends H{constructor(e,n){super(e,n),this.type="object",this.properties=[]}get children(){return this.properties}}function j(t){return B(t)?t?{}:{not:{}}:t}var Ve;(function(t){t[t.Key=0]="Key",t[t.Enum=1]="Enum"})(Ve||(Ve={}));const dt={"http://json-schema.org/draft-03/schema#":U.v3,"http://json-schema.org/draft-04/schema#":U.v4,"http://json-schema.org/draft-06/schema#":U.v6,"http://json-schema.org/draft-07/schema#":U.v7,"https://json-schema.org/draft/2019-09/schema":U.v2019_09,"https://json-schema.org/draft/2020-12/schema":U.v2020_12};class Me{constructor(e){this.schemaDraft=e}}class Se{constructor(e=-1,n){this.focusOffset=e,this.exclude=n,this.schemas=[]}add(e){this.schemas.push(e)}merge(e){Array.prototype.push.apply(this.schemas,e.schemas)}include(e){return(this.focusOffset===-1||Be(e,this.focusOffset))&&e!==this.exclude}newSub(){return new Se(-1,this.exclude)}}class ne{constructor(){}get schemas(){return[]}add(e){}merge(e){}include(e){return!0}newSub(){return this}}ne.instance=new ne;class D{constructor(){this.problems=[],this.propertiesMatches=0,this.processedProperties=new Set,this.propertiesValueMatches=0,this.primaryValueMatches=0,this.enumValueMatch=!1,this.enumValues=void 0}hasProblems(){return!!this.problems.length}merge(e){this.problems=this.problems.concat(e.problems),this.propertiesMatches+=e.propertiesMatches,this.propertiesValueMatches+=e.propertiesValueMatches,this.mergeProcessedProperties(e)}mergeEnumValues(e){if(!this.enumValueMatch&&!e.enumValueMatch&&this.enumValues&&e.enumValues){this.enumValues=this.enumValues.concat(e.enumValues);for(const n of this.problems)n.code===O.EnumValueMismatch&&(n.message=o.t("Value is not accepted. Valid values: {0}.",this.enumValues.map(r=>JSON.stringify(r)).join(", ")))}}mergePropertyMatch(e){this.problems=this.problems.concat(e.problems),this.propertiesMatches++,(e.enumValueMatch||!e.hasProblems()&&e.propertiesMatches)&&this.propertiesValueMatches++,e.enumValueMatch&&e.enumValues&&e.enumValues.length===1&&this.primaryValueMatches++}mergeProcessedProperties(e){e.processedProperties.forEach(n=>this.processedProperties.add(n))}compare(e){const n=this.hasProblems();return n!==e.hasProblems()?n?-1:1:this.enumValueMatch!==e.enumValueMatch?e.enumValueMatch?-1:1:this.primaryValueMatches!==e.primaryValueMatches?this.primaryValueMatches-e.primaryValueMatches:this.propertiesValueMatches!==e.propertiesValueMatches?this.propertiesValueMatches-e.propertiesValueMatches:this.propertiesMatches-e.propertiesMatches}}function yt(t,e=[]){return new Je(t,e,[])}function z(t){return at(t)}function ge(t){return ot(t)}function Be(t,e,n=!1){return e>=t.offset&&e<t.offset+t.length||n&&e===t.offset+t.length}class Je{constructor(e,n=[],r=[]){this.root=e,this.syntaxErrors=n,this.comments=r}getNodeFromOffset(e,n=!1){if(this.root)return st(this.root,e,n)}visit(e){if(this.root){const n=r=>{let s=e(r);const i=r.children;if(Array.isArray(i))for(let l=0;l<i.length&&s;l++)s=n(i[l]);return s};n(this.root)}}validate(e,n,r=o.DiagnosticSeverity.Warning,s){if(this.root&&n){const i=new D;return $(this.root,n,i,ne.instance,new Me(s??Fe(n))),i.problems.map(l=>{const a=o.Range.create(e.positionAt(l.location.offset),e.positionAt(l.location.offset+l.location.length));return o.Diagnostic.create(a,l.message,l.severity??r,l.code)})}}getMatchingSchemas(e,n=-1,r){if(this.root&&e){const s=new Se(n,r),i=Fe(e),l=new Me(i);return $(this.root,e,new D,s,l),s.schemas}return[]}}function Fe(t,e=U.v2020_12){let n=t.$schema;return n?dt[n]??e:e}function $(t,e,n,r,s){if(!t||!r.include(t))return;if(t.type==="property")return $(t.valueNode,e,n,r,s);const i=t;switch(l(),i.type){case"object":g(i);break;case"array":c(i);break;case"string":h(i);break;case"number":a(i);break}r.add({node:i,schema:e});function l(){var N;function f(u){return i.type===u||u==="integer"&&i.type==="number"&&i.isInteger}if(Array.isArray(e.type)?e.type.some(f)||n.problems.push({location:{offset:i.offset,length:i.length},message:e.errorMessage||o.t("Incorrect type. Expected one of {0}.",e.type.join(", "))}):e.type&&(f(e.type)||n.problems.push({location:{offset:i.offset,length:i.length},message:e.errorMessage||o.t('Incorrect type. Expected "{0}".',e.type)})),Array.isArray(e.allOf))for(const u of e.allOf){const v=new D,d=r.newSub();$(i,j(u),v,d,s),n.merge(v),r.merge(d)}const p=j(e.not);if(p){const u=new D,v=r.newSub();$(i,p,u,v,s),u.hasProblems()||n.problems.push({location:{offset:i.offset,length:i.length},message:e.errorMessage||o.t("Matches a schema that is not allowed.")});for(const d of v.schemas)d.inverted=!d.inverted,r.add(d)}const k=(u,v)=>{const d=[];let S;for(const A of u){const x=j(A),w=new D,L=r.newSub();if($(i,x,w,L,s),w.hasProblems()||d.push(x),!S)S={schema:x,validationResult:w,matchingSchemas:L};else if(!v&&!w.hasProblems()&&!S.validationResult.hasProblems())S.matchingSchemas.merge(L),S.validationResult.propertiesMatches+=w.propertiesMatches,S.validationResult.propertiesValueMatches+=w.propertiesValueMatches,S.validationResult.mergeProcessedProperties(w);else{const P=w.compare(S.validationResult);P>0?S={schema:x,validationResult:w,matchingSchemas:L}:P===0&&(S.matchingSchemas.merge(L),S.validationResult.mergeEnumValues(w))}}return d.length>1&&v&&n.problems.push({location:{offset:i.offset,length:1},message:o.t("Matches multiple schemas when only one must validate.")}),S&&(n.merge(S.validationResult),r.merge(S.matchingSchemas)),d.length};Array.isArray(e.anyOf)&&k(e.anyOf,!1),Array.isArray(e.oneOf)&&k(e.oneOf,!0);const m=u=>{const v=new D,d=r.newSub();$(i,j(u),v,d,s),n.merge(v),r.merge(d)},b=(u,v,d)=>{const S=j(u),A=new D,x=r.newSub();$(i,S,A,x,s),r.merge(x),n.mergeProcessedProperties(A),A.hasProblems()?d&&m(d):v&&m(v)},y=j(e.if);if(y&&b(y,j(e.then),j(e.else)),Array.isArray(e.enum)){const u=z(i);let v=!1;for(const d of e.enum)if(Q(u,d)){v=!0;break}n.enumValues=e.enum,n.enumValueMatch=v,v||n.problems.push({location:{offset:i.offset,length:i.length},code:O.EnumValueMismatch,message:e.errorMessage||o.t("Value is not accepted. Valid values: {0}.",e.enum.map(d=>JSON.stringify(d)).join(", "))})}if(R(e.const)){const u=z(i);Q(u,e.const)?n.enumValueMatch=!0:(n.problems.push({location:{offset:i.offset,length:i.length},code:O.EnumValueMismatch,message:e.errorMessage||o.t("Value must be {0}.",JSON.stringify(e.const))}),n.enumValueMatch=!1),n.enumValues=[e.const]}let T=e.deprecationMessage;if(T||e.deprecated){T=T||o.t("Value is deprecated");let u=((N=i.parent)==null?void 0:N.type)==="property"?i.parent:i;n.problems.push({location:{offset:u.offset,length:u.length},severity:o.DiagnosticSeverity.Warning,message:T,code:O.Deprecated})}}function a(f){const p=f.value;function k(v){var S;const d=/^(-?\d+)(?:\.(\d+))?(?:e([-+]\d+))?$/.exec(v.toString());return d&&{value:Number(d[1]+(d[2]||"")),multiplier:(((S=d[2])==null?void 0:S.length)||0)-(parseInt(d[3])||0)}}if(E(e.multipleOf)){let v=-1;if(Number.isInteger(e.multipleOf))v=p%e.multipleOf;else{let d=k(e.multipleOf),S=k(p);if(d&&S){const A=10**Math.abs(S.multiplier-d.multiplier);S.multiplier<d.multiplier?S.value*=A:d.value*=A,v=S.value%d.value}}v!==0&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Value is not divisible by {0}.",e.multipleOf)})}function m(v,d){if(E(d))return d;if(B(d)&&d)return v}function b(v,d){if(!B(d)||!d)return v}const y=m(e.minimum,e.exclusiveMinimum);E(y)&&p<=y&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Value is below the exclusive minimum of {0}.",y)});const T=m(e.maximum,e.exclusiveMaximum);E(T)&&p>=T&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Value is above the exclusive maximum of {0}.",T)});const N=b(e.minimum,e.exclusiveMinimum);E(N)&&p<N&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Value is below the minimum of {0}.",N)});const u=b(e.maximum,e.exclusiveMaximum);E(u)&&p>u&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Value is above the maximum of {0}.",u)})}function h(f){if(E(e.minLength)&&Pe(f.value)<e.minLength&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("String is shorter than the minimum length of {0}.",e.minLength)}),E(e.maxLength)&&Pe(f.value)>e.maxLength&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("String is longer than the maximum length of {0}.",e.maxLength)}),Ue(e.pattern)){const p=le(e.pattern);p!=null&&p.test(f.value)||n.problems.push({location:{offset:f.offset,length:f.length},message:e.patternErrorMessage||e.errorMessage||o.t('String does not match the pattern of "{0}".',e.pattern)})}if(e.format)switch(e.format){case"uri":case"uri-reference":{let k;if(!f.value)k=o.t("URI expected.");else{const m=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(f.value);m?!m[2]&&e.format==="uri"&&(k=o.t("URI with a scheme is expected.")):k=o.t("URI is expected.")}k&&n.problems.push({location:{offset:f.offset,length:f.length},message:e.patternErrorMessage||e.errorMessage||o.t("String is not a URI: {0}",k)})}break;case"color-hex":case"date-time":case"date":case"time":case"email":case"hostname":case"ipv4":case"ipv6":const p=ct[e.format];(!f.value||!p.pattern.exec(f.value))&&n.problems.push({location:{offset:f.offset,length:f.length},message:e.patternErrorMessage||e.errorMessage||p.errorMessage})}}function c(f){let p,k;s.schemaDraft>=U.v2020_12?(p=e.prefixItems,k=Array.isArray(e.items)?void 0:e.items):(p=Array.isArray(e.items)?e.items:void 0,k=Array.isArray(e.items)?e.additionalItems:e.items);let m=0;if(p!==void 0){const T=Math.min(p.length,f.items.length);for(;m<T;m++){const N=p[m],u=j(N),v=new D,d=f.items[m];d&&($(d,u,v,r,s),n.mergePropertyMatch(v)),n.processedProperties.add(String(m))}}if(k!==void 0&&m<f.items.length)if(typeof k=="boolean")for(k===!1&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Array has too many items according to schema. Expected {0} or fewer.",m)});m<f.items.length;m++)n.processedProperties.add(String(m)),n.propertiesValueMatches++;else for(;m<f.items.length;m++){const T=new D;$(f.items[m],k,T,r,s),n.mergePropertyMatch(T),n.processedProperties.add(String(m))}const b=j(e.contains);if(b){let T=0;for(let N=0;N<f.items.length;N++){const u=f.items[N],v=new D;$(u,b,v,ne.instance,s),v.hasProblems()||(T++,s.schemaDraft>=U.v2020_12&&n.processedProperties.add(String(N)))}T===0&&!E(e.minContains)&&n.problems.push({location:{offset:f.offset,length:f.length},message:e.errorMessage||o.t("Array does not contain required item.")}),E(e.minContains)&&T<e.minContains&&n.problems.push({location:{offset:f.offset,length:f.length},message:e.errorMessage||o.t("Array has too few items that match the contains contraint. Expected {0} or more.",e.minContains)}),E(e.maxContains)&&T>e.maxContains&&n.problems.push({location:{offset:f.offset,length:f.length},message:e.errorMessage||o.t("Array has too many items that match the contains contraint. Expected {0} or less.",e.maxContains)})}const y=e.unevaluatedItems;if(y!==void 0)for(let T=0;T<f.items.length;T++){if(!n.processedProperties.has(String(T)))if(y===!1)n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Item does not match any validation rule from the array.")});else{const N=new D;$(f.items[T],e.unevaluatedItems,N,r,s),n.mergePropertyMatch(N)}n.processedProperties.add(String(T)),n.propertiesValueMatches++}if(E(e.minItems)&&f.items.length<e.minItems&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Array has too few items. Expected {0} or more.",e.minItems)}),E(e.maxItems)&&f.items.length>e.maxItems&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Array has too many items. Expected {0} or fewer.",e.maxItems)}),e.uniqueItems===!0){let N=function(){for(let u=0;u<T.length-1;u++){const v=T[u];for(let d=u+1;d<T.length;d++)if(Q(v,T[d]))return!0}return!1};const T=z(f);N()&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Array has duplicate items.")})}}function g(f){const p=Object.create(null),k=new Set;for(const u of f.properties){const v=u.keyNode.value;p[v]=u.valueNode,k.add(v)}if(Array.isArray(e.required)){for(const u of e.required)if(!p[u]){const v=f.parent&&f.parent.type==="property"&&f.parent.keyNode,d=v?{offset:v.offset,length:v.length}:{offset:f.offset,length:1};n.problems.push({location:d,message:o.t('Missing property "{0}".',u)})}}const m=u=>{k.delete(u),n.processedProperties.add(u)};if(e.properties)for(const u of Object.keys(e.properties)){m(u);const v=e.properties[u],d=p[u];if(d)if(B(v))if(v)n.propertiesMatches++,n.propertiesValueMatches++;else{const S=d.parent;n.problems.push({location:{offset:S.keyNode.offset,length:S.keyNode.length},message:e.errorMessage||o.t("Property {0} is not allowed.",u)})}else{const S=new D;$(d,v,S,r,s),n.mergePropertyMatch(S)}}if(e.patternProperties)for(const u of Object.keys(e.patternProperties)){const v=le(u);if(v){const d=[];for(const S of k)if(v.test(S)){d.push(S);const A=p[S];if(A){const x=e.patternProperties[u];if(B(x))if(x)n.propertiesMatches++,n.propertiesValueMatches++;else{const w=A.parent;n.problems.push({location:{offset:w.keyNode.offset,length:w.keyNode.length},message:e.errorMessage||o.t("Property {0} is not allowed.",S)})}else{const w=new D;$(A,x,w,r,s),n.mergePropertyMatch(w)}}}d.forEach(m)}}const b=e.additionalProperties;if(b!==void 0)for(const u of k){m(u);const v=p[u];if(v){if(b===!1){const d=v.parent;n.problems.push({location:{offset:d.keyNode.offset,length:d.keyNode.length},message:e.errorMessage||o.t("Property {0} is not allowed.",u)})}else if(b!==!0){const d=new D;$(v,b,d,r,s),n.mergePropertyMatch(d)}}}const y=e.unevaluatedProperties;if(y!==void 0){const u=[];for(const v of k)if(!n.processedProperties.has(v)){u.push(v);const d=p[v];if(d){if(y===!1){const S=d.parent;n.problems.push({location:{offset:S.keyNode.offset,length:S.keyNode.length},message:e.errorMessage||o.t("Property {0} is not allowed.",v)})}else if(y!==!0){const S=new D;$(d,y,S,r,s),n.mergePropertyMatch(S)}}}u.forEach(m)}if(E(e.maxProperties)&&f.properties.length>e.maxProperties&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Object has more properties than limit of {0}.",e.maxProperties)}),E(e.minProperties)&&f.properties.length<e.minProperties&&n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Object has fewer properties than the required number of {0}",e.minProperties)}),e.dependentRequired)for(const u in e.dependentRequired){const v=p[u],d=e.dependentRequired[u];v&&Array.isArray(d)&&N(u,d)}if(e.dependentSchemas)for(const u in e.dependentSchemas){const v=p[u],d=e.dependentSchemas[u];v&&K(d)&&N(u,d)}if(e.dependencies)for(const u in e.dependencies)p[u]&&N(u,e.dependencies[u]);const T=j(e.propertyNames);if(T)for(const u of f.properties){const v=u.keyNode;v&&$(v,T,n,ne.instance,s)}function N(u,v){if(Array.isArray(v))for(const d of v)p[d]?n.propertiesValueMatches++:n.problems.push({location:{offset:f.offset,length:f.length},message:o.t("Object is missing property {0} required by property {1}.",d,u)});else{const d=j(v);if(d){const S=new D;$(f,d,S,r,s),n.mergePropertyMatch(S)}}}}}function bt(t,e){const n=[];let r=-1;const s=t.getText(),i=W(s,!1),l=e&&e.collectComments?[]:void 0;function a(){for(;;){const S=i.scan();switch(g(),S){case 12:case 13:Array.isArray(l)&&l.push(o.Range.create(t.positionAt(i.getTokenOffset()),t.positionAt(i.getTokenOffset()+i.getTokenLength())));break;case 15:case 14:break;default:return S}}}function h(S,A,x,w,L=o.DiagnosticSeverity.Error){if(n.length===0||x!==r){const P=o.Range.create(t.positionAt(x),t.positionAt(w));n.push(o.Diagnostic.create(P,S,L,A,t.languageId)),r=x}}function c(S,A,x=void 0,w=[],L=[]){let P=i.getTokenOffset(),I=i.getTokenOffset()+i.getTokenLength();if(P===I&&P>0){for(P--;P>0&&/\s/.test(s.charAt(P));)P--;I=P+1}if(h(S,A,P,I),x&&f(x,!1),w.length+L.length>0){let V=i.getToken();for(;V!==17;){if(w.indexOf(V)!==-1){a();break}else if(L.indexOf(V)!==-1)break;V=a()}}return x}function g(){switch(i.getTokenError()){case 4:return c(o.t("Invalid unicode sequence in string."),O.InvalidUnicode),!0;case 5:return c(o.t("Invalid escape character in string."),O.InvalidEscapeCharacter),!0;case 3:return c(o.t("Unexpected end of number."),O.UnexpectedEndOfNumber),!0;case 1:return c(o.t("Unexpected end of comment."),O.UnexpectedEndOfComment),!0;case 2:return c(o.t("Unexpected end of string."),O.UnexpectedEndOfString),!0;case 6:return c(o.t("Invalid characters in string. Control characters must be escaped."),O.InvalidCharacter),!0}return!1}function f(S,A){return S.length=i.getTokenOffset()+i.getTokenLength()-S.offset,A&&a(),S}function p(S){if(i.getToken()!==3)return;const A=new pt(S,i.getTokenOffset());a();let x=!1;for(;i.getToken()!==4&&i.getToken()!==17;){if(i.getToken()===5){x||c(o.t("Value expected"),O.ValueExpected);const L=i.getTokenOffset();if(a(),i.getToken()===4){x&&h(o.t("Trailing comma"),O.TrailingComma,L,L+1);continue}}else x&&c(o.t("Expected comma"),O.CommaExpected);const w=u(A);w?A.items.push(w):c(o.t("Value expected"),O.ValueExpected,void 0,[],[4,5]),x=!0}return i.getToken()!==4?c(o.t("Expected comma or closing bracket"),O.CommaOrCloseBacketExpected,A):f(A,!0)}const k=new ce(void 0,0,0);function m(S,A){const x=new ht(S,i.getTokenOffset(),k);let w=y(x);if(!w)if(i.getToken()===16){c(o.t("Property keys must be doublequoted"),O.PropertyKeysMustBeDoublequoted);const P=new ce(x,i.getTokenOffset(),i.getTokenLength());P.value=i.getTokenValue(),w=P,a()}else return;if(x.keyNode=w,w.value!=="//"){const P=A[w.value];P?(h(o.t("Duplicate object key"),O.DuplicateKey,x.keyNode.offset,x.keyNode.offset+x.keyNode.length,o.DiagnosticSeverity.Warning),K(P)&&h(o.t("Duplicate object key"),O.DuplicateKey,P.keyNode.offset,P.keyNode.offset+P.keyNode.length,o.DiagnosticSeverity.Warning),A[w.value]=!0):A[w.value]=x}if(i.getToken()===6)x.colonOffset=i.getTokenOffset(),a();else if(c(o.t("Colon expected"),O.ColonExpected),i.getToken()===10&&t.positionAt(w.offset+w.length).line<t.positionAt(i.getTokenOffset()).line)return x.length=w.length,x;const L=u(x);return L?(x.valueNode=L,x.length=L.offset+L.length-x.offset,x):c(o.t("Value expected"),O.ValueExpected,x,[],[2,5])}function b(S){if(i.getToken()!==1)return;const A=new gt(S,i.getTokenOffset()),x=Object.create(null);a();let w=!1;for(;i.getToken()!==2&&i.getToken()!==17;){if(i.getToken()===5){w||c(o.t("Property expected"),O.PropertyExpected);const P=i.getTokenOffset();if(a(),i.getToken()===2){w&&h(o.t("Trailing comma"),O.TrailingComma,P,P+1);continue}}else w&&c(o.t("Expected comma"),O.CommaExpected);const L=m(A,x);L?A.properties.push(L):c(o.t("Property expected"),O.PropertyExpected,void 0,[],[2,5]),w=!0}return i.getToken()!==2?c(o.t("Expected comma or closing brace"),O.CommaOrCloseBraceExpected,A):f(A,!0)}function y(S){if(i.getToken()!==10)return;const A=new ce(S,i.getTokenOffset());return A.value=i.getTokenValue(),f(A,!0)}function T(S){if(i.getToken()!==11)return;const A=new mt(S,i.getTokenOffset());if(i.getTokenError()===0){const x=i.getTokenValue();try{const w=JSON.parse(x);if(!E(w))return c(o.t("Invalid number format."),O.Undefined,A);A.value=w}catch{return c(o.t("Invalid number format."),O.Undefined,A)}A.isInteger=x.indexOf(".")===-1}return f(A,!0)}function N(S){switch(i.getToken()){case 7:return f(new ut(S,i.getTokenOffset()),!0);case 8:return f(new Le(S,!0,i.getTokenOffset()),!0);case 9:return f(new Le(S,!1,i.getTokenOffset()),!0);default:return}}function u(S){return p(S)||b(S)||y(S)||T(S)||N(S)}let v;return a()!==17&&(v=u(v),v?i.getToken()!==17&&c(o.t("End of file expected."),O.Undefined):c(o.t("Expected a JSON object, array or literal."),O.Undefined)),new Je(v,n,l)}function de(t,e,n){if(t!==null&&typeof t=="object"){const r=e+" ";if(Array.isArray(t)){if(t.length===0)return"[]";let s=`[
16
+ `;for(let i=0;i<t.length;i++)s+=r+de(t[i],r,n),i<t.length-1&&(s+=","),s+=`
17
+ `;return s+=e+"]",s}else{const s=Object.keys(t);if(s.length===0)return"{}";let i=`{
18
+ `;for(let l=0;l<s.length;l++){const a=s[l];i+=r+JSON.stringify(a)+": "+de(t[a],r,n),l<s.length-1&&(i+=","),i+=`
19
+ `}return i+=e+"}",i}}return n(t)}class kt{constructor(e,n=[],r=Promise,s={}){this.schemaService=e,this.contributions=n,this.promiseConstructor=r,this.clientCapabilities=s}doResolve(e){for(let n=this.contributions.length-1;n>=0;n--){const r=this.contributions[n].resolveCompletion;if(r){const s=r(e);if(s)return s}}return this.promiseConstructor.resolve(e)}doComplete(e,n,r){const s={items:[],isIncomplete:!1},i=e.getText(),l=e.offsetAt(n);let a=r.getNodeFromOffset(l,!0);if(this.isInComment(e,a?a.offset:0,l))return Promise.resolve(s);if(a&&l===a.offset+a.length&&l>0){const p=i[l-1];(a.type==="object"&&p==="}"||a.type==="array"&&p==="]")&&(a=a.parent)}const h=this.getCurrentWord(e,l);let c;if(a&&(a.type==="string"||a.type==="number"||a.type==="boolean"||a.type==="null"))c=o.Range.create(e.positionAt(a.offset),e.positionAt(a.offset+a.length));else{let p=l-h.length;p>0&&i[p-1]==='"'&&p--,c=o.Range.create(e.positionAt(p),n)}const g=new Map,f={add:p=>{let k=p.label;const m=g.get(k);if(m)m.documentation||(m.documentation=p.documentation),m.detail||(m.detail=p.detail),m.labelDetails||(m.labelDetails=p.labelDetails);else{if(k=k.replace(/[\n]/g,"↵"),k.length>60){const b=k.substr(0,57).trim()+"...";g.has(b)||(k=b)}p.textEdit=o.TextEdit.replace(c,p.insertText),p.label=k,g.set(k,p),s.items.push(p)}},setAsIncomplete:()=>{s.isIncomplete=!0},error:p=>{console.error(p)},getNumberOfProposals:()=>s.items.length};return this.schemaService.getSchemaForResource(e.uri,r).then(p=>{const k=[];let m=!0,b="",y;if(a&&a.type==="string"){const N=a.parent;N&&N.type==="property"&&N.keyNode===a&&(m=!N.valueNode,y=N,b=i.substr(a.offset+1,a.length-2),N&&(a=N.parent))}if(a&&a.type==="object"){if(a.offset===l)return s;a.properties.forEach(d=>{(!y||y!==d)&&g.set(d.keyNode.value,o.CompletionItem.create("__"))});let u="";m&&(u=this.evaluateSeparatorAfter(e,e.offsetAt(c.end))),p?this.getPropertyCompletions(p,r,a,m,u,f):this.getSchemaLessPropertyCompletions(r,a,b,f);const v=ge(a);this.contributions.forEach(d=>{const S=d.collectPropertyCompletions(e.uri,v,h,m,u==="",f);S&&k.push(S)}),!p&&h.length>0&&i.charAt(l-h.length-1)!=='"'&&(f.add({kind:o.CompletionItemKind.Property,label:this.getLabelForValue(h),insertText:this.getInsertTextForProperty(h,void 0,!1,u),insertTextFormat:o.InsertTextFormat.Snippet,documentation:""}),f.setAsIncomplete())}const T={};return p?this.getValueCompletions(p,r,a,l,e,f,T):this.getSchemaLessValueCompletions(r,a,l,e,f),this.contributions.length>0&&this.getContributedValueCompletions(r,a,l,e,f,k),this.promiseConstructor.all(k).then(()=>{if(f.getNumberOfProposals()===0){let N=l;a&&(a.type==="string"||a.type==="number"||a.type==="boolean"||a.type==="null")&&(N=a.offset+a.length);const u=this.evaluateSeparatorAfter(e,N);this.addFillerValueCompletions(T,u,f)}return s})})}getPropertyCompletions(e,n,r,s,i,l){n.getMatchingSchemas(e.schema,r.offset).forEach(h=>{if(h.node===r&&!h.inverted){const c=h.schema.properties;c&&Object.keys(c).forEach(f=>{const p=c[f];if(typeof p=="object"&&!p.deprecationMessage&&!p.doNotSuggest){const k={kind:o.CompletionItemKind.Property,label:f,insertText:this.getInsertTextForProperty(f,p,s,i),insertTextFormat:o.InsertTextFormat.Snippet,filterText:this.getFilterTextForValue(f),documentation:this.fromMarkup(p.markdownDescription)||p.description||""};p.suggestSortText!==void 0&&(k.sortText=p.suggestSortText),k.insertText&&te(k.insertText,`$1${i}`)&&(k.command={title:"Suggest",command:"editor.action.triggerSuggest"}),l.add(k)}});const g=h.schema.propertyNames;if(typeof g=="object"&&!g.deprecationMessage&&!g.doNotSuggest){const f=(p,k=void 0)=>{const m={kind:o.CompletionItemKind.Property,label:p,insertText:this.getInsertTextForProperty(p,void 0,s,i),insertTextFormat:o.InsertTextFormat.Snippet,filterText:this.getFilterTextForValue(p),documentation:k||this.fromMarkup(g.markdownDescription)||g.description||""};g.suggestSortText!==void 0&&(m.sortText=g.suggestSortText),m.insertText&&te(m.insertText,`$1${i}`)&&(m.command={title:"Suggest",command:"editor.action.triggerSuggest"}),l.add(m)};if(g.enum)for(let p=0;p<g.enum.length;p++){let k;g.markdownEnumDescriptions&&p<g.markdownEnumDescriptions.length?k=this.fromMarkup(g.markdownEnumDescriptions[p]):g.enumDescriptions&&p<g.enumDescriptions.length&&(k=g.enumDescriptions[p]),f(g.enum[p],k)}g.const&&f(g.const)}}})}getSchemaLessPropertyCompletions(e,n,r,s){const i=l=>{l.properties.forEach(a=>{const h=a.keyNode.value;s.add({kind:o.CompletionItemKind.Property,label:h,insertText:this.getInsertTextForValue(h,""),insertTextFormat:o.InsertTextFormat.Snippet,filterText:this.getFilterTextForValue(h),documentation:""})})};if(n.parent)if(n.parent.type==="property"){const l=n.parent.keyNode.value;e.visit(a=>(a.type==="property"&&a!==n.parent&&a.keyNode.value===l&&a.valueNode&&a.valueNode.type==="object"&&i(a.valueNode),!0))}else n.parent.type==="array"&&n.parent.items.forEach(l=>{l.type==="object"&&l!==n&&i(l)});else n.type==="object"&&s.add({kind:o.CompletionItemKind.Property,label:"$schema",insertText:this.getInsertTextForProperty("$schema",void 0,!0,""),insertTextFormat:o.InsertTextFormat.Snippet,documentation:"",filterText:this.getFilterTextForValue("$schema")})}getSchemaLessValueCompletions(e,n,r,s,i){let l=r;if(n&&(n.type==="string"||n.type==="number"||n.type==="boolean"||n.type==="null")&&(l=n.offset+n.length,n=n.parent),!n){i.add({kind:this.getSuggestionKind("object"),label:"Empty object",insertText:this.getInsertTextForValue({},""),insertTextFormat:o.InsertTextFormat.Snippet,documentation:""}),i.add({kind:this.getSuggestionKind("array"),label:"Empty array",insertText:this.getInsertTextForValue([],""),insertTextFormat:o.InsertTextFormat.Snippet,documentation:""});return}const a=this.evaluateSeparatorAfter(s,l),h=c=>{c.parent&&!Be(c.parent,r,!0)&&i.add({kind:this.getSuggestionKind(c.type),label:this.getLabelTextForMatchingNode(c,s),insertText:this.getInsertTextForMatchingNode(c,s,a),insertTextFormat:o.InsertTextFormat.Snippet,documentation:""}),c.type==="boolean"&&this.addBooleanValueCompletion(!c.value,a,i)};if(n.type==="property"&&r>(n.colonOffset||0)){const c=n.valueNode;if(c&&(r>c.offset+c.length||c.type==="object"||c.type==="array"))return;const g=n.keyNode.value;e.visit(f=>(f.type==="property"&&f.keyNode.value===g&&f.valueNode&&h(f.valueNode),!0)),g==="$schema"&&n.parent&&!n.parent.parent&&this.addDollarSchemaCompletions(a,i)}if(n.type==="array")if(n.parent&&n.parent.type==="property"){const c=n.parent.keyNode.value;e.visit(g=>(g.type==="property"&&g.keyNode.value===c&&g.valueNode&&g.valueNode.type==="array"&&g.valueNode.items.forEach(h),!0))}else n.items.forEach(h)}getValueCompletions(e,n,r,s,i,l,a){let h=s,c,g;if(r&&(r.type==="string"||r.type==="number"||r.type==="boolean"||r.type==="null")&&(h=r.offset+r.length,g=r,r=r.parent),!r){this.addSchemaValueCompletions(e.schema,"",l,a);return}if(r.type==="property"&&s>(r.colonOffset||0)){const f=r.valueNode;if(f&&s>f.offset+f.length)return;c=r.keyNode.value,r=r.parent}if(r&&(c!==void 0||r.type==="array")){const f=this.evaluateSeparatorAfter(i,h),p=n.getMatchingSchemas(e.schema,r.offset,g);for(const k of p)if(k.node===r&&!k.inverted&&k.schema){if(r.type==="array"&&k.schema.items){let m=l;if(k.schema.uniqueItems){const b=new Set;r.children.forEach(y=>{y.type!=="array"&&y.type!=="object"&&b.add(this.getLabelForValue(z(y)))}),m={...l,add(y){b.has(y.label)||l.add(y)}}}if(Array.isArray(k.schema.items)){const b=this.findItemAtOffset(r,i,s);b<k.schema.items.length&&this.addSchemaValueCompletions(k.schema.items[b],f,m,a)}else this.addSchemaValueCompletions(k.schema.items,f,m,a)}if(c!==void 0){let m=!1;if(k.schema.properties){const b=k.schema.properties[c];b&&(m=!0,this.addSchemaValueCompletions(b,f,l,a))}if(k.schema.patternProperties&&!m)for(const b of Object.keys(k.schema.patternProperties)){const y=le(b);if(y!=null&&y.test(c)){m=!0;const T=k.schema.patternProperties[b];this.addSchemaValueCompletions(T,f,l,a)}}if(k.schema.additionalProperties&&!m){const b=k.schema.additionalProperties;this.addSchemaValueCompletions(b,f,l,a)}}}c==="$schema"&&!r.parent&&this.addDollarSchemaCompletions(f,l),a.boolean&&(this.addBooleanValueCompletion(!0,f,l),this.addBooleanValueCompletion(!1,f,l)),a.null&&this.addNullValueCompletion(f,l)}}getContributedValueCompletions(e,n,r,s,i,l){if(!n)this.contributions.forEach(a=>{const h=a.collectDefaultCompletions(s.uri,i);h&&l.push(h)});else if((n.type==="string"||n.type==="number"||n.type==="boolean"||n.type==="null")&&(n=n.parent),n&&n.type==="property"&&r>(n.colonOffset||0)){const a=n.keyNode.value,h=n.valueNode;if((!h||r<=h.offset+h.length)&&n.parent){const c=ge(n.parent);this.contributions.forEach(g=>{const f=g.collectValueCompletions(s.uri,c,a,i);f&&l.push(f)})}}}addSchemaValueCompletions(e,n,r,s){typeof e=="object"&&(this.addEnumValueCompletions(e,n,r),this.addDefaultValueCompletions(e,n,r),this.collectTypes(e,s),Array.isArray(e.allOf)&&e.allOf.forEach(i=>this.addSchemaValueCompletions(i,n,r,s)),Array.isArray(e.anyOf)&&e.anyOf.forEach(i=>this.addSchemaValueCompletions(i,n,r,s)),Array.isArray(e.oneOf)&&e.oneOf.forEach(i=>this.addSchemaValueCompletions(i,n,r,s)))}addDefaultValueCompletions(e,n,r,s=0){let i=!1;if(R(e.default)){let l=e.type,a=e.default;for(let c=s;c>0;c--)a=[a],l="array";const h={kind:this.getSuggestionKind(l),label:this.getLabelForValue(a),insertText:this.getInsertTextForValue(a,n),insertTextFormat:o.InsertTextFormat.Snippet};this.doesSupportsLabelDetails()?h.labelDetails={description:o.t("Default value")}:h.detail=o.t("Default value"),r.add(h),i=!0}Array.isArray(e.examples)&&e.examples.forEach(l=>{let a=e.type,h=l;for(let c=s;c>0;c--)h=[h],a="array";r.add({kind:this.getSuggestionKind(a),label:this.getLabelForValue(h),insertText:this.getInsertTextForValue(h,n),insertTextFormat:o.InsertTextFormat.Snippet}),i=!0}),Array.isArray(e.defaultSnippets)&&e.defaultSnippets.forEach(l=>{let a=e.type,h=l.body,c=l.label,g,f;if(R(h)){e.type;for(let p=s;p>0;p--)h=[h];g=this.getInsertTextForSnippetValue(h,n),f=this.getFilterTextForSnippetValue(h),c=c||this.getLabelForSnippetValue(h)}else if(typeof l.bodyText=="string"){let p="",k="",m="";for(let b=s;b>0;b--)p=p+m+`[
20
+ `,k=k+`
21
+ `+m+"]",m+=" ",a="array";g=p+m+l.bodyText.split(`
22
+ `).join(`
23
+ `+m)+k+n,c=c||g,f=g.replace(/[\n]/g,"")}else return;r.add({kind:this.getSuggestionKind(a),label:c,documentation:this.fromMarkup(l.markdownDescription)||l.description,insertText:g,insertTextFormat:o.InsertTextFormat.Snippet,filterText:f}),i=!0}),!i&&typeof e.items=="object"&&!Array.isArray(e.items)&&s<5&&this.addDefaultValueCompletions(e.items,n,r,s+1)}addEnumValueCompletions(e,n,r){if(R(e.const)&&r.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(e.const),insertText:this.getInsertTextForValue(e.const,n),insertTextFormat:o.InsertTextFormat.Snippet,documentation:this.fromMarkup(e.markdownDescription)||e.description}),Array.isArray(e.enum))for(let s=0,i=e.enum.length;s<i;s++){const l=e.enum[s];let a=this.fromMarkup(e.markdownDescription)||e.description;e.markdownEnumDescriptions&&s<e.markdownEnumDescriptions.length&&this.doesSupportMarkdown()?a=this.fromMarkup(e.markdownEnumDescriptions[s]):e.enumDescriptions&&s<e.enumDescriptions.length&&(a=e.enumDescriptions[s]),r.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(l),insertText:this.getInsertTextForValue(l,n),insertTextFormat:o.InsertTextFormat.Snippet,documentation:a})}}collectTypes(e,n){if(Array.isArray(e.enum)||R(e.const))return;const r=e.type;Array.isArray(r)?r.forEach(s=>n[s]=!0):r&&(n[r]=!0)}addFillerValueCompletions(e,n,r){e.object&&r.add({kind:this.getSuggestionKind("object"),label:"{}",insertText:this.getInsertTextForGuessedValue({},n),insertTextFormat:o.InsertTextFormat.Snippet,detail:o.t("New object"),documentation:""}),e.array&&r.add({kind:this.getSuggestionKind("array"),label:"[]",insertText:this.getInsertTextForGuessedValue([],n),insertTextFormat:o.InsertTextFormat.Snippet,detail:o.t("New array"),documentation:""})}addBooleanValueCompletion(e,n,r){r.add({kind:this.getSuggestionKind("boolean"),label:e?"true":"false",insertText:this.getInsertTextForValue(e,n),insertTextFormat:o.InsertTextFormat.Snippet,documentation:""})}addNullValueCompletion(e,n){n.add({kind:this.getSuggestionKind("null"),label:"null",insertText:"null"+e,insertTextFormat:o.InsertTextFormat.Snippet,documentation:""})}addDollarSchemaCompletions(e,n){this.schemaService.getRegisteredSchemaIds(s=>s==="http"||s==="https").forEach(s=>{s.startsWith("http://json-schema.org/draft-")&&(s=s+"#"),n.add({kind:o.CompletionItemKind.Module,label:this.getLabelForValue(s),filterText:this.getFilterTextForValue(s),insertText:this.getInsertTextForValue(s,e),insertTextFormat:o.InsertTextFormat.Snippet,documentation:""})})}getLabelForValue(e){return JSON.stringify(e)}getValueFromLabel(e){return JSON.parse(e)}getFilterTextForValue(e){return JSON.stringify(e)}getFilterTextForSnippetValue(e){return JSON.stringify(e).replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1")}getLabelForSnippetValue(e){return JSON.stringify(e).replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1")}getInsertTextForPlainText(e){return e.replace(/[\\\$\}]/g,"\\$&")}getInsertTextForValue(e,n){const r=JSON.stringify(e,null," ");return r==="{}"?"{$1}"+n:r==="[]"?"[$1]"+n:this.getInsertTextForPlainText(r+n)}getInsertTextForSnippetValue(e,n){return de(e,"",s=>typeof s=="string"&&s[0]==="^"?s.substr(1):JSON.stringify(s))+n}getInsertTextForGuessedValue(e,n){switch(typeof e){case"object":return e===null?"${1:null}"+n:this.getInsertTextForValue(e,n);case"string":let r=JSON.stringify(e);return r=r.substr(1,r.length-2),r=this.getInsertTextForPlainText(r),'"${1:'+r+'}"'+n;case"number":case"boolean":return"${1:"+JSON.stringify(e)+"}"+n}return this.getInsertTextForValue(e,n)}getSuggestionKind(e){if(Array.isArray(e)){const n=e;e=n.length>0?n[0]:void 0}if(!e)return o.CompletionItemKind.Value;switch(e){case"string":return o.CompletionItemKind.Value;case"object":return o.CompletionItemKind.Module;case"property":return o.CompletionItemKind.Property;default:return o.CompletionItemKind.Value}}getLabelTextForMatchingNode(e,n){switch(e.type){case"array":return"[]";case"object":return"{}";default:return n.getText().substr(e.offset,e.length)}}getInsertTextForMatchingNode(e,n,r){switch(e.type){case"array":return this.getInsertTextForValue([],r);case"object":return this.getInsertTextForValue({},r);default:const s=n.getText().substr(e.offset,e.length)+r;return this.getInsertTextForPlainText(s)}}getInsertTextForProperty(e,n,r,s){const i=this.getInsertTextForValue(e,"");if(!r)return i;const l=i+": ";let a,h=0;if(n){if(Array.isArray(n.defaultSnippets)){if(n.defaultSnippets.length===1){const c=n.defaultSnippets[0].body;R(c)&&(a=this.getInsertTextForSnippetValue(c,""))}h+=n.defaultSnippets.length}if(n.enum&&(!a&&n.enum.length===1&&(a=this.getInsertTextForGuessedValue(n.enum[0],"")),h+=n.enum.length),R(n.const)&&(a||(a=this.getInsertTextForGuessedValue(n.const,"")),h++),R(n.default)&&(a||(a=this.getInsertTextForGuessedValue(n.default,"")),h++),Array.isArray(n.examples)&&n.examples.length&&(a||(a=this.getInsertTextForGuessedValue(n.examples[0],"")),h+=n.examples.length),h===0){let c=Array.isArray(n.type)?n.type[0]:n.type;switch(c||(n.properties?c="object":n.items&&(c="array")),c){case"boolean":a="$1";break;case"string":a='"$1"';break;case"object":a="{$1}";break;case"array":a="[$1]";break;case"number":case"integer":a="${1:0}";break;case"null":a="${1:null}";break;default:return i}}}return(!a||h>1)&&(a="$1"),l+a+s}getCurrentWord(e,n){let r=n-1;const s=e.getText();for(;r>=0&&`
24
+ \r\v":{[,]}`.indexOf(s.charAt(r))===-1;)r--;return s.substring(r+1,n)}evaluateSeparatorAfter(e,n){const r=W(e.getText(),!0);switch(r.setPosition(n),r.scan()){case 5:case 2:case 4:case 17:return"";default:return","}}findItemAtOffset(e,n,r){const s=W(n.getText(),!0),i=e.items;for(let l=i.length-1;l>=0;l--){const a=i[l];if(r>a.offset+a.length)return s.setPosition(a.offset+a.length),s.scan()===5&&r>=s.getTokenOffset()+s.getTokenLength()?l+1:l;if(r>=a.offset)return l}return 0}isInComment(e,n,r){const s=W(e.getText(),!1);s.setPosition(n);let i=s.scan();for(;i!==17&&s.getTokenOffset()+s.getTokenLength()<r;)i=s.scan();return(i===12||i===13)&&s.getTokenOffset()<=r}fromMarkup(e){if(e&&this.doesSupportMarkdown())return{kind:o.MarkupKind.Markdown,value:e}}doesSupportMarkdown(){var e,n,r;if(!R(this.supportsMarkdown)){const s=(r=(n=(e=this.clientCapabilities.textDocument)==null?void 0:e.completion)==null?void 0:n.completionItem)==null?void 0:r.documentationFormat;this.supportsMarkdown=Array.isArray(s)&&s.indexOf(o.MarkupKind.Markdown)!==-1}return this.supportsMarkdown}doesSupportsCommitCharacters(){var e,n,r;return R(this.supportsCommitCharacters)||(this.labelDetailsSupport=(r=(n=(e=this.clientCapabilities.textDocument)==null?void 0:e.completion)==null?void 0:n.completionItem)==null?void 0:r.commitCharactersSupport),this.supportsCommitCharacters}doesSupportsLabelDetails(){var e,n,r;return R(this.labelDetailsSupport)||(this.labelDetailsSupport=(r=(n=(e=this.clientCapabilities.textDocument)==null?void 0:e.completion)==null?void 0:n.completionItem)==null?void 0:r.labelDetailsSupport),this.labelDetailsSupport}}class vt{constructor(e,n=[],r){this.schemaService=e,this.contributions=n,this.promise=r||Promise}doHover(e,n,r){const s=e.offsetAt(n);let i=r.getNodeFromOffset(s);if(!i||(i.type==="object"||i.type==="array")&&s>i.offset+1&&s<i.offset+i.length-1)return this.promise.resolve(null);const l=i;if(i.type==="string"){const g=i.parent;if(g&&g.type==="property"&&g.keyNode===i&&(i=g.valueNode,!i))return this.promise.resolve(null)}const a=o.Range.create(e.positionAt(l.offset),e.positionAt(l.offset+l.length)),h=g=>({contents:g,range:a}),c=ge(i);for(let g=this.contributions.length-1;g>=0;g--){const p=this.contributions[g].getInfoContribution(e.uri,c);if(p)return p.then(k=>h(k))}return this.schemaService.getSchemaForResource(e.uri,r).then(g=>{if(g&&i){const f=r.getMatchingSchemas(g.schema,i.offset);let p,k,m,b;f.every(T=>{if(T.node===i&&!T.inverted&&T.schema&&(p=p||T.schema.title,k=k||T.schema.markdownDescription||ue(T.schema.description),T.schema.enum)){const N=T.schema.enum.indexOf(z(i));T.schema.markdownEnumDescriptions?m=T.schema.markdownEnumDescriptions[N]:T.schema.enumDescriptions&&(m=ue(T.schema.enumDescriptions[N])),m&&(b=T.schema.enum[N],typeof b!="string"&&(b=JSON.stringify(b)))}return!0});let y="";return p&&(y=ue(p)),k&&(y.length>0&&(y+=`
25
+
26
+ `),y+=k),m&&(y.length>0&&(y+=`
27
+
28
+ `),y+=`\`${St(b)}\`: ${m}`),h([y])}return null})}}function ue(t){if(t)return t.replace(/([^\n\r])(\r?\n)([^\n\r])/gm,`$1
29
+
30
+ $3`).replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}function St(t){return t.indexOf("`")!==-1?"`` "+t+" ``":t}class Tt{constructor(e,n){this.jsonSchemaService=e,this.promise=n,this.validationEnabled=!0}configure(e){e&&(this.validationEnabled=e.validate!==!1,this.commentSeverity=e.allowComments?void 0:o.DiagnosticSeverity.Error)}doValidation(e,n,r,s){if(!this.validationEnabled)return this.promise.resolve([]);const i=[],l={},a=c=>{const g=c.range.start.line+" "+c.range.start.character+" "+c.message;l[g]||(l[g]=!0,i.push(c))},h=c=>{let g=r!=null&&r.trailingCommas?ie(r.trailingCommas):o.DiagnosticSeverity.Error,f=r!=null&&r.comments?ie(r.comments):this.commentSeverity,p=r!=null&&r.schemaValidation?ie(r.schemaValidation):o.DiagnosticSeverity.Warning,k=r!=null&&r.schemaRequest?ie(r.schemaRequest):o.DiagnosticSeverity.Warning;if(c){const m=(b,y)=>{if(n.root&&k){const T=n.root,N=T.type==="object"?T.properties[0]:void 0;if(N&&N.keyNode.value==="$schema"){const u=N.valueNode||N,v=o.Range.create(e.positionAt(u.offset),e.positionAt(u.offset+u.length));a(o.Diagnostic.create(v,b,k,y))}else{const u=o.Range.create(e.positionAt(T.offset),e.positionAt(T.offset+1));a(o.Diagnostic.create(u,b,k,y))}}};if(c.errors.length)m(c.errors[0],O.SchemaResolveError);else if(p){for(const y of c.warnings)m(y,O.SchemaUnsupportedFeature);const b=n.validate(e,c.schema,p,r==null?void 0:r.schemaDraft);b&&b.forEach(a)}qe(c.schema)&&(f=void 0),Ke(c.schema)&&(g=void 0)}for(const m of n.syntaxErrors){if(m.code===O.TrailingComma){if(typeof g!="number")continue;m.severity=g}a(m)}if(typeof f=="number"){const m=o.t("Comments are not permitted in JSON.");n.comments.forEach(b=>{a(o.Diagnostic.create(b,m,f,O.CommentNotPermitted))})}return i};if(s){const c=s.id||"schemaservice://untitled/"+At++;return this.jsonSchemaService.registerExternalSchema({uri:c,schema:s}).getResolvedSchema().then(f=>h(f))}return this.jsonSchemaService.getSchemaForResource(e.uri,n).then(c=>h(c))}getLanguageStatus(e,n){return{schemas:this.jsonSchemaService.getSchemaURIsForResource(e.uri,n)}}}let At=0;function qe(t){if(t&&typeof t=="object"){if(B(t.allowComments))return t.allowComments;if(t.allOf)for(const e of t.allOf){const n=qe(e);if(B(n))return n}}}function Ke(t){if(t&&typeof t=="object"){if(B(t.allowTrailingCommas))return t.allowTrailingCommas;const e=t;if(B(e.allowsTrailingCommas))return e.allowsTrailingCommas;if(t.allOf)for(const n of t.allOf){const r=Ke(n);if(B(r))return r}}}function ie(t){switch(t){case"error":return o.DiagnosticSeverity.Error;case"warning":return o.DiagnosticSeverity.Warning;case"ignore":return}}const $e=48,Nt=57,xt=65,se=97,wt=102;function M(t){return t<$e?0:t<=Nt?t-$e:(t<se&&(t+=se-xt),t>=se&&t<=wt?t-se+10:0)}function Ot(t){if(t[0]==="#")switch(t.length){case 4:return{red:M(t.charCodeAt(1))*17/255,green:M(t.charCodeAt(2))*17/255,blue:M(t.charCodeAt(3))*17/255,alpha:1};case 5:return{red:M(t.charCodeAt(1))*17/255,green:M(t.charCodeAt(2))*17/255,blue:M(t.charCodeAt(3))*17/255,alpha:M(t.charCodeAt(4))*17/255};case 7:return{red:(M(t.charCodeAt(1))*16+M(t.charCodeAt(2)))/255,green:(M(t.charCodeAt(3))*16+M(t.charCodeAt(4)))/255,blue:(M(t.charCodeAt(5))*16+M(t.charCodeAt(6)))/255,alpha:1};case 9:return{red:(M(t.charCodeAt(1))*16+M(t.charCodeAt(2)))/255,green:(M(t.charCodeAt(3))*16+M(t.charCodeAt(4)))/255,blue:(M(t.charCodeAt(5))*16+M(t.charCodeAt(6)))/255,alpha:(M(t.charCodeAt(7))*16+M(t.charCodeAt(8)))/255}}}class It{constructor(e){this.schemaService=e}findDocumentSymbols(e,n,r={resultLimit:Number.MAX_VALUE}){const s=n.root;if(!s)return[];let i=r.resultLimit||Number.MAX_VALUE;const l=e.uri;if((l==="vscode://defaultsettings/keybindings.json"||te(l.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){const p=[];for(const k of s.items)if(k.type==="object"){for(const m of k.properties)if(m.keyNode.value==="key"&&m.valueNode){const b=o.Location.create(e.uri,J(e,k));if(p.push({name:Ee(m.valueNode),kind:o.SymbolKind.Function,location:b}),i--,i<=0)return r&&r.onResultLimitExceeded&&r.onResultLimitExceeded(l),p}}return p}const a=[{node:s,containerName:""}];let h=0,c=!1;const g=[],f=(p,k)=>{p.type==="array"?p.items.forEach(m=>{m&&a.push({node:m,containerName:k})}):p.type==="object"&&p.properties.forEach(m=>{const b=m.valueNode;if(b)if(i>0){i--;const y=o.Location.create(e.uri,J(e,m)),T=k?k+"."+m.keyNode.value:m.keyNode.value;g.push({name:this.getKeyLabel(m),kind:this.getSymbolKind(b.type),location:y,containerName:k}),a.push({node:b,containerName:T})}else c=!0})};for(;h<a.length;){const p=a[h++];f(p.node,p.containerName)}return c&&r&&r.onResultLimitExceeded&&r.onResultLimitExceeded(l),g}findDocumentSymbols2(e,n,r={resultLimit:Number.MAX_VALUE}){const s=n.root;if(!s)return[];let i=r.resultLimit||Number.MAX_VALUE;const l=e.uri;if((l==="vscode://defaultsettings/keybindings.json"||te(l.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){const p=[];for(const k of s.items)if(k.type==="object"){for(const m of k.properties)if(m.keyNode.value==="key"&&m.valueNode){const b=J(e,k),y=J(e,m.keyNode);if(p.push({name:Ee(m.valueNode),kind:o.SymbolKind.Function,range:b,selectionRange:y}),i--,i<=0)return r&&r.onResultLimitExceeded&&r.onResultLimitExceeded(l),p}}return p}const a=[],h=[{node:s,result:a}];let c=0,g=!1;const f=(p,k)=>{p.type==="array"?p.items.forEach((m,b)=>{if(m)if(i>0){i--;const y=J(e,m),T=y,u={name:String(b),kind:this.getSymbolKind(m.type),range:y,selectionRange:T,children:[]};k.push(u),h.push({result:u.children,node:m})}else g=!0}):p.type==="object"&&p.properties.forEach(m=>{const b=m.valueNode;if(b)if(i>0){i--;const y=J(e,m),T=J(e,m.keyNode),N=[],u={name:this.getKeyLabel(m),kind:this.getSymbolKind(b.type),range:y,selectionRange:T,children:N,detail:this.getDetail(b)};k.push(u),h.push({result:N,node:b})}else g=!0})};for(;c<h.length;){const p=h[c++];f(p.node,p.result)}return g&&r&&r.onResultLimitExceeded&&r.onResultLimitExceeded(l),a}getSymbolKind(e){switch(e){case"object":return o.SymbolKind.Module;case"string":return o.SymbolKind.String;case"number":return o.SymbolKind.Number;case"array":return o.SymbolKind.Array;case"boolean":return o.SymbolKind.Boolean;default:return o.SymbolKind.Variable}}getKeyLabel(e){let n=e.keyNode.value;return n&&(n=n.replace(/[\n]/g,"↵")),n&&n.trim()?n:`"${n}"`}getDetail(e){if(e){if(e.type==="boolean"||e.type==="number"||e.type==="null"||e.type==="string")return String(e.value);if(e.type==="array")return e.children.length?void 0:"[]";if(e.type==="object")return e.children.length?void 0:"{}"}}findDocumentColors(e,n,r){return this.schemaService.getSchemaForResource(e.uri,n).then(s=>{const i=[];if(s){let l=r&&typeof r.resultLimit=="number"?r.resultLimit:Number.MAX_VALUE;const a=n.getMatchingSchemas(s.schema),h={};for(const c of a)if(!c.inverted&&c.schema&&(c.schema.format==="color"||c.schema.format==="color-hex")&&c.node&&c.node.type==="string"){const g=String(c.node.offset);if(!h[g]){const f=Ot(z(c.node));if(f){const p=J(e,c.node);i.push({color:f,range:p})}if(h[g]=!0,l--,l<=0)return r&&r.onResultLimitExceeded&&r.onResultLimitExceeded(e.uri),i}}}return i})}getColorPresentations(e,n,r,s){const i=[],l=Math.round(r.red*255),a=Math.round(r.green*255),h=Math.round(r.blue*255);function c(f){const p=f.toString(16);return p.length!==2?"0"+p:p}let g;return r.alpha===1?g=`#${c(l)}${c(a)}${c(h)}`:g=`#${c(l)}${c(a)}${c(h)}${c(Math.round(r.alpha*255))}`,i.push({label:g,textEdit:o.TextEdit.replace(s,JSON.stringify(g))}),i}}function J(t,e){return o.Range.create(t.positionAt(e.offset),t.positionAt(e.offset+e.length))}function Ee(t){return z(t)||o.t("<empty>")}const ye={schemaAssociations:[],schemas:{"http://json-schema.org/draft-04/schema#":{$schema:"http://json-schema.org/draft-04/schema#",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},positiveInteger:{type:"integer",minimum:0},positiveIntegerDefault0:{allOf:[{$ref:"#/definitions/positiveInteger"},{default:0}]},simpleTypes:{type:"string",enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0}},type:"object",properties:{id:{type:"string",format:"uri"},$schema:{type:"string",format:"uri"},title:{type:"string"},description:{type:"string"},default:{},multipleOf:{type:"number",minimum:0,exclusiveMinimum:!0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{allOf:[{$ref:"#/definitions/positiveInteger"}]},minLength:{allOf:[{$ref:"#/definitions/positiveIntegerDefault0"}]},pattern:{type:"string",format:"regex"},additionalItems:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:{}},maxItems:{allOf:[{$ref:"#/definitions/positiveInteger"}]},minItems:{allOf:[{$ref:"#/definitions/positiveIntegerDefault0"}]},uniqueItems:{type:"boolean",default:!1},maxProperties:{allOf:[{$ref:"#/definitions/positiveInteger"}]},minProperties:{allOf:[{$ref:"#/definitions/positiveIntegerDefault0"}]},required:{allOf:[{$ref:"#/definitions/stringArray"}]},additionalProperties:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{anyOf:[{type:"string",enum:["date-time","uri","email","hostname","ipv4","ipv6","regex"]},{type:"string"}]},allOf:{allOf:[{$ref:"#/definitions/schemaArray"}]},anyOf:{allOf:[{$ref:"#/definitions/schemaArray"}]},oneOf:{allOf:[{$ref:"#/definitions/schemaArray"}]},not:{allOf:[{$ref:"#"}]}},dependencies:{exclusiveMaximum:["maximum"],exclusiveMinimum:["minimum"]},default:{}},"http://json-schema.org/draft-07/schema#":{definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}},Pt={id:o.t("A unique identifier for the schema."),$schema:o.t("The schema to verify this document against."),title:o.t("A descriptive title of the element."),description:o.t("A long description of the element. Used in hover menus and suggestions."),default:o.t("A default value. Used by suggestions."),multipleOf:o.t("A number that should cleanly divide the current value (i.e. have no remainder)."),maximum:o.t("The maximum numerical value, inclusive by default."),exclusiveMaximum:o.t("Makes the maximum property exclusive."),minimum:o.t("The minimum numerical value, inclusive by default."),exclusiveMinimum:o.t("Makes the minimum property exclusive."),maxLength:o.t("The maximum length of a string."),minLength:o.t("The minimum length of a string."),pattern:o.t("A regular expression to match the string against. It is not implicitly anchored."),additionalItems:o.t("For arrays, only when items is set as an array. If it is a schema, then this schema validates items after the ones specified by the items array. If it is false, then additional items will cause validation to fail."),items:o.t("For arrays. Can either be a schema to validate every element against or an array of schemas to validate each item against in order (the first schema will validate the first element, the second schema will validate the second element, and so on."),maxItems:o.t("The maximum number of items that can be inside an array. Inclusive."),minItems:o.t("The minimum number of items that can be inside an array. Inclusive."),uniqueItems:o.t("If all of the items in the array must be unique. Defaults to false."),maxProperties:o.t("The maximum number of properties an object can have. Inclusive."),minProperties:o.t("The minimum number of properties an object can have. Inclusive."),required:o.t("An array of strings that lists the names of all properties required on this object."),additionalProperties:o.t("Either a schema or a boolean. If a schema, then used to validate all properties not matched by 'properties' or 'patternProperties'. If false, then any properties not matched by either will cause this schema to fail."),definitions:o.t("Not used for validation. Place subschemas here that you wish to reference inline with $ref."),properties:o.t("A map of property names to schemas for each property."),patternProperties:o.t("A map of regular expressions on property names to schemas for matching properties."),dependencies:o.t("A map of property names to either an array of property names or a schema. An array of property names means the property named in the key depends on the properties in the array being present in the object in order to be valid. If the value is a schema, then the schema is only applied to the object if the property in the key exists on the object."),enum:o.t("The set of literal values that are valid."),type:o.t("Either a string of one of the basic schema types (number, integer, null, array, object, boolean, string) or an array of strings specifying a subset of those types."),format:o.t("Describes the format expected for the value."),allOf:o.t("An array of schemas, all of which must match."),anyOf:o.t("An array of schemas, where at least one must match."),oneOf:o.t("An array of schemas, exactly one of which must match."),not:o.t("A schema which must not match."),$id:o.t("A unique identifier for the schema."),$ref:o.t("Reference a definition hosted on any location."),$comment:o.t("Comments from schema authors to readers or maintainers of the schema."),readOnly:o.t("Indicates that the value of the instance is managed exclusively by the owning authority."),examples:o.t("Sample JSON values associated with a particular schema, for the purpose of illustrating usage."),contains:o.t('An array instance is valid against "contains" if at least one of its elements is valid against the given schema.'),propertyNames:o.t("If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema."),const:o.t("An instance validates successfully against this keyword if its value is equal to the value of the keyword."),contentMediaType:o.t("Describes the media type of a string property."),contentEncoding:o.t("Describes the content encoding of a string property."),if:o.t('The validation outcome of the "if" subschema controls which of the "then" or "else" keywords are evaluated.'),then:o.t('The "if" subschema is used for validation when the "if" subschema succeeds.'),else:o.t('The "else" subschema is used for validation when the "if" subschema fails.')};for(const t in ye.schemas){const e=ye.schemas[t];for(const n in e.properties){let r=e.properties[n];typeof r=="boolean"&&(r=e.properties[n]={});const s=Pt[n];s&&(r.description=s)}}function Lt(t,e){if(typeof t!="string")throw new TypeError("Expected a string");const n=String(t);let r="";const s=!!e,i=!!e;let l=!1;const a=e&&typeof e.flags=="string"?e.flags:"";let h;for(let c=0,g=n.length;c<g;c++)switch(h=n[c],h){case"/":case"$":case"^":case"+":case".":case"(":case")":case"=":case"!":case"|":r+="\\"+h;break;case"?":if(s){r+=".";break}case"[":case"]":if(s){r+=h;break}case"{":if(s){l=!0,r+="(";break}case"}":if(s){l=!1,r+=")";break}case",":if(l){r+="|";break}r+="\\"+h;break;case"*":const f=n[c-1];let p=1;for(;n[c+1]==="*";)p++,c++;const k=n[c+1];i?p>1&&(f==="/"||f===void 0||f==="{"||f===",")&&(k==="/"||k===void 0||k===","||k==="}")?(k==="/"?c++:f==="/"&&r.endsWith("\\/")&&(r=r.substr(0,r.length-2)),r+="((?:[^/]*(?:/|$))*)"):r+="([^/]*)":r+=".*";break;default:r+=h}return(!a||!~a.indexOf("g"))&&(r="^"+r+"$"),new RegExp(r,a)}const Vt="!",Mt="/";class Ft{constructor(e,n,r){this.folderUri=n,this.uris=r,this.globWrappers=[];try{for(let s of e){const i=s[0]!==Vt;i||(s=s.substring(1)),s.length>0&&(s[0]===Mt&&(s=s.substring(1)),this.globWrappers.push({regexp:Lt("**/"+s,{extended:!0,globstar:!0}),include:i}))}n&&(n=We(n),n.endsWith("/")||(n=n+"/"),this.folderUri=n)}catch{this.globWrappers.length=0,this.uris=[]}}matchesPattern(e){if(this.folderUri&&!e.startsWith(this.folderUri))return!1;let n=!1;for(const{regexp:r,include:s}of this.globWrappers)r.test(e)&&(n=s);return n}getURIs(){return this.uris}}class $t{constructor(e,n,r){this.service=e,this.uri=n,this.dependencies=new Set,this.anchors=void 0,r&&(this.unresolvedSchema=this.service.promise.resolve(new ee(r)))}getUnresolvedSchema(){return this.unresolvedSchema||(this.unresolvedSchema=this.service.loadSchema(this.uri)),this.unresolvedSchema}getResolvedSchema(){return this.resolvedSchema||(this.resolvedSchema=this.getUnresolvedSchema().then(e=>this.service.resolveSchemaContent(e,this))),this.resolvedSchema}clearSchema(){const e=!!this.unresolvedSchema;return this.resolvedSchema=void 0,this.unresolvedSchema=void 0,this.dependencies.clear(),this.anchors=void 0,e}}class ee{constructor(e,n=[]){this.schema=e,this.errors=n}}class De{constructor(e,n=[],r=[],s){this.schema=e,this.errors=n,this.warnings=r,this.schemaDraft=s}getSection(e){const n=this.getSectionRecursive(e,this.schema);if(n)return j(n)}getSectionRecursive(e,n){if(!n||typeof n=="boolean"||e.length===0)return n;const r=e.shift();if(n.properties&&typeof n.properties[r])return this.getSectionRecursive(e,n.properties[r]);if(n.patternProperties)for(const s of Object.keys(n.patternProperties)){const i=le(s);if(i!=null&&i.test(r))return this.getSectionRecursive(e,n.patternProperties[s])}else{if(typeof n.additionalProperties=="object")return this.getSectionRecursive(e,n.additionalProperties);if(r.match("[0-9]+")){if(Array.isArray(n.items)){const s=parseInt(r,10);if(!isNaN(s)&&n.items[s])return this.getSectionRecursive(e,n.items[s])}else if(n.items)return this.getSectionRecursive(e,n.items)}}}}class Et{constructor(e,n,r){this.contextService=n,this.requestService=e,this.promiseConstructor=r||Promise,this.callOnDispose=[],this.contributionSchemas={},this.contributionAssociations=[],this.schemasById={},this.filePatternAssociations=[],this.registeredSchemasIds={}}getRegisteredSchemaIds(e){return Object.keys(this.registeredSchemasIds).filter(n=>{const r=o.URI.parse(n).scheme;return r!=="schemaservice"&&(!e||e(r))})}get promise(){return this.promiseConstructor}dispose(){for(;this.callOnDispose.length>0;)this.callOnDispose.pop()()}onResourceChange(e){this.cachedSchemaForResource=void 0;let n=!1;e=q(e);const r=[e],s=Object.keys(this.schemasById).map(i=>this.schemasById[i]);for(;r.length;){const i=r.pop();for(let l=0;l<s.length;l++){const a=s[l];a&&(a.uri===i||a.dependencies.has(i))&&(a.uri!==i&&r.push(a.uri),a.clearSchema()&&(n=!0),s[l]=void 0)}}return n}setSchemaContributions(e){if(e.schemas){const n=e.schemas;for(const r in n){const s=q(r);this.contributionSchemas[s]=this.addSchemaHandle(s,n[r])}}if(Array.isArray(e.schemaAssociations)){const n=e.schemaAssociations;for(let r of n){const s=r.uris.map(q),i=this.addFilePatternAssociation(r.pattern,r.folderUri,s);this.contributionAssociations.push(i)}}}addSchemaHandle(e,n){const r=new $t(this,e,n);return this.schemasById[e]=r,r}getOrAddSchemaHandle(e,n){return this.schemasById[e]||this.addSchemaHandle(e,n)}addFilePatternAssociation(e,n,r){const s=new Ft(e,n,r);return this.filePatternAssociations.push(s),s}registerExternalSchema(e){const n=q(e.uri);return this.registeredSchemasIds[n]=!0,this.cachedSchemaForResource=void 0,e.fileMatch&&e.fileMatch.length&&this.addFilePatternAssociation(e.fileMatch,e.folderUri,[n]),e.schema?this.addSchemaHandle(n,e.schema):this.getOrAddSchemaHandle(n)}clearExternalSchemas(){this.schemasById={},this.filePatternAssociations=[],this.registeredSchemasIds={},this.cachedSchemaForResource=void 0;for(const e in this.contributionSchemas)this.schemasById[e]=this.contributionSchemas[e],this.registeredSchemasIds[e]=!0;for(const e of this.contributionAssociations)this.filePatternAssociations.push(e)}getResolvedSchema(e){const n=q(e),r=this.schemasById[n];return r?r.getResolvedSchema():this.promise.resolve(void 0)}loadSchema(e){if(!this.requestService){const n=o.t("Unable to load schema from '{0}'. No schema request service available",C(e));return this.promise.resolve(new ee({},[n]))}return e.startsWith("http://json-schema.org/")&&(e="https"+e.substring(4)),this.requestService(e).then(n=>{if(!n){const l=o.t("Unable to load schema from '{0}': No content.",C(e));return new ee({},[l])}const r=[];n.charCodeAt(0)===65279&&(r.push(o.t("Problem reading content from '{0}': UTF-8 with BOM detected, only UTF 8 is allowed.",C(e))),n=n.trimStart());let s={};const i=[];return s=it(n,i),i.length&&r.push(o.t("Unable to parse content from '{0}': Parse error at offset {1}.",C(e),i[0].offset)),new ee(s,r)},n=>{let r=n.toString();const s=n.toString().split("Error: ");return s.length>1&&(r=s[1]),te(r,".")&&(r=r.substr(0,r.length-1)),new ee({},[o.t("Unable to load schema from '{0}': {1}.",C(e),r)])})}resolveSchemaContent(e,n){const r=e.errors.slice(0),s=e.schema;let i=s.$schema?q(s.$schema):void 0;if(i==="http://json-schema.org/draft-03/schema")return this.promise.resolve(new De({},[o.t("Draft-03 schemas are not supported.")],[],i));let l=new Set;const a=this.contextService,h=(b,y)=>{y=decodeURIComponent(y);let T=b;return y[0]==="/"&&(y=y.substring(1)),y.split("/").some(N=>(N=N.replace(/~1/g,"/").replace(/~0/g,"~"),T=T[N],!T)),T},c=(b,y,T)=>(y.anchors||(y.anchors=m(b)),y.anchors.get(T)),g=(b,y)=>{for(const T in y)y.hasOwnProperty(T)&&T!=="id"&&T!=="$id"&&(b[T]=y[T])},f=(b,y,T,N)=>{let u;N===void 0||N.length===0?u=y:N.charAt(0)==="/"?u=h(y,N):u=c(y,T,N),u?g(b,u):r.push(o.t("$ref '{0}' in '{1}' can not be resolved.",N||"",T.uri))},p=(b,y,T,N)=>{a&&!/^[A-Za-z][A-Za-z0-9+\-.+]*:\/\/.*/.test(y)&&(y=a.resolveRelativePath(y,N.uri)),y=q(y);const u=this.getOrAddSchemaHandle(y);return u.getUnresolvedSchema().then(v=>{if(N.dependencies.add(y),v.errors.length){const d=T?y+"#"+T:y;r.push(o.t("Problems loading reference '{0}': {1}",d,v.errors[0]))}return f(b,v.schema,u,T),k(b,v.schema,u)})},k=(b,y,T)=>{const N=[];return this.traverseNodes(b,u=>{const v=new Set;for(;u.$ref;){const d=u.$ref,S=d.split("#",2);if(delete u.$ref,S[0].length>0){N.push(p(u,S[0],S[1],T));return}else if(!v.has(d)){const A=S[1];f(u,y,T,A),v.add(d)}}u.$recursiveRef&&l.add("$recursiveRef"),u.$dynamicRef&&l.add("$dynamicRef")}),this.promise.all(N)},m=b=>{const y=new Map;return this.traverseNodes(b,T=>{const N=T.$id||T.id,u=Ue(N)&&N.charAt(0)==="#"?N.substring(1):T.$anchor;u&&(y.has(u)?r.push(o.t("Duplicate anchor declaration: '{0}'",u)):y.set(u,T)),T.$recursiveAnchor&&l.add("$recursiveAnchor"),T.$dynamicAnchor&&l.add("$dynamicAnchor")}),y};return k(s,s,n).then(b=>{let y=[];return l.size&&y.push(o.t("The schema uses meta-schema features ({0}) that are not yet supported by the validator.",Array.from(l.keys()).join(", "))),new De(s,r,y,i)})}traverseNodes(e,n){if(!e||typeof e!="object")return Promise.resolve(null);const r=new Set,s=(...g)=>{for(const f of g)K(f)&&h.push(f)},i=(...g)=>{for(const f of g)if(K(f))for(const p in f){const m=f[p];K(m)&&h.push(m)}},l=(...g)=>{for(const f of g)if(Array.isArray(f))for(const p of f)K(p)&&h.push(p)},a=g=>{if(Array.isArray(g))for(const f of g)K(f)&&h.push(f);else K(g)&&h.push(g)},h=[e];let c=h.pop();for(;c;)r.has(c)||(r.add(c),n(c),s(c.additionalItems,c.additionalProperties,c.not,c.contains,c.propertyNames,c.if,c.then,c.else,c.unevaluatedItems,c.unevaluatedProperties),i(c.definitions,c.$defs,c.properties,c.patternProperties,c.dependencies,c.dependentSchemas),l(c.anyOf,c.allOf,c.oneOf,c.prefixItems),a(c.items)),c=h.pop()}getSchemaFromProperty(e,n){var r,s;if(((r=n.root)==null?void 0:r.type)==="object"){for(const i of n.root.properties)if(i.keyNode.value==="$schema"&&((s=i.valueNode)==null?void 0:s.type)==="string"){let l=i.valueNode.value;return this.contextService&&!/^\w[\w\d+.-]*:/.test(l)&&(l=this.contextService.resolveRelativePath(l,e)),l}}}getAssociatedSchemas(e){const n=Object.create(null),r=[],s=We(e);for(const i of this.filePatternAssociations)if(i.matchesPattern(s))for(const l of i.getURIs())n[l]||(r.push(l),n[l]=!0);return r}getSchemaURIsForResource(e,n){let r=n&&this.getSchemaFromProperty(e,n);return r?[r]:this.getAssociatedSchemas(e)}getSchemaForResource(e,n){if(n){let i=this.getSchemaFromProperty(e,n);if(i){const l=q(i);return this.getOrAddSchemaHandle(l).getResolvedSchema()}}if(this.cachedSchemaForResource&&this.cachedSchemaForResource.resource===e)return this.cachedSchemaForResource.resolvedSchema;const r=this.getAssociatedSchemas(e),s=r.length>0?this.createCombinedSchema(e,r).getResolvedSchema():this.promise.resolve(void 0);return this.cachedSchemaForResource={resource:e,resolvedSchema:s},s}createCombinedSchema(e,n){if(n.length===1)return this.getOrAddSchemaHandle(n[0]);{const r="schemaservice://combinedSchema/"+encodeURIComponent(e),s={allOf:n.map(i=>({$ref:i}))};return this.addSchemaHandle(r,s)}}getMatchingSchemas(e,n,r){if(r){const s=r.id||"schemaservice://untitled/matchingSchemas/"+Dt++;return this.addSchemaHandle(s,r).getResolvedSchema().then(l=>n.getMatchingSchemas(l.schema).filter(a=>!a.inverted))}return this.getSchemaForResource(e.uri,n).then(s=>s?n.getMatchingSchemas(s.schema).filter(i=>!i.inverted):[])}}let Dt=0;function q(t){try{return o.URI.parse(t).toString(!0)}catch{return t}}function We(t){try{return o.URI.parse(t).with({fragment:null,query:null}).toString(!0)}catch{return t}}function C(t){try{const e=o.URI.parse(t);if(e.scheme==="file")return e.fsPath}catch{}return t}function jt(t,e){const n=[],r=[],s=[];let i=-1;const l=W(t.getText(),!1);let a=l.scan();function h(m){n.push(m),r.push(s.length)}for(;a!==17;){switch(a){case 1:case 3:{const m=t.positionAt(l.getTokenOffset()).line,b={startLine:m,endLine:m,kind:a===1?"object":"array"};s.push(b);break}case 2:case 4:{const m=a===2?"object":"array";if(s.length>0&&s[s.length-1].kind===m){const b=s.pop(),y=t.positionAt(l.getTokenOffset()).line;b&&y>b.startLine+1&&i!==b.startLine&&(b.endLine=y-1,h(b),i=b.startLine)}break}case 13:{const m=t.positionAt(l.getTokenOffset()).line,b=t.positionAt(l.getTokenOffset()+l.getTokenLength()).line;l.getTokenError()===1&&m+1<t.lineCount?l.setPosition(t.offsetAt(o.Position.create(m+1,0))):m<b&&(h({startLine:m,endLine:b,kind:o.FoldingRangeKind.Comment}),i=m);break}case 12:{const b=t.getText().substr(l.getTokenOffset(),l.getTokenLength()).match(/^\/\/\s*#(region\b)|(endregion\b)/);if(b){const y=t.positionAt(l.getTokenOffset()).line;if(b[1]){const T={startLine:y,endLine:y,kind:o.FoldingRangeKind.Region};s.push(T)}else{let T=s.length-1;for(;T>=0&&s[T].kind!==o.FoldingRangeKind.Region;)T--;if(T>=0){const N=s[T];s.length=T,y>N.startLine&&i!==N.startLine&&(N.endLine=y,h(N),i=N.startLine)}}}break}}a=l.scan()}const c=e&&e.rangeLimit;if(typeof c!="number"||n.length<=c)return n;e&&e.onRangeLimitExceeded&&e.onRangeLimitExceeded(t.uri);const g=[];for(let m of r)m<30&&(g[m]=(g[m]||0)+1);let f=0,p=0;for(let m=0;m<g.length;m++){const b=g[m];if(b){if(b+f>c){p=m;break}f+=b}}const k=[];for(let m=0;m<n.length;m++){const b=r[m];typeof b=="number"&&(b<p||b===p&&f++<c)&&k.push(n[m])}return k}function _t(t,e,n){function r(a){let h=t.offsetAt(a),c=n.getNodeFromOffset(h,!0);const g=[];for(;c;){switch(c.type){case"string":case"object":case"array":const p=c.offset+1,k=c.offset+c.length-1;p<k&&h>=p&&h<=k&&g.push(s(p,k)),g.push(s(c.offset,c.offset+c.length));break;case"number":case"boolean":case"null":case"property":g.push(s(c.offset,c.offset+c.length));break}if(c.type==="property"||c.parent&&c.parent.type==="array"){const p=l(c.offset+c.length,5);p!==-1&&g.push(s(c.offset,p))}c=c.parent}let f;for(let p=g.length-1;p>=0;p--)f=o.SelectionRange.create(g[p],f);return f||(f=o.SelectionRange.create(o.Range.create(a,a))),f}function s(a,h){return o.Range.create(t.positionAt(a),t.positionAt(h))}const i=W(t.getText(),!0);function l(a,h){return i.setPosition(a),i.scan()===h?i.getTokenOffset()+i.getTokenLength():-1}return e.map(r)}function be(t,e,n){let r;if(n){const i=t.offsetAt(n.start),l=t.offsetAt(n.end)-i;r={offset:i,length:l}}const s={tabSize:e?e.tabSize:4,insertSpaces:(e==null?void 0:e.insertSpaces)===!0,insertFinalNewline:(e==null?void 0:e.insertFinalNewline)===!0,eol:`
31
+ `,keepLines:(e==null?void 0:e.keepLines)===!0};return lt(t.getText(),r,s).map(i=>o.TextEdit.replace(o.Range.create(t.positionAt(i.offset),t.positionAt(i.offset+i.length)),i.content))}var F;(function(t){t[t.Object=0]="Object",t[t.Array=1]="Array"})(F||(F={}));class oe{constructor(e,n){this.propertyName=e??"",this.beginningLineNumber=n,this.childrenProperties=[],this.lastProperty=!1,this.noKeyName=!1}addChildProperty(e){if(e.parent=this,this.childrenProperties.length>0){let n=0;e.noKeyName?n=this.childrenProperties.length:n=Ut(this.childrenProperties,e,Rt),n<0&&(n=n*-1-1),this.childrenProperties.splice(n,0,e)}else this.childrenProperties.push(e);return e}}function Rt(t,e){const n=t.propertyName.toLowerCase(),r=e.propertyName.toLowerCase();return n<r?-1:n>r?1:0}function Ut(t,e,n){const r=e.propertyName.toLowerCase(),s=t[0].propertyName.toLowerCase(),i=t[t.length-1].propertyName.toLowerCase();if(r<s)return 0;if(r>i)return t.length;let l=0,a=t.length-1;for(;l<=a;){let h=a+l>>1,c=n(e,t[h]);if(c>0)l=h+1;else if(c<0)a=h-1;else return h}return-l-1}function Bt(t,e){const n={...e,keepLines:!1},r=o.TextDocument.applyEdits(t,be(t,n,void 0)),s=o.TextDocument.create("test://test.json","json",0,r),i=Jt(s),l=qt(s,i),a=be(l,n,void 0),h=o.TextDocument.applyEdits(l,a);return[o.TextEdit.replace(o.Range.create(o.Position.create(0,0),t.positionAt(t.getText().length)),h)]}function Jt(t){const e=t.getText(),n=W(e,!1);let r=new oe,s=r,i=r,l=r,a,h=0,c=0,g,f,p=-1,k=-1,m=0,b=0,y=[],T=!1,N=!1;for(;(a=n.scan())!==17;){if(T===!0&&a!==14&&a!==15&&a!==12&&a!==13&&i.endLineNumber===void 0){let u=n.getTokenStartLine();f===2||f===4?l.endLineNumber=u-1:i.endLineNumber=u-1,m=u,T=!1}if(N===!0&&a!==14&&a!==15&&a!==12&&a!==13&&(m=n.getTokenStartLine(),N=!1),n.getTokenStartLine()!==h){for(let u=h;u<n.getTokenStartLine();u++){const v=t.getText(o.Range.create(o.Position.create(u,0),o.Position.create(u+1,0))).length;c=c+v}h=n.getTokenStartLine()}switch(a){case 10:{if(g===void 0||g===1||g===5&&y[y.length-1]===F.Object){const u=new oe(n.getTokenValue(),m);l=i,i=s.addChildProperty(u)}break}case 3:{if(r.beginningLineNumber===void 0&&(r.beginningLineNumber=n.getTokenStartLine()),y[y.length-1]===F.Object)s=i;else if(y[y.length-1]===F.Array){const u=new oe(n.getTokenValue(),m);u.noKeyName=!0,l=i,i=s.addChildProperty(u),s=i}y.push(F.Array),i.type=F.Array,m=n.getTokenStartLine(),m++;break}case 1:{if(r.beginningLineNumber===void 0)r.beginningLineNumber=n.getTokenStartLine();else if(y[y.length-1]===F.Array){const u=new oe(n.getTokenValue(),m);u.noKeyName=!0,l=i,i=s.addChildProperty(u)}i.type=F.Object,y.push(F.Object),s=i,m=n.getTokenStartLine(),m++;break}case 4:{b=n.getTokenStartLine(),y.pop(),i.endLineNumber===void 0&&(g===2||g===4)&&(i.endLineNumber=b-1,i.lastProperty=!0,i.lineWhereToAddComma=p,i.indexWhereToAddComa=k,l=i,i=i?i.parent:void 0,s=i),r.endLineNumber=b,m=b+1;break}case 2:{b=n.getTokenStartLine(),y.pop(),g!==1&&(i.endLineNumber===void 0&&(i.endLineNumber=b-1,i.lastProperty=!0,i.lineWhereToAddComma=p,i.indexWhereToAddComa=k),l=i,i=i?i.parent:void 0,s=i),r.endLineNumber=n.getTokenStartLine(),m=b+1;break}case 5:{b=n.getTokenStartLine(),i.endLineNumber===void 0&&(y[y.length-1]===F.Object||y[y.length-1]===F.Array&&(g===2||g===4))&&(i.endLineNumber=b,i.commaIndex=n.getTokenOffset()-c,i.commaLine=b),(g===2||g===4)&&(l=i,i=i?i.parent:void 0,s=i),m=b+1;break}case 13:{g===5&&p===n.getTokenStartLine()&&(y[y.length-1]===F.Array&&(f===2||f===4)||y[y.length-1]===F.Object)&&(y[y.length-1]===F.Array&&(f===2||f===4)||y[y.length-1]===F.Object)&&(i.endLineNumber=void 0,T=!0),(g===1||g===3)&&p===n.getTokenStartLine()&&(N=!0);break}}a!==14&&a!==13&&a!==12&&a!==15&&(f=g,g=a,p=n.getTokenStartLine(),k=n.getTokenOffset()+n.getTokenLength()-c)}return r}function qt(t,e){if(e.childrenProperties.length===0)return t;const n=o.TextDocument.create("test://test.json","json",0,t.getText()),r=[];for(je(r,e,e.beginningLineNumber);r.length>0;){const s=r.shift(),i=s.propertyTreeArray;let l=s.beginningLineNumber;for(let a=0;a<i.length;a++){const h=i[a],c=o.Range.create(o.Position.create(h.beginningLineNumber,0),o.Position.create(h.endLineNumber+1,0)),g=t.getText(c),f=o.TextDocument.create("test://test.json","json",0,g);if(h.lastProperty===!0&&a!==i.length-1){const m=h.lineWhereToAddComma-h.beginningLineNumber,b=h.indexWhereToAddComa,y={range:o.Range.create(o.Position.create(m,b),o.Position.create(m,b)),text:","};o.TextDocument.update(f,[y],1)}else if(h.lastProperty===!1&&a===i.length-1){const m=h.commaIndex,y=h.commaLine-h.beginningLineNumber,T={range:o.Range.create(o.Position.create(y,m),o.Position.create(y,m+1)),text:""};o.TextDocument.update(f,[T],1)}const p=h.endLineNumber-h.beginningLineNumber+1,k={range:o.Range.create(o.Position.create(l,0),o.Position.create(l+p,0)),text:f.getText()};o.TextDocument.update(n,[k],1),je(r,h,l),l=l+p}}return n}function je(t,e,n){if(e.childrenProperties.length!==0)if(e.type===F.Object){let r=1/0;for(const i of e.childrenProperties)i.beginningLineNumber<r&&(r=i.beginningLineNumber);const s=r-e.beginningLineNumber;n=n+s,t.push(new He(n,e.childrenProperties))}else e.type===F.Array&&ze(t,e,n)}function ze(t,e,n){for(const r of e.childrenProperties){if(r.type===F.Object){let s=1/0;for(const l of r.childrenProperties)l.beginningLineNumber<s&&(s=l.beginningLineNumber);const i=s-r.beginningLineNumber;t.push(new He(n+r.beginningLineNumber-e.beginningLineNumber+i,r.childrenProperties))}r.type===F.Array&&ze(t,r,n+r.beginningLineNumber-e.beginningLineNumber)}}class He{constructor(e,n){this.beginningLineNumber=e,this.propertyTreeArray=n}}function Kt(t,e){const n=[];return e.visit(r=>{var s;if(r.type==="property"&&r.keyNode.value==="$ref"&&((s=r.valueNode)==null?void 0:s.type)==="string"){const i=r.valueNode.value,l=zt(e,i);if(l){const a=t.positionAt(l.offset);n.push({target:`${t.uri}#${a.line+1},${a.character+1}`,range:Wt(t,r.valueNode)})}}return!0}),Promise.resolve(n)}function Wt(t,e){return o.Range.create(t.positionAt(e.offset+1),t.positionAt(e.offset+e.length-1))}function zt(t,e){const n=Ht(e);return n?ke(n,t.root):null}function ke(t,e){if(!e)return null;if(t.length===0)return e;const n=t.shift();if(e&&e.type==="object"){const r=e.properties.find(s=>s.keyNode.value===n);return r?ke(t,r.valueNode):null}else if(e&&e.type==="array"&&n.match(/^(0|[1-9][0-9]*)$/)){const r=Number.parseInt(n),s=e.items[r];return s?ke(t,s):null}return null}function Ht(t){return t==="#"?[]:t[0]!=="#"||t[1]!=="/"?null:t.substring(2).split(/\//).map(Gt)}function Gt(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Zt(t){const e=t.promiseConstructor||Promise,n=new Et(t.schemaRequestService,t.workspaceContext,e);n.setSchemaContributions(ye);const r=new kt(n,t.contributions,e,t.clientCapabilities),s=new vt(n,t.contributions,e),i=new It(n),l=new Tt(n,e);return{configure:a=>{var h;n.clearExternalSchemas(),(h=a.schemas)==null||h.forEach(n.registerExternalSchema.bind(n)),l.configure(a)},resetSchema:a=>n.onResourceChange(a),doValidation:l.doValidation.bind(l),getLanguageStatus:l.getLanguageStatus.bind(l),parseJSONDocument:a=>bt(a,{collectComments:!0}),newJSONDocument:(a,h)=>yt(a,h),getMatchingSchemas:n.getMatchingSchemas.bind(n),doResolve:r.doResolve.bind(r),doComplete:r.doComplete.bind(r),findDocumentSymbols:i.findDocumentSymbols.bind(i),findDocumentSymbols2:i.findDocumentSymbols2.bind(i),findDocumentColors:i.findDocumentColors.bind(i),getColorPresentations:i.getColorPresentations.bind(i),doHover:s.doHover.bind(s),getFoldingRanges:jt,getSelectionRanges:_t,findDefinition:()=>Promise.resolve([]),findLinks:Kt,format:(a,h,c)=>be(a,c,h),sort:(a,h)=>Bt(a,h)}}let Ge;typeof fetch<"u"&&(Ge=function(t){return fetch(t).then(e=>e.text())});class Xt{constructor(e,n){this._ctx=e,this._languageSettings=n.languageSettings,this._languageId=n.languageId,this._languageService=Zt({workspaceContext:{resolveRelativePath:(r,s)=>{const i=s.substr(0,s.lastIndexOf("/")+1);return Ct(i,r)}},schemaRequestService:n.enableSchemaRequest?Ge:void 0,clientCapabilities:he.LATEST}),this._languageService.configure(this._languageSettings)}async doValidation(e){let n=this._getTextDocument(e);if(n){let r=this._languageService.parseJSONDocument(n);return this._languageService.doValidation(n,r,this._languageSettings)}return Promise.resolve([])}async doComplete(e,n){let r=this._getTextDocument(e);if(!r)return null;let s=this._languageService.parseJSONDocument(r);return this._languageService.doComplete(r,n,s)}async doResolve(e){return this._languageService.doResolve(e)}async doHover(e,n){let r=this._getTextDocument(e);if(!r)return null;let s=this._languageService.parseJSONDocument(r);return this._languageService.doHover(r,n,s)}async format(e,n,r){let s=this._getTextDocument(e);if(!s)return[];let i=this._languageService.format(s,n,r);return Promise.resolve(i)}async resetSchema(e){return Promise.resolve(this._languageService.resetSchema(e))}async findDocumentSymbols(e){let n=this._getTextDocument(e);if(!n)return[];let r=this._languageService.parseJSONDocument(n),s=this._languageService.findDocumentSymbols2(n,r);return Promise.resolve(s)}async findDocumentColors(e){let n=this._getTextDocument(e);if(!n)return[];let r=this._languageService.parseJSONDocument(n),s=this._languageService.findDocumentColors(n,r);return Promise.resolve(s)}async getColorPresentations(e,n,r){let s=this._getTextDocument(e);if(!s)return[];let i=this._languageService.parseJSONDocument(s),l=this._languageService.getColorPresentations(s,i,n,r);return Promise.resolve(l)}async getFoldingRanges(e,n){let r=this._getTextDocument(e);if(!r)return[];let s=this._languageService.getFoldingRanges(r,n);return Promise.resolve(s)}async getSelectionRanges(e,n){let r=this._getTextDocument(e);if(!r)return[];let s=this._languageService.parseJSONDocument(r),i=this._languageService.getSelectionRanges(r,n,s);return Promise.resolve(i)}async parseJSONDocument(e){let n=this._getTextDocument(e);if(!n)return null;let r=this._languageService.parseJSONDocument(n);return Promise.resolve(r)}async getMatchingSchemas(e){let n=this._getTextDocument(e);if(!n)return[];let r=this._languageService.parseJSONDocument(n);return Promise.resolve(this._languageService.getMatchingSchemas(n,r))}_getTextDocument(e){let n=this._ctx.getMirrorModels();for(let r of n)if(r.uri.toString()===e)return o.TextDocument.create(e,this._languageId,r.version,r.getValue());return null}}const Qt=47,pe=46;function Yt(t){return t.charCodeAt(0)===Qt}function Ct(t,e){if(Yt(e)){const n=o.URI.parse(t),r=e.split("/");return n.with({path:Ze(r)}).toString()}return en(t,e)}function Ze(t){const e=[];for(const r of t)r.length===0||r.length===1&&r.charCodeAt(0)===pe||(r.length===2&&r.charCodeAt(0)===pe&&r.charCodeAt(1)===pe?e.pop():e.push(r));t.length>1&&t[t.length-1].length===0&&e.push("");let n=e.join("/");return t[0].length===0&&(n="/"+n),n}function en(t,...e){const n=o.URI.parse(t),r=n.path.split("/");for(let s of e)r.push(...s.split("/"));return n.with({path:Ze(r)}).toString()}self.onmessage=()=>{Xe.initialize((t,e)=>new Xt(t,e))};