securityos/public/Program Files/MonacoEditor/vs/language/json/jsonMode.js

16 lines
39 KiB
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
/*!-----------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Version: 0.32.1(29a273516805a852aa8edc5e05059f119b13eff0)
* Released under the MIT license
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
*-----------------------------------------------------------------------------*/
define("vs/language/json/jsonMode", ["require","require"],(require)=>{
var moduleExports=(()=>{var Tn=Object.create;var X=Object.defineProperty;var bn=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var wn=Object.getPrototypeOf,In=Object.prototype.hasOwnProperty;var Te=e=>X(e,"__esModule",{value:!0});var xn=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,i)=>(typeof require!="undefined"?require:t)[i]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var En=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_n=(e,t)=>{for(var i in t)X(e,i,{get:t[i],enumerable:!0})},Y=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Cn(t))!In.call(e,n)&&(i||n!=="default")&&X(e,n,{get:()=>t[n],enumerable:!(r=bn(t,n))||r.enumerable});return e},be=(e,t)=>Y(Te(X(e!=null?Tn(wn(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),An=(e=>(t,i)=>e&&e.get(t)||(i=Y(Te({}),t,1),e&&e.set(t,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var we=En((gr,Ce)=>{var Pn=be(xn("vs/editor/editor.api"));Ce.exports=Pn});var dr={};_n(dr,{CompletionAdapter:()=>ie,DefinitionAdapter:()=>tn,DiagnosticsAdapter:()=>te,DocumentColorAdapter:()=>ce,DocumentFormattingEditProvider:()=>se,DocumentHighlightAdapter:()=>rn,DocumentLinkAdapter:()=>un,DocumentRangeFormattingEditProvider:()=>ue,DocumentSymbolAdapter:()=>oe,FoldingRangeAdapter:()=>le,HoverAdapter:()=>ae,ReferenceAdapter:()=>on,RenameAdapter:()=>sn,SelectionRangeAdapter:()=>de,WorkerManager:()=>V,fromPosition:()=>S,fromRange:()=>ke,setupMode:()=>cr,toRange:()=>C,toTextEdit:()=>M});var l={};Y(l,be(we()));var Sn=2*60*1e3,V=class{_defaults;_idleCheckInterval;_lastUsedTime;_configChangeListener;_worker;_client;constructor(t){this._defaults=t,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){if(!this._worker)return;Date.now()-this._lastUsedTime>Sn&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||(this._worker=l.editor.createWebWorker({moduleId:"vs/language/json/jsonWorker",label:this._defaults.languageId,createData:{languageSettings:this._defaults.diagnosticsOptions,languageId:this._defaults.languageId,enableSchemaRequest:this._defaults.diagnosticsOptions.enableSchemaRequest}}),this._client=this._worker.getProxy()),this._client}getLanguageServiceWorker(...t){let i;return this._getClient().then(r=>{i=r}).then(r=>{if(this._worker)return this._worker.withSyncedResources(t)}).then(r=>i)}};var Ie;(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647})(Ie||(Ie={}));var G;(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647})(G||(G={}));var _;(function(e){function t(r,n){return r===Number.MAX_VALUE&&(r=G.MAX_VALUE),n===Number.MAX_VALUE&&(n=G.MAX_VALUE),{line:r,character:n}}e.create=t;function i(r){var n=r;return s.objectLiteral(n)&&s.uinteger(n.line)&&s.uinteger(n.character)}e.is=i})(_||(_={}));var k;(function(e){function t(r,n,a,o){if(s.uinteger(r)&&s.uinteger(n)&&s.uinteger(a)&&s.uinteger(o))return{start:_.create(r,n),end:_.create(a,o)};if(_.is(r)&&_.is(n))return{start:r,end:n};throw new Error("Range#create called with invalid arguments["+r+", "+n+", "+a+", "+o+"]")}e.create=t;function i(r){var n=r;return s.objectLiteral(n)&&_.is(n.start)&&_.is(n.end)}e.is=i})(k||(k={}));var ge;(function(e){function t(r,n){return{uri:r,range:n}}e.create=t;function i(r){var n=r;return s.defined(n)&&k.is(n.range)&&(s.string(n.uri)||s.undefined(n.uri))}e.is=i})(ge||(ge={}));var xe;(function(e){function t(r,n,a,o){return{targetUri:r,targetRange:n,targetSelectionRange:a,originSelectionRange:o}}e.create=t;function i(r){var n=r;return s.defined(n)&&k.is(n.targetRange)&&s.string(n.targetUri)
`,a==="\r"&&n+1<i.length&&i.charAt(n+1)===`
`&&n++}r&&i.length>0&&t.push(i.length),this._lineOffsets=t}return this._lineOffsets},e.prototype.positionAt=function(t){t=Math.max(Math.min(t,this._content.length),0);var i=this.getLineOffsets(),r=0,n=i.length;if(n===0)return _.create(0,t);for(;r<n;){var a=Math.floor((r+n)/2);i[a]>t?n=a:r=a+1}var o=r-1;return _.create(o,t-i[o])},e.prototype.offsetAt=function(t){var i=this.getLineOffsets();if(t.line>=i.length)return this._content.length;if(t.line<0)return 0;var r=i[t.line],n=t.line+1<i.length?i[t.line+1]:this._content.length;return Math.max(Math.min(r+t.character,n),r)},Object.defineProperty(e.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),e}(),s;(function(e){var t=Object.prototype.toString;function i(g){return typeof g<"u"}e.defined=i;function r(g){return typeof g>"u"}e.undefined=r;function n(g){return g===!0||g===!1}e.boolean=n;function a(g){return t.call(g)==="[object String]"}e.string=a;function o(g){return t.call(g)==="[object Number]"}e.number=o;function u(g,E,R){return t.call(g)==="[object Number]"&&E<=g&&g<=R}e.numberRange=u;function c(g){return t.call(g)==="[object Number]"&&-2147483648<=g&&g<=2147483647}e.integer=c;function h(g){return t.call(g)==="[object Number]"&&0<=g&&g<=2147483647}e.uinteger=h;function p(g){return t.call(g)==="[object Function]"}e.func=p;function d(g){return g!==null&&typeof g=="object"}e.objectLiteral=d;function b(g,E){return Array.isArray(g)&&g.every(E)}e.typedArray=b})(s||(s={}));var te=class{constructor(t,i,r){this._languageId=t;this._worker=i;let n=o=>{let u=o.getLanguageId();if(u!==this._languageId)return;let c;this._listener[o.uri.toString()]=o.onDidChangeContent(()=>{window.clearTimeout(c),c=window.setTimeout(()=>this._doValidate(o.uri,u),500)}),this._doValidate(o.uri,u)},a=o=>{l.editor.setModelMarkers(o,this._languageId,[]);let u=o.uri.toString(),c=this._listener[u];c&&(c.dispose(),delete this._listener[u])};this._disposables.push(l.editor.onDidCreateModel(n)),this._disposables.push(l.editor.onWillDisposeModel(a)),this._disposables.push(l.editor.onDidChangeModelLanguage(o=>{a(o.model),n(o.model)})),this._disposables.push(r(o=>{l.editor.getModels().forEach(u=>{u.getLanguageId()===this._languageId&&(a(u),n(u))})})),this._disposables.push({dispose:()=>{l.editor.getModels().forEach(a);for(let o in this._listener)this._listener[o].dispose()}}),l.editor.getModels().forEach(n)}_disposables=[];_listener=Object.create(null);dispose(){this._disposables.forEach(t=>t&&t.dispose()),this._disposables.length=0}_doValidate(t,i){this._worker(t).then(r=>r.doValidation(t.toString())).then(r=>{let n=r.map(o=>Wn(t,o)),a=l.editor.getModel(t);a&&a.getLanguageId()===i&&l.editor.setModelMarkers(a,i,n)}).then(void 0,r=>{console.error(r)})}};function Rn(e){switch(e){case O.Error:return l.MarkerSeverity.Error;case O.Warning:return l.MarkerSeverity.Warning;case O.Information:return l.MarkerSeverity.Info;case O.Hint:return l.MarkerSeverity.Hint;default:return l.MarkerSeverity.Info}}function Wn(e,t){let i=typeof t.code=="number"?String(t.code):t.code;return{severity:Rn(t.severity),startLineNumber:t.range.start.line+1,startColumn:t.range.start.character+1,endLineNumber:t.range.end.line+1,endColumn:t.range.end.character+1,message:t.message,code:i,source:t.source}}var ie=class{constructor(t,i){this._worker=t;this._triggerCharacters=i}get triggerCharacters(){return this._triggerCharacters}provideCompletionItems(t,i,r,n){let a=t.uri;return this._worker(a).then(o=>o.doComplete(a.toString(),S(i))).then(o=>{if(!o)return;let u=t.getWordUntilPosition(i),c=new l.Range(i.lineNumber,u.startColumn,i.lineNumber,u.endColumn),h=o.items.map(p=>{let d={label:p.label,insertText:p.insertText||p.label,sortText:p.sortText,filterText:p.filterText,documentation:p.documentation,detail:p.detail,command:Mn(p.command),range:c,kind:Nn(p.kind)};return p.textEdit&&(Dn(p.textEdit)?d.range={insert:C(p.textEdit.insert),replace:C(p.textEdit.replace)}:d.range=C(p.textEdit.range),d.insertText=p.textEdit.newText),p.additionalTextEdits&&(d.additionalTextEdits=p.additionalTextEdits.map(M)),p.
`+e.value+"\n```\n"}}function jn(e){if(!!e)return Array.isArray(e)?e.map(nn):[nn(e)]}var rn=class{constructor(t){this._worker=t}provideDocumentHighlights(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.findDocumentHighlights(n.toString(),S(i))).then(a=>{if(!!a)return a.map(o=>({range:C(o.range),kind:Un(o.kind)}))})}};function Un(e){switch(e){case N.Read:return l.languages.DocumentHighlightKind.Read;case N.Write:return l.languages.DocumentHighlightKind.Write;case N.Text:return l.languages.DocumentHighlightKind.Text}return l.languages.DocumentHighlightKind.Text}var tn=class{constructor(t){this._worker=t}provideDefinition(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.findDefinition(n.toString(),S(i))).then(a=>{if(!!a)return[an(a)]})}};function an(e){return{uri:l.Uri.parse(e.uri),range:C(e.range)}}var on=class{constructor(t){this._worker=t}provideReferences(t,i,r,n){let a=t.uri;return this._worker(a).then(o=>o.findReferences(a.toString(),S(i))).then(o=>{if(!!o)return o.map(an)})}},sn=class{constructor(t){this._worker=t}provideRenameEdits(t,i,r,n){let a=t.uri;return this._worker(a).then(o=>o.doRename(a.toString(),S(i),r)).then(o=>Vn(o))}};function Vn(e){if(!e||!e.changes)return;let t=[];for(let i in e.changes){let r=l.Uri.parse(i);for(let n of e.changes[i])t.push({resource:r,edit:{range:C(n.range),text:n.newText}})}return{edits:t}}var oe=class{constructor(t){this._worker=t}provideDocumentSymbols(t,i){let r=t.uri;return this._worker(r).then(n=>n.findDocumentSymbols(r.toString())).then(n=>{if(!!n)return n.map(a=>({name:a.name,detail:"",containerName:a.containerName,kind:Kn(a.kind),range:C(a.location.range),selectionRange:C(a.location.range),tags:[]}))})}};function Kn(e){let t=l.languages.SymbolKind;switch(e){case v.File:return t.Array;case v.Module:return t.Module;case v.Namespace:return t.Namespace;case v.Package:return t.Package;case v.Class:return t.Class;case v.Method:return t.Method;case v.Property:return t.Property;case v.Field:return t.Field;case v.Constructor:return t.Constructor;case v.Enum:return t.Enum;case v.Interface:return t.Interface;case v.Function:return t.Function;case v.Variable:return t.Variable;case v.Constant:return t.Constant;case v.String:return t.String;case v.Number:return t.Number;case v.Boolean:return t.Boolean;case v.Array:return t.Array}return t.Function}var un=class{constructor(t){this._worker=t}provideLinks(t,i){let r=t.uri;return this._worker(r).then(n=>n.findDocumentLinks(r.toString())).then(n=>{if(!!n)return{links:n.map(a=>({range:C(a.range),url:a.target}))}})}},se=class{constructor(t){this._worker=t}provideDocumentFormattingEdits(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.format(n.toString(),null,cn(i)).then(o=>{if(!(!o||o.length===0))return o.map(M)}))}},ue=class{constructor(t){this._worker=t}provideDocumentRangeFormattingEdits(t,i,r,n){let a=t.uri;return this._worker(a).then(o=>o.format(a.toString(),ke(i),cn(r)).then(u=>{if(!(!u||u.length===0))return u.map(M)}))}};function cn(e){return{tabSize:e.tabSize,insertSpaces:e.insertSpaces}}var ce=class{constructor(t){this._worker=t}provideDocumentColors(t,i){let r=t.uri;return this._worker(r).then(n=>n.findDocumentColors(r.toString())).then(n=>{if(!!n)return n.map(a=>({color:a.color,range:C(a.range)}))})}provideColorPresentations(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.getColorPresentations(n.toString(),i.color,ke(i.range))).then(a=>{if(!!a)return a.map(o=>{let u={label:o.label};return o.textEdit&&(u.textEdit=M(o.textEdit)),o.additionalTextEdits&&(u.additionalTextEdits=o.additionalTextEdits.map(M)),u})})}},le=class{constructor(t){this._worker=t}provideFoldingRanges(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.getFoldingRanges(n.toString(),i)).then(a=>{if(!!a)return a.map(o=>{let u={start:o.startLine+1,end:o.endLine+1};return typeof o.kind<"u"&&(u.kind=Hn(o.kind)),u})})}};function Hn(e){switch(e){case D.Comment:return l.languages.FoldingRangeKind.Comment;case D.Imports:return l.languages.FoldingRangeKind.Imports;case D.Region:return l.languages.FoldingRangeKind.Region}}var de=class{constructor(t){this._worker=t
`;break;case 114:f+="\r";break;case 116:f+=" ";break;case 117:var y=b(4,!0);y>=0?f+=String.fromCharCode(y):d=4;break;default:d=5}w=r;continue}if(x>=0&&x<=31)if(q(x)){f+=e.substring(w,r),d=2;break}else d=6;r++}return f}function U(){if(n="",d=0,a=r,c=u,p=h,r>=i)return a=i,o=17;var f=e.charCodeAt(r);if(ye(f)){do r++,n+=String.fromCharCode(f),f=e.charCodeAt(r);while(ye(f));return o=15}if(q(f))return r++,n+=String.fromCharCode(f),f===13&&e.charCodeAt(r)===10&&(r++,n+=`
`),u++,h=r,o=14;switch(f){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,n=R(),o=10;case 47:var w=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<i&&!q(e.charCodeAt(r));)r++;return n=e.substring(w,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;for(var x=i-1,I=!1;r<x;){var y=e.charCodeAt(r);if(y===42&&e.charCodeAt(r+1)===47){r+=2,I=!0;break}r++,q(y)&&(y===13&&e.charCodeAt(r)===10&&r++,u++,h=r)}return I||(r++,d=1),n=e.substring(w,r),o=13}return n+=String.fromCharCode(f),r++,o=16;case 45:if(n+=String.fromCharCode(f),r++,r===i||!F(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return n+=E(),o=11;default:for(;r<i&&kn(f);)r++,f=e.charCodeAt(r);if(a!==r){switch(n=e.substring(a,r),n){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return n+=String.fromCharCode(f),r++,o=16}}function kn(f){if(ye(f)||q(f))return!1;switch(f){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function yn(){var f;do f=U();while(f>=12&&f<=15);return f}return{setPosition:g,getPosition:function(){return r},scan:t?yn:U,getToken:function(){return o},getTokenValue:function(){return n},getTokenOffset:function(){return a},getTokenLength:function(){return r-a},getTokenStartLine:function(){return c},getTokenStartCharacter:function(){return a-p},getTokenError:function(){return d}}}function ye(e){return e===32||e===9||e===11||e===12||e===160||e===5760||e>=8192&&e<=8203||e===8239||e===8287||e===12288||e===65279}function q(e){return e===10||e===13||e===8232||e===8233}function F(e){return e>=48&&e<=57}var ln;(function(e){e.DEFAULT={allowTrailingComma:!1}})(ln||(ln={}));var dn=fe;function pn(e){return{getInitialState:()=>new j(null,null,!1,null),tokenize:(t,i)=>ur(e,t,i)}}var fn="delimiter.bracket.json",gn="delimiter.array.json",Zn="delimiter.colon.json",er="delimiter.comma.json",nr="keyword.json",rr="keyword.json",tr="string.value.json",ir="number.json",ar="string.key.json",or="comment.block.json",sr="comment.line.json";var L=class{constructor(t,i){this.parent=t;this.type=i}static pop(t){return t?t.parent:null}static push(t,i){return new L(t,i)}static equals(t,i){if(!t&&!i)return!0;if(!t||!i)return!1;for(;t&&i;){if(t===i)return!0;if(t.type!==i.type)return!1;t=t.parent,i=i.parent}return!0}},j=class{_state;scanError;lastWasColon;parents;constructor(t,i,r,n){this._state=t,this.scanError=i,this.lastWasColon=r,this.parents=n}clone(){return new j(this._state,this.scanError,this.lastWasColon,this.parents)}equals(t){return t===this?!0:!t||!(t instanceof j)?!1:this.scanError===t.scanError&&this.lastWasColon===t.lastWasColon&&L.equals(this.parents,t.parents)}getStateData(){return this._state}setStateData(t){this._state=t}};function ur(e,t,i,r=0){let n=0,a=!1;switch(i.scanError){case 2:t='"'+t,n=1;break;case 1:t="/*"+t,n=2;break}let o=dn(t),u=i.lastWasColon,c=i.parents,h={tokens:[],endState:i.clone()};for(;;){let p=r+o.getPosition(),d="",b=o.scan();if(b===17)break;if(p===r+o.getPosition())throw new Error("Scanner did not advance, next 3 characters are: "+t.substr(o.getPosition(),3));switch(a&&(p-=n),a=n>0,b){case 1:c=L.push(c,0),d=fn,u=!1;break;case 2:c=L.pop(c),d=fn,u=!1;break;case 3:c=L.push(c,1),d=gn,u=!1;break;case 4:c=L.pop(c),d=gn,u=!1;break;case 6:d=Zn,u=!0;break;case 5:d=er,u=!1;break;case 8:case 9:d=nr,u=!1;break;case 7:d=rr,u=!1;break;case 10:let E=(c?c.type:0)===1;d=u||E?tr:ar,u=!1;break;case 11:d=ir,u=!1;break}if(e)switch(b){case 12:d=sr;break;case 13:d=or;break}h.endState=new j(i.getStateData(),o.getTokenError(),u,c),h.tokens.push({startIndex:p,scopes:d})}return h}var mn=class extends te{constructor(t,i,r){super(t,i,r.onDidChange);this._disposables.push(l.editor.onWillDisposeModel(n=>{this._resetSchema(n.uri)})),this._disposables.push(l.editor.onDidChangeModelLanguage(n=>{this._resetSchema(n.model.uri)}))}_resetSchema(t){this._worker().then(i=>{i.resetSchema(t.toString())})}};function cr(e){let t=[],i=[],r=new V(e);t.push(r);let n=(...u)=>r.g
return moduleExports;
});