UNPKG

huncwot

Version:

A Programming Environment for TypeScript apps built on top of VS Code

3 lines (1 loc) 16.2 kB
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var l=/\blang(?:uage)?-(\w+)\b/i,t=0,L=_self.Prism={util:{encode:function(e){return e instanceof s?new s(e.type,L.util.encode(e.content),e.alias):"Array"===L.util.type(e)?e.map(L.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e){switch(L.util.type(e)){case"Object":var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=L.util.clone(e[n]));return t;case"Array":return e.map&&e.map(function(e){return L.util.clone(e)})}return e}},languages:{extend:function(e,t){var n=L.util.clone(L.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(n,e,t,a){var r=(a=a||L.languages)[n];if(2==arguments.length){for(var i in t=e)t.hasOwnProperty(i)&&(r[i]=t[i]);return r}var s={};for(var o in r)if(r.hasOwnProperty(o)){if(o==e)for(var i in t)t.hasOwnProperty(i)&&(s[i]=t[i]);s[o]=r[o]}return L.languages.DFS(L.languages,function(e,t){t===a[n]&&e!=n&&(this[e]=s)}),a[n]=s},DFS:function(e,t,n,a){for(var r in a=a||{},e)e.hasOwnProperty(r)&&(t.call(e,r,e[r],n||r),"Object"!==L.util.type(e[r])||a[L.util.objId(e[r])]?"Array"!==L.util.type(e[r])||a[L.util.objId(e[r])]||(a[L.util.objId(e[r])]=!0,L.languages.DFS(e[r],t,r,a)):(a[L.util.objId(e[r])]=!0,L.languages.DFS(e[r],t,null,a)))}},plugins:{},highlightAll:function(e,t){var n={callback:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};L.hooks.run("before-highlightall",n);for(var a,r=n.elements||document.querySelectorAll(n.selector),i=0;a=r[i++];)L.highlightElement(a,!0===e,n.callback)},highlightElement:function(e,t,n){for(var a,r,i=e;i&&!l.test(i.className);)i=i.parentNode;i&&(a=(i.className.match(l)||[,""])[1].toLowerCase(),r=L.languages[a]),e.className=e.className.replace(l,"").replace(/\s+/g," ")+" language-"+a,i=e.parentNode,/pre/i.test(i.nodeName)&&(i.className=i.className.replace(l,"").replace(/\s+/g," ")+" language-"+a);var s={element:e,language:a,grammar:r,code:e.textContent};if(L.hooks.run("before-sanity-check",s),!s.code||!s.grammar)return s.code&&(s.element.textContent=s.code),void L.hooks.run("complete",s);if(L.hooks.run("before-highlight",s),t&&_self.Worker){var o=new Worker(L.filename);o.onmessage=function(e){s.highlightedCode=e.data,L.hooks.run("before-insert",s),s.element.innerHTML=s.highlightedCode,n&&n.call(s.element),L.hooks.run("after-highlight",s),L.hooks.run("complete",s)},o.postMessage(JSON.stringify({language:s.language,code:s.code,immediateClose:!0}))}else s.highlightedCode=L.highlight(s.code,s.grammar,s.language),L.hooks.run("before-insert",s),s.element.innerHTML=s.highlightedCode,n&&n.call(e),L.hooks.run("after-highlight",s),L.hooks.run("complete",s)},highlight:function(e,t,n){var a=L.tokenize(e,t);return s.stringify(L.util.encode(a),n)},tokenize:function(e,t){var n=L.Token,a=[e],r=t.rest;if(r){for(var i in r)t[i]=r[i];delete t.rest}e:for(var i in t)if(t.hasOwnProperty(i)&&t[i]){var s=t[i];s="Array"===L.util.type(s)?s:[s];for(var o=0;o<s.length;++o){var l=s[o],u=l.inside,c=!!l.lookbehind,d=!!l.greedy,p=0,g=l.alias;if(d&&!l.pattern.global){var m=l.pattern.toString().match(/[imuy]*$/)[0];l.pattern=RegExp(l.pattern.source,m+"g")}l=l.pattern||l;for(var f=0,h=0;f<a.length;h+=a[f].length,++f){var b=a[f];if(a.length>e.length)break e;if(!(b instanceof n)){l.lastIndex=0;var y=1;if(!(S=l.exec(b))&&d&&f!=a.length-1){if(l.lastIndex=h,!(S=l.exec(e)))break;for(var v=S.index+(c?S[1].length:0),w=S.index+S[0].length,k=f,A=h,P=a.length;k<P&&A<w;++k)(A+=a[k].length)<=v&&(++f,h=A);if(a[f]instanceof n||a[k-1].greedy)continue;y=k-f,b=e.slice(h,A),S.index-=h}if(S){c&&(p=S[1].length);w=(v=S.index+p)+(S=S[0].slice(p)).length;var S,x=b.slice(0,v),N=b.slice(w),E=[f,y];x&&E.push(x);var C=new n(i,u?L.tokenize(S,u):S,g,S,d);E.push(C),N&&E.push(N),Array.prototype.splice.apply(a,E)}}}}}return a},hooks:{all:{},add:function(e,t){var n=L.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=L.hooks.all[e];if(n&&n.length)for(var a,r=0;a=n[r++];)a(t)}}},s=L.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length,this.greedy=!!r};if(s.stringify=function(t,n,e){if("string"==typeof t)return t;if("Array"===L.util.type(t))return t.map(function(e){return s.stringify(e,n,t)}).join("");var a={type:t.type,content:s.stringify(t.content,n,e),tag:"span",classes:["token",t.type],attributes:{},language:n,parent:e};if("comment"==a.type&&(a.attributes.spellcheck="true"),t.alias){var r="Array"===L.util.type(t.alias)?t.alias:[t.alias];Array.prototype.push.apply(a.classes,r)}L.hooks.run("wrap",a);var i=Object.keys(a.attributes).map(function(e){return e+'="'+(a.attributes[e]||"").replace(/"/g,"&quot;")+'"'}).join(" ");return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+(i?" "+i:"")+">"+a.content+"</"+a.tag+">"},!_self.document)return _self.addEventListener&&_self.addEventListener("message",function(e){var t=JSON.parse(e.data),n=t.language,a=t.code,r=t.immediateClose;_self.postMessage(L.highlight(a,L.languages[n],n)),r&&_self.close()},!1),_self.Prism;var e=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return e&&(L.filename=e.src,document.addEventListener&&!e.hasAttribute("data-manual")&&("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(L.highlightAll):window.setTimeout(L.highlightAll,16):document.addEventListener("DOMContentLoaded",L.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism),Prism.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/i,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\w\W]*?>)[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)),Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(true|false)\b/,function:/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,function:/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript,function(){function r(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function d(e,t){return t=" "+t+" ",-1<(" "+e.className+" ").replace(/[\n\t]/g," ").indexOf(t)}function i(e,t,n){for(var a,r=t.replace(/\s+/g,"").split(","),i=+e.getAttribute("data-line-offset")||0,s=(p()?parseInt:parseFloat)(getComputedStyle(e).lineHeight),o=0;a=r[o++];){var l=+(a=a.split("-"))[0],u=+a[1]||l,c=document.createElement("div");c.textContent=Array(u-l+2).join(" \n"),c.setAttribute("aria-hidden","true"),c.className=(n||"")+" line-highlight",d(e,"line-numbers")||(c.setAttribute("data-start",l),l<u&&c.setAttribute("data-end",u)),c.style.top=(l-i-1)*s+"px",d(e,"line-numbers")?e.appendChild(c):(e.querySelector("code")||e).appendChild(c)}}function a(){var e=location.hash.slice(1);r(".temporary.line-highlight").forEach(function(e){e.parentNode.removeChild(e)});var t=(e.match(/\.([\d,-]+)$/)||[,""])[1];if(t&&!document.getElementById(e)){var n=e.slice(0,e.lastIndexOf(".")),a=document.getElementById(n);a&&(a.hasAttribute("data-line")||a.setAttribute("data-line",""),i(a,t,"temporary "),document.querySelector(".temporary.line-highlight").scrollIntoView())}}if("undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector){var p=function(){if(void 0===t){var e=document.createElement("div");e.style.fontSize="13px",e.style.lineHeight="1.5",e.style.padding=0,e.style.border=0,e.innerHTML="&nbsp;<br />&nbsp;",document.body.appendChild(e),t=38===e.offsetHeight,document.body.removeChild(e)}return t},s=0;Prism.hooks.add("complete",function(e){var t=e.element.parentNode,n=t&&t.getAttribute("data-line");t&&n&&/pre/i.test(t.nodeName)&&(clearTimeout(s),r(".line-highlight",t).forEach(function(e){e.parentNode.removeChild(e)}),i(t,n),s=setTimeout(a,1))}),window.addEventListener&&window.addEventListener("hashchange",a)}var t}(),"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("complete",function(e){if(e.code){var t=e.element.parentNode,n=/\s*\bline-numbers\b\s*/;if(t&&/pre/i.test(t.nodeName)&&(n.test(t.className)||n.test(e.element.className))&&!e.element.querySelector(".line-numbers-rows")){n.test(e.element.className)&&(e.element.className=e.element.className.replace(n,"")),n.test(t.className)||(t.className+=" line-numbers");var a,r=e.code.match(/\n(?!$)/g),i=r?r.length+1:1,s=new Array(i+1);s=s.join("<span></span>"),(a=document.createElement("span")).setAttribute("aria-hidden","true"),a.className="line-numbers-rows",a.innerHTML=s,t.hasAttribute("data-start")&&(t.style.counterReset="linenumber "+(parseInt(t.getAttribute("data-start"),10)-1)),e.element.appendChild(a)}}}),function(){if("undefined"!=typeof self&&self.Prism&&self.document){function t(){}var i=[],s={};Prism.plugins.toolbar={};var e=Prism.plugins.toolbar.registerButton=function(e,n){var t;t="function"==typeof n?n:function(e){var t;return"function"==typeof n.onClick?((t=document.createElement("button")).type="button",t.addEventListener("click",function(){n.onClick.call(this,e)})):"string"==typeof n.url?(t=document.createElement("a")).href=n.url:t=document.createElement("span"),t.textContent=n.text,t},i.push(s[e]=t)},n=Prism.plugins.toolbar.hook=function(a){var e=a.element.parentNode;if(e&&/pre/i.test(e.nodeName)&&!e.classList.contains("code-toolbar")){e.classList.add("code-toolbar");var r=document.createElement("div");r.classList.add("toolbar"),document.body.hasAttribute("data-toolbar-order")&&(i=document.body.getAttribute("data-toolbar-order").split(",").map(function(e){return s[e]||t})),i.forEach(function(e){var t=e(a);if(t){var n=document.createElement("div");n.classList.add("toolbar-item"),n.appendChild(t),r.appendChild(n)}}),e.appendChild(r)}};e("label",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&t.hasAttribute("data-label")){var n,a,r=t.getAttribute("data-label");try{a=document.querySelector("template#"+r)}catch(e){}return a?n=a.content:(t.hasAttribute("data-url")?(n=document.createElement("a")).href=t.getAttribute("data-url"):n=document.createElement("span"),n.textContent=r),n}}),Prism.hooks.add("complete",n)}}(),function(){if("undefined"!=typeof self&&self.Prism&&self.document){if(!Prism.plugins.toolbar)return console.warn("Show Languages plugin loaded before Toolbar plugin.");var r={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",css:"CSS",clike:"C-like",javascript:"JavaScript",abap:"ABAP",actionscript:"ActionScript",apacheconf:"Apache Configuration",apl:"APL",applescript:"AppleScript",asciidoc:"AsciiDoc",aspnet:"ASP.NET (C#)",autoit:"AutoIt",autohotkey:"AutoHotkey",basic:"BASIC",csharp:"C#",cpp:"C++",coffeescript:"CoffeeScript","css-extras":"CSS Extras",fsharp:"F#",glsl:"GLSL",graphql:"GraphQL",http:"HTTP",inform7:"Inform 7",json:"JSON",latex:"LaTeX",livescript:"LiveScript",lolcode:"LOLCODE",matlab:"MATLAB",mel:"MEL",nasm:"NASM",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",ocaml:"OCaml",parigp:"PARI/GP",php:"PHP","php-extras":"PHP Extras",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",jsx:"React JSX",rest:"reST (reStructuredText)",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)",sql:"SQL",typescript:"TypeScript",vhdl:"VHDL",vim:"vim",wiki:"Wiki markup",xojo:"Xojo (REALbasic)",yaml:"YAML"};Prism.plugins.toolbar.registerButton("show-language",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)){var n=t.getAttribute("data-language")||r[e.language]||e.language.substring(0,1).toUpperCase()+e.language.substring(1),a=document.createElement("span");return a.textContent=n,a}})}}(),window.onload=function(e){function t(e){var t=e.querySelector(".frame-context"),n=t.innerHTML;n=0===n.trim().length?"Stack frames not available":n;var a=t.getAttribute("data-line"),r=t.getAttribute("data-start"),i=t.getAttribute("data-file"),s=t.getAttribute("data-method"),o=t.getAttribute("data-line-column");document.getElementById("snippet").parentNode.setAttribute("data-line",a),document.getElementById("snippet").parentNode.setAttribute("data-start",r),document.getElementById("snippet").parentNode.setAttribute("data-line-offset",Number(r)-1),document.getElementById("snippet").innerHTML=n,document.getElementById("frame-file-name").innerHTML=i,document.getElementById("frame-function-name").innerHTML=s+" "+o,window.Prism.highlightAll()}var n=document.querySelector(".frame-row.active");document.querySelectorAll(".frame-row").forEach(function(e){e.addEventListener("click",function(){document.querySelector(".frame-row.active").classList.remove("active"),this.classList.add("active"),t(this)})}),t(n)};