MCPcopy
hub / github.com/deepchecks/deepchecks / forEach

Method forEach

deepchecks/core/resources/widgets-embed.js:122–122  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

120 * Released under the MIT license.
121 * http://jquery.org/license
122 */i=[n(17),n(45)],void 0===(o="function"==typeof(r=function(e){return e.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}})?r.apply(t,i):r)||(e.exports=o)},function(e){e.exports=JSON.parse('{"name":"@jupyter-widgets/controls","version":"3.1.1","description":"Jupyter interactive widgets","repository":{"type":"git","url":"https://github.com/jupyter-widgets/ipywidgets.git"},"license":"BSD-3-Clause","author":"Project Jupyter","main":"lib/index.js","typings":"lib/index.d.ts","files":["lib/**/*.d.ts","lib/**/*.js","css/*.css","dist/"],"scripts":{"build":"npm run build:src && npm run build:css","build:css":"postcss --use postcss-import --use postcss-cssnext -o css/widgets.built.css css/widgets.css","build:src":"tsc","build:test":"tsc --project test && webpack --config test/webpack.conf.js","clean":"npm run clean:src","clean:src":"rimraf lib && rimraf tsconfig.tsbuildinfo","lint":"tslint --project tslint.json --format stylish","prepublish":"npm run clean && npm run build","test":"npm run test:unit","test:coverage":"npm run build:test && webpack --config test/webpack-cov.conf.js && karma start test/karma-cov.conf.js","test:unit":"npm run test:unit:firefox && npm run test:unit:chrome","test:unit:chrome":"npm run test:unit:default -- --browsers=Chrome","test:unit:default":"npm run build:test && karma start test/karma.conf.js --log-level debug","test:unit:firefox":"npm run test:unit:default -- --browsers=Firefox","test:unit:firefox:headless":"npm run test:unit:default -- --browsers=FirefoxHeadless","test:unit:ie":"npm run test:unit:default -- --browsers=IE"},"dependencies":{"@jupyter-widgets/base":"^4.1.1","@lumino/algorithm":"^1.1.0","@lumino/domutils":"^1.1.0","@lumino/messaging":"^1.2.1","@lumino/signaling":"^1.2.0","@lumino/widgets":"^1.3.0","d3-format":"^1.3.0","jquery":"^3.1.1","jquery-ui":"^1.12.1","underscore":"^1.8.3"},"devDependencies":{"@jupyterlab/services":"^6.0.0","@types/d3-format":"^1.3.1","@types/expect.js":"^0.3.29","@types/mathjax":"^0.0.35","@types/mocha":"^5.2.7","@types/node":"^12.0.10","chai":"^4.0.0","css-loader":"^3.4.0","expect.js":"^0.3.1","file-loader":"^5.0.2","istanbul-instrumenter-loader":"^3.0.1","karma":"^4.1.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.2","karma-firefox-launcher":"^1.1.0","karma-ie-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-mocha-reporter":"^2.2.5","karma-webpack":"^4.0.2","mocha":"^6.1.4","npm-run-all":"^4.1.5","postcss-cli":"^6.1.2","postcss-cssnext":"^3.1.0","postcss-import":"^12.0.1","postcss-loader":"^3.0.0","rimraf":"^2.6.1","sinon":"^7.3.2","sinon-chai":"^3.3.0","style-loader":"^1.1.2","tslint":"^5.20.1","typescript":"~3.7.4","url-loader":"^3.0.0","webpack":"^4.41.5"},"gitHead":"79e50e2f66df991b602fe19b888dfaf4ce55133d"}')},function(e,t,n){var r=n(46),i=n(375);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var o={insert:"head",singleton:!1},a=(r(e.i,i,o),i.locals?i.locals:{});e.exports=a},function(e,t,n){(t=n(20)(!1)).push([e.i,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n.jupyter-widgets.widget-output .jp-OutputArea-prompt {\n display: none;\n}\n",""]),e.exports=t},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigWithDefaults=t.ConfigSection=void 0;const r=n(14),i=n(22);!function(e){e.create=function(e){const t=new o(e);return t.load().then(()=>t)}}(t.ConfigSection||(t.ConfigSection={}));class o{constructor(e){var t;this._url="unknown";const n=this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:i.ServerConnection.makeSettings();this._url=r.URLExt.join(n.baseUrl,"api/config",encodeURIComponent(e.name))}get data(){return this._data}async load(){const e=await i.ServerConnection.makeRequest(this._url,{},this.serverSettings);if(200!==e.status){throw await i.ServerConnection.ResponseError.create(e)}this._data=await e.json()}async update(e){this._data=Object.assign(Object.assign({},this._data),e);const t={method:"PATCH",body:JSON.stringify(e)},n=await i.ServerConnection.makeRequest(this._url,t,this.serverSettings);if(200!==n.status){throw await i.ServerConnection.ResponseError.create(n)}return this._data=await n.json(),this._data}}t.ConfigWithDefaults=class{constructor(e){var t,n;this._className="",this._section=e.section,this._defaults=null!==(t=e.defaults)&&void 0!==t?t:{},this._className=null!==(n=e.className)&&void 0!==n?n:""}get(e){const t=this._classData();return e in t?t[e]:this._defaults[e]}set(e,t){const n={};if(n[e]=t,this._className){const e={};return e[this._className]=n,this._section.update(e)}return this._section.update(n)}_classData(){const e=this._section.data;return this._className&&this._className in e?e[this._className]:e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActivityMonitor=void 0;const r=n(7);t.ActivityMonitor=class{constructor(e){this._timer=-1,this._timeout=-1,this._isDisposed=!1,this._activityStopped=new r.Signal(this),e.signal.connect(this._onSignalFired,this),this._timeout=e.timeout||1e3}get activityStopped(){return this._activityStopped}get timeout(){return this._timeout}set timeout(e){this._timeout=e}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,r.Signal.clearData(this))}_onSignalFired(e,t){clearTimeout(this._timer),this._sender=e,this._args=t,this._timer=setTimeout(()=>{this._activityStopped.emit({sender:this._sender,args:this._args})},this._timeout)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MarkdownCodeBlocks=void 0,function(e){e.CODE_BLOCK_MARKER="```";const t=[".markdown",".mdown",".mkdn",".md",".mkd",".mdwn",".mdtxt",".mdtext",".text",".txt",".Rmd"];class n{constructor(e){this.startLine=e,this.code="",this.endLine=-1}}e.MarkdownCodeBlock=n,e.isMarkdown=function(e){return t.indexOf(e)>-1},e.findMarkdownCodeBlocks=function(t){if(!t||""===t)return[];const r=t.split("\n"),i=[];let o=null;for(let t=0;t<r.length;t++){const a=r[t],s=0===a.indexOf(e.CODE_BLOCK_MARKER),l=null!=o;if(s||l)if(l)o&&(s?(o.endLine=t-1,i.push(o),o=null):o.code+=a+"\n");else{o=new n(t);const r=a.indexOf(e.CODE_BLOCK_MARKER),s=a.lastIndexOf(e.CODE_BLOCK_MARKER);r!==s&&(o.code=a.substring(r+e.CODE_BLOCK_MARKER.length,s),o.endLine=t,i.push(o),o=null)}}return i}}(t.MarkdownCodeBlocks||(t.MarkdownCodeBlocks={}))},function(module,exports,__webpack_require__){"use strict";(function(process){var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PageConfig=void 0;const coreutils_1=__webpack_require__(9),minimist_1=__importDefault(__webpack_require__(381)),url_1=__webpack_require__(103);var PageConfig;!function(PageConfig){function getOption(name){if(configData)return configData[name]||getBodyData(name);configData=Object.create(null);let found=!1;if("undefined"!=typeof document&&document){const e=document.getElementById("jupyter-config-data");e&&(configData=JSON.parse(e.textContent||""),found=!0)}if(!found&&void 0!==process)try{const cli=minimist_1.default(process.argv.slice(2)),path=__webpack_require__(66);let fullPath="";"jupyter-config-data"in cli?fullPath=path.resolve(cli["jupyter-config-data"]):"JUPYTER_CONFIG_DATA"in process.env&&(fullPath=path.resolve(process.env.JUPYTER_CONFIG_DATA)),fullPath&&(configData=eval("require")(fullPath))}catch(e){console.error(e)}if(coreutils_1.JSONExt.isObject(configData))for(const e in configData)"string"!=typeof configData[e]&&(configData[e]=JSON.stringify(configData[e]));else configData=Object.create(null);return configData[name]||getBodyData(name)}function setOption(e,t){const n=getOption(e);return configData[e]=t,n}function getBaseUrl(){return url_1.URLExt.normalize(getOption("baseUrl")||"/")}function getTreeUrl(){return url_1.URLExt.join(getBaseUrl(),getOption("treeUrl"))}function getShareUrl(){return url_1.URLExt.normalize(getOption("shareUrl")||getBaseUrl())}function getTreeShareUrl(){return url_1.URLExt.normalize(url_1.URLExt.join(getShareUrl(),getOption("treeUrl")))}function getUrl(e){var t,n,r;let i=getOption("baseUrl")||"/";const o=null!==(t=e.mode)&&void 0!==t?t:getOption("mode"),a=null!==(n=e.workspace)&&void 0!==n?n:getOption("workspace"),s="multiple-document"===o?"lab":"doc";i=url_1.URLExt.join(i,s),a!==PageConfig.defaultWorkspace&&(i=url_1.URLExt.join(i,"workspaces",encodeURIComponent(getOption("workspace"))));const l=null!==(r=e.treePath)&&void 0!==r?r:getOption("treePath");return l&&(i=url_1.URLExt.join(i,"tree",url_1.URLExt.encodeParts(l))),i}function getWsUrl(e){let t=getOption("wsUrl");if(!t){if(0!==(e=e?url_1.URLExt.normalize(e):getBaseUrl()).indexOf("http"))return"";t="ws"+e.slice(4)}return url_1.URLExt.normalize(t)}function getNBConvertURL({path:e,format:t,download:n}){const r=url_1.URLExt.encodeParts(e),i=url_1.URLExt.join(getBaseUrl(),"nbconvert",t,r);return n?i+"?download=true":i}function getToken(){return getOption("token")||getBodyData("jupyterApiToken")}function getNotebookVersion(){const e=getOption("notebookVersion");return""===e?[0,0,0]:JSON.parse(e)}PageConfig.getOption=getOption,PageConfig.setOption=setOption,PageConfig.getBaseUrl=getBaseUrl,PageConfig.getTreeUrl=getTreeUrl,PageConfig.getShareUrl=getShareUrl,PageConfig.getTreeShareUrl=getTreeShareUrl,PageConfig.getUrl=getUrl,PageConfig.defaultWorkspace="default",PageConfig.getWsUrl=getWsUrl,PageConfig.getNBConvertURL=getNBConvertURL,PageConfig.getToken=getToken,PageConfig.getNotebookVersion=getNotebookVersion;let configData=null,Extension;function getBodyData(e){if("undefined"==typeof document||!document.body)return"";const t=document.body.dataset[e];return void 0===t?"":decodeURIComponent(t)}!function(e){function t(e){try{const t=getOption(e);if(t)return JSON.parse(t)}catch(t){console.warn(`Unable to parse ${e}.`,t)}return[]}e.deferred=t("deferredExtensions"),e.disabled=t("disabledExtensions"),e.isDeferred=function(t){const n=t.indexOf(":");let r="";return-1!==n&&(r=t.slice(0,n)),e.deferred.some(e=>e===t||r&&e===r)},e.isDisabled=function(t){const n=t.indexOf(":");let r="";return-1!==n&&(r=t.slice(0,n)),e.disabled.some(e=>e===t||r&&e===r)}}(Extension=PageConfig.Extension||(PageConfig.Extension={}))}(PageConfig=exports.PageConfig||(exports.PageConfig={}))}).call(this,__webpack_require__(27))},function(e,t){function n(e){return"number"==typeof e||(!!/^0x[0-9a-f]+$/i.test(e)||/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e))}e.exports=function(e,t){t||(t={});var r={bools:{},strings:{},unknownFn:null};"function"==typeof t.unknown&&(r.unknownFn=t.unknown),"boolean"==typeof t.boolean&&t.boolean?r.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach((function(e){r.bools[e]=!0}));var i={};Object.keys(t.alias||{}).forEach((function(e){i[e]=[].concat(t.alias[e]),i[e].forEach((function(t){i[t]=[e].concat(i[e].filter((function(e){return t!==e})))}))})),[].concat(t.string).filter(Boolean).forEach((function(e){r.strings[e]=!0,i[e]&&(r.strings[i[e]]=!0)}));var o=t.default||{},a={_:[]};Object.keys(r.bools).forEach((function(e){l(e,void 0!==o[e]&&o[e])}));var s=[];function l(e,t,o){if(!o||!r.unknownFn||function(e,t){return r.allBools&&/^--[^=]+$/.test(t)||r.strings[e]||r.bools[e]||i[e]}(e,o)||!1!==r.unknownFn(o)){var s=!r.strings[e]&&n(t)?Number(t):t;c(a,e.split("."),s),(i[e]||[]).forEach((function(e){c(a,e.split("."),s)}))}}function c(e,t,n){var i=e;t.slice(0,-1).forEach((function(e){void 0===i[e]&&(i[e]={}),i=i[e]}));var o=t[t.length-1];void 0===i[o]||r.bools[o]||"boolean"==typeof i[o]?i[o]=n:Array.isArray(i[o])?i[o].push(n):i[o]=[i[o],n]}function u(e){return i[e].some((function(e){return r.bools[e]}))}-1!==e.indexOf("--")&&(s=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(var d=0;d<e.length;d++){var h=e[d];if(/^--.+=/.test(h)){var p=h.match(/^--([^=]+)=([\s\S]*)$/),f=p[1],m=p[2];r.bools[f]&&(m="false"!==m),l(f,m,h)}else if(/^--no-.+/.test(h)){l(f=h.match(/^--no-(.+)/)[1],!1,h)}else if(/^--.+/.test(h)){f=h.match(/^--(.+)/)[1];void 0===(y=e[d+1])||/^-/.test(y)||r.bools[f]||r.allBools||i[f]&&u(f)?/^(true|false)$/.test(y)?(l(f,"true"===y,h),d++):l(f,!r.strings[f]||"",h):(l(f,y,h),d++)}else if(/^-[^-]+/.test(h)){for(var g=h.slice(1,-1).split(""),v=!1,_=0;_<g.length;_++){var y;if("-"!==(y=h.slice(_+2))){if(/[A-Za-z]/.test(g[_])&&/=/.test(y)){l(g[_],y.split("=")[1],h),v=!0;break}if(/[A-Za-z]/.test(g[_])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(y)){l(g[_],y,h),v=!0;break}if(g[_+1]&&g[_+1].match(/\W/)){l(g[_],h.slice(_+2),h),v=!0;break}l(g[_],!r.strings[g[_]]||"",h)}else l(g[_],y,h)}f=h.slice(-1)[0];v||"-"===f||(!e[d+1]||/^(-|--)[^-]/.test(e[d+1])||r.bools[f]||i[f]&&u(f)?e[d+1]&&/true|false/.test(e[d+1])?(l(f,"true"===e[d+1],h),d++):l(f,!r.strings[f]||"",h):(l(f,e[d+1],h),d++))}else if(r.unknownFn&&!1===r.unknownFn(h)||a._.push(r.strings._||!n(h)?h:Number(h)),t.stopEarly){a._.push.apply(a._,e.slice(d+1));break}}return Object.keys(o).forEach((function(e){var t,n,r;t=a,n=e.split("."),r=t,n.slice(0,-1).forEach((function(e){r=r[e]||{}})),n[n.length-1]in r||(c(a,e.split("."),o[e]),(i[e]||[]).forEach((function(t){c(a,t.split("."),o[e])})))})),t["--"]?(a["--"]=new Array,s.forEach((function(e){a["--"].push(e)}))):s.forEach((function(e){a._.push(e)})),a}},function(e,t,n){"use strict";(function(t){var r=n(383),i=n(384),o=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,a=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,s=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function l(e){return(e||"").toString().replace(s,"")}var c=[["#","hash"],["?","query"],function(e){return e.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],u={hash:1,query:1};function d(e){var n,r=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},i={},a=typeof(e=e||r);if("blob:"===e.protocol)i=new p(unescape(e.pathname),{});else if("string"===a)for(n in i=new p(e,{}),u)delete i[n];else if("object"===a){for(n in e)n in u||(i[n]=e[n]);void 0===i.slashes&&(i.slashes=o.test(e.href))}return i}function h(e){e=l(e);var t=a.exec(e);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!t[2],rest:t[3]}}function p(e,t,n){if(e=l(e),!(this instanceof p))return new p(e,t,n);var o,a,s,u,f,m,g=c.slice(),v=typeof t,_=this,y=0;for("object"!==v&&"string"!==v&&(n=t,t=null),n&&"function"!=typeof n&&(n=i.parse),t=d(t),o=!(a=h(e||"")).protocol&&!a.slashes,_.slashes=a.slashes||o&&t.slashes,_.protocol=a.protocol||t.protocol||"",e=a.rest,a.slashes||(g[3]=[/(.*)/,"pathname"]);y<g.length;y++)"function"!=typeof(u=g[y])?(s=u[0],m=u[1],s!=s?_[m]=e:"string"==typeof s?~(f=e.indexOf(s))&&("number"==typeof u[2]?(_[m]=e.slice(0,f),e=e.slice(f+u[2])):(_[m]=e.slice(f),e=e.slice(0,f))):(f=s.exec(e))&&(_[m]=f[1],e=e.slice(0,f.index)),_[m]=_[m]||o&&u[3]&&t[m]||"",u[4]&&(_[m]=_[m].toLowerCase())):e=u(e);n&&(_.query=n(_.query)),o&&t.slashes&&"/"!==_.pathname.charAt(0)&&(""!==_.pathname||""!==t.pathname)&&(_.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,i=n[r-1],o=!1,a=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),a++):a&&(0===r&&(o=!0),n.splice(r,1),a--);return o&&n.unshift(""),"."!==i&&".."!==i||n.push(""),n.join("/")}(_.pathname,t.pathname)),r(_.port,_.protocol)||(_.host=_.hostname,_.port=""),_.username=_.password="",_.auth&&(u=_.auth.split(":"),_.username=u[0]||"",_.password=u[1]||""),_.origin=_.protocol&&_.host&&"file:"!==_.protocol?_.protocol+"//"+_.host:"null",_.href=_.toString()}p.prototype={set:function(e,t,n){var o=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||i.parse)(t)),o[e]=t;break;case"port":o[e]=t,r(t,o.protocol)?t&&(o.host=o.hostname+":"+t):(o.host=o.hostname,o[e]="");break;case"hostname":o[e]=t,o.port&&(t+=":"+o.port),o.host=t;break;case"host":o[e]=t,/:\d+$/.test(t)?(t=t.split(":"),o.port=t.pop(),o.hostname=t.join(":")):(o.hostname=t,o.port="");break;case"protocol":o.protocol=t.toLowerCase(),o.slashes=!n;break;case"pathname":case"hash":if(t){var a="pathname"===e?"/":"#";o[e]=t.charAt(0)!==a?a+t:t}else o[e]=t;break;default:o[e]=t}for(var s=0;s<c.length;s++){var l=c[s];l[4]&&(o[l[1]]=o[l[1]].toLowerCase())}return o.origin=o.protocol&&o.host&&"file:"!==o.protocol?o.protocol+"//"+o.host:"null",o.href=o.toString(),o},toString:function(e){e&&"function"==typeof e||(e=i.stringify);var t,n=this,r=n.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var o=r+(n.slashes?"//":"");return n.username&&(o+=n.username,n.password&&(o+=":"+n.password),o+="@"),o+=n.host+n.pathname,(t="object"==typeof n.query?e(n.query):n.query)&&(o+="?"!==t.charAt(0)?"?"+t:t),n.hash&&(o+=n.hash),o}},p.extractProtocol=h,p.location=d,p.trimLeft=l,p.qs=i,e.exports=p}).call(this,n(24))},function(e,t,n){"use strict";e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty;function i(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}t.stringify=function(e,t){t=t||"";var n,i,o=[];for(i in"string"!=typeof t&&(t="?"),e)if(r.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=encodeURIComponent(i),n=encodeURIComponent(n),null===i||null===n)continue;o.push(i+"="+n)}return o.length?t+o.join("&"):""},t.parse=function(e){for(var t,n=/([^=?&]+)=?([^&]*)/g,r={};t=n.exec(e);){var o=i(t[1]),a=i(t[2]);null===o||null===a||o in r||(r[o]=a)}return r}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PathExt=void 0;const a=o(n(66));!function(e){function t(e){return 0===e.indexOf("/")&&(e=e.slice(1)),e}e.join=function(...e){const n=a.join(...e);return"."===n?"":t(n)},e.basename=function(e,t){return a.basename(e,t)},e.dirname=function(e){const n=t(a.dirname(e));return"."===n?"":n},e.extname=function(e){return a.extname(e)},e.normalize=function(e){return""===e?"":t(a.normalize(e))},e.resolve=function(...e){return t(a.resolve(...e))},e.relative=function(e,n){return t(a.relative(e,n))},e.normalizeExtension=function(e){return e.length>0&&0!==e.indexOf(".")&&(e="."+e),e},e.removeSlash=t}(t.PathExt||(t.PathExt={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Text=void 0,function(e){const t="𝐚".length>1;e.jsIndexToCharIndex=function(e,n){if(t)return e;let r=e;for(let t=0;t+1<n.length&&t<e;t++){const e=n.charCodeAt(t);if(e>=55296&&e<=56319){const e=n.charCodeAt(t+1);e>=56320&&e<=57343&&(r--,t++)}}return r},e.charIndexToJsIndex=function(e,n){if(t)return e;let r=e;for(let e=0;e+1<n.length&&e<r;e++){const t=n.charCodeAt(e);if(t>=55296&&t<=56319){const t=n.charCodeAt(e+1);t>=56320&&t<=57343&&(r++,e++)}}return r},e.camelCase=function(e,t=!1){return e.replace(/^(\w)|[\s-_:]+(\w)/g,(function(e,n,r){return r?r.toUpperCase():t?n.toUpperCase():n.toLowerCase()}))},e.titleCase=function(e){return(e||"").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}}(t.Text||(t.Text={}))},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Time=void 0;const i=r(n(4));!function(e){e.formatHuman=function(e){i.default.locale(document.documentElement.lang);let t=i.default(e).fromNow();return t="a few seconds ago"===t?"seconds ago":t,t},e.format=function(e,t="YYYY-MM-DD HH:mm"){return i.default(e).format(t)}}(t.Time||(t.Time={}))},function(e,t,n){var r={"./af":104,"./af.js":104,"./ar":105,"./ar-dz":106,"./ar-dz.js":106,"./ar-kw":107,"./ar-kw.js":107,"./ar-ly":108,"./ar-ly.js":108,"./ar-ma":109,"./ar-ma.js":109,"./ar-sa":110,"./ar-sa.js":110,"./ar-tn":111,"./ar-tn.js":111,"./ar.js":105,"./az":112,"./az.js":112,"./be":113,"./be.js":113,"./bg":114,"./bg.js":114,"./bm":115,"./bm.js":115,"./bn":116,"./bn.js":116,"./bo":117,"./bo.js":117,"./br":118,"./br.js":118,"./bs":119,"./bs.js":119,"./ca":120,"./ca.js":120,"./cs":121,"./cs.js":121,"./cv":122,"./cv.js":122,"./cy":123,"./cy.js":123,"./da":124,"./da.js":124,"./de":125,"./de-at":126,"./de-at.js":126,"./de-ch":127,"./de-ch.js":127,"./de.js":125,"./dv":128,"./dv.js":128,"./el":129,"./el.js":129,"./en-SG":130,"./en-SG.js":130,"./en-au":131,"./en-au.js":131,"./en-ca":132,"./en-ca.js":132,"./en-gb":133,"./en-gb.js":133,"./en-ie":134,"./en-ie.js":134,"./en-il":135,"./en-il.js":135,"./en-nz":136,"./en-nz.js":136,"./eo":137,"./eo.js":137,"./es":138,"./es-do":139,"./es-do.js":139,"./es-us":140,"./es-us.js":140,"./es.js":138,"./et":141,"./et.js":141,"./eu":142,"./eu.js":142,"./fa":143,"./fa.js":143,"./fi":144,"./fi.js":144,"./fo":145,"./fo.js":145,"./fr":146,"./fr-ca":147,"./fr-ca.js":147,"./fr-ch":148,"./fr-ch.js":148,"./fr.js":146,"./fy":149,"./fy.js":149,"./ga":150,"./ga.js":150,"./gd":151,"./gd.js":151,"./gl":152,"./gl.js":152,"./gom-latn":153,"./gom-latn.js":153,"./gu":154,"./gu.js":154,"./he":155,"./he.js":155,"./hi":156,"./hi.js":156,"./hr":157,"./hr.js":157,"./hu":158,"./hu.js":158,"./hy-am":159,"./hy-am.js":159,"./id":160,"./id.js":160,"./is":161,"./is.js":161,"./it":162,"./it-ch":163,"./it-ch.js":163,"./it.js":162,"./ja":164,"./ja.js":164,"./jv":165,"./jv.js":165,"./ka":166,"./ka.js":166,"./kk":167,"./kk.js":167,"./km":168,"./km.js":168,"./kn":169,"./kn.js":169,"./ko":170,"./ko.js":170,"./ku":171,"./ku.js":171,"./ky":172,"./ky.js":172,"./lb":173,"./lb.js":173,"./lo":174,"./lo.js":174,"./lt":175,"./lt.js":175,"./lv":176,"./lv.js":176,"./me":177,"./me.js":177,"./mi":178,"./mi.js":178,"./mk":179,"./mk.js":179,"./ml":180,"./ml.js":180,"./mn":181,"./mn.js":181,"./mr":182,"./mr.js":182,"./ms":183,"./ms-my":184,"./ms-my.js":184,"./ms.js":183,"./mt":185,"./mt.js":185,"./my":186,"./my.js":186,"./nb":187,"./nb.js":187,"./ne":188,"./ne.js":188,"./nl":189,"./nl-be":190,"./nl-be.js":190,"./nl.js":189,"./nn":191,"./nn.js":191,"./pa-in":192,"./pa-in.js":192,"./pl":193,"./pl.js":193,"./pt":194,"./pt-br":195,"./pt-br.js":195,"./pt.js":194,"./ro":196,"./ro.js":196,"./ru":197,"./ru.js":197,"./sd":198,"./sd.js":198,"./se":199,"./se.js":199,"./si":200,"./si.js":200,"./sk":201,"./sk.js":201,"./sl":202,"./sl.js":202,"./sq":203,"./sq.js":203,"./sr":204,"./sr-cyrl":205,"./sr-cyrl.js":205,"./sr.js":204,"./ss":206,"./ss.js":206,"./sv":207,"./sv.js":207,"./sw":208,"./sw.js":208,"./ta":209,"./ta.js":209,"./te":210,"./te.js":210,"./tet":211,"./tet.js":211,"./tg":212,"./tg.js":212,"./th":213,"./th.js":213,"./tl-ph":214,"./tl-ph.js":214,"./tlh":215,"./tlh.js":215,"./tr":216,"./tr.js":216,"./tzl":217,"./tzl.js":217,"./tzm":218,"./tzm-latn":219,"./tzm-latn.js":219,"./tzm.js":218,"./ug-cn":220,"./ug-cn.js":220,"./uk":221,"./uk.js":221,"./ur":222,"./ur.js":222,"./uz":223,"./uz-latn":224,"./uz-latn.js":224,"./uz.js":223,"./vi":225,"./vi.js":225,"./x-pseudo":226,"./x-pseudo.js":226,"./yo":227,"./yo.js":227,"./zh-cn":228,"./zh-cn.js":228,"./zh-hk":229,"./zh-hk.js":229,"./zh-tw":230,"./zh-tw.js":230};function i(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}i.keys=function(){return Object.keys(r)},i.resolve=o,e.exports=i,i.id=388},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateCheckpointModel=t.validateContentsModel=void 0;const r=n(54);t.validateContentsModel=function(e){r.validateProperty(e,"name","string"),r.validateProperty(e,"path","string"),r.validateProperty(e,"type","string"),r.validateProperty(e,"created","string"),r.validateProperty(e,"last_modified","string"),r.validateProperty(e,"mimetype","object"),r.validateProperty(e,"content","object"),r.validateProperty(e,"format","object")},t.validateCheckpointModel=function(e){r.validateProperty(e,"id","string"),r.validateProperty(e,"last_modified","string")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=WebSocket},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KernelManager=void 0;const r=n(2),i=n(40),o=n(7),a=n(22),s=n(56),l=n(67),c=n(394);class u extends s.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._kernelConnections=new Set,this._models=new Map,this._runningChanged=new o.Signal(this),this._connectionFailure=new o.Signal(this),this._pollModels=new i.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:1e4,backoff:!0,max:3e5},name:"@jupyterlab/services:KernelManager#models",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._kernelConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}connectTo(e){var t;const{id:n}=e.model;let r=null===(t=e.handleComms)||void 0===t||t;if(void 0===e.handleComms)for(const e of this._kernelConnections)if(e.id===n&&e.handleComms){r=!1;break}const i=new c.KernelConnection(Object.assign(Object.assign({handleComms:r},e),{serverSettings:this.serverSettings}));return this._onStarted(i),this._models.has(n)||this.refreshRunning().catch(()=>{}),i}running(){return r.iter([...this._models.values()])}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={},t={}){const n=await l.startNew(e,this.serverSettings);return this.connectTo(Object.assign(Object.assign({},t),{model:n}))}async shutdown(e){await l.shutdownKernel(e,this.serverSettings),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map(e=>l.shutdownKernel(e,this.serverSettings))),await this.refreshRunning()}async findById(e){return this._models.has(e)||await this.refreshRunning(),this._models.get(e)}async requestRunning(){var e;let t;try{t=await l.listRunning(this.serverSettings)}catch(t){throw(t instanceof a.ServerConnection.NetworkError||503===(null===(e=t.response)||void 0===e?void 0:e.status))&&this._connectionFailure.emit(t),t}this.isDisposed||this._models.size===t.length&&r.every(t,e=>{const t=this._models.get(e.id);return!!t&&t.name===e.name})||(this._models=new Map(t.map(e=>[e.id,e])),this._kernelConnections.forEach(e=>{this._models.has(e.id)||e.handleShutdown()}),this._runningChanged.emit(t))}_onStarted(e){this._kernelConnections.add(e),e.statusChanged.connect(this._onStatusChanged,this),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._kernelConnections.delete(e),this.refreshRunning().catch(()=>{})}_onStatusChanged(e,t){"dead"===t&&this.refreshRunning().catch(()=>{})}}t.KernelManager=u},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelConnection=void 0;const a=n(14),s=n(9),l=n(7),c=n(22),u=n(395),d=o(n(55)),h=n(396),p=o(n(397)),f=o(n(68)),m=n(69),g=o(n(67));class v{constructor(e){var t,n,r,i;this._createSocket=()=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");const e=this.serverSettings,t=a.URLExt.join(e.wsUrl,g.KERNEL_SERVICE_URL,encodeURIComponent(this._id)),n=t.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/,"$1");console.debug("Starting WebSocket: "+n);let r=a.URLExt.join(t,"channels?session_id="+encodeURIComponent(this._clientId));const i=e.token;e.appendToken&&""!==i&&(r=r+"&token="+encodeURIComponent(i)),this._ws=new e.WebSocket(r),this._ws.binaryType="arraybuffer",this._ws.onmessage=this._onWSMessage,this._ws.onopen=this._onWSOpen,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose},this._onWSOpen=e=>{this._updateConnectionStatus("connected")},this._onWSMessage=e=>{let t;try{t=p.deserialize(e.data),f.validateMessage(t)}catch(e){throw e.message="Kernel message validation error: "+e.message,e}this._kernelSession=t.header.session,this._msgChain=this._msgChain.then(()=>this._handleMessage(t)).catch(e=>{e.message.startsWith("Canceled future for ")&&console.error(e)}),this._anyMessage.emit({msg:t,direction:"recv"})},this._onWSClose=e=>{this.isDisposed||this._reconnect()},this._id="",this._name="",this._status="unknown",this._connectionStatus="connecting",this._kernelSession="",this._isDisposed=!1,this._ws=null,this._username="",this._reconnectLimit=7,this._reconnectAttempt=0,this._reconnectTimeout=null,this._futures=new Map,this._comms=new Map,this._targetRegistry=Object.create(null),this._info=new s.PromiseDelegate,this._pendingMessages=[],this._statusChanged=new l.Signal(this),this._connectionStatusChanged=new l.Signal(this),this._disposed=new l.Signal(this),this._iopubMessage=new l.Signal(this),this._anyMessage=new l.Signal(this),this._unhandledMessage=new l.Signal(this),this._displayIdToParentIds=new Map,this._msgIdToDisplayIds=new Map,this._msgChain=Promise.resolve(),this._noOp=()=>{},this._name=e.model.name,this._id=e.model.id,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:c.ServerConnection.makeSettings(),this._clientId=null!==(n=e.clientId)&&void 0!==n?n:s.UUID.uuid4(),this._username=null!==(r=e.username)&&void 0!==r?r:"",this.handleComms=null===(i=e.handleComms)||void 0===i||i,this._createSocket(),this.requestKernelInfo()}get disposed(){return this._disposed}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get model(){return{id:this.id,name:this.name}}get anyMessage(){return this._anyMessage}get id(){return this._id}get name(){return this._name}get username(){return this._username}get clientId(){return this._clientId}get status(){return this._status}get connectionStatus(){return this._connectionStatus}get isDisposed(){return this._isDisposed}get info(){return this._info.promise}get spec(){return this._specPromise||(this._specPromise=m.KernelSpecAPI.getSpecs(this.serverSettings).then(e=>e.kernelspecs[this._name])),this._specPromise}clone(e={}){return new v(Object.assign({model:this.model,username:this.username,serverSettings:this.serverSettings,handleComms:!1},e))}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearKernelState(),this._pendingMessages=[],this._clearSocket(),l.Signal.clearData(this))}sendShellMessage(e,t=!1,n=!0){return this._sendKernelShellControl(h.KernelShellFutureHandler,e,t,n)}sendControlMessage(e,t=!1,n=!0){return this._sendKernelShellControl(h.KernelControlFutureHandler,e,t,n)}_sendKernelShellControl(e,t,n=!1,r=!0){this._sendMessage(t),this._anyMessage.emit({msg:t,direction:"send"});const i=new e(()=>{const e=t.header.msg_id;this._futures.delete(e);const n=this._msgIdToDisplayIds.get(e);n&&(n.forEach(t=>{const n=this._displayIdToParentIds.get(t);if(n){const r=n.indexOf(e);if(-1===r)return;1===n.length?this._displayIdToParentIds.delete(t):(n.splice(r,1),this._displayIdToParentIds.set(t,n))}}),this._msgIdToDisplayIds.delete(e))},t,n,r,this);return this._futures.set(t.header.msg_id,i),i}_sendMessage(e,t=!0){if("dead"===this.status)throw new Error("Kernel is dead");if("connected"===this.connectionStatus&&"_RESTARTING_"!==this._kernelSession)this._ws.send(p.serialize(e));else{if(!t)throw new Error("Could not send message");this._pendingMessages.push(e)}}async interrupt(){if("dead"===this.status)throw new Error("Kernel is dead");return g.interruptKernel(this.id,this.serverSettings)}async restart(){if("dead"===this.status)throw new Error("Kernel is dead");this._clearKernelState(),this._updateStatus("restarting"),this._kernelSession="_RESTARTING_",await g.restartKernel(this.id,this.serverSettings),await this.reconnect()}reconnect(){this._errorIfDisposed();const e=new s.PromiseDelegate,t=(n,r)=>{"connected"===r?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):"disconnected"===r&&(e.reject(new Error("Kernel connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}async shutdown(){"dead"!==this.status&&await g.shutdownKernel(this.id,this.serverSettings),this.handleShutdown()}handleShutdown(){this._updateStatus("dead"),this.dispose()}async requestKernelInfo(){const e=d.createMessage({msgType:"kernel_info_request",channel:"shell",username:this._username,session:this._clientId,content:{}});let t;try{t=await _.handleShellMessage(this,e)}catch(e){if(this.isDisposed)return;throw e}if(this._errorIfDisposed(),t)return void 0===t.content.status&&(t.content.status="ok"),"ok"!==t.content.status?(this._info.reject("Kernel info reply errored"),t):(this._info.resolve(t.content),this._kernelSession=t.header.session,t)}requestComplete(e){const t=d.createMessage({msgType:"complete_request",channel:"shell",username:this._username,session:this._clientId,content:e});return _.handleShellMessage(this,t)}requestInspect(e){const t=d.createMessage({msgType:"inspect_request",channel:"shell",username:this._username,session:this._clientId,content:e});return _.handleShellMessage(this,t)}requestHistory(e){const t=d.createMessage({msgType:"history_request",channel:"shell",username:this._username,session:this._clientId,content:e});return _.handleShellMessage(this,t)}requestExecute(e,t=!0,n){const r=d.createMessage({msgType:"execute_request",channel:"shell",username:this._username,session:this._clientId,content:Object.assign(Object.assign({},{silent:!1,store_history:!0,user_expressions:{},allow_stdin:!0,stop_on_error:!1}),e),metadata:n});return this.sendShellMessage(r,!0,t)}requestDebug(e,t=!0){const n=d.createMessage({msgType:"debug_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestIsComplete(e){const t=d.createMessage({msgType:"is_complete_request",channel:"shell",username:this._username,session:this._clientId,content:e});return _.handleShellMessage(this,t)}requestCommInfo(e){const t=d.createMessage({msgType:"comm_info_request",channel:"shell",username:this._username,session:this._clientId,content:e});return _.handleShellMessage(this,t)}sendInputReply(e){const t=d.createMessage({msgType:"input_reply",channel:"stdin",username:this._username,session:this._clientId,content:e});this._sendMessage(t),this._anyMessage.emit({msg:t,direction:"send"})}createComm(e,t=s.UUID.uuid4()){if(!this.handleComms)throw new Error("Comms are disabled on this kernel connection");if(this._comms.has(t))throw new Error("Comm is already created");const n=new u.CommHandler(e,t,this,()=>{this._unregisterComm(t)});return this._comms.set(t,n),n}hasComm(e){return this._comms.has(e)}registerCommTarget(e,t){this.handleComms&&(this._targetRegistry[e]=t)}removeCommTarget(e,t){this.handleComms&&(this.isDisposed||this._targetRegistry[e]!==t||delete this._targetRegistry[e])}registerMessageHook(e,t){var n;const r=null===(n=this._futures)||void 0===n?void 0:n.get(e);r&&r.registerMessageHook(t)}removeMessageHook(e,t){var n;const r=null===(n=this._futures)||void 0===n?void 0:n.get(e);r&&r.removeMessageHook(t)}async _handleDisplayId(e,t){var n,r;const i=t.parent_header.msg_id;let o=this._displayIdToParentIds.get(e);if(o){const e={header:s.JSONExt.deepCopy(t.header),parent_header:s.JSONExt.deepCopy(t.parent_header),metadata:s.JSONExt.deepCopy(t.metadata),content:s.JSONExt.deepCopy(t.content),channel:t.channel,buffers:t.buffers?t.buffers.slice():[]};e.header.msg_type="update_display_data",await Promise.all(o.map(async t=>{const n=this._futures&&this._futures.get(t);n&&await n.handleMsg(e)}))}if("update_display_data"===t.header.msg_type)return!0;o=null!==(n=this._displayIdToParentIds.get(e))&&void 0!==n?n:[],-1===o.indexOf(i)&&o.push(i),this._displayIdToParentIds.set(e,o);const a=null!==(r=this._msgIdToDisplayIds.get(i))&&void 0!==r?r:[];return-1===a.indexOf(i)&&a.push(i),this._msgIdToDisplayIds.set(i,a),!1}async _handleRestart(){this._clearKernelState(),this._updateStatus("restarting"),setTimeout(()=>{this.reconnect(),this.requestKernelInfo()},0)}_clearSocket(){null!==this._ws&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}_updateStatus(e){this._status!==e&&"dead"!==this._status&&(this._status=e,_.logKernelStatus(this),this._statusChanged.emit(e),"dead"===e&&this.dispose())}_sendPending(){for(;"connected"===this.connectionStatus&&"_RESTARTING_"!==this._kernelSession&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}_clearKernelState(){this._kernelSession="",this._pendingMessages=[],this._futures.forEach(e=>{e.dispose()}),this._comms.forEach(e=>{e.dispose()}),this._msgChain=Promise.resolve(),this._futures=new Map,this._comms=new Map,this._displayIdToParentIds.clear(),this._msgIdToDisplayIds.clear()}_assertCurrentMessage(e){if(this._errorIfDisposed(),e.header.session!==this._kernelSession)throw new Error("Canceling handling of old message: "+e.header.msg_type)}async _handleCommOpen(e){this._assertCurrentMessage(e);const t=e.content,n=new u.CommHandler(t.target_name,t.comm_id,this,()=>{this._unregisterComm(t.comm_id)});this._comms.set(t.comm_id,n);try{const r=await _.loadObject(t.target_name,t.target_module,this._targetRegistry);await r(n,e)}catch(e){throw n.close(),console.error("Exception opening new comm"),e}}async _handleCommClose(e){this._assertCurrentMessage(e);const t=e.content,n=this._comms.get(t.comm_id);if(!n)return void console.error("Comm not found for comm id "+t.comm_id);this._unregisterComm(n.commId);const r=n.onClose;r&&await r(e),n.dispose()}async _handleCommMsg(e){this._assertCurrentMessage(e);const t=e.content,n=this._comms.get(t.comm_id);if(!n)return;const r=n.onMsg;r&&await r(e)}_unregisterComm(e){this._comms.delete(e)}_updateConnectionStatus(e){if(this._connectionStatus!==e){if(this._connectionStatus=e,"connecting"!==e&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),"dead"!==this.status)if("connected"===e){let e=!1;"_RESTARTING_"===this._kernelSession&&(this._kernelSession="",e=!0);let t=this.requestKernelInfo();e&&(this._kernelSession="_RESTARTING_");let n=!1,r=()=>{n||(n=!0,e&&"_RESTARTING_"===this._kernelSession&&(this._kernelSession=""),clearTimeout(i),this._pendingMessages.length>0&&this._sendPending())};t.then(r);let i=setTimeout(r,3e3)}else this._updateStatus("unknown");this._connectionStatusChanged.emit(e)}}async _handleMessage(e){var t,n;let r=!1;if("shutdown_reply"===e.header.msg_type&&(this._kernelSession=e.header.session,this._sendPending()),e.parent_header&&"iopub"===e.channel&&(d.isDisplayDataMsg(e)||d.isUpdateDisplayDataMsg(e)||d.isExecuteResultMsg(e))){const n=(null!==(t=e.content.transient)&&void 0!==t?t:{}).display_id;n&&(r=await this._handleDisplayId(n,e),this._assertCurrentMessage(e))}if(!r&&e.parent_header){const t=e.parent_header,r=null===(n=this._futures)||void 0===n?void 0:n.get(t.msg_id);if(r)await r.handleMsg(e),this._assertCurrentMessage(e);else{const n=t.session===this.clientId;"iopub"!==e.channel&&n&&this._unhandledMessage.emit(e)}}if("iopub"===e.channel){switch(e.header.msg_type){case"status":{const t=e.content.execution_state;"autorestarting"===t&&Promise.resolve().then(async()=>{await this._handleRestart(),this._updateStatus("autorestarting")}),"restarting"===t&&Promise.resolve().then(async()=>{await this._handleRestart(),this._kernelSession=e.header.session,this._updateStatus("restarting")}),this._updateStatus(t);break}case"comm_open":this.handleComms&&await this._handleCommOpen(e);break;case"comm_msg":this.handleComms&&await this._handleCommMsg(e);break;case"comm_close":this.handleComms&&await this._handleCommClose(e)}this.isDisposed||(this._assertCurrentMessage(e),this._iopubMessage.emit(e))}}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt<this._reconnectLimit){this._updateConnectionStatus("connecting");const e=_.getRandomIntInclusive(0,1e3*(Math.pow(2,this._reconnectAttempt)-1));console.warn(`Connection lost, reconnecting in ${Math.floor(e/1e3)} seconds.`),this._reconnectTimeout=setTimeout(this._createSocket,e),this._reconnectAttempt+=1}else this._updateConnectionStatus("disconnected");this._clearSocket()}_errorIfDisposed(){if(this.isDisposed)throw new Error("Kernel connection is disposed")}}var _;t.KernelConnection=v,function(e){e.logKernelStatus=function(e){switch(e.status){case"idle":case"busy":case"unknown":return;default:console.debug(`Kernel: ${e.status} (${e.id})`)}},e.handleShellMessage=async function(e,t){return e.sendShellMessage(t,!0).done},e.loadObject=function(e,t,n){return new Promise((r,i)=>{if(t){if("undefined"==typeof requirejs)throw new Error("requirejs not found");requirejs([t],n=>{if(void 0===n[e]){i(new Error(`Object '${e}' not found in module '${t}'`))}else r(n[e])},i)}else(null==n?void 0:n[e])?r(n[e]):i(new Error(`Object '${e}' not found in registry`))})},e.getRandomIntInclusive=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}}(_||(_={}))},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CommHandler=void 0;const a=n(21),s=o(n(55));class l extends a.DisposableDelegate{constructor(e,t,n,r){super(r),this._target="",this._id="",this._id=t,this._target=e,this._kernel=n}get commId(){return this._id}get targetName(){return this._target}get onClose(){return this._onClose}set onClose(e){this._onClose=e}get onMsg(){return this._onMsg}set onMsg(e){this._onMsg=e}open(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot open");const r=s.createMessage({msgType:"comm_open",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,target_name:this._target,data:null!=e?e:{}},metadata:t,buffers:n});return this._kernel.sendShellMessage(r,!1,!0)}send(e,t,n=[],r=!0){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot send");const i=s.createMessage({msgType:"comm_msg",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:e},metadata:t,buffers:n});return this._kernel.sendShellMessage(i,!1,r)}close(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot close");const r=s.createMessage({msgType:"comm_close",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:null!=e?e:{}},metadata:t,buffers:n}),i=this._kernel.sendShellMessage(r,!1,!0),o=this._onClose;if(o){o(s.createMessage({msgType:"comm_close",channel:"iopub",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:null!=e?e:{}},metadata:t,buffers:n}))}return this.dispose(),i}}t.CommHandler=l},function(e,t,n){"use strict";(function(e){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelShellFutureHandler=t.KernelControlFutureHandler=t.KernelFutureHandler=void 0;const a=n(9),s=n(21),l=o(n(55));class c extends s.DisposableDelegate{constructor(e,t,n,r,i){super(e),this._status=0,this._stdin=u.noOp,this._iopub=u.noOp,this._reply=u.noOp,this._done=new a.PromiseDelegate,this._hooks=new u.HookList,this._disposeOnDone=!0,this._msg=t,n||this._setFlag(u.KernelFutureFlag.GotReply),this._disposeOnDone=r,this._kernel=i}get msg(){return this._msg}get done(){return this._done.promise}get onReply(){return this._reply}set onReply(e){this._reply=e}get onIOPub(){return this._iopub}set onIOPub(e){this._iopub=e}get onStdin(){return this._stdin}set onStdin(e){this._stdin=e}registerMessageHook(e){if(this.isDisposed)throw new Error("Kernel future is disposed");this._hooks.add(e)}removeMessageHook(e){this.isDisposed||this._hooks.remove(e)}sendInputReply(e){this._kernel.sendInputReply(e)}dispose(){this._stdin=u.noOp,this._iopub=u.noOp,this._reply=u.noOp,this._hooks=null,this._testFlag(u.KernelFutureFlag.IsDone)||(this._done.promise.catch(()=>{}),this._done.reject(new Error(`Canceled future for ${this.msg.header.msg_type} message before replies were done`))),super.dispose()}async handleMsg(e){switch(e.channel){case"control":case"shell":e.channel===this.msg.channel&&e.parent_header.msg_id===this.msg.header.msg_id&&await this._handleReply(e);break;case"stdin":await this._handleStdin(e);break;case"iopub":await this._handleIOPub(e)}}async _handleReply(e){const t=this._reply;t&&await t(e),this._replyMsg=e,this._setFlag(u.KernelFutureFlag.GotReply),this._testFlag(u.KernelFutureFlag.GotIdle)&&this._handleDone()}async _handleStdin(e){const t=this._stdin;t&&await t(e)}async _handleIOPub(e){const t=await this._hooks.process(e),n=this._iopub;t&&n&&await n(e),l.isStatusMsg(e)&&"idle"===e.content.execution_state&&(this._setFlag(u.KernelFutureFlag.GotIdle),this._testFlag(u.KernelFutureFlag.GotReply)&&this._handleDone())}_handleDone(){this._testFlag(u.KernelFutureFlag.IsDone)||(this._setFlag(u.KernelFutureFlag.IsDone),this._done.resolve(this._replyMsg),this._disposeOnDone&&this.dispose())}_testFlag(e){return 0!=(this._status&e)}_setFlag(e){this._status|=e}}t.KernelFutureHandler=c;t.KernelControlFutureHandler=class extends c{};var u;t.KernelShellFutureHandler=class extends c{},function(t){t.noOp=()=>{};const n="function"==typeof requestAnimationFrame?requestAnimationFrame:e;let r;t.HookList=class{constructor(){this._hooks=[]}add(e){this.remove(e),this._hooks.push(e)}remove(e){const t=this._hooks.indexOf(e);t>=0&&(this._hooks[t]=null,this._scheduleCompact())}async process(e){await this._processing;const t=new a.PromiseDelegate;let n;this._processing=t.promise;for(let r=this._hooks.length-1;r>=0;r--){const i=this._hooks[r];if(null!==i){try{n=await i(e)}catch(e){n=!0,console.error(e)}if(!1===n)return t.resolve(void 0),!1}}return t.resolve(void 0),!0}_scheduleCompact(){this._compactScheduled||(this._compactScheduled=!0,n(()=>{this._processing=this._processing.then(()=>{this._compactScheduled=!1,this._compact()})}))}_compact(){let e=0;for(let t=0,n=this._hooks.length;t<n;t++){const n=this._hooks[t];null===this._hooks[t]?e++:this._hooks[t-e]=n}this._hooks.length-=e}},function(e){e[e.GotReply=1]="GotReply",e[e.GotIdle=2]="GotIdle",e[e.IsDone=4]="IsDone",e[e.DisposeOnDone=8]="DisposeOnDone"}(r=t.KernelFutureFlag||(t.KernelFutureFlag={}))}(u||(u={}))}).call(this,n(35).setImmediate)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.serialize=t.deserialize=void 0,t.deserialize=function(e){let t;return t="string"==typeof e?JSON.parse(e):function(e){const t=new DataView(e),n=t.getUint32(0),r=[];if(n<2)throw new Error("Invalid incoming Kernel Message");for(let e=1;e<=n;e++)r.push(t.getUint32(4*e));const i=new Uint8Array(e.slice(r[0],r[1])),o=JSON.parse(new TextDecoder("utf8").decode(i));o.buffers=[];for(let t=1;t<n;t++){const n=r[t],i=r[t+1]||e.byteLength;o.buffers.push(new DataView(e.slice(n,i)))}return o}(e),t},t.serialize=function(e){var t;let n;return n=(null===(t=e.buffers)||void 0===t?void 0:t.length)?function(e){const t=[],n=[],r=new TextEncoder;let i=[];void 0!==e.buffers&&(i=e.buffers,delete e.buffers);const o=r.encode(JSON.stringify(e));n.push(o.buffer);for(let e=0;e<i.length;e++){const t=i[e];n.push(ArrayBuffer.isView(t)?t.buffer:t)}const a=n.length;t.push(4*(a+1));for(let e=0;e+1<n.length;e++)t.push(t[t.length-1]+n[e].byteLength);const s=new Uint8Array(t[t.length-1]+n[n.length-1].byteLength),l=new DataView(s.buffer);l.setUint32(0,a);for(let e=0;e<t.length;e++)l.setUint32(4*(e+1),t[e]);for(let e=0;e<n.length;e++)s.set(new Uint8Array(n[e]),t[e]);return s.buffer}(e):JSON.stringify(e),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSpecModels=t.validateSpecModel=void 0;const r=n(54);function i(e){const t=e.spec;if(!t)throw new Error("Invalid kernel spec");r.validateProperty(e,"name","string"),r.validateProperty(e,"resources","object"),r.validateProperty(t,"language","string"),r.validateProperty(t,"display_name","string"),r.validateProperty(t,"argv","array");let n=null;t.hasOwnProperty("metadata")&&(r.validateProperty(t,"metadata","object"),n=t.metadata);let i=null;return t.hasOwnProperty("env")&&(r.validateProperty(t,"env","object"),i=t.env),{name:e.name,resources:e.resources,language:t.language,display_name:t.display_name,argv:t.argv,metadata:n,env:i}}t.validateSpecModel=i,t.validateSpecModels=function(e){if(!e.hasOwnProperty("kernelspecs"))throw new Error("No kernelspecs found");let t=Object.keys(e.kernelspecs);const n=Object.create(null);let r=e.default;for(let r=0;r<t.length;r++){const o=e.kernelspecs[t[r]];try{n[t[r]]=i(o)}catch(e){console.warn("Removing errant kernel spec: "+t[r])}}if(t=Object.keys(n),!t.length)throw new Error("No valid kernelspecs found");return r&&"string"==typeof r&&r in n||(r=t[0],console.warn(`Default kernel not found, using '${t[0]}'`)),{default:r,kernelspecs:n}}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelSpecManager=void 0;const a=n(9),s=n(40),l=n(7),c=o(n(233)),u=n(56);class d extends u.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._connectionFailure=new l.Signal(this),this._specs=null,this._specsChanged=new l.Signal(this),this._ready=Promise.all([this.requestSpecs()]).then(e=>{}).catch(e=>{}).then(()=>{this.isDisposed||(this._isReady=!0)}),this._pollSpecs=new s.Poll({auto:!1,factory:()=>this.requestSpecs(),frequency:{interval:61e3,backoff:!0,max:3e5},name:"@jupyterlab/services:KernelSpecManager#specs",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this.ready.then(()=>{this._pollSpecs.start()})}get isReady(){return this._isReady}get ready(){return this._ready}get specs(){return this._specs}get specsChanged(){return this._specsChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshSpecs(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestSpecs(){const e=await c.getSpecs(this.serverSettings);this.isDisposed||a.JSONExt.deepEqual(e,this._specs)||(this._specs=e,this._specsChanged.emit(e))}}t.KernelSpecManager=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceManager=void 0;const r=n(7),i=n(402),o=n(234),a=n(231),s=n(69),l=n(235),c=n(236),u=n(237),d=n(25),h=n(238),p=n(232);t.ServiceManager=class{constructor(e={}){var t,n;this._isDisposed=!1,this._connectionFailure=new r.Signal(this),this._isReady=!1;const f=e.defaultDrive,m=null!==(t=e.serverSettings)&&void 0!==t?t:d.ServerConnection.makeSettings(),g={defaultDrive:f,serverSettings:m,standby:null!==(n=e.standby)&&void 0!==n?n:"when-hidden"},v=new p.KernelManager(g);this.serverSettings=m,this.contents=new a.ContentsManager(g),this.sessions=new l.SessionManager(Object.assign(Object.assign({},g),{kernelManager:v})),this.settings=new c.SettingManager(g),this.terminals=new u.TerminalManager(g),this.builder=new i.BuildManager(g),this.workspaces=new h.WorkspaceManager(g),this.nbconvert=new o.NbConvertManager(g),this.kernelspecs=new s.KernelSpecManager(g),this.kernelspecs.connectionFailure.connect(this._onConnectionFailure,this),this.sessions.connectionFailure.connect(this._onConnectionFailure,this),this.terminals.connectionFailure.connect(this._onConnectionFailure,this);const _=[this.sessions.ready,this.kernelspecs.ready];this.terminals.isAvailable()&&_.push(this.terminals.ready),this._readyPromise=Promise.all(_).then(()=>{this._isReady=!0})}get connectionFailure(){return this._connectionFailure}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,r.Signal.clearData(this),this.contents.dispose(),this.sessions.dispose(),this.terminals.dispose())}get isReady(){return this._isReady}get ready(){return this._readyPromise}_onConnectionFailure(e,t){this._connectionFailure.emit(t)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BuildManager=void 0;const r=n(14),i=n(25);t.BuildManager=class{constructor(e={}){var t;this._url="",this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:i.ServerConnection.makeSettings();const{baseUrl:n,appUrl:o}=this.serverSettings;this._url=r.URLExt.join(n,o,"api/build")}get isAvailable(){return"true"===r.PageConfig.getOption("buildAvailable").toLowerCase()}get shouldCheck(){return"true"===r.PageConfig.getOption("buildCheck").toLowerCase()}getStatus(){const{_url:e,serverSettings:t}=this;return i.ServerConnection.makeRequest(e,{},t).then(e=>{if(200!==e.status)throw new i.ServerConnection.ResponseError(e);return e.json()}).then(e=>{if("string"!=typeof e.status)throw new Error("Invalid data");if("string"!=typeof e.message)throw new Error("Invalid data");return e})}build(){const{_url:e,serverSettings:t}=this;return i.ServerConnection.makeRequest(e,{method:"POST"},t).then(e=>{if(400===e.status)throw new i.ServerConnection.ResponseError(e,"Build aborted");if(200!==e.status){const t=`Build failed with ${e.status}, please run 'jupyter lab build' on the server for full output`;throw new i.ServerConnection.ResponseError(e,t)}})}cancel(){const{_url:e,serverSettings:t}=this;return i.ServerConnection.makeRequest(e,{method:"DELETE"},t).then(e=>{if(204!==e.status)throw new i.ServerConnection.ResponseError(e)})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateModels=t.updateLegacySessionModel=t.validateModel=void 0;const r=n(68),i=n(54);function o(e){i.validateProperty(e,"id","string"),i.validateProperty(e,"type","string"),i.validateProperty(e,"name","string"),i.validateProperty(e,"path","string"),i.validateProperty(e,"kernel","object"),r.validateModel(e.kernel)}t.validateModel=o,t.updateLegacySessionModel=function(e){void 0===e.path&&void 0!==e.notebook&&(e.path=e.notebook.path,e.type="notebook",e.name="")},t.validateModels=function(e){if(!Array.isArray(e))throw new Error("Invalid session list");e.forEach(e=>o(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=void 0;const r=n(2),i=n(40),o=n(7),a=n(25),s=n(56),l=n(406),c=n(70);class u extends s.BaseManager{constructor(e){var t;super(e),this._isReady=!1,this._sessionConnections=new Set,this._models=new Map,this._runningChanged=new o.Signal(this),this._connectionFailure=new o.Signal(this),this._connectToKernel=e=>this._kernelManager.connectTo(e),this._kernelManager=e.kernelManager,this._pollModels=new i.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:1e4,backoff:!0,max:3e5},name:"@jupyterlab/services:SessionManager#models",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,await this._kernelManager.ready,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._sessionConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}connectTo(e){const t=new l.SessionConnection(Object.assign(Object.assign({},e),{connectToKernel:this._connectToKernel,serverSettings:this.serverSettings}));return this._onStarted(t),this._models.has(e.model.id)||this.refreshRunning().catch(()=>{}),t}running(){return r.iter([...this._models.values()])}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e,t={}){const n=await c.startSession(e,this.serverSettings);return await this.refreshRunning(),this.connectTo(Object.assign(Object.assign({},t),{model:n}))}async shutdown(e){await c.shutdownSession(e,this.serverSettings),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map(e=>c.shutdownSession(e,this.serverSettings))),await this.refreshRunning()}async stopIfNeeded(e){try{const t=(await c.listRunning(this.serverSettings)).filter(t=>t.path===e);if(1===t.length){const e=t[0].id;await this.shutdown(e)}}catch(e){}}async findById(e){return this._models.has(e)||await this.refreshRunning(),this._models.get(e)}async findByPath(e){for(const t of this._models.values())if(t.path===e)return t;await this.refreshRunning();for(const t of this._models.values())if(t.path===e)return t}async requestRunning(){var e;let t;try{t=await c.listRunning(this.serverSettings)}catch(t){throw(t instanceof a.ServerConnection.NetworkError||503===(null===(e=t.response)||void 0===e?void 0:e.status))&&this._connectionFailure.emit(t),t}this.isDisposed||this._models.size===t.length&&r.every(t,e=>{var t,n,r,i;const o=this._models.get(e.id);return!!o&&((null===(t=o.kernel)||void 0===t?void 0:t.id)===(null===(n=e.kernel)||void 0===n?void 0:n.id)&&(null===(r=o.kernel)||void 0===r?void 0:r.name)===(null===(i=e.kernel)||void 0===i?void 0:i.name)&&o.name===e.name&&o.path===e.path&&o.type===e.type)})||(this._models=new Map(t.map(e=>[e.id,e])),this._sessionConnections.forEach(e=>{this._models.has(e.id)?e.update(this._models.get(e.id)):e.dispose()}),this._runningChanged.emit(t))}_onStarted(e){this._sessionConnections.add(e),e.disposed.connect(this._onDisposed,this),e.propertyChanged.connect(this._onChanged,this),e.kernelChanged.connect(this._onChanged,this)}_onDisposed(e){this._sessionConnections.delete(e),this.refreshRunning().catch(()=>{})}_onChanged(){this.refreshRunning().catch(()=>{})}}t.SessionManager=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionConnection=void 0;const r=n(7),i=n(22),o=n(70),a=n(9);t.SessionConnection=class{constructor(e){var t,n,o,s;this._id="",this._path="",this._name="",this._type="",this._kernel=null,this._isDisposed=!1,this._disposed=new r.Signal(this),this._kernelChanged=new r.Signal(this),this._statusChanged=new r.Signal(this),this._connectionStatusChanged=new r.Signal(this),this._iopubMessage=new r.Signal(this),this._unhandledMessage=new r.Signal(this),this._anyMessage=new r.Signal(this),this._propertyChanged=new r.Signal(this),this._id=e.model.id,this._name=e.model.name,this._path=e.model.path,this._type=e.model.type,this._username=null!==(t=e.username)&&void 0!==t?t:"",this._clientId=null!==(n=e.clientId)&&void 0!==n?n:a.UUID.uuid4(),this._connectToKernel=e.connectToKernel,this._kernelConnectionOptions=null!==(o=e.kernelConnectionOptions)&&void 0!==o?o:{},this.serverSettings=null!==(s=e.serverSettings)&&void 0!==s?s:i.ServerConnection.makeSettings(),this.setupKernel(e.model.kernel)}get disposed(){return this._disposed}get kernelChanged(){return this._kernelChanged}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get anyMessage(){return this._anyMessage}get propertyChanged(){return this._propertyChanged}get id(){return this._id}get kernel(){return this._kernel}get path(){return this._path}get type(){return this._type}get name(){return this._name}get model(){return{id:this.id,kernel:this.kernel&&{id:this.kernel.id,name:this.kernel.name},path:this._path,type:this._type,name:this._name}}get isDisposed(){return this._isDisposed}update(e){const t=this.model;if(this._path=e.path,this._name=e.name,this._type=e.type,null===this._kernel&&null!==e.kernel||null!==this._kernel&&null===e.kernel||null!==this._kernel&&null!==e.kernel&&this._kernel.id!==e.kernel.id){null!==this._kernel&&this._kernel.dispose();const t=this._kernel||null;this.setupKernel(e.kernel);const n=this._kernel||null;this._kernelChanged.emit({name:"kernel",oldValue:t,newValue:n})}this._handleModelChange(t)}dispose(){if(!this.isDisposed){if(this._isDisposed=!0,this._disposed.emit(),this._kernel){this._kernel.dispose();const e=this._kernel;this._kernel=null;const t=this._kernel;this._kernelChanged.emit({name:"kernel",oldValue:e,newValue:t})}r.Signal.clearData(this)}}async setPath(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({path:e})}async setName(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({name:e})}async setType(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({type:e})}async changeKernel(e){if(this.isDisposed)throw new Error("Session is disposed");return await this._patch({kernel:e}),this.kernel}async shutdown(){if(this.isDisposed)throw new Error("Session is disposed");await o.shutdownSession(this.id,this.serverSettings),this.dispose()}setupKernel(e){if(null===e)return void(this._kernel=null);const t=this._connectToKernel(Object.assign(Object.assign({},this._kernelConnectionOptions),{model:e,username:this._username,clientId:this._clientId,serverSettings:this.serverSettings}));this._kernel=t,t.statusChanged.connect(this.onKernelStatus,this),t.connectionStatusChanged.connect(this.onKernelConnectionStatus,this),t.unhandledMessage.connect(this.onUnhandledMessage,this),t.iopubMessage.connect(this.onIOPubMessage,this),t.anyMessage.connect(this.onAnyMessage,this)}onKernelStatus(e,t){this._statusChanged.emit(t)}onKernelConnectionStatus(e,t){this._connectionStatusChanged.emit(t)}onIOPubMessage(e,t){this._iopubMessage.emit(t)}onUnhandledMessage(e,t){this._unhandledMessage.emit(t)}onAnyMessage(e,t){this._anyMessage.emit(t)}async _patch(e){const t=await o.updateSession(Object.assign(Object.assign({},e),{id:this._id}),this.serverSettings);return this.update(t),t}_handleModelChange(e){e.name!==this._name&&this._propertyChanged.emit("name"),e.type!==this._type&&this._propertyChanged.emit("type"),e.path!==this._path&&this._propertyChanged.emit("path")}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataConnector=void 0;t.DataConnector=class{async list(e){throw new Error("DataConnector#list method has not been implemented.")}async remove(e){throw new Error("DataConnector#remove method has not been implemented.")}async save(e,t){throw new Error("DataConnector#save method has not been implemented.")}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RestorablePool=void 0;const r=n(9),i=n(23),o=n(7);var a;t.RestorablePool=class{constructor(e){this._added=new o.Signal(this),this._current=null,this._currentChanged=new o.Signal(this),this._hasRestored=!1,this._isDisposed=!1,this._objects=new Set,this._restore=null,this._restored=new r.PromiseDelegate,this._updated=new o.Signal(this),this.namespace=e.namespace}get added(){return this._added}get current(){return this._current}set current(e){this._current!==e&&null!==e&&this._objects.has(e)&&(this._current=e,this._currentChanged.emit(this._current))}get currentChanged(){return this._currentChanged}get isDisposed(){return this._isDisposed}get restored(){return this._restored.promise}get size(){return this._objects.size}get updated(){return this._updated}async add(e){var t,n;if(e.isDisposed){const t="A disposed object cannot be added.";throw console.warn(t,e),new Error(t)}if(this._objects.has(e)){const t="This object already exists in the pool.";throw console.warn(t,e),new Error(t)}if(this._objects.add(e),e.disposed.connect(this._onInstanceDisposed,this),!a.injectedProperty.get(e)){if(this._restore){const{connector:r}=this._restore,i=this._restore.name(e);if(i){const o=`${this.namespace}:${i}`,s=null===(n=(t=this._restore).args)||void 0===n?void 0:n.call(t,e);a.nameProperty.set(e,o),await r.save(o,{data:s})}}this._added.emit(e)}}dispose(){this.isDisposed||(this._current=null,this._isDisposed=!0,this._objects.clear(),o.Signal.clearData(this))}find(e){const t=this._objects.values();for(const n of t)if(e(n))return n}forEach(e){this._objects.forEach(e)}filter(e){const t=[];return this.forEach(n=>{e(n)&&t.push(n)}),t}inject(e){return a.injectedProperty.set(e,!0),this.add(e)}has(e){return this._objects.has(e)}async restore(e){if(this._hasRestored)throw new Error("This pool has already been restored.");this._hasRestored=!0;const{command:t,connector:n,registry:r,when:i}=e,o=this.namespace,a=i?[n.list(o)].concat(i):[n.list(o)];this._restore=e;const[s]=await Promise.all(a),l=await Promise.all(s.ids.map(async(e,i)=>{const o=s.values[i],a=o&&o.data;return void 0===a?n.remove(e):r.execute(t,a).catch(()=>n.remove(e))}));return this._restored.resolve(),l}async save(e){var t,n;const r=a.injectedProperty.get(e);if(!this._restore||!this.has(e)||r)return;const{connector:i}=this._restore,o=this._restore.name(e),s=a.nameProperty.get(e),l=o?`${this.namespace}:${o}`:"";if(s&&s!==l&&await i.remove(s),a.nameProperty.set(e,l),l){const r=null===(n=(t=this._restore).args)||void 0===n?void 0:n.call(t,e);await i.save(l,{data:r})}s!==l&&this._updated.emit(e)}_onInstanceDisposed(e){if(this._objects.delete(e),e===this._current&&(this._current=null,this._currentChanged.emit(this._current)),a.injectedProperty.get(e))return;if(!this._restore)return;const{connector:t}=this._restore,n=a.nameProperty.get(e);n&&t.remove(n)}},function(e){e.injectedProperty=new i.AttachedProperty({name:"injected",create:()=>!1}),e.nameProperty=new i.AttachedProperty({name:"name",create:()=>""})}(a||(a={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateDB=void 0;const r=n(7);class i{constructor(e={}){this._changed=new r.Signal(this);const{connector:t,transform:n}=e;this._connector=t||new i.Connector,this._ready=n?n.then(e=>{const{contents:t,type:n}=e;switch(n){case"cancel":return;case"clear":return this._clear();case"merge":return this._merge(t||{});case"overwrite":return this._overwrite(t||{});default:return}}):Promise.resolve(void 0)}get changed(){return this._changed}async clear(){await this._ready,await this._clear()}async fetch(e){return await this._ready,this._fetch(e)}async list(e){return await this._ready,this._list(e)}async remove(e){await this._ready,await this._remove(e),this._changed.emit({id:e,type:"remove"})}async save(e,t){await this._ready,await this._save(e,t),this._changed.emit({id:e,type:"save"})}async toJSON(){await this._ready;const{ids:e,values:t}=await this._list();return t.reduce((t,n,r)=>(t[e[r]]=n,t),{})}async _clear(){await Promise.all((await this._list()).ids.map(e=>this._remove(e)))}async _fetch(e){const t=await this._connector.fetch(e);if(t)return JSON.parse(t).v}async _list(e=""){const{ids:t,values:n}=await this._connector.list(e);return{ids:t,values:n.map(e=>JSON.parse(e).v)}}async _merge(e){await Promise.all(Object.keys(e).map(t=>e[t]&&this._save(t,e[t])))}async _overwrite(e){await this._clear(),await this._merge(e)}async _remove(e){return this._connector.remove(e)}async _save(e,t){return this._connector.save(e,JSON.stringify({v:t}))}}t.StateDB=i,function(e){e.Connector=class{constructor(){this._storage={}}async fetch(e){return this._storage[e]}async list(e=""){return Object.keys(this._storage).reduce((t,n)=>(""!==e&&e!==n.split(":")[0]||(t.ids.push(n),t.values.push(this._storage[n])),t),{ids:[],values:[]})}async remove(e){delete this._storage[e]}async save(e,t){this._storage[e]=t}}}(i=t.StateDB||(t.StateDB={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IStateDB=void 0;const r=n(9);t.IStateDB=new r.Token("@jupyterlab/coreutils:IStateDB")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAvailable=void 0;const r=n(57);Object.defineProperty(t,"isAvailable",{enumerable:!0,get:function(){return r.isAvailable}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalManager=void 0;const r=n(2),i=n(40),o=n(7),a=n(22),s=n(56),l=n(57),c=n(414);class u extends s.BaseManager{constructor(e={}){var t;if(super(e),this._isReady=!1,this._names=[],this._terminalConnections=new Set,this._runningChanged=new o.Signal(this),this._connectionFailure=new o.Signal(this),!this.isAvailable())return this._ready=Promise.reject("Terminals unavailable"),void this._ready.catch(e=>{});this._pollModels=new i.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:1e4,backoff:!0,max:3e5},name:"@jupyterlab/services:TerminalManager#models",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._names.length=0,this._terminalConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}isAvailable(){return l.isAvailable()}connectTo(e){const t=new c.TerminalConnection(Object.assign(Object.assign({},e),{serverSettings:this.serverSettings}));return this._onStarted(t),this._names.includes(e.model.name)||this.refreshRunning().catch(()=>{}),t}running(){return r.iter(this._models)}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(){const e=await l.startNew(this.serverSettings);return await this.refreshRunning(),this.connectTo({model:e})}async shutdown(e){await l.shutdownTerminal(e,this.serverSettings),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all(this._names.map(e=>l.shutdownTerminal(e,this.serverSettings))),await this.refreshRunning()}async requestRunning(){var e;let t;try{t=await l.listRunning(this.serverSettings)}catch(t){throw(t instanceof a.ServerConnection.NetworkError||503===(null===(e=t.response)||void 0===e?void 0:e.status))&&this._connectionFailure.emit(t),t}if(this.isDisposed)return;const n=t.map(({name:e})=>e).sort();n!==this._names&&(this._names=n,this._terminalConnections.forEach(e=>{n.includes(e.name)||e.dispose()}),this._runningChanged.emit(this._models))}_onStarted(e){this._terminalConnections.add(e),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._terminalConnections.delete(e),this.refreshRunning().catch(()=>{})}get _models(){return this._names.map(e=>({name:e}))}}t.TerminalManager=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalConnection=void 0;const r=n(14),i=n(9),o=n(7),a=n(22),s=n(57);class l{constructor(e){var t;this._createSocket=()=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");const e=this._name,t=this.serverSettings;let n=r.URLExt.join(t.wsUrl,"terminals","websocket",encodeURIComponent(e));const i=t.token;t.appendToken&&""!==i&&(n=n+"?token="+encodeURIComponent(i)),this._ws=new t.WebSocket(n),this._ws.onmessage=this._onWSMessage,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose},this._onWSMessage=e=>{if(this._isDisposed)return;const t=JSON.parse(e.data);"disconnect"===t[0]&&this.dispose(),"connecting"!==this._connectionStatus?this._messageReceived.emit({type:t[0],content:t.slice(1)}):"setup"===t[0]&&this._updateConnectionStatus("connected")},this._onWSClose=e=>{console.warn("Terminal websocket closed: "+e.code),this.isDisposed||this._reconnect()},this._connectionStatus="connecting",this._connectionStatusChanged=new o.Signal(this),this._isDisposed=!1,this._disposed=new o.Signal(this),this._messageReceived=new o.Signal(this),this._reconnectTimeout=null,this._ws=null,this._noOp=()=>{},this._reconnectLimit=7,this._reconnectAttempt=0,this._pendingMessages=[],this._name=e.model.name,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:a.ServerConnection.makeSettings(),this._createSocket()}get disposed(){return this._disposed}get messageReceived(){return this._messageReceived}get name(){return this._name}get model(){return{name:this._name}}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearSocket(),o.Signal.clearData(this))}send(e){this._sendMessage(e)}_sendMessage(e,t=!0){if(!this._isDisposed&&e.content)if("connected"===this.connectionStatus&&this._ws){const t=[e.type,...e.content];this._ws.send(JSON.stringify(t))}else{if(!t)throw new Error("Could not send message: "+JSON.stringify(e));this._pendingMessages.push(e)}}_sendPending(){for(;"connected"===this.connectionStatus&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}reconnect(){this._errorIfDisposed();const e=new i.PromiseDelegate,t=(n,r)=>{"connected"===r?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):"disconnected"===r&&(e.reject(new Error("Terminal connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt<this._reconnectLimit){this._updateConnectionStatus("connecting");const e=c.getRandomIntInclusive(0,1e3*(Math.pow(2,this._reconnectAttempt)-1));console.error(`Connection lost, reconnecting in ${Math.floor(e/1e3)} seconds.`),this._reconnectTimeout=setTimeout(this._createSocket,e),this._reconnectAttempt+=1}else this._updateConnectionStatus("disconnected");this._clearSocket()}_clearSocket(){null!==this._ws&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}async shutdown(){await s.shutdownTerminal(this.name,this.serverSettings),this.dispose()}clone(){return new l(this)}_updateConnectionStatus(e){this._connectionStatus!==e&&(this._connectionStatus=e,"connecting"!==e&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),"connected"===e&&this._sendPending(),this._connectionStatusChanged.emit(e))}_errorIfDisposed(){if(this.isDisposed)throw new Error("Terminal connection is disposed")}get connectionStatusChanged(){return this._connectionStatusChanged}get connectionStatus(){return this._connectionStatus}}var c;t.TerminalConnection=l,function(e){e.getTermUrl=function(e,t){return r.URLExt.join(e,s.TERMINAL_SERVICE_URL,encodeURIComponent(t))},e.getRandomIntInclusive=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}}(c||(c={}))},function(e,t,n){!function(e){"use strict";e.runMode=function(t,n,r,i){var o=e.getMode(e.defaults,n),a=i&&i.tabSize||e.defaults.tabSize;if(r.appendChild){var s=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<9),l=r,c=0;l.innerHTML="",r=function(e,t){if("\n"==e)return l.appendChild(document.createTextNode(s?"\r":e)),void(c=0);for(var n="",r=0;;){var i=e.indexOf("\t",r);if(-1==i){n+=e.slice(r),c+=e.length-r;break}c+=i-r,n+=e.slice(r,i);var o=a-c%a;c+=o;for(var u=0;u<o;++u)n+=" ";r=i+1}if(t){var d=l.appendChild(document.createElement("span"));d.className="cm-"+t.replace(/ +/g," cm-"),d.appendChild(document.createTextNode(n))}else l.appendChild(document.createTextNode(n))}}for(var u=e.splitLines(t),d=i&&i.state||e.startState(o),h=0,p=u.length;h<p;++h){h&&r("\n");var f=new e.StringStream(u[h],null,{lookAhead:function(e){return u[h+e]},baseToken:function(){}});for(!f.string&&o.blankLine&&o.blankLine(d);!f.eol();){var m=o.token(f,d);r(f.current(),m,h,f.start,d),f.start=f.pos}}}}(n(8))},function(e,t,n){!function(e){"use strict";var t={},n=/[^\s\u00a0]/,r=e.Pos,i=e.cmpPos;function o(e){var t=e.search(n);return-1==t?0:t}function a(e,t){var n=e.getMode();return!1!==n.useInnerComments&&n.innerMode?e.getModeAt(t):n}e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",(function(e){e||(e=t);for(var n=1/0,i=this.listSelections(),o=null,a=i.length-1;a>=0;a--){var s=i[a].from(),l=i[a].to();s.line>=n||(l.line>=n&&(l=r(n,0)),n=s.line,null==o?this.uncomment(s,l,e)?o="un":(this.lineComment(s,l,e),o="line"):"un"==o?this.uncomment(s,l,e):this.lineComment(s,l,e))}})),e.defineExtension("lineComment",(function(e,i,s){s||(s=t);var l=this,c=a(l,e),u=l.getLine(e.line);if(null!=u&&(d=e,h=u,!/\bstring\b/.test(l.getTokenTypeAt(r(d.line,0)))||/^[\'\"\`]/.test(h))){var d,h,p=s.lineComment||c.lineComment;if(p){var f=Math.min(0!=i.ch||i.line==e.line?i.line+1:i.line,l.lastLine()+1),m=null==s.padding?" ":s.padding,g=s.commentBlankLines||e.line==i.line;l.operation((function(){if(s.indent){for(var t=null,i=e.line;i<f;++i){var a=(c=l.getLine(i)).slice(0,o(c));(null==t||t.length>a.length)&&(t=a)}for(i=e.line;i<f;++i){var c=l.getLine(i),u=t.length;(g||n.test(c))&&(c.slice(0,u)!=t&&(u=o(c)),l.replaceRange(t+p+m,r(i,0),r(i,u)))}}else for(i=e.line;i<f;++i)(g||n.test(l.getLine(i)))&&l.replaceRange(p+m,r(i,0))}))}else(s.blockCommentStart||c.blockCommentStart)&&(s.fullLines=!0,l.blockComment(e,i,s))}})),e.defineExtension("blockComment",(function(e,o,s){s||(s=t);var l=this,c=a(l,e),u=s.blockCommentStart||c.blockCommentStart,d=s.blockCommentEnd||c.blockCommentEnd;if(u&&d){if(!/\bcomment\b/.test(l.getTokenTypeAt(r(e.line,0)))){var h=Math.min(o.line,l.lastLine());h!=e.line&&0==o.ch&&n.test(l.getLine(h))&&--h;var p=null==s.padding?" ":s.padding;e.line>h||l.operation((function(){if(0!=s.fullLines){var t=n.test(l.getLine(h));l.replaceRange(p+d,r(h)),l.replaceRange(u+p,r(e.line,0));var a=s.blockCommentLead||c.blockCommentLead;if(null!=a)for(var f=e.line+1;f<=h;++f)(f!=h||t)&&l.replaceRange(a+p,r(f,0))}else{var m=0==i(l.getCursor("to"),o),g=!l.somethingSelected();l.replaceRange(d,o),m&&l.setSelection(g?o:l.getCursor("from"),o),l.replaceRange(u,e)}}))}}else(s.lineComment||c.lineComment)&&0!=s.fullLines&&l.lineComment(e,o,s)})),e.defineExtension("uncomment",(function(e,i,o){o||(o=t);var s,l=this,c=a(l,e),u=Math.min(0!=i.ch||i.line==e.line?i.line:i.line-1,l.lastLine()),d=Math.min(e.line,u),h=o.lineComment||c.lineComment,p=[],f=null==o.padding?" ":o.padding;e:if(h){for(var m=d;m<=u;++m){var g=l.getLine(m),v=g.indexOf(h);if(v>-1&&!/comment/.test(l.getTokenTypeAt(r(m,v+1)))&&(v=-1),-1==v&&n.test(g))break e;if(v>-1&&n.test(g.slice(0,v)))break e;p.push(g)}if(l.operation((function(){for(var e=d;e<=u;++e){var t=p[e-d],n=t.indexOf(h),i=n+h.length;n<0||(t.slice(i,i+f.length)==f&&(i+=f.length),s=!0,l.replaceRange("",r(e,n),r(e,i)))}})),s)return!0}var _=o.blockCommentStart||c.blockCommentStart,y=o.blockCommentEnd||c.blockCommentEnd;if(!_||!y)return!1;var b=o.blockCommentLead||c.blockCommentLead,M=l.getLine(d),w=M.indexOf(_);if(-1==w)return!1;var L=u==d?M:l.getLine(u),x=L.indexOf(y,u==d?w+_.length:0),E=r(d,w+1),C=r(u,x+1);if(-1==x||!/comment/.test(l.getTokenTypeAt(E))||!/comment/.test(l.getTokenTypeAt(C))||l.getRange(E,C,"\n").indexOf(y)>-1)return!1;var T=M.lastIndexOf(_,e.ch),S=-1==T?-1:M.slice(0,e.ch).indexOf(y,T+_.length);if(-1!=T&&-1!=S&&S+y.length!=e.ch)return!1;S=L.indexOf(y,i.ch);var A=L.slice(i.ch).lastIndexOf(_,S-i.ch);return T=-1==S||-1==A?-1:i.ch+A,(-1==S||-1==T||T==i.ch)&&(l.operation((function(){l.replaceRange("",r(u,x-(f&&L.slice(x-f.length,x)==f?f.length:0)),r(u,x+y.length));var e=w+_.length;if(f&&M.slice(e,e+f.length)==f&&(e+=f.length),l.replaceRange("",r(d,w),r(d,e)),b)for(var t=d+1;t<=u;++t){var i=l.getLine(t),o=i.indexOf(b);if(-1!=o&&!n.test(i.slice(0,o))){var a=o+b.length;f&&i.slice(a,a+f.length)==f&&(a+=f.length),l.replaceRange("",r(t,o),r(t,a))}}})),!0)}))}(n(8))},function(e,t,n){!function(e){"use strict";function t(t){t.state.rulerDiv.textContent="";var n=t.getOption("rulers"),r=t.defaultCharWidth(),i=t.charCoords(e.Pos(t.firstLine(),0),"div").left;t.state.rulerDiv.style.minHeight=t.display.scroller.offsetHeight+30+"px";for(var o=0;o<n.length;o++){var a=document.createElement("div");a.className="CodeMirror-ruler";var s,l=n[o];"number"==typeof l?s=l:(s=l.column,l.className&&(a.className+=" "+l.className),l.color&&(a.style.borderColor=l.color),l.lineStyle&&(a.style.borderLeftStyle=l.lineStyle),l.width&&(a.style.borderLeftWidth=l.width)),a.style.left=i+s*r+"px",t.state.rulerDiv.appendChild(a)}}e.defineOption("rulers",!1,(function(e,n){e.state.rulerDiv&&(e.state.rulerDiv.parentElement.removeChild(e.state.rulerDiv),e.state.rulerDiv=null,e.off("refresh",t)),n&&n.length&&(e.state.rulerDiv=e.display.lineSpace.parentElement.insertBefore(document.createElement("div"),e.display.lineSpace),e.state.rulerDiv.className="CodeMirror-rulers",t(e),e.on("refresh",t))}))}(n(8))},function(e,t,n){!function(e){var t={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},n=e.Pos;function r(e,n){return"pairs"==n&&"string"==typeof e?e:"object"==typeof e&&null!=e[n]?e[n]:t[n]}e.defineOption("autoCloseBrackets",!1,(function(t,n,a){a&&a!=e.Init&&(t.removeKeyMap(i),t.state.closeBrackets=null),n&&(o(r(n,"pairs")),t.state.closeBrackets=n,t.addKeyMap(i))}));var i={Backspace:function(t){var i=s(t);if(!i||t.getOption("disableInput"))return e.Pass;for(var o=r(i,"pairs"),a=t.listSelections(),c=0;c<a.length;c++){if(!a[c].empty())return e.Pass;var u=l(t,a[c].head);if(!u||o.indexOf(u)%2!=0)return e.Pass}for(c=a.length-1;c>=0;c--){var d=a[c].head;t.replaceRange("",n(d.line,d.ch-1),n(d.line,d.ch+1),"+delete")}},Enter:function(t){var n=s(t),i=n&&r(n,"explode");if(!i||t.getOption("disableInput"))return e.Pass;for(var o=t.listSelections(),a=0;a<o.length;a++){if(!o[a].empty())return e.Pass;var c=l(t,o[a].head);if(!c||i.indexOf(c)%2!=0)return e.Pass}t.operation((function(){var e=t.lineSeparator()||"\n";t.replaceSelection(e+e,null),t.execCommand("goCharLeft"),o=t.listSelections();for(var n=0;n<o.length;n++){var r=o[n].head.line;t.indentLine(r,null,!0),t.indentLine(r+1,null,!0)}}))}};function o(e){for(var t=0;t<e.length;t++){var n=e.charAt(t),r="'"+n+"'";i[r]||(i[r]=a(n))}}function a(t){return function(i){return function(t,i){var o=s(t);if(!o||t.getOption("disableInput"))return e.Pass;var a=r(o,"pairs"),l=a.indexOf(i);if(-1==l)return e.Pass;for(var u,d=r(o,"closeBefore"),h=r(o,"triples"),p=a.charAt(l+1)==i,f=t.listSelections(),m=l%2==0,g=0;g<f.length;g++){var v,_=f[g],y=_.head,b=t.getRange(y,n(y.line,y.ch+1));if(m&&!_.empty())v="surround";else if(!p&&m||b!=i)if(p&&y.ch>1&&h.indexOf(i)>=0&&t.getRange(n(y.line,y.ch-2),y)==i+i){if(y.ch>2&&/\bstring/.test(t.getTokenTypeAt(n(y.line,y.ch-2))))return e.Pass;v="addFour"}else if(p){var M=0==y.ch?" ":t.getRange(n(y.line,y.ch-1),y);if(e.isWordChar(b)||M==i||e.isWordChar(M))return e.Pass;v="both"}else{if(!m||!(0===b.length||/\s/.test(b)||d.indexOf(b)>-1))return e.Pass;v="both"}else v=p&&c(t,y)?"both":h.indexOf(i)>=0&&t.getRange(y,n(y.line,y.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=v)return e.Pass}else u=v}var w=l%2?a.charAt(l-1):i,L=l%2?i:a.charAt(l+1);t.operation((function(){if("skip"==u)t.execCommand("goCharRight");else if("skipThree"==u)for(var r=0;r<3;r++)t.execCommand("goCharRight");else if("surround"==u){var i=t.getSelections();for(r=0;r<i.length;r++)i[r]=w+i[r]+L;for(t.replaceSelections(i,"around"),i=t.listSelections().slice(),r=0;r<i.length;r++)i[r]=(o=i[r],a=void 0,a=e.cmpPos(o.anchor,o.head)>0,{anchor:new n(o.anchor.line,o.anchor.ch+(a?-1:1)),head:new n(o.head.line,o.head.ch+(a?1:-1))});t.setSelections(i)}else"both"==u?(t.replaceSelection(w+L,null),t.triggerElectric(w+L),t.execCommand("goCharLeft")):"addFour"==u&&(t.replaceSelection(w+w+w+w,"before"),t.execCommand("goCharRight"));var o,a}))}(i,t)}}function s(e){var t=e.state.closeBrackets;return!t||t.override?t:e.getModeAt(e.getCursor()).closeBrackets||t}function l(e,t){var r=e.getRange(n(t.line,t.ch-1),n(t.line,t.ch+1));return 2==r.length?r:null}function c(e,t){var r=e.getTokenAt(n(t.line,t.ch+1));return/\bstring/.test(r.type)&&r.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}o(t.pairs+"`")}(n(8))},function(e,t,n){!function(e){"use strict";e.defineOption("foldGutter",!1,(function(t,r,i){var o;i&&i!=e.Init&&(t.clearGutter(t.state.foldGutter.options.gutter),t.state.foldGutter=null,t.off("gutterClick",l),t.off("changes",c),t.off("viewportChange",u),t.off("fold",d),t.off("unfold",d),t.off("swapDoc",c)),r&&(t.state.foldGutter=new n((!0===(o=r)&&(o={}),null==o.gutter&&(o.gutter="CodeMirror-foldgutter"),null==o.indicatorOpen&&(o.indicatorOpen="CodeMirror-foldgutter-open"),null==o.indicatorFolded&&(o.indicatorFolded="CodeMirror-foldgutter-folded"),o)),s(t),t.on("gutterClick",l),t.on("changes",c),t.on("viewportChange",u),t.on("fold",d),t.on("unfold",d),t.on("swapDoc",c))}));var t=e.Pos;function n(e){this.options=e,this.from=this.to=0}function r(e,n){for(var r=e.findMarks(t(n,0),t(n+1,0)),i=0;i<r.length;++i)if(r[i].__isFold){var o=r[i].find(-1);if(o&&o.line===n)return r[i]}}function i(e){if("string"==typeof e){var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}return e.cloneNode(!0)}function o(e,n,o){var s=e.state.foldGutter.options,l=n-1,c=e.foldOption(s,"minFoldSize"),u=e.foldOption(s,"rangeFinder"),d="string"==typeof s.indicatorFolded&&a(s.indicatorFolded),h="string"==typeof s.indicatorOpen&&a(s.indicatorOpen);e.eachLine(n,o,(function(n){++l;var o=null,a=n.gutterMarkers;if(a&&(a=a[s.gutter]),r(e,l)){if(d&&a&&d.test(a.className))return;o=i(s.indicatorFolded)}else{var p=t(l,0),f=u&&u(e,p);if(f&&f.to.line-f.from.line>=c){if(h&&a&&h.test(a.className))return;o=i(s.indicatorOpen)}}(o||a)&&e.setGutterMarker(n,s.gutter,o)}))}function a(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function s(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation((function(){o(e,t.from,t.to)})),n.from=t.from,n.to=t.to)}function l(e,n,i){var o=e.state.foldGutter;if(o){var a=o.options;if(i==a.gutter){var s=r(e,n);s?s.clear():e.foldCode(t(n,0),a)}}}function c(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout((function(){s(e)}),n.foldOnChangeTimeSpan||600)}}function u(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout((function(){var n=e.getViewport();t.from==t.to||n.from-t.to>20||t.from-n.to>20?s(e):e.operation((function(){n.from<t.from&&(o(e,n.from,t.from),t.from=n.from),n.to>t.to&&(o(e,t.to,n.to),t.to=n.to)}))}),n.updateViewportTimeSpan||400)}}function d(e,t){var n=e.state.foldGutter;if(n){var r=t.line;r>=n.from&&r<n.to&&o(e,r,r+1)}}}(n(8),n(240))},function(e,t,n){!function(e){"use strict";e.registerHelper("fold","brace",(function(t,n){var r,i=n.line,o=t.getLine(i);function a(a){for(var s=n.ch,l=0;;){var c=s<=0?-1:o.lastIndexOf(a,s-1);if(-1!=c){if(1==l&&c<n.ch)break;if(r=t.getTokenTypeAt(e.Pos(i,c+1)),!/^(comment|string)/.test(r))return c+1;s=c-1}else{if(1==l)break;l=1,s=o.length}}}var s="{",l="}",c=a("{");if(null==c&&(s="[",l="]",c=a("[")),null!=c){var u,d,h=1,p=t.lastLine();e:for(var f=i;f<=p;++f)for(var m=t.getLine(f),g=f==i?c:0;;){var v=m.indexOf(s,g),_=m.indexOf(l,g);if(v<0&&(v=m.length),_<0&&(_=m.length),(g=Math.min(v,_))==m.length)break;if(t.getTokenTypeAt(e.Pos(f,g+1))==r)if(g==v)++h;else if(!--h){u=f,d=g;break e}++g}if(null!=u&&i!=u)return{from:e.Pos(i,c),to:e.Pos(u,d)}}})),e.registerHelper("fold","import",(function(t,n){function r(n){if(n<t.firstLine()||n>t.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));if(/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"keyword"!=r.type||"import"!=r.string)return null;for(var i=n,o=Math.min(t.lastLine(),n+10);i<=o;++i){var a=t.getLine(i).indexOf(";");if(-1!=a)return{startCh:r.end,end:e.Pos(i,a)}}}var i,o=n.line,a=r(o);if(!a||r(o-1)||(i=r(o-2))&&i.end.line==o-1)return null;for(var s=a.end;;){var l=r(s.line+1);if(null==l)break;s=l.end}return{from:t.clipPos(e.Pos(o,a.startCh+1)),to:s}})),e.registerHelper("fold","include",(function(t,n){function r(n){if(n<t.firstLine()||n>t.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));return/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"meta"==r.type&&"#include"==r.string.slice(0,8)?r.start+8:void 0}var i=n.line,o=r(i);if(null==o||null!=r(i-1))return null;for(var a=i;null!=r(a+1);)++a;return{from:e.Pos(i,o+1),to:t.clipPos(e.Pos(a))}}))}(n(8))},function(e,t,n){!function(e){"use strict";function t(t,n){var r=t.getLine(n),i=r.search(/\S/);return-1==i||/\bcomment\b/.test(t.getTokenTypeAt(e.Pos(n,i+1)))?-1:e.countColumn(r,null,t.getOption("tabSize"))}e.registerHelper("fold","indent",(function(n,r){var i=t(n,r.line);if(!(i<0)){for(var o=null,a=r.line+1,s=n.lastLine();a<=s;++a){var l=t(n,a);if(-1==l);else{if(!(l>i))break;o=a}}return o?{from:e.Pos(r.line,n.getLine(r.line).length),to:e.Pos(o,n.getLine(o).length)}:void 0}}))}(n(8))},function(e,t,n){!function(e){"use strict";e.registerHelper("fold","markdown",(function(t,n){function r(n){var r=t.getTokenTypeAt(e.Pos(n,0));return r&&/\bheader\b/.test(r)}function i(e,t,n){var i=t&&t.match(/^#+/);return i&&r(e)?i[0].length:(i=n&&n.match(/^[=\-]+\s*$/))&&r(e+1)?"="==n[0]?1:2:100}var o=t.getLine(n.line),a=t.getLine(n.line+1),s=i(n.line,o,a);if(100!==s){for(var l=t.lastLine(),c=n.line,u=t.getLine(c+2);c<l&&!(i(c+1,a,u)<=s);)++c,a=u,u=t.getLine(c+2);return{from:e.Pos(n.line,o.length),to:e.Pos(c,t.getLine(c).length)}}}))}(n(8))},function(e,t,n){!function(e){"use strict";var t=e.Pos;function n(e,t){return e.line-t.line||e.ch-t.ch}var r="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i=new RegExp("<(/?)(["+r+"]["+r+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function o(e,t,n,r){this.line=t,this.ch=n,this.cm=e,this.text=e.getLine(t),this.min=r?Math.max(r.from,e.firstLine()):e.firstLine(),this.max=r?Math.min(r.to-1,e.lastLine()):e.lastLine()}function a(e,n){var r=e.cm.getTokenTypeAt(t(e.line,n));return r&&/\btag\b/.test(r)}function s(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function l(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function c(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(s(e))continue;return}if(a(e,t+1)){var n=e.text.lastIndexOf("/",t),r=n>-1&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t+1}}function u(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(l(e))continue;return}if(a(e,t+1)){i.lastIndex=t,e.ch=t;var n=i.exec(e.text);if(n&&n.index==t)return n}else e.ch=t}}function d(e){for(;;){i.lastIndex=e.ch;var t=i.exec(e.text);if(!t){if(s(e))continue;return}if(a(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}function h(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(l(e))continue;return}if(a(e,t+1)){var n=e.text.lastIndexOf("/",t),r=n>-1&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t}}function p(e,n){for(var r=[];;){var i,o=d(e),a=e.line,s=e.ch-(o?o[0].length:0);if(!o||!(i=c(e)))return;if("selfClose"!=i)if(o[1]){for(var l=r.length-1;l>=0;--l)if(r[l]==o[2]){r.length=l;break}if(l<0&&(!n||n==o[2]))return{tag:o[2],from:t(a,s),to:t(e.line,e.ch)}}else r.push(o[2])}}function f(e,n){for(var r=[];;){var i=h(e);if(!i)return;if("selfClose"!=i){var o=e.line,a=e.ch,s=u(e);if(!s)return;if(s[1])r.push(s[2]);else{for(var l=r.length-1;l>=0;--l)if(r[l]==s[2]){r.length=l;break}if(l<0&&(!n||n==s[2]))return{tag:s[2],from:t(e.line,e.ch),to:t(o,a)}}}else u(e)}}e.registerHelper("fold","xml",(function(e,r){for(var i=new o(e,r.line,0);;){var a=d(i);if(!a||i.line!=r.line)return;var s=c(i);if(!s)return;if(!a[1]&&"selfClose"!=s){var l=t(i.line,i.ch),u=p(i,a[2]);return u&&n(u.from,l)>0?{from:l,to:u.from}:null}}})),e.findMatchingTag=function(e,r,i){var a=new o(e,r.line,r.ch,i);if(-1!=a.text.indexOf(">")||-1!=a.text.indexOf("<")){var s=c(a),l=s&&t(a.line,a.ch),d=s&&u(a);if(s&&d&&!(n(a,r)>0)){var h={from:t(a.line,a.ch),to:l,tag:d[2]};return"selfClose"==s?{open:h,close:null,at:"open"}:d[1]?{open:f(a,d[2]),close:h,at:"close"}:{open:h,close:p(a=new o(e,l.line,l.ch,i),d[2]),at:"open"}}}},e.findEnclosingTag=function(e,t,n,r){for(var i=new o(e,t.line,t.ch,n);;){var a=f(i,r);if(!a)break;var s=p(new o(e,t.line,t.ch,n),a.tag);if(s)return{open:a,close:s}}},e.scanForClosingTag=function(e,t,n,r){return p(new o(e,t.line,t.ch,r?{from:0,to:r}:null),n)}}(n(8))},function(e,t,n){!function(e){"use strict";e.registerGlobalHelper("fold","comment",(function(e){return e.blockCommentStart&&e.blockCommentEnd}),(function(t,n){var r=t.getModeAt(n),i=r.blockCommentStart,o=r.blockCommentEnd;if(i&&o){for(var a,s=n.line,l=t.getLine(s),c=n.ch,u=0;;){var d=c<=0?-1:l.lastIndexOf(i,c-1);if(-1!=d){if(1==u&&d<n.ch)return;if(/comment/.test(t.getTokenTypeAt(e.Pos(s,d+1)))&&(0==d||l.slice(d-o.length,d)==o||!/comment/.test(t.getTokenTypeAt(e.Pos(s,d))))){a=d+i.length;break}c=d-1}else{if(1==u)return;u=1,c=l.length}}var h,p,f=1,m=t.lastLine();e:for(var g=s;g<=m;++g)for(var v=t.getLine(g),_=g==s?a:0;;){var y=v.indexOf(i,_),b=v.indexOf(o,_);if(y<0&&(y=v.length),b<0&&(b=v.length),(_=Math.min(y,b))==v.length)break;if(_==y)++f;else if(!--f){h=g,p=_;break e}++_}if(null!=h&&(s!=h||p!=a))return{from:e.Pos(s,a),to:e.Pos(h,p)}}}))}(n(8))},function(e,t,n){!function(e){"use strict";function t(t,r){e.changeEnd(r).line==t.lastLine()&&n(t)}function n(e){var t="";e.lineCount()>1&&(t=e.display.scroller.clientHeight-30-e.getLineHandle(e.lastLine()).height+"px"),e.state.scrollPastEndPadding!=t&&(e.state.scrollPastEndPadding=t,e.display.lineSpace.parentNode.style.paddingBottom=t,e.off("refresh",n),e.setSize(),e.on("refresh",n))}e.defineOption("scrollPastEnd",!1,(function(r,i,o){o&&o!=e.Init&&(r.off("change",t),r.off("refresh",n),r.display.lineSpace.parentNode.style.paddingBottom="",r.state.scrollPastEndPadding=null),i&&(r.on("change",t),r.on("refresh",n),n(r))}))}(n(8))},function(e,t,n){!function(e){"use strict";function t(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function n(e){return e.state.search||(e.state.search=new t)}function r(e){return"string"==typeof e&&e==e.toLowerCase()}function i(e,t,n){return e.getSearchCursor(t,n,{caseFold:r(t),multiline:!0})}function o(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0}):i(prompt(n,r))}function a(e){return e.replace(/\\([nrt\\])/g,(function(e,t){return"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"==t?"\\":e}))}function s(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(e){}else e=a(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function l(e,t,n){t.queryText=n,t.query=s(n),e.removeOverlay(t.overlay,r(t.query)),t.overlay=function(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var n=e.exec(t.string);if(n&&n.index==t.pos)return t.pos+=n[0].length||1,"searching";n?t.pos=n.index:t.skipToEnd()}}}(t.query,r(t.query)),e.addOverlay(t.overlay),e.showMatchesOnScrollbar&&(t.annotate&&(t.annotate.clear(),t.annotate=null),t.annotate=e.showMatchesOnScrollbar(t.query,r(t.query)))}function c(t,r,i,a){var s=n(t);if(s.query)return u(t,r);var c=t.getSelection()||s.lastQuery;if(c instanceof RegExp&&"x^"==c.source&&(c=null),i&&t.openDialog){var p=null,f=function(n,r){e.e_stop(r),n&&(n!=s.queryText&&(l(t,s,n),s.posFrom=s.posTo=t.getCursor()),p&&(p.style.opacity=1),u(t,r.shiftKey,(function(e,n){var r;n.line<3&&document.querySelector&&(r=t.display.wrapper.querySelector(".CodeMirror-dialog"))&&r.getBoundingClientRect().bottom-4>t.cursorCoords(n,"window").top&&((p=r).style.opacity=.4)})))};!function(e,t,n,r,i){e.openDialog(t,r,{value:n,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){d(e)},onKeyDown:i})}(t,h(t),c,f,(function(r,i){var o=e.keyName(r),a=t.getOption("extraKeys"),s=a&&a[o]||e.keyMap[t.getOption("keyMap")][o];"findNext"==s||"findPrev"==s||"findPersistentNext"==s||"findPersistentPrev"==s?(e.e_stop(r),l(t,n(t),i),t.execCommand(s)):"find"!=s&&"findPersistent"!=s||(e.e_stop(r),f(i,r))})),a&&c&&(l(t,s,c),u(t,r))}else o(t,h(t),"Search for:",c,(function(e){e&&!s.query&&t.operation((function(){l(t,s,e),s.posFrom=s.posTo=t.getCursor(),u(t,r)}))}))}function u(t,r,o){t.operation((function(){var a=n(t),s=i(t,a.query,r?a.posFrom:a.posTo);(s.find(r)||(s=i(t,a.query,r?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0))).find(r))&&(t.setSelection(s.from(),s.to()),t.scrollIntoView({from:s.from(),to:s.to()},20),a.posFrom=s.from(),a.posTo=s.to(),o&&o(s.from(),s.to()))}))}function d(e){e.operation((function(){var t=n(e);t.lastQuery=t.query,t.query&&(t.query=t.queryText=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))}))}function h(e){return'<span class="CodeMirror-search-label">'+e.phrase("Search:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+e.phrase("(Use /re/ syntax for regexp search)")+"</span>"}function p(e,t,n){e.operation((function(){for(var r=i(e,t);r.findNext();)if("string"!=typeof t){var o=e.getRange(r.from(),r.to()).match(t);r.replace(n.replace(/\$(\d)/g,(function(e,t){return o[t]})))}else r.replace(n)}))}function f(e,t){if(!e.getOption("readOnly")){var r=e.getSelection()||n(e).lastQuery,l='<span class="CodeMirror-search-label">'+(t?e.phrase("Replace all:"):e.phrase("Replace:"))+"</span>";o(e,l+function(e){return' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+e.phrase("(Use /re/ syntax for regexp search)")+"</span>"}(e),l,r,(function(n){n&&(n=s(n),o(e,function(e){return'<span class="CodeMirror-search-label">'+e.phrase("With:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>'}(e),e.phrase("Replace with:"),"",(function(r){if(r=a(r),t)p(e,n,r);else{d(e);var o=i(e,n,e.getCursor("from")),s=function(){var t,a=o.from();!(t=o.findNext())&&(o=i(e,n),!(t=o.findNext())||a&&o.from().line==a.line&&o.from().ch==a.ch)||(e.setSelection(o.from(),o.to()),e.scrollIntoView({from:o.from(),to:o.to()}),function(e,t,n,r){e.openConfirm?e.openConfirm(t,r):confirm(n)&&r[0]()}(e,function(e){return'<span class="CodeMirror-search-label">'+e.phrase("Replace?")+"</span> <button>"+e.phrase("Yes")+"</button> <button>"+e.phrase("No")+"</button> <button>"+e.phrase("All")+"</button> <button>"+e.phrase("Stop")+"</button> "}(e),e.phrase("Replace?"),[function(){l(t)},s,function(){p(e,n,r)}]))},l=function(e){o.replace("string"==typeof n?r:r.replace(/\$(\d)/g,(function(t,n){return e[n]}))),s()};s()}})))}))}}e.commands.find=function(e){d(e),c(e)},e.commands.findPersistent=function(e){d(e),c(e,!1,!0)},e.commands.findPersistentNext=function(e){c(e,!1,!0,!0)},e.commands.findPersistentPrev=function(e){c(e,!0,!0,!0)},e.commands.findNext=c,e.commands.findPrev=function(e){c(e,!0)},e.commands.clearSearch=d,e.commands.replace=f,e.commands.replaceAll=function(e){f(e,!0)}}(n(8),n(72),n(241))},function(e,t,n){!function(e){"use strict";function t(e,t){var n=Number(t);return/^[-+]/.test(t)?e.getCursor().line+n:n-1}e.commands.jumpToLine=function(e){var n=e.getCursor();!function(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0}):i(prompt(n,r))}(e,function(e){return e.phrase("Jump to line:")+' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+e.phrase("(Use line:column or scroll% syntax)")+"</span>"}(e),e.phrase("Jump to line:"),n.line+1+":"+n.ch,(function(r){var i;if(r)if(i=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(r))e.setCursor(t(e,i[1]),Number(i[2]));else if(i=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(r)){var o=Math.round(e.lineCount()*Number(i[1])/100);/^[-+]/.test(i[1])&&(o=n.line+o+1),e.setCursor(o-1,n.ch)}else(i=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(r))&&e.setCursor(t(e,i[1]),n.ch)}))},e.keyMap.default["Alt-G"]="jumpToLine"}(n(8),n(241))},function(e,t,n){!function(e){"use strict";var t="CodeMirror-activeline-background";function n(e){for(var n=0;n<e.state.activeLines.length;n++)e.removeLineClass(e.state.activeLines[n],"wrap","CodeMirror-activeline"),e.removeLineClass(e.state.activeLines[n],"background",t),e.removeLineClass(e.state.activeLines[n],"gutter","CodeMirror-activeline-gutter")}function r(e,r){for(var i=[],o=0;o<r.length;o++){var a=r[o],s=e.getOption("styleActiveLine");if("object"==typeof s&&s.nonEmpty?a.anchor.line==a.head.line:a.empty()){var l=e.getLineHandleVisualStart(a.head.line);i[i.length-1]!=l&&i.push(l)}}(function(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0})(e.state.activeLines,i)||e.operation((function(){n(e);for(var r=0;r<i.length;r++)e.addLineClass(i[r],"wrap","CodeMirror-activeline"),e.addLineClass(i[r],"background",t),e.addLineClass(i[r],"gutter","CodeMirror-activeline-gutter");e.state.activeLines=i}))}function i(e,t){r(e,t.ranges)}e.defineOption("styleActiveLine",!1,(function(t,o,a){var s=a!=e.Init&&a;o!=s&&(s&&(t.off("beforeSelectionChange",i),n(t),delete t.state.activeLines),o&&(t.state.activeLines=[],r(t,t.listSelections()),t.on("beforeSelectionChange",i)))}))}(n(8))},function(e,t,n){!function(e){"use strict";function t(e){e.state.markedSelection&&e.operation((function(){!function(e){if(!e.somethingSelected())return a(e);if(e.listSelections().length>1)return s(e);var t=e.getCursor("start"),n=e.getCursor("end"),r=e.state.markedSelection;if(!r.length)return o(e,t,n);var l=r[0].find(),c=r[r.length-1].find();if(!l||!c||n.line-t.line<=8||i(t,c.to)>=0||i(n,l.from)<=0)return s(e);for(;i(t,l.from)>0;)r.shift().clear(),l=r[0].find();for(i(t,l.from)<0&&(l.to.line-t.line<8?(r.shift().clear(),o(e,t,l.to,0)):o(e,t,l.from,0));i(n,c.to)<0;)r.pop().clear(),c=r[r.length-1].find();i(n,c.to)>0&&(n.line-c.from.line<8?(r.pop().clear(),o(e,c.from,n)):o(e,c.to,n))}(e)}))}function n(e){e.state.markedSelection&&e.state.markedSelection.length&&e.operation((function(){a(e)}))}e.defineOption("styleSelectedText",!1,(function(r,i,o){var l=o&&o!=e.Init;i&&!l?(r.state.markedSelection=[],r.state.markedSelectionStyle="string"==typeof i?i:"CodeMirror-selectedtext",s(r),r.on("cursorActivity",t),r.on("change",n)):!i&&l&&(r.off("cursorActivity",t),r.off("change",n),a(r),r.state.markedSelection=r.state.markedSelectionStyle=null)}));var r=e.Pos,i=e.cmpPos;function o(e,t,n,o){if(0!=i(t,n))for(var a=e.state.markedSelection,s=e.state.markedSelectionStyle,l=t.line;;){var c=l==t.line?t:r(l,0),u=l+8,d=u>=n.line,h=d?n:r(u,0),p=e.markText(c,h,{className:s});if(null==o?a.push(p):a.splice(o++,0,p),d)break;l=u}}function a(e){for(var t=e.state.markedSelection,n=0;n<t.length;++n)t[n].clear();t.length=0}function s(e){a(e);for(var t=e.listSelections(),n=0;n<t.length;n++)o(e,t[n].from(),t[n].to())}}(n(8))},function(e,t,n){!function(e){"use strict";function t(e){e.state.selectionPointer.rects=null,n(e)}function n(e){e.state.selectionPointer.willUpdate||(e.state.selectionPointer.willUpdate=!0,setTimeout((function(){!function(e){var t=e.state.selectionPointer;if(t){if(null==t.rects&&null!=t.mouseX&&(t.rects=[],e.somethingSelected()))for(var n=e.display.selectionDiv.firstChild;n;n=n.nextSibling)t.rects.push(n.getBoundingClientRect());var r=!1;if(null!=t.mouseX)for(var i=0;i<t.rects.length;i++){var o=t.rects[i];o.left<=t.mouseX&&o.right>=t.mouseX&&o.top<=t.mouseY&&o.bottom>=t.mouseY&&(r=!0)}var a=r?t.value:"";e.display.lineDiv.style.cursor!=a&&(e.display.lineDiv.style.cursor=a)}}(e),e.state.selectionPointer.willUpdate=!1}),50))}e.defineOption("selectionPointer",!1,(function(r,i){var o=r.state.selectionPointer;o&&(e.off(r.getWrapperElement(),"mousemove",o.mousemove),e.off(r.getWrapperElement(),"mouseout",o.mouseout),e.off(window,"scroll",o.windowScroll),r.off("cursorActivity",t),r.off("scroll",t),r.state.selectionPointer=null,r.display.lineDiv.style.cursor=""),i&&(o=r.state.selectionPointer={value:"string"==typeof i?i:"default",mousemove:function(e){!function(e,t){var r=e.state.selectionPointer;(null==t.buttons?t.which:t.buttons)?r.mouseX=r.mouseY=null:(r.mouseX=t.clientX,r.mouseY=t.clientY),n(e)}(r,e)},mouseout:function(e){!function(e,t){if(!e.getWrapperElement().contains(t.relatedTarget)){var r=e.state.selectionPointer;r.mouseX=r.mouseY=null,n(e)}}(r,e)},windowScroll:function(){t(r)},rects:null,mouseX:null,mouseY:null,willUpdate:!1},e.on(r.getWrapperElement(),"mousemove",o.mousemove),e.on(r.getWrapperElement(),"mouseout",o.mouseout),e.on(window,"scroll",o.windowScroll),r.on("cursorActivity",t),r.on("scroll",t))}))}(n(8))},function(e,t,n){!function(e){"use strict";var t=e.Pos;function n(e,t){return e.line==t.line&&e.ch==t.ch}var r=[];function i(e){r.push(e),r.length>50&&r.shift()}function o(e){return r[r.length-(e?Math.min(e,1):1)]||""}var a=null;function s(e,t,o,s,l){null==l&&(l=e.getRange(t,o)),"grow"==s&&a&&a.cm==e&&n(t,a.pos)&&e.isClean(a.gen)?function(e){if(!r.length)return i(e);r[r.length-1]+=e}(l):!1!==s&&i(l),e.replaceRange("",t,o,"+delete"),a="grow"==s?{cm:e,pos:t,gen:e.changeGeneration()}:null}function l(e,t,n){return e.findPosH(t,n,"char",!0)}function c(e,t,n){return e.findPosH(t,n,"word",!0)}function u(e,t,n){return e.findPosV(t,n,"line",e.doc.sel.goalColumn)}function d(e,t,n){return e.findPosV(t,n,"page",e.doc.sel.goalColumn)}function h(e,n,r){for(var i=n.line,o=e.getLine(i),a=/\S/.test(r<0?o.slice(0,n.ch):o.slice(n.ch)),s=e.firstLine(),l=e.lastLine();;){if((i+=r)<s||i>l)return e.clipPos(t(i-r,r<0?0:null));if(o=e.getLine(i),/\S/.test(o))a=!0;else if(a)return t(i,0)}}function p(e,n,r){for(var i=n.line,o=n.ch,a=e.getLine(n.line),s=!1;;){var l=a.charAt(o+(r<0?-1:0));if(l){if(s&&/[!?.]/.test(l))return t(i,o+(r>0?1:0));s||(s=/\w/.test(l)),o+=r}else{if(i==(r<0?e.firstLine():e.lastLine()))return t(i,o);if(a=e.getLine(i+r),!/\S/.test(a))return t(i,o);i+=r,o=r<0?a.length:0}}}function f(e,r,i){var o;if(e.findMatchingBracket&&(o=e.findMatchingBracket(r,{strict:!0}))&&o.match&&(o.forward?1:-1)==i)return i>0?t(o.to.line,o.to.ch+1):o.to;for(var a=!0;;a=!1){var s=e.getTokenAt(r),l=t(r.line,i<0?s.start:s.end);if(!(a&&i>0&&s.end==r.ch)&&/\w/.test(s.string))return l;var c=e.findPosH(l,i,"char");if(n(l,c))return r;r=c}}function m(e,t){var n=e.state.emacsPrefix;return n?(x(e),"-"==n?-1:Number(n)):t?null:1}function g(e){var t="string"==typeof e?function(t){t.execCommand(e)}:e;return function(e){var n=m(e);t(e);for(var r=1;r<n;++r)t(e)}}function v(e,t,r,i){var o=m(e);o<0&&(i=-i,o=-o);for(var a=0;a<o;++a){var s=r(e,t,i);if(n(s,t))break;t=s}return t}function _(e,t){var n=function(n){n.extendSelection(v(n,n.getCursor(),e,t))};return n.motion=!0,n}function y(e,t,n,r){for(var i,o=e.listSelections(),a=o.length;a--;)s(e,i=o[a].head,v(e,i,t,n),r)}function b(e,t){if(e.somethingSelected()){for(var n,r=e.listSelections(),i=r.length;i--;)s(e,(n=r[i]).anchor,n.head,t);return!0}}function M(e,t){e.state.emacsPrefix?"-"!=t&&(e.state.emacsPrefix+=t):(e.state.emacsPrefix=t,e.on("keyHandled",L),e.on("inputRead",E))}var w={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0};function L(e,t){e.state.emacsPrefixMap||w.hasOwnProperty(t)||x(e)}function x(e){e.state.emacsPrefix=null,e.off("keyHandled",L),e.off("inputRead",E)}function E(e,t){var n=m(e);if(n>1&&"+input"==t.origin){for(var r=t.text.join("\n"),i="",o=1;o<n;++o)i+=r;e.replaceSelection(i)}}function C(e,t){("string"!=typeof t||!/^\d$/.test(t)&&"Ctrl-U"!=t)&&(e.removeKeyMap(D),e.state.emacsPrefixMap=!1,e.off("keyHandled",C),e.off("inputRead",C))}function T(e){e.setCursor(e.getCursor()),e.setExtending(!e.getExtending()),e.on("change",(function(){e.setExtending(!1)}))}function S(e){e.setExtending(!1),e.setCursor(e.getCursor())}function A(e,t){var n=e.getCursor(),r=e.findPosH(n,1,"word");e.replaceRange(t(e.getRange(n,r)),n,r),e.setCursor(r)}e.emacs={kill:s,killRegion:b,repeated:g};var k=e.keyMap.emacs=e.normalizeKeyMap({"Ctrl-W":function(e){s(e,e.getCursor("start"),e.getCursor("end"),!0)},"Ctrl-K":g((function(e){var n=e.getCursor(),r=e.clipPos(t(n.line)),i=e.getRange(n,r);/\S/.test(i)||(i+="\n",r=t(n.line+1,0)),s(e,n,r,"grow",i)})),"Alt-W":function(e){i(e.getSelection()),S(e)},"Ctrl-Y":function(e){var t=e.getCursor();e.replaceRange(o(m(e)),t,t,"paste"),e.setSelection(t,e.getCursor())},"Alt-Y":function(e){e.replaceSelection((r.length>1&&r.pop(),o()),"around","paste")},"Ctrl-Space":T,"Ctrl-Shift-2":T,"Ctrl-F":_(l,1),"Ctrl-B":_(l,-1),Right:_(l,1),Left:_(l,-1),"Ctrl-D":function(e){y(e,l,1,!1)},Delete:function(e){b(e,!1)||y(e,l,1,!1)},"Ctrl-H":function(e){y(e,l,-1,!1)},Backspace:function(e){b(e,!1)||y(e,l,-1,!1)},"Alt-F":_(c,1),"Alt-B":_(c,-1),"Alt-Right":_(c,1),"Alt-Left":_(c,-1),"Alt-D":function(e){y(e,c,1,"grow")},"Alt-Backspace":function(e){y(e,c,-1,"grow")},"Ctrl-N":_(u,1),"Ctrl-P":_(u,-1),Down:_(u,1),Up:_(u,-1),"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":_(d,-1),"Ctrl-V":_(d,1),PageUp:_(d,-1),PageDown:_(d,1),"Ctrl-Up":_(h,-1),"Ctrl-Down":_(h,1),"Alt-A":_(p,-1),"Alt-E":_(p,1),"Alt-K":function(e){y(e,p,1,"grow")},"Ctrl-Alt-K":function(e){y(e,f,1,"grow")},"Ctrl-Alt-Backspace":function(e){y(e,f,-1,"grow")},"Ctrl-Alt-F":_(f,1),"Ctrl-Alt-B":_(f,-1),"Shift-Ctrl-Alt-2":function(e){var t=e.getCursor();e.setSelection(v(e,t,f,1),t)},"Ctrl-Alt-T":function(e){var t=f(e,e.getCursor(),-1),n=f(e,t,1),r=f(e,n,1),i=f(e,r,-1);e.replaceRange(e.getRange(i,r)+e.getRange(n,i)+e.getRange(t,n),t,r)},"Ctrl-Alt-U":g((function(e){for(var n=e.getCursor(),r=n.line,i=n.ch,o=[];r>=e.firstLine();){for(var a=e.getLine(r),s=null==i?a.length:i;s>0;)if(")"==(i=a.charAt(--s)))o.push("(");else if("]"==i)o.push("[");else if("}"==i)o.push("{");else if(/[\(\{\[]/.test(i)&&(!o.length||o.pop()!=i))return e.extendSelection(t(r,s));--r,i=null}})),"Alt-Space":function(e){for(var n=e.getCursor(),r=n.ch,i=n.ch,o=e.getLine(n.line);r&&/\s/.test(o.charAt(r-1));)--r;for(;i<o.length&&/\s/.test(o.charAt(i));)++i;e.replaceRange(" ",t(n.line,r),t(n.line,i))},"Ctrl-O":g((function(e){e.replaceSelection("\n","start")})),"Ctrl-T":g((function(e){e.execCommand("transposeChars")})),"Alt-C":g((function(e){A(e,(function(e){var t=e.search(/\w/);return-1==t?e:e.slice(0,t)+e.charAt(t).toUpperCase()+e.slice(t+1).toLowerCase()}))})),"Alt-U":g((function(e){A(e,(function(e){return e.toUpperCase()}))})),"Alt-L":g((function(e){A(e,(function(e){return e.toLowerCase()}))})),"Alt-;":"toggleComment","Ctrl-/":g("undo"),"Shift-Ctrl--":g("undo"),"Ctrl-Z":g("undo"),"Cmd-Z":g("undo"),"Shift-Ctrl-Z":"redo","Shift-Alt-,":"goDocStart","Shift-Alt-.":"goDocEnd","Ctrl-S":"findPersistentNext","Ctrl-R":"findPersistentPrev","Ctrl-G":function(e){e.execCommand("clearSearch"),S(e)},"Shift-Alt-5":"replace","Alt-/":"autocomplete",Enter:"newlineAndIndent","Ctrl-J":g((function(e){e.replaceSelection("\n","end")})),Tab:"indentAuto","Alt-G G":function(e){var t=m(e,!0);if(null!=t&&t>0)return e.setCursor(t-1);!function(e,t,n){e.openDialog?e.openDialog(t+': <input type="text" style="width: 10em"/>',n,{bottom:!0}):n(prompt(t,""))}(e,"Goto line",(function(t){var n;t&&!isNaN(n=Number(t))&&n==(0|n)&&n>0&&e.setCursor(n-1)}))},"Ctrl-X Tab":function(e){e.indentSelection(m(e,!0)||e.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(e){e.setSelection(e.getCursor("head"),e.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":g("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(e){s(e,e.getCursor(),p(e,e.getCursor(),1),"grow")},"Ctrl-X H":"selectAll","Ctrl-Q Tab":g("insertTab"),"Ctrl-U":function(e){e.state.emacsPrefixMap=!0,e.addKeyMap(D),e.on("keyHandled",C),e.on("inputRead",C)},fallthrough:"default"}),D={"Ctrl-G":x};function I(e){D[e]=function(t){M(t,e)},k["Ctrl-"+e]=function(t){M(t,e)},w["Ctrl-"+e]=!0}for(var O=0;O<10;++O)I(String(O));I("-")}(n(8))},function(e,t,n){!function(e){"use strict";var t=e.commands,n=e.Pos;function r(t,r){t.extendSelectionsBy((function(i){return t.display.shift||t.doc.extend||i.empty()?function(t,r,i){if(i<0&&0==r.ch)return t.clipPos(n(r.line-1));var o=t.getLine(r.line);if(i>0&&r.ch>=o.length)return t.clipPos(n(r.line+1,0));for(var a,s="start",l=r.ch,c=l,u=i<0?0:o.length,d=0;c!=u;c+=i,d++){var h=o.charAt(i<0?c-1:c),p="_"!=h&&e.isWordChar(h)?"w":"o";if("w"==p&&h.toUpperCase()==h&&(p="W"),"start"==s)"o"!=p?(s="in",a=p):l=c+i;else if("in"==s&&a!=p){if("w"==a&&"W"==p&&i<0&&c--,"W"==a&&"w"==p&&i>0){if(c==l+1){a="w";continue}c--}break}}return n(r.line,c)}(t.doc,i.head,r):r<0?i.from():i.to()}))}function i(t,r){if(t.isReadOnly())return e.Pass;t.operation((function(){for(var e=t.listSelections().length,i=[],o=-1,a=0;a<e;a++){var s=t.listSelections()[a].head;if(!(s.line<=o)){var l=n(s.line+(r?0:1),0);t.replaceRange("\n",l,null,"+insertLine"),t.indentLine(l.line,null,!0),i.push({head:l,anchor:l}),o=s.line+1}}t.setSelections(i)})),t.execCommand("indentAuto")}function o(t,r){for(var i=r.ch,o=i,a=t.getLine(r.line);i&&e.isWordChar(a.charAt(i-1));)--i;for(;o<a.length&&e.isWordChar(a.charAt(o));)++o;return{from:n(r.line,i),to:n(r.line,o),word:a.slice(i,o)}}function a(e,t){for(var n=e.listSelections(),r=[],i=0;i<n.length;i++){var o=n[i],a=e.findPosV(o.anchor,t,"line",o.anchor.goalColumn),s=e.findPosV(o.head,t,"line",o.head.goalColumn);a.goalColumn=null!=o.anchor.goalColumn?o.anchor.goalColumn:e.cursorCoords(o.anchor,"div").left,s.goalColumn=null!=o.head.goalColumn?o.head.goalColumn:e.cursorCoords(o.head,"div").left;var l={anchor:a,head:s};r.push(o),r.push(l)}e.setSelections(r)}function s(t){for(var r=t.listSelections(),i=[],o=0;o<r.length;o++){var a=r[o],s=a.head,l=t.scanForBracket(s,-1);if(!l)return!1;for(;;){var c=t.scanForBracket(s,1);if(!c)return!1;if(c.ch=="(){}[]".charAt("(){}[]".indexOf(l.ch)+1)){var u=n(l.pos.line,l.pos.ch+1);if(0!=e.cmpPos(u,a.from())||0!=e.cmpPos(c.pos,a.to())){i.push({anchor:u,head:c.pos});break}if(!(l=t.scanForBracket(l.pos,-1)))return!1}s=n(c.pos.line,c.pos.ch+1)}}return t.setSelections(i),!0}function l(e){return e?/\bpunctuation\b/.test(e)?e:void 0:null}function c(t,r){if(t.isReadOnly())return e.Pass;for(var i,o=t.listSelections(),a=[],s=0;s<o.length;s++){var l=o[s];if(!l.empty()){for(var c=l.from().line,u=l.to().line;s<o.length-1&&o[s+1].from().line==u;)u=o[++s].to().line;o[s].to().ch||u--,a.push(c,u)}}a.length?i=!0:a.push(t.firstLine(),t.lastLine()),t.operation((function(){for(var e=[],o=0;o<a.length;o+=2){var s=a[o],l=a[o+1],c=n(s,0),u=n(l),d=t.getRange(c,u,!1);r?d.sort():d.sort((function(e,t){var n=e.toUpperCase(),r=t.toUpperCase();return n!=r&&(e=n,t=r),e<t?-1:e==t?0:1})),t.replaceRange(d,c,u),i&&e.push({anchor:c,head:n(l+1,0)})}i&&t.setSelections(e,0)}))}function u(t,n){t.operation((function(){for(var r=t.listSelections(),i=[],a=[],s=0;s<r.length;s++)(c=r[s]).empty()?(i.push(s),a.push("")):a.push(n(t.getRange(c.from(),c.to())));var l;for(t.replaceSelections(a,"around","case"),s=i.length-1;s>=0;s--){var c=r[i[s]];if(!(l&&e.cmpPos(c.head,l)>0)){var u=o(t,c.head);l=u.from,t.replaceRange(n(u.word),u.from,u.to)}}}))}function d(t){var n=t.getCursor("from"),r=t.getCursor("to");if(0==e.cmpPos(n,r)){var i=o(t,n);if(!i.word)return;n=i.from,r=i.to}return{from:n,to:r,query:t.getRange(n,r),word:i}}function h(e,t){var r=d(e);if(r){var i=r.query,o=e.getSearchCursor(i,t?r.to:r.from);(t?o.findNext():o.findPrevious())?e.setSelection(o.from(),o.to()):(o=e.getSearchCursor(i,t?n(e.firstLine(),0):e.clipPos(n(e.lastLine()))),(t?o.findNext():o.findPrevious())?e.setSelection(o.from(),o.to()):r.word&&e.setSelection(r.from,r.to))}}t.goSubwordLeft=function(e){r(e,-1)},t.goSubwordRight=function(e){r(e,1)},t.scrollLineUp=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top+t.clientHeight,"local");e.getCursor().line>=n&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},t.scrollLineDown=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=n&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},t.splitSelectionByLine=function(e){for(var t=e.listSelections(),r=[],i=0;i<t.length;i++)for(var o=t[i].from(),a=t[i].to(),s=o.line;s<=a.line;++s)a.line>o.line&&s==a.line&&0==a.ch||r.push({anchor:s==o.line?o:n(s,0),head:s==a.line?a:n(s)});e.setSelections(r,0)},t.singleSelectionTop=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},t.selectLine=function(e){for(var t=e.listSelections(),r=[],i=0;i<t.length;i++){var o=t[i];r.push({anchor:n(o.from().line,0),head:n(o.to().line+1,0)})}e.setSelections(r)},t.insertLineAfter=function(e){return i(e,!1)},t.insertLineBefore=function(e){return i(e,!0)},t.selectNextOccurrence=function(t){var r=t.getCursor("from"),i=t.getCursor("to"),a=t.state.sublimeFindFullWord==t.doc.sel;if(0==e.cmpPos(r,i)){var s=o(t,r);if(!s.word)return;t.setSelection(s.from,s.to),a=!0}else{var l=t.getRange(r,i),c=a?new RegExp("\\b"+l+"\\b"):l,u=t.getSearchCursor(c,i),d=u.findNext();if(d||(d=(u=t.getSearchCursor(c,n(t.firstLine(),0))).findNext()),!d||function(t,n,r){for(var i=0;i<t.length;i++)if(0==e.cmpPos(t[i].from(),n)&&0==e.cmpPos(t[i].to(),r))return!0;return!1}(t.listSelections(),u.from(),u.to()))return;t.addSelection(u.from(),u.to())}a&&(t.state.sublimeFindFullWord=t.doc.sel)},t.skipAndSelectNextOccurrence=function(n){var r=n.getCursor("anchor"),i=n.getCursor("head");t.selectNextOccurrence(n),0!=e.cmpPos(r,i)&&n.doc.setSelections(n.doc.listSelections().filter((function(e){return e.anchor!=r||e.head!=i})))},t.addCursorToPrevLine=function(e){a(e,-1)},t.addCursorToNextLine=function(e){a(e,1)},t.selectScope=function(e){s(e)||e.execCommand("selectAll")},t.selectBetweenBrackets=function(t){if(!s(t))return e.Pass},t.goToBracket=function(t){t.extendSelectionsBy((function(r){var i=t.scanForBracket(r.head,1,l(t.getTokenTypeAt(r.head)));if(i&&0!=e.cmpPos(i.pos,r.head))return i.pos;var o=t.scanForBracket(r.head,-1,l(t.getTokenTypeAt(n(r.head.line,r.head.ch+1))));return o&&n(o.pos.line,o.pos.ch+1)||r.head}))},t.swapLineUp=function(t){if(t.isReadOnly())return e.Pass;for(var r=t.listSelections(),i=[],o=t.firstLine()-1,a=[],s=0;s<r.length;s++){var l=r[s],c=l.from().line-1,u=l.to().line;a.push({anchor:n(l.anchor.line-1,l.anchor.ch),head:n(l.head.line-1,l.head.ch)}),0!=l.to().ch||l.empty()||--u,c>o?i.push(c,u):i.length&&(i[i.length-1]=u),o=u}t.operation((function(){for(var e=0;e<i.length;e+=2){var r=i[e],o=i[e+1],s=t.getLine(r);t.replaceRange("",n(r,0),n(r+1,0),"+swapLine"),o>t.lastLine()?t.replaceRange("\n"+s,n(t.lastLine()),null,"+swapLine"):t.replaceRange(s+"\n",n(o,0),null,"+swapLine")}t.setSelections(a),t.scrollIntoView()}))},t.swapLineDown=function(t){if(t.isReadOnly())return e.Pass;for(var r=t.listSelections(),i=[],o=t.lastLine()+1,a=r.length-1;a>=0;a--){var s=r[a],l=s.to().line+1,c=s.from().line;0!=s.to().ch||s.empty()||l--,l<o?i.push(l,c):i.length&&(i[i.length-1]=c),o=c}t.operation((function(){for(var e=i.length-2;e>=0;e-=2){var r=i[e],o=i[e+1],a=t.getLine(r);r==t.lastLine()?t.replaceRange("",n(r-1),n(r),"+swapLine"):t.replaceRange("",n(r,0),n(r+1,0),"+swapLine"),t.replaceRange(a+"\n",n(o,0),null,"+swapLine")}t.scrollIntoView()}))},t.toggleCommentIndented=function(e){e.toggleComment({indent:!0})},t.joinLines=function(e){for(var t=e.listSelections(),r=[],i=0;i<t.length;i++){for(var o=t[i],a=o.from(),s=a.line,l=o.to().line;i<t.length-1&&t[i+1].from().line==l;)l=t[++i].to().line;r.push({start:s,end:l,anchor:!o.empty()&&a})}e.operation((function(){for(var t=0,i=[],o=0;o<r.length;o++){for(var a,s=r[o],l=s.anchor&&n(s.anchor.line-t,s.anchor.ch),c=s.start;c<=s.end;c++){var u=c-t;c==s.end&&(a=n(u,e.getLine(u).length+1)),u<e.lastLine()&&(e.replaceRange(" ",n(u),n(u+1,/^\s*/.exec(e.getLine(u+1))[0].length)),++t)}i.push({anchor:l||a,head:a})}e.setSelections(i,0)}))},t.duplicateLine=function(e){e.operation((function(){for(var t=e.listSelections().length,r=0;r<t;r++){var i=e.listSelections()[r];i.empty()?e.replaceRange(e.getLine(i.head.line)+"\n",n(i.head.line,0)):e.replaceRange(e.getRange(i.from(),i.to()),i.from())}e.scrollIntoView()}))},t.sortLines=function(e){c(e,!0)},t.sortLinesInsensitive=function(e){c(e,!1)},t.nextBookmark=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var n=t.shift(),r=n.find();if(r)return t.push(n),e.setSelection(r.from,r.to)}},t.prevBookmark=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var n=t[t.length-1].find();if(n)return e.setSelection(n.from,n.to);t.pop()}},t.toggleBookmark=function(e){for(var t=e.listSelections(),n=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),r=0;r<t.length;r++){for(var i=t[r].from(),o=t[r].to(),a=t[r].empty()?e.findMarksAt(i):e.findMarks(i,o),s=0;s<a.length;s++)if(a[s].sublimeBookmark){a[s].clear();for(var l=0;l<n.length;l++)n[l]==a[s]&&n.splice(l--,1);break}s==a.length&&n.push(e.markText(i,o,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},t.clearBookmarks=function(e){var t=e.state.sublimeBookmarks;if(t)for(var n=0;n<t.length;n++)t[n].clear();t.length=0},t.selectBookmarks=function(e){var t=e.state.sublimeBookmarks,n=[];if(t)for(var r=0;r<t.length;r++){var i=t[r].find();i?n.push({anchor:i.from,head:i.to}):t.splice(r--,0)}n.length&&e.setSelections(n,0)},t.smartBackspace=function(t){if(t.somethingSelected())return e.Pass;t.operation((function(){for(var r=t.listSelections(),i=t.getOption("indentUnit"),o=r.length-1;o>=0;o--){var a=r[o].head,s=t.getRange({line:a.line,ch:0},a),l=e.countColumn(s,null,t.getOption("tabSize")),c=t.findPosH(a,-1,"char",!1);if(s&&!/\S/.test(s)&&l%i==0){var u=new n(a.line,e.findColumn(s,l-i,i));u.ch!=a.ch&&(c=u)}t.replaceRange("",c,a,"+delete")}}))},t.delLineRight=function(e){e.operation((function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange("",t[r].anchor,n(t[r].to().line),"+delete");e.scrollIntoView()}))},t.upcaseAtCursor=function(e){u(e,(function(e){return e.toUpperCase()}))},t.downcaseAtCursor=function(e){u(e,(function(e){return e.toLowerCase()}))},t.setSublimeMark=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},t.selectToSublimeMark=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},t.deleteToSublimeMark=function(t){var n=t.state.sublimeMark&&t.state.sublimeMark.find();if(n){var r=t.getCursor(),i=n;if(e.cmpPos(r,i)>0){var o=i;i=r,r=o}t.state.sublimeKilled=t.getRange(r,i),t.replaceRange("",r,i)}},t.swapWithSublimeMark=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},t.sublimeYank=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},t.showInCenter=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},t.findUnder=function(e){h(e,!0)},t.findUnderPrevious=function(e){h(e,!1)},t.findAllUnder=function(e){var t=d(e);if(t){for(var n=e.getSearchCursor(t.query),r=[],i=-1;n.findNext();)r.push({anchor:n.from(),head:n.to()}),n.from().line<=t.from.line&&n.from().ch<=t.from.ch&&i++;e.setSelections(r,i)}};var p=e.keyMap;p.macSublime={"Cmd-Left":"goLineStartSmart","Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Ctrl-Alt-Up":"scrollLineUp","Ctrl-Alt-Down":"scrollLineDown","Cmd-L":"selectLine","Shift-Cmd-L":"splitSelectionByLine",Esc:"singleSelectionTop","Cmd-Enter":"insertLineAfter","Shift-Cmd-Enter":"insertLineBefore","Cmd-D":"selectNextOccurrence","Shift-Cmd-Space":"selectScope","Shift-Cmd-M":"selectBetweenBrackets","Cmd-M":"goToBracket","Cmd-Ctrl-Up":"swapLineUp","Cmd-Ctrl-Down":"swapLineDown","Cmd-/":"toggleCommentIndented","Cmd-J":"joinLines","Shift-Cmd-D":"duplicateLine",F5:"sortLines","Cmd-F5":"sortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Cmd-F2":"toggleBookmark","Shift-Cmd-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Cmd-K Cmd-D":"skipAndSelectNextOccurrence","Cmd-K Cmd-K":"delLineRight","Cmd-K Cmd-U":"upcaseAtCursor","Cmd-K Cmd-L":"downcaseAtCursor","Cmd-K Cmd-Space":"setSublimeMark","Cmd-K Cmd-A":"selectToSublimeMark","Cmd-K Cmd-W":"deleteToSublimeMark","Cmd-K Cmd-X":"swapWithSublimeMark","Cmd-K Cmd-Y":"sublimeYank","Cmd-K Cmd-C":"showInCenter","Cmd-K Cmd-G":"clearBookmarks","Cmd-K Cmd-Backspace":"delLineLeft","Cmd-K Cmd-1":"foldAll","Cmd-K Cmd-0":"unfoldAll","Cmd-K Cmd-J":"unfoldAll","Ctrl-Shift-Up":"addCursorToPrevLine","Ctrl-Shift-Down":"addCursorToNextLine","Cmd-F3":"findUnder","Shift-Cmd-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Cmd-[":"fold","Shift-Cmd-]":"unfold","Cmd-I":"findIncremental","Shift-Cmd-I":"findIncrementalReverse","Cmd-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"macDefault"},e.normalizeKeyMap(p.macSublime),p.pcSublime={"Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-T":"transposeChars","Alt-Left":"goSubwordLeft","Alt-Right":"goSubwordRight","Ctrl-Up":"scrollLineUp","Ctrl-Down":"scrollLineDown","Ctrl-L":"selectLine","Shift-Ctrl-L":"splitSelectionByLine",Esc:"singleSelectionTop","Ctrl-Enter":"insertLineAfter","Shift-Ctrl-Enter":"insertLineBefore","Ctrl-D":"selectNextOccurrence","Shift-Ctrl-Space":"selectScope","Shift-Ctrl-M":"selectBetweenBrackets","Ctrl-M":"goToBracket","Shift-Ctrl-Up":"swapLineUp","Shift-Ctrl-Down":"swapLineDown","Ctrl-/":"toggleCommentIndented","Ctrl-J":"joinLines","Shift-Ctrl-D":"duplicateLine",F9:"sortLines","Ctrl-F9":"sortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Ctrl-F2":"toggleBookmark","Shift-Ctrl-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Ctrl-K Ctrl-D":"skipAndSelectNextOccurrence","Ctrl-K Ctrl-K":"delLineRight","Ctrl-K Ctrl-U":"upcaseAtCursor","Ctrl-K Ctrl-L":"downcaseAtCursor","Ctrl-K Ctrl-Space":"setSublimeMark","Ctrl-K Ctrl-A":"selectToSublimeMark","Ctrl-K Ctrl-W":"deleteToSublimeMark","Ctrl-K Ctrl-X":"swapWithSublimeMark","Ctrl-K Ctrl-Y":"sublimeYank","Ctrl-K Ctrl-C":"showInCenter","Ctrl-K Ctrl-G":"clearBookmarks","Ctrl-K Ctrl-Backspace":"delLineLeft","Ctrl-K Ctrl-1":"foldAll","Ctrl-K Ctrl-0":"unfoldAll","Ctrl-K Ctrl-J":"unfoldAll","Ctrl-Alt-Up":"addCursorToPrevLine","Ctrl-Alt-Down":"addCursorToNextLine","Ctrl-F3":"findUnder","Shift-Ctrl-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Ctrl-[":"fold","Shift-Ctrl-]":"unfold","Ctrl-I":"findIncremental","Shift-Ctrl-I":"findIncrementalReverse","Ctrl-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"pcDefault"},e.normalizeKeyMap(p.pcSublime);var f=p.default==p.macDefault;p.sublime=f?p.macSublime:p.pcSublime}(n(8),n(72),n(239))},function(e,t,n){"use strict";
123/** @license React v17.0.1
124 * react.production.min.js
125 *

Callers 15

$eFunction · 0.45
rrFunction · 0.45
nrFunction · 0.45
snFunction · 0.45
TFunction · 0.45
kFunction · 0.45
MFunction · 0.45
SFunction · 0.45
EFunction · 0.45
LFunction · 0.45
NFunction · 0.45
jFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected