amis-rpc-design/node_modules/monaco-editor/min/vs/language/json/jsonMode.js

16 lines
39 KiB
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
"use strict";/*!-----------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Version: 0.43.0(94c055bcbdd49f04a0fa15515e848542a79fb948)
* 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 ie=Object.defineProperty;var bn=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var wn=Object.getPrototypeOf,In=Object.prototype.hasOwnProperty;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)ie(e,i,{get:t[i],enumerable:!0})},te=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Cn(t))!In.call(e,n)&&n!==i&&ie(e,n,{get:()=>t[n],enumerable:!(r=bn(t,n))||r.enumerable});return e},Ee=(e,t,i)=>(te(e,t,"default"),i&&te(i,t,"default")),_e=(e,t,i)=>(i=e!=null?Tn(wn(e)):{},te(t||!e||!e.__esModule?ie(i,"default",{value:e,enumerable:!0}):i,e)),Pn=e=>te(ie({},"__esModule",{value:!0}),e);var Se=En((gr,Pe)=>{var Sn=_e(xn("vs/editor/editor.api"));Pe.exports=Sn});var fr={};_n(fr,{CompletionAdapter:()=>X,DefinitionAdapter:()=>ke,DiagnosticsAdapter:()=>q,DocumentColorAdapter:()=>Z,DocumentFormattingEditProvider:()=>G,DocumentHighlightAdapter:()=>ye,DocumentLinkAdapter:()=>Ce,DocumentRangeFormattingEditProvider:()=>Q,DocumentSymbolAdapter:()=>$,FoldingRangeAdapter:()=>ee,HoverAdapter:()=>Y,ReferenceAdapter:()=>Te,RenameAdapter:()=>be,SelectionRangeAdapter:()=>ne,WorkerManager:()=>D,fromPosition:()=>L,fromRange:()=>we,setupMode:()=>cr,toRange:()=>C,toTextEdit:()=>j});var l={};Ee(l,_e(Se()));var An=2*60*1e3,D=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>An&&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 Ae;(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647})(Ae||(Ae={}));var oe;(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647})(oe||(oe={}));var _;(function(e){function t(r,n){return r===Number.MAX_VALUE&&(r=oe.MAX_VALUE),n===Number.MAX_VALUE&&(n=oe.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 y;(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})(y||(y={}));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)&&y.is(n.range)&&(s.string(n.uri)||s.undefined(n.uri))}e.is=i})(ge||(ge={}));var Le;(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)&&y.is(n.targetRange)&&s.string(n.targetUri)&&(y.is(n.targetSelectionRange)||s.undefined(n.targetSelectionRange))&&(y.is(n.orig
`,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 f(g){return g!==null&&typeof g=="object"}e.objectLiteral=f;function b(g,E){return Array.isArray(g)&&g.every(E)}e.typedArray=b})(s||(s={}));var q=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=>Rn(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 Wn(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 Rn(e,t){let i=typeof t.code=="number"?String(t.code):t.code;return{severity:Wn(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 X=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(),L(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 f={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)?f.range={insert:C(p.textEdit.insert),replace:C(p.textEdit.replace)}:f.range=C(p.textEdit.range),f.insertText=p.textEdit.newText),p.additionalTextEdits&&(f.additionalTextEdits=p.additionalTextEdits.map(j)),p.in
`+e.value+"\n```\n"}}function jn(e){if(!!e)return Array.isArray(e)?e.map(un):[un(e)]}var ye=class{constructor(t){this._worker=t}provideDocumentHighlights(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.findDocumentHighlights(n.toString(),L(i))).then(a=>{if(!!a)return a.map(o=>({range:C(o.range),kind:Un(o.kind)}))})}};function Un(e){switch(e){case F.Read:return l.languages.DocumentHighlightKind.Read;case F.Write:return l.languages.DocumentHighlightKind.Write;case F.Text:return l.languages.DocumentHighlightKind.Text}return l.languages.DocumentHighlightKind.Text}var ke=class{constructor(t){this._worker=t}provideDefinition(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.findDefinition(n.toString(),L(i))).then(a=>{if(!!a)return[cn(a)]})}};function cn(e){return{uri:l.Uri.parse(e.uri),range:C(e.range)}}var Te=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(),L(i))).then(o=>{if(!!o)return o.map(cn)})}},be=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(),L(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,versionId:void 0,textEdit:{range:C(n.range),text:n.newText}})}return{edits:t}}var $=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 Ce=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}))}})}},G=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,ln(i)).then(o=>{if(!(!o||o.length===0))return o.map(j)}))}},Q=class{constructor(t){this._worker=t}canFormatMultipleRanges=!1;provideDocumentRangeFormattingEdits(t,i,r,n){let a=t.uri;return this._worker(a).then(o=>o.format(a.toString(),we(i),ln(r)).then(u=>{if(!(!u||u.length===0))return u.map(j)}))}};function ln(e){return{tabSize:e.tabSize,insertSpaces:e.insertSpaces}}var Z=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,we(i.range))).then(a=>{if(!!a)return a.map(o=>{let u={label:o.label};return o.textEdit&&(u.textEdit=j(o.textEdit)),o.additionalTextEdits&&(u.additionalTextEdits=o.additionalTextEdits.map(j)),u})})}},ee=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 M.Comment:return l.languages.FoldingRangeKind.Comment;case M.Imports:return l.languages.FoldingRangeKind.Imports;case M.Region:return l.languages.FoldingRangeKind.Region
`;break;case 114:d+="\r";break;case 116:d+=" ";break;case 117:var k=b(4,!0);k>=0?d+=String.fromCharCode(k):f=4;break;default:f=5}w=r;continue}if(x>=0&&x<=31)if(re(x)){d+=e.substring(w,r),f=2;break}else f=6;r++}return d}function V(){if(n="",f=0,a=r,c=u,p=h,r>=i)return a=i,o=17;var d=e.charCodeAt(r);if(Ie(d)){do r++,n+=String.fromCharCode(d),d=e.charCodeAt(r);while(Ie(d));return o=15}if(re(d))return r++,n+=String.fromCharCode(d),d===13&&e.charCodeAt(r)===10&&(r++,n+=`
`),u++,h=r,o=14;switch(d){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&&!re(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 k=e.charCodeAt(r);if(k===42&&e.charCodeAt(r+1)===47){r+=2,I=!0;break}r++,re(k)&&(k===13&&e.charCodeAt(r)===10&&r++,u++,h=r)}return I||(r++,f=1),n=e.substring(w,r),o=13}return n+=String.fromCharCode(d),r++,o=16;case 45:if(n+=String.fromCharCode(d),r++,r===i||!U(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&&yn(d);)r++,d=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(d),r++,o=16}}function yn(d){if(Ie(d)||re(d))return!1;switch(d){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function kn(){var d;do d=V();while(d>=12&&d<=15);return d}return{setPosition:g,getPosition:function(){return r},scan:t?kn:V,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 f}}}function Ie(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 re(e){return e===10||e===13||e===8232||e===8233}function U(e){return e>=48&&e<=57}var fn;(function(e){e.DEFAULT={allowTrailingComma:!1}})(fn||(fn={}));var dn=de;function hn(e){return{getInitialState:()=>new W(null,null,!1,null),tokenize:(t,i)=>ur(e,t,i)}}var gn="delimiter.bracket.json",pn="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 P=class{constructor(t,i){this.parent=t;this.type=i}static pop(t){return t?t.parent:null}static push(t,i){return new P(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}},W=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 W(this._state,this.scanError,this.lastWasColon,this.parents)}equals(t){return t===this?!0:!t||!(t instanceof W)?!1:this.scanError===t.scanError&&this.lastWasColon===t.lastWasColon&&P.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(),f="",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=P.push(c,0),f=gn,u=!1;break;case 2:c=P.pop(c),f=gn,u=!1;break;case 3:c=P.push(c,1),f=pn,u=!1;break;case 4:c=P.pop(c),f=pn,u=!1;break;case 6:f=Zn,u=!0;break;case 5:f=er,u=!1;break;case 8:case 9:f=nr,u=!1;break;case 7:f=rr,u=!1;break;case 10:let E=(c?c.type:0)===1;f=u||E?tr:ar,u=!1;break;case 11:f=ir,u=!1;break}if(e)switch(b){case 12:f=sr;break;case 13:f=or;break}h.endState=new W(i.getStateData(),o.getTokenError(),u,c),h.tokens.push({startIndex:p,scopes:f})}return h}var xe=class extends q{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 D(e);t.push(r);let n=(...u)=>
return moduleExports;
});