S2OJ/web/js/monaco-editor/min/vs/loader.js

11 lines
33 KiB
JavaScript
Raw Normal View History

"use strict";/*!-----------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Version: 0.34.1(0316a754aa4c25208bef91937efbce2ab1e3ce37)
* Released under the MIT license
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
*-----------------------------------------------------------*/var _amdLoaderGlobal=this,_commonjsGlobal=typeof global=="object"?global:{},AMDLoader;(function(l){l.global=_amdLoaderGlobal;var E=function(){function p(){this._detected=!1,this._isWindows=!1,this._isNode=!1,this._isElectronRenderer=!1,this._isWebWorker=!1,this._isElectronNodeIntegrationWebWorker=!1}return Object.defineProperty(p.prototype,"isWindows",{get:function(){return this._detect(),this._isWindows},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isNode",{get:function(){return this._detect(),this._isNode},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isElectronRenderer",{get:function(){return this._detect(),this._isElectronRenderer},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isWebWorker",{get:function(){return this._detect(),this._isWebWorker},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isElectronNodeIntegrationWebWorker",{get:function(){return this._detect(),this._isElectronNodeIntegrationWebWorker},enumerable:!1,configurable:!0}),p.prototype._detect=function(){this._detected||(this._detected=!0,this._isWindows=p._isWindows(),this._isNode=typeof module!="undefined"&&!!module.exports,this._isElectronRenderer=typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.electron!="undefined"&&process.type==="renderer",this._isWebWorker=typeof l.global.importScripts=="function",this._isElectronNodeIntegrationWebWorker=this._isWebWorker&&typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.electron!="undefined"&&process.type==="worker")},p._isWindows=function(){return typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.indexOf("Windows")>=0?!0:typeof process!="undefined"?process.platform==="win32":!1},p}();l.Environment=E})(AMDLoader||(AMDLoader={}));var AMDLoader;(function(l){var E=function(){function a(n,v,s){this.type=n,this.detail=v,this.timestamp=s}return a}();l.LoaderEvent=E;var p=function(){function a(n){this._events=[new E(1,"",n)]}return a.prototype.record=function(n,v){this._events.push(new E(n,v,l.Utilities.getHighPerformanceTimestamp()))},a.prototype.getEvents=function(){return this._events},a}();l.LoaderEventRecorder=p;var g=function(){function a(){}return a.prototype.record=function(n,v){},a.prototype.getEvents=function(){return[]},a.INSTANCE=new a,a}();l.NullLoaderEventRecorder=g})(AMDLoader||(AMDLoader={}));var AMDLoader;(function(l){var E=function(){function p(){}return p.fileUriToFilePath=function(g,a){if(a=decodeURI(a).replace(/%23/g,"#"),g){if(/^file:\/\/\//.test(a))return a.substr(8);if(/^file:\/\//.test(a))return a.substr(5)}else if(/^file:\/\//.test(a))return a.substr(7);return a},p.startsWith=function(g,a){return g.length>=a.length&&g.substr(0,a.length)===a},p.endsWith=function(g,a){return g.length>=a.length&&g.substr(g.length-a.length)===a},p.containsQueryString=function(g){return/^[^\#]*\?/gi.test(g)},p.isAbsolutePath=function(g){return/^((http:\/\/)|(https:\/\/)|(file:\/\/)|(\/))/.test(g)},p.forEachProperty=function(g,a){if(g){var n=void 0;for(n in g)g.hasOwnProperty(n)&&a(n,g[n])}},p.isEmpty=function(g){var a=!0;return p.forEachProperty(g,function(){a=!1}),a},p.recursiveClone=function(g){if(!g||typeof g!="object"||g instanceof RegExp||!Array.isArray(g)&&Object.getPrototypeOf(g)!==Object.prototype)return g;var a=Array.isArray(g)?[]:{};return p.forEachProperty(g,function(n,v){v&&typeof v=="object"?a[n]=p.recursiveClone(v):a[n]=v}),a},p.generateAnonymousModule=function(){return"===anonymous"+p.NEXT_ANONYMOUS_ID+++"==="},p.isAnonymousModule=function(g){return p.startsWith(g,"===anonymous")},p.getHighPerformanceTimestamp=function(){return this.PERFORMANCE_NOW_PROBED||(this.PERFORMANCE_NOW_PROBED=!0,this.HAS_PERFORMANCE_NOW=l.global.performance&&typeof l.global.performance.now=="function"),this.HAS_PERFORMANCE_NOW?l.global.performance.now():Date.now()},p.NEXT_ANONYMOUS_ID=1,p.PERFORMANCE_NOW_PROBED=!1,p.HAS_PERFORMANCE_NOW=!1,p}();l.Utilities=E})(AMDLoader||(AMDL
//# sourceURL=`+r;var m=h?self.eval(h.createScript("",_)):new Function(_);m.call(self),o()}).then(void 0,i);return}try{h&&(r=h.createScriptURL(r)),importScripts(r),o()}catch(_){i(_)}}},e}(),n=function(){function e(t){this._env=t,this._didInitialize=!1,this._didPatchNodeRequire=!1}return e.prototype._init=function(t){this._didInitialize||(this._didInitialize=!0,this._fs=t("fs"),this._vm=t("vm"),this._path=t("path"),this._crypto=t("crypto"))},e.prototype._initNodeRequire=function(t,r){var o=r.getConfig().getOptionsLiteral().nodeCachedData;if(!o||this._didPatchNodeRequire)return;this._didPatchNodeRequire=!0;var i=this,u=t("module");function f(c){var d=c.constructor,h=function(_){try{return c.require(_)}finally{}};return h.resolve=function(_,m){return d._resolveFilename(_,c,!1,m)},h.resolve.paths=function(_){return d._resolveLookupPaths(_,c)},h.main=process.mainModule,h.extensions=d._extensions,h.cache=d._cache,h}u.prototype._compile=function(c,d){var h=u.wrap(c.replace(/^#!.*/,"")),y=r.getRecorder(),_=i._getCachedDataPath(o,d),m={filename:d},R;try{var P=i._fs.readFileSync(_);R=P.slice(0,16),m.cachedData=P.slice(16),y.record(60,_)}catch{y.record(61,_)}var b=new i._vm.Script(h,m),I=b.runInThisContext(m),U=i._path.dirname(d),w=f(this),O=[this.exports,w,this,d,U,process,_commonjsGlobal,Buffer],C=I.apply(this.exports,O);return i._handleCachedData(b,h,_,!m.cachedData,r),i._verifyCachedData(b,h,_,R,r),C}},e.prototype.load=function(t,r,o,i){var u=this,f=t.getConfig().getOptionsLiteral(),c=v(t.getRecorder(),f.nodeRequire||l.global.nodeRequire),d=f.nodeInstrumenter||function(I){return I};this._init(c),this._initNodeRequire(c,t);var h=t.getRecorder();if(/^node\|/.test(r)){var y=r.split("|"),_=null;try{_=c(y[1])}catch(I){i(I);return}t.enqueueDefineAnonymousModule([],function(){return _}),o()}else{r=l.Utilities.fileUriToFilePath(this._env.isWindows,r);var m=this._path.normalize(r),R=this._getElectronRendererScriptPathOrUri(m),P=Boolean(f.nodeCachedData),b=P?this._getCachedDataPath(f.nodeCachedData,r):void 0;this._readSourceAndCachedData(m,b,h,function(I,U,w,O){if(I){i(I);return}var C;U.charCodeAt(0)===e._BOM?C=e._PREFIX+U.substring(1)+e._SUFFIX:C=e._PREFIX+U+e._SUFFIX,C=d(C,m);var M={filename:R,cachedData:w},N=u._createAndEvalScript(t,C,M,o,i);u._handleCachedData(N,C,b,P&&!w,t),u._verifyCachedData(N,C,b,O,t)})}},e.prototype._createAndEvalScript=function(t,r,o,i,u){var f=t.getRecorder();f.record(31,o.filename);var c=new this._vm.Script(r,o),d=c.runInThisContext(o),h=t.getGlobalAMDDefineFunc(),y=!1,_=function(){return y=!0,h.apply(null,arguments)};return _.amd=h.amd,d.call(l.global,t.getGlobalAMDRequireFunc(),_,o.filename,this._path.dirname(o.filename)),f.record(32,o.filename),y?i():u(new Error("Didn't receive define call in "+o.filename+"!")),c},e.prototype._getElectronRendererScriptPathOrUri=function(t){if(!this._env.isElectronRenderer)return t;var r=t.match(/^([a-z])\:(.*)/i);return r?"file:///"+(r[1].toUpperCase()+":"+r[2]).replace(/\\/g,"/"):"file://"+t},e.prototype._getCachedDataPath=function(t,r){var o=this._crypto.createHash("md5").update(r,"utf8").update(t.seed,"utf8").update(process.arch,"").digest("hex"),i=this._path.basename(r).replace(/\.js$/,"");return this._path.join(t.path,i+"-"+o+".code")},e.prototype._handleCachedData=function(t,r,o,i,u){var f=this;t.cachedDataRejected?this._fs.unlink(o,function(c){u.getRecorder().record(62,o),f._createAndWriteCachedData(t,r,o,u),c&&u.getConfig().onError(c)}):i&&this._createAndWriteCachedData(t,r,o,u)},e.prototype._createAndWriteCachedData=function(t,r,o,i){var u=this,f=Math.ceil(i.getConfig().getOptionsLiteral().nodeCachedData.writeDelay*(1+Math.random())),c=-1,d=0,h=void 0,y=function(){setTimeout(function(){h||(h=u._crypto.createHash("md5").update(r,"utf8").digest());var _=t.createCachedData();if(!(_.length===0||_.length===c||d>=5)){if(_.length<c){y();return}c=_.length,u._fs.writeFile(o,Buffer.concat([h,_]),function(m){m&&i.getConfig().onError(m),i.getRecorder().record(63,o),y()})}},f*Math.pow(4,d++))};y()},e.prototype._readSourceAndCachedData=function(t,r,o,i){if(!r)this._fs.readFile
});`,e}();function v(e,t){if(t.__$__isRecorded)return t;var r=function(i){e.record(33,i);try{return t(i)}finally{e.record(34,i)}};return r.__$__isRecorded=!0,r}l.ensureRecordedNodeRequire=v;function s(e){return new E(e)}l.createScriptLoader=s})(AMDLoader||(AMDLoader={}));var AMDLoader;(function(l){var E=function(){function s(e){var t=e.lastIndexOf("/");t!==-1?this.fromModulePath=e.substr(0,t+1):this.fromModulePath=""}return s._normalizeModuleId=function(e){var t=e,r;for(r=/\/\.\//;r.test(t);)t=t.replace(r,"/");for(t=t.replace(/^\.\//g,""),r=/\/(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//;r.test(t);)t=t.replace(r,"/");return t=t.replace(/^(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//,""),t},s.prototype.resolveModule=function(e){var t=e;return l.Utilities.isAbsolutePath(t)||(l.Utilities.startsWith(t,"./")||l.Utilities.startsWith(t,"../"))&&(t=s._normalizeModuleId(this.fromModulePath+t)),t},s.ROOT=new s(""),s}();l.ModuleIdResolver=E;var p=function(){function s(e,t,r,o,i,u){this.id=e,this.strId=t,this.dependencies=r,this._callback=o,this._errorback=i,this.moduleIdResolver=u,this.exports={},this.error=null,this.exportsPassedIn=!1,this.unresolvedDependenciesCount=this.dependencies.length,this._isComplete=!1}return s._safeInvokeFunction=function(e,t){try{return{returnedValue:e.apply(l.global,t),producedError:null}}catch(r){return{returnedValue:null,producedError:r}}},s._invokeFactory=function(e,t,r,o){return e.shouldInvokeFactory(t)?e.shouldCatchError()?this._safeInvokeFunction(r,o):{returnedValue:r.apply(l.global,o),producedError:null}:{returnedValue:null,producedError:null}},s.prototype.complete=function(e,t,r,o){this._isComplete=!0;var i=null;if(this._callback)if(typeof this._callback=="function"){e.record(21,this.strId);var u=s._invokeFactory(t,this.strId,this._callback,r);i=u.producedError,e.record(22,this.strId),!i&&typeof u.returnedValue!="undefined"&&(!this.exportsPassedIn||l.Utilities.isEmpty(this.exports))&&(this.exports=u.returnedValue)}else this.exports=this._callback;if(i){var f=l.ensureError(i);f.phase="factory",f.moduleId=this.strId,f.neededBy=o(this.id),this.error=f,t.onError(f)}this.dependencies=null,this._callback=null,this._errorback=null,this.moduleIdResolver=null},s.prototype.onDependencyError=function(e){return this._isComplete=!0,this.error=e,this._errorback?(this._errorback(e),!0):!1},s.prototype.isComplete=function(){return this._isComplete},s}();l.Module=p;var g=function(){function s(){this._nextId=0,this._strModuleIdToIntModuleId=new Map,this._intModuleIdToStrModuleId=[],this.getModuleId("exports"),this.getModuleId("module"),this.getModuleId("require")}return s.prototype.getMaxModuleId=function(){return this._nextId},s.prototype.getModuleId=function(e){var t=this._strModuleIdToIntModuleId.get(e);return typeof t=="undefined"&&(t=this._nextId++,this._strModuleIdToIntModuleId.set(e,t),this._intModuleIdToStrModuleId[t]=e),t},s.prototype.getStrModuleId=function(e){return this._intModuleIdToStrModuleId[e]},s}(),a=function(){function s(e){this.id=e}return s.EXPORTS=new s(0),s.MODULE=new s(1),s.REQUIRE=new s(2),s}();l.RegularDependency=a;var n=function(){function s(e,t,r){this.id=e,this.pluginId=t,this.pluginParam=r}return s}();l.PluginDependency=n;var v=function(){function s(e,t,r,o,i){i===void 0&&(i=0),this._env=e,this._scriptLoader=t,this._loaderAvailableTimestamp=i,this._defineFunc=r,this._requireFunc=o,this._moduleIdProvider=new g,this._config=new l.Configuration(this._env),this._hasDependencyCycle=!1,this._modules2=[],this._knownModules2=[],this._inverseDependencies2=[],this._inversePluginDependencies2=new Map,this._currentAnonymousDefineCall=null,this._recorder=null,this._buildInfoPath=[],this._buildInfoDefineStack=[],this._buildInfoDependencies=[]}return s.prototype.reset=function(){return new s(this._env,this._scriptLoader,this._defineFunc,this._requireFunc,this._loaderAvailableTimestamp)},s.prototype.getGlobalAMDDefineFunc=function(){return this._defineFunc},s.prototype.getGlobalAMDRequireFunc=function(){return this._requireFunc},s._findRelevantLocationI
`)),e.unresolvedDependenciesCount--;continue}if(this._inverseDependencies2[u.id]=this._inverseDependencies2[u.id]||[],this._inverseDependencies2[u.id].push(e.id),u instanceof n){var d=this._modules2[u.pluginId];if(d&&d.isComplete()){this._loadPluginDependency(d.exports,u);continue}var h=this._inversePluginDependencies2.get(u.pluginId);h||(h=[],this._inversePluginDependencies2.set(u.pluginId,h)),h.push(u),this._loadModule(u.pluginId);continue}this._loadModule(u.id)}e.unresolvedDependenciesCount===0&&this._onModuleComplete(e)},s.prototype._onModuleComplete=function(e){var t=this,r=this.getRecorder();if(!e.isComplete()){var o=e.dependencies,i=[];if(o)for(var u=0,f=o.length;u<f;u++){var c=o[u];if(c===a.EXPORTS){i[u]=e.exports;continue}if(c===a.MODULE){i[u]={id:e.strId,config:function(){return t._config.getConfigForModule(e.strId)}};continue}if(c===a.REQUIRE){i[u]=this._createRequire(e.moduleIdResolver);continue}var d=this._modules2[c.id];if(d){i[u]=d.exports;continue}i[u]=null}var h=function(P){return(t._inverseDependencies2[P]||[]).map(function(b){return t._moduleIdProvider.getStrModuleId(b)})};e.complete(r,this._config,i,h);var y=this._inverseDependencies2[e.id];if(this._inverseDependencies2[e.id]=null,y)for(var u=0,f=y.length;u<f;u++){var _=y[u],m=this._modules2[_];m.unresolvedDependenciesCount--,m.unresolvedDependenciesCount===0&&this._onModuleComplete(m)}var R=this._inversePluginDependencies2.get(e.id);if(R){this._inversePluginDependencies2.delete(e.id);for(var u=0,f=R.length;u<f;u++)this._loadPluginDependency(e.exports,R[u])}}},s}();l.ModuleManager=v})(AMDLoader||(AMDLoader={}));var define,AMDLoader;(function(l){var E=new l.Environment,p=null,g=function(s,e,t){typeof s!="string"&&(t=e,e=s,s=null),(typeof e!="object"||!Array.isArray(e))&&(t=e,e=null),e||(e=["require","exports","module"]),s?p.defineModule(s,e,t,null,null):p.enqueueDefineAnonymousModule(e,t)};g.amd={jQuery:!0};var a=function(s,e){e===void 0&&(e=!1),p.configure(s,e)},n=function(){if(arguments.length===1){if(arguments[0]instanceof Object&&!Array.isArray(arguments[0])){a(arguments[0]);return}if(typeof arguments[0]=="string")return p.synchronousRequire(arguments[0])}if((arguments.length===2||arguments.length===3)&&Array.isArray(arguments[0])){p.defineModule(l.Utilities.generateAnonymousModule(),arguments[0],arguments[1],arguments[2],null);return}throw new Error("Unrecognized require call")};n.config=a,n.getConfig=function(){return p.getConfig().getOptionsLiteral()},n.reset=function(){p=p.reset()},n.getBuildInfo=function(){return p.getBuildInfo()},n.getStats=function(){return p.getLoaderEvents()},n.define=g;function v(){if(typeof l.global.require!="undefined"||typeof require!="undefined"){var s=l.global.require||require;if(typeof s=="function"&&typeof s.resolve=="function"){var e=l.ensureRecordedNodeRequire(p.getRecorder(),s);l.global.nodeRequire=e,n.nodeRequire=e,n.__$__nodeRequire=e}}E.isNode&&!E.isElectronRenderer&&!E.isElectronNodeIntegrationWebWorker?(module.exports=n,require=n):(E.isElectronRenderer||(l.global.define=g),l.global.require=n)}l.init=v,(typeof l.global.define!="function"||!l.global.define.amd)&&(p=new l.ModuleManager(E,l.createScriptLoader(E),g,n,l.Utilities.getHighPerformanceTimestamp()),typeof l.global.require!="undefined"&&typeof l.global.require!="function"&&n.config(l.global.require),define=function(){return g.apply(null,arguments)},define.amd=g.amd,typeof doNotInitLoader=="undefined"&&v())})(AMDLoader||(AMDLoader={}));
//# sourceMappingURL=../../min-maps/vs/loader.js.map