Socket
Socket
Sign inDemoInstall

@webqit/subscript

Package Overview
Dependencies
2
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.13 to 2.1.14-0

src/compiler/Contract.js

2

dist/console-element.js

@@ -1,2 +0,2 @@

(()=>{"use strict";var e={829:(e,t,n)=>{n.d(t,{Z:()=>i});const i=e=>class extends e{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){[].concat(this.css).forEach((e=>{if(e.includes("{")&&e.includes(":")&&e.includes(";"))this.shadowRoot.appendChild(document.createElement("style")).textContent=e;else{let t=this.shadowRoot.appendChild(document.createElement("link"));t.setAttribute("rel","stylesheet"),t.setAttribute("href",e)}}))}get css(){return[]}}},790:(e,t,n)=>{function i(e,t=!1){let n=e.split(/\n/g);if(n.length>1){for(;!n[0].trim().length;)n.shift();let e=n[t?1:0].split(/[^\s]/)[0].length;if(e)return n.map(((t,i)=>{let r=t.substring(0,e);return r.trim().length?"}"===r.trim()&&i===n.length-1?"}":t:t.substring(e)})).join("\n")}return e}n.d(t,{B:()=>i})}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e=n(790),t=n(829),i=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,i={},r={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var i,a;switch(n=n||{},r.util.type(t)){case"Object":if(a=r.util.objId(t),n[a])return n[a];for(var s in i={},n[a]=i,t)t.hasOwnProperty(s)&&(i[s]=e(t[s],n));return i;case"Array":return a=r.util.objId(t),n[a]?n[a]:(i=[],n[a]=i,t.forEach((function(t,r){i[r]=e(t,n)})),i);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+n)},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(i){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(i.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var i="no-"+t;e;){var r=e.classList;if(r.contains(t))return!0;if(r.contains(i))return!1;e=e.parentElement}return!!n}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var i in t)n[i]=t[i];return n},insertBefore:function(e,t,n,i){var a=(i=i||r.languages)[e],s={};for(var o in a)if(a.hasOwnProperty(o)){if(o==t)for(var l in n)n.hasOwnProperty(l)&&(s[l]=n[l]);n.hasOwnProperty(o)||(s[o]=a[o])}var c=i[e];return i[e]=s,r.languages.DFS(r.languages,(function(t,n){n===c&&t!=e&&(this[t]=s)})),s},DFS:function e(t,n,i,a){a=a||{};var s=r.util.objId;for(var o in t)if(t.hasOwnProperty(o)){n.call(t,o,t[o],i||o);var l=t[o],c=r.util.type(l);"Object"!==c||a[s(l)]?"Array"!==c||a[s(l)]||(a[s(l)]=!0,e(l,n,o,a)):(a[s(l)]=!0,e(l,n,null,a))}}},plugins:{},highlightAll:function(e,t){r.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var i={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",i),i.elements=Array.prototype.slice.apply(i.container.querySelectorAll(i.selector)),r.hooks.run("before-all-elements-highlight",i);for(var a,s=0;a=i.elements[s++];)r.highlightElement(a,!0===t,i.callback)},highlightElement:function(t,n,i){var a=r.util.getLanguage(t),s=r.languages[a];r.util.setLanguage(t,a);var o=t.parentElement;o&&"pre"===o.nodeName.toLowerCase()&&r.util.setLanguage(o,a);var l={element:t,language:a,grammar:s,code:t.textContent};function c(e){l.highlightedCode=e,r.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,r.hooks.run("after-highlight",l),r.hooks.run("complete",l),i&&i.call(l.element)}if(r.hooks.run("before-sanity-check",l),(o=l.element.parentElement)&&"pre"===o.nodeName.toLowerCase()&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","0"),!l.code)return r.hooks.run("complete",l),void(i&&i.call(l.element));if(r.hooks.run("before-highlight",l),l.grammar)if(n&&e.Worker){var u=new Worker(r.filename);u.onmessage=function(e){c(e.data)},u.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else c(r.highlight(l.code,l.grammar,l.language));else c(r.util.encode(l.code))},highlight:function(e,t,n){var i={code:e,grammar:t,language:n};if(r.hooks.run("before-tokenize",i),!i.grammar)throw new Error('The language "'+i.language+'" has no grammar.');return i.tokens=r.tokenize(i.code,i.grammar),r.hooks.run("after-tokenize",i),a.stringify(r.util.encode(i.tokens),i.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var i in n)t[i]=n[i];delete t.rest}var u=new o;return l(u,u.head,e),function e(t,n,i,o,u,d){for(var h in i)if(i.hasOwnProperty(h)&&i[h]){var p=i[h];p=Array.isArray(p)?p:[p];for(var g=0;g<p.length;++g){if(d&&d.cause==h+","+g)return;var f=p[g],m=f.inside,b=!!f.lookbehind,v=!!f.greedy,y=f.alias;if(v&&!f.pattern.global){var x=f.pattern.toString().match(/[imsuy]*$/)[0];f.pattern=RegExp(f.pattern.source,x+"g")}for(var k=f.pattern||f,w=o.next,_=u;w!==n.tail&&!(d&&_>=d.reach);_+=w.value.length,w=w.next){var A=w.value;if(n.length>t.length)return;if(!(A instanceof a)){var E,F=1;if(v){if(!(E=s(k,_,t,b))||E.index>=t.length)break;var S=E.index,C=E.index+E[0].length,L=_;for(L+=w.value.length;L<=S;)L+=(w=w.next).value.length;if(_=L-=w.value.length,w.value instanceof a)continue;for(var N=w;N!==n.tail&&(L<C||"string"==typeof N.value);N=N.next)F++,L+=N.value.length;F--,A=t.slice(_,L),E.index-=_}else if(!(E=s(k,0,A,b)))continue;S=E.index;var $=E[0],T=A.slice(0,S),B=A.slice(S+$.length),z=_+A.length;d&&z>d.reach&&(d.reach=z);var P=w.prev;if(T&&(P=l(n,P,T),_+=T.length),c(n,P,F),w=l(n,P,new a(h,m?r.tokenize($,m):$,y,$)),B&&l(n,w,B),1<F){var j={cause:h+","+g,reach:z};e(t,n,i,w.prev,_,j),d&&j.reach>d.reach&&(d.reach=j.reach)}}}}}}(e,u,t,u.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(u)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,a=0;i=n[a++];)i(t)}},Token:a};function a(e,t,n,i){this.type=e,this.content=t,this.alias=n,this.length=0|(i||"").length}function s(e,t,n,i){e.lastIndex=t;var r=e.exec(n);if(r&&i&&r[1]){var a=r[1].length;r.index+=a,r[0]=r[0].slice(a)}return r}function o(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var i=t.next,r={value:n,prev:t,next:i};return t.next=r,i.prev=r,e.length++,r}function c(e,t,n){for(var i=t.next,r=0;r<n&&i!==e.tail;r++)i=i.next;(t.next=i).prev=t,e.length-=r}if(e.Prism=r,a.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var i="";return t.forEach((function(t){i+=e(t,n)})),i}var a={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(a.classes,s):a.classes.push(s)),r.hooks.run("wrap",a);var o="";for(var l in a.attributes)o+=" "+l+'="'+(a.attributes[l]||"").replace(/"/g,"&quot;")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+o+">"+a.content+"</"+a.tag+">"},!e.document)return e.addEventListener&&(r.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),i=n.language,a=n.code,s=n.immediateClose;e.postMessage(r.highlight(a,r.languages[i],i)),s&&e.close()}),!1)),r;var u=r.util.currentScript();function d(){r.manual||r.highlightAll()}if(u&&(r.filename=u.src,u.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var h=document.readyState;"loading"===h||"interactive"===h&&u&&u.defer?document.addEventListener("DOMContentLoaded",d):window.requestAnimationFrame?window.requestAnimationFrame(d):window.setTimeout(d,16)}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});"undefined"!=typeof module&&module.exports&&(module.exports=i),"undefined"!=typeof global&&(global.Prism=i),i.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},i.languages.markup.tag.inside["attr-value"].inside.entity=i.languages.markup.entity,i.languages.markup.doctype.inside["internal-subset"].inside=i.languages.markup,i.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))})),Object.defineProperty(i.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:i.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:i.languages[t]};var a={};a[e]={pattern:RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])*?(?=</__>)".replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},i.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(i.languages.markup.tag,"addAttribute",{value:function(e,t){i.languages.markup.tag.inside["special-attr"].push({pattern:RegExp("(^|[\"'\\s])(?:"+e+")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))","i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:i.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),i.languages.html=i.languages.markup,i.languages.mathml=i.languages.markup,i.languages.svg=i.languages.markup,i.languages.xml=i.languages.extend("markup",{}),i.languages.ssml=i.languages.xml,i.languages.atom=i.languages.xml,i.languages.rss=i.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|(?:[^\\\\\r\n()\"']|\\\\[^])*)\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(i),i.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},i.languages.javascript=i.languages.extend("clike",{"class-name":[i.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),i.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,i.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:i.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:i.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:i.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:i.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?: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|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:i.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),i.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:i.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),i.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),i.languages.markup&&(i.languages.markup.tag.addInlined("script","javascript"),i.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)","javascript")),i.languages.js=i.languages.javascript,function(){if(void 0!==i&&"undefined"!=typeof document&&document.querySelector){var e,t="line-numbers",n="linkable-line-numbers",r=function(){if(void 0===e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding="0",t.style.border="0",t.innerHTML="&nbsp;<br />&nbsp;",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e},a=!0;i.plugins.lineHighlight={highlightLines:function(e,s,u){var d=(s="string"==typeof s?s:e.getAttribute("data-line")||"").replace(/\s+/g,"").split(",").filter(Boolean),h=+e.getAttribute("data-line-offset")||0,p=(r()?parseInt:parseFloat)(getComputedStyle(e).lineHeight),g=i.util.isActive(e,t),f=e.querySelector("code"),m=g?e:f||e,b=[],v=f&&m!=f?function(e,t){var n=getComputedStyle(e),i=getComputedStyle(t);function r(e){return+e.substr(0,e.length-2)}return t.offsetTop+r(i.borderTopWidth)+r(i.paddingTop)-r(n.paddingTop)}(e,f):0;d.forEach((function(t){var n=t.split("-"),r=+n[0],a=+n[1]||r,s=e.querySelector('.line-highlight[data-range="'+t+'"]')||document.createElement("div");if(b.push((function(){s.setAttribute("aria-hidden","true"),s.setAttribute("data-range",t),s.className=(u||"")+" line-highlight"})),g&&i.plugins.lineNumbers){var o=i.plugins.lineNumbers.getLine(e,r),l=i.plugins.lineNumbers.getLine(e,a);if(o){var c=o.offsetTop+v+"px";b.push((function(){s.style.top=c}))}if(l){var d=l.offsetTop-o.offsetTop+l.offsetHeight+"px";b.push((function(){s.style.height=d}))}}else b.push((function(){s.setAttribute("data-start",String(r)),r<a&&s.setAttribute("data-end",String(a)),s.style.top=(r-h-1)*p+v+"px",s.textContent=new Array(a-r+2).join(" \n")}));b.push((function(){s.style.width=e.scrollWidth+"px"})),b.push((function(){m.appendChild(s)}))}));var y=e.id;if(g&&i.util.isActive(e,n)&&y){l(e,n)||b.push((function(){e.classList.add(n)}));var x=parseInt(e.getAttribute("data-start")||"1");o(".line-numbers-rows > span",e).forEach((function(e,t){var n=t+x;e.onclick=function(){var e=y+"."+n;a=!1,location.hash=e,setTimeout((function(){a=!0}),1)}}))}return function(){b.forEach(c)}}};var s=0;i.hooks.add("before-sanity-check",(function(e){var t=e.element.parentElement;if(u(t)){var n=0;o(".line-highlight",t).forEach((function(e){n+=e.textContent.length,e.parentNode.removeChild(e)})),n&&/^(?: \n)+$/.test(e.code.slice(-n))&&(e.code=e.code.slice(0,-n))}})),i.hooks.add("complete",(function e(n){var r=n.element.parentElement;if(u(r)){clearTimeout(s);var a=i.plugins.lineNumbers,o=n.plugins&&n.plugins.lineNumbers;l(r,t)&&a&&!o?i.hooks.add("line-numbers",e):(i.plugins.lineHighlight.highlightLines(r)(),s=setTimeout(d,1))}})),window.addEventListener("hashchange",d),window.addEventListener("resize",(function(){o("pre").filter(u).map((function(e){return i.plugins.lineHighlight.highlightLines(e)})).forEach(c)}))}function o(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function l(e,t){return e.classList.contains(t)}function c(e){e()}function u(e){return!!(e&&/pre/i.test(e.nodeName)&&(e.hasAttribute("data-line")||e.id&&i.util.isActive(e,n)))}function d(){var e=location.hash.slice(1);o(".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(".")),r=document.getElementById(n);r&&(r.hasAttribute("data-line")||r.setAttribute("data-line",""),i.plugins.lineHighlight.highlightLines(r,t,"temporary ")(),a&&document.querySelector(".temporary.line-highlight").scrollIntoView())}}}(),function(){if(void 0!==i&&"undefined"!=typeof document){var e="line-numbers",t=/\n(?!$)/g,n=i.plugins.lineNumbers={getLine:function(t,n){if("PRE"===t.tagName&&t.classList.contains(e)){var i=t.querySelector(".line-numbers-rows");if(i){var r=parseInt(t.getAttribute("data-start"),10)||1,a=r+(i.children.length-1);n<r&&(n=r),a<n&&(n=a);var s=n-r;return i.children[s]}}},resize:function(e){a([e])},assumeViewportIndependence:!0},r=void 0;window.addEventListener("resize",(function(){n.assumeViewportIndependence&&r===window.innerWidth||(r=window.innerWidth,a(Array.prototype.slice.call(document.querySelectorAll("pre."+e))))})),i.hooks.add("complete",(function(n){if(n.code){var r=n.element,s=r.parentNode;if(s&&/pre/i.test(s.nodeName)&&!r.querySelector(".line-numbers-rows")&&i.util.isActive(r,e)){r.classList.remove(e),s.classList.add(e);var o,l=n.code.match(t),c=l?l.length+1:1,u=new Array(c+1).join("<span></span>");(o=document.createElement("span")).setAttribute("aria-hidden","true"),o.className="line-numbers-rows",o.innerHTML=u,s.hasAttribute("data-start")&&(s.style.counterReset="linenumber "+(parseInt(s.getAttribute("data-start"),10)-1)),n.element.appendChild(o),a([s]),i.hooks.run("line-numbers",n)}}})),i.hooks.add("line-numbers",(function(e){e.plugins=e.plugins||{},e.plugins.lineNumbers=!0}))}function a(e){if(0!=(e=e.filter((function(e){var t=function(e){return e?window.getComputedStyle?getComputedStyle(e):e.currentStyle||null:null}(e)["white-space"];return"pre-wrap"===t||"pre-line"===t}))).length){var n=e.map((function(e){var n=e.querySelector("code"),i=e.querySelector(".line-numbers-rows");if(n&&i){var r=e.querySelector(".line-numbers-sizer"),a=n.textContent.split(t);r||((r=document.createElement("span")).className="line-numbers-sizer",n.appendChild(r)),r.innerHTML="0",r.style.display="block";var s=r.getBoundingClientRect().height;return r.innerHTML="",{element:e,lines:a,lineHeights:[],oneLinerHeight:s,sizer:r}}})).filter(Boolean);n.forEach((function(e){var t=e.sizer,n=e.lines,i=e.lineHeights,r=e.oneLinerHeight;i[n.length-1]=void 0,n.forEach((function(e,n){if(e&&1<e.length){var a=t.appendChild(document.createElement("span"));a.style.display="block",a.textContent=e}else i[n]=r}))})),n.forEach((function(e){for(var t=e.sizer,n=e.lineHeights,i=0,r=0;r<n.length;r++)void 0===n[r]&&(n[r]=t.children[i++].getBoundingClientRect().height)})),n.forEach((function(e){var t=e.sizer,n=e.element.querySelector(".line-numbers-rows");t.style.display="none",t.innerHTML="",e.lineHeights.forEach((function(e,t){n.children[t].style.height=e+"px"}))}))}}}(),function(){if(void 0!==i&&"undefined"!=typeof document){var e=[],t={},n=function(){};i.plugins.toolbar={};var r=i.plugins.toolbar.registerButton=function(n,i){var r;r="function"==typeof i?i:function(e){var t;return"function"==typeof i.onClick?((t=document.createElement("button")).type="button",t.addEventListener("click",(function(){i.onClick.call(this,e)}))):"string"==typeof i.url?(t=document.createElement("a")).href=i.url:t=document.createElement("span"),i.className&&t.classList.add(i.className),t.textContent=i.text,t},n in t?console.warn('There is a button with the key "'+n+'" registered already.'):e.push(t[n]=r)},a=i.plugins.toolbar.hook=function(i){var r=i.element.parentNode;if(r&&/pre/i.test(r.nodeName)&&!r.parentNode.classList.contains("code-toolbar")){var a=document.createElement("div");a.classList.add("code-toolbar"),r.parentNode.insertBefore(a,r),a.appendChild(r);var s=document.createElement("div");s.classList.add("toolbar");var o=e,l=function(e){for(;e;){var t=e.getAttribute("data-toolbar-order");if(null!=t)return(t=t.trim()).length?t.split(/\s*,\s*/g):[];e=e.parentElement}}(i.element);l&&(o=l.map((function(e){return t[e]||n}))),o.forEach((function(e){var t=e(i);if(t){var n=document.createElement("div");n.classList.add("toolbar-item"),n.appendChild(t),s.appendChild(n)}})),a.appendChild(s)}};r("label",(function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&t.hasAttribute("data-label")){var n,i,r=t.getAttribute("data-label");try{i=document.querySelector("template#"+r)}catch(e){}return i?n=i.content:(t.hasAttribute("data-url")?(n=document.createElement("a")).href=t.getAttribute("data-url"):n=document.createElement("span"),n.textContent=r),n}})),i.hooks.add("complete",a)}}(),function(){function e(e,n){e.addEventListener("click",(function(){!function(e){navigator.clipboard?navigator.clipboard.writeText(e.getText()).then(e.success,(function(){t(e)})):t(e)}(n)}))}function t(e){var t=document.createElement("textarea");t.value=e.getText(),t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{var n=document.execCommand("copy");setTimeout((function(){n?e.success():e.error()}),1)}catch(t){setTimeout((function(){e.error(t)}),1)}document.body.removeChild(t)}void 0!==i&&"undefined"!=typeof document&&(i.plugins.toolbar?i.plugins.toolbar.registerButton("copy-to-clipboard",(function(t){var n=t.element,i=function(e){var t={copy:"Copy","copy-error":"Press Ctrl+C to copy","copy-success":"Copied!","copy-timeout":5e3};for(var n in t){for(var i="data-prismjs-"+n,r=e;r&&!r.hasAttribute(i);)r=r.parentElement;r&&(t[n]=r.getAttribute(i))}return t}(n),r=document.createElement("button");r.className="copy-to-clipboard-button",r.setAttribute("type","button");var a=document.createElement("span");return r.appendChild(a),o("copy"),e(r,{getText:function(){return n.textContent},success:function(){o("copy-success"),s()},error:function(){o("copy-error"),setTimeout((function(){!function(e){window.getSelection().selectAllChildren(e)}(n)}),1),s()}}),r;function s(){setTimeout((function(){o("copy")}),i["copy-timeout"])}function o(e){a.textContent=i[e],r.setAttribute("data-copy-state",e)}})):console.warn("Copy to Clipboard plugin loaded before Toolbar plugin."))}(),function(){if(void 0!==i&&"undefined"!=typeof document){var e={"(":")","[":"]","{":"}"},t={"(":"brace-round","[":"brace-square","{":"brace-curly"},n={"${":"{"},r=0,a=/^(pair-\d+-)(close|open)$/;i.hooks.add("complete",(function(a){var o=a.element,d=o.parentElement;if(d&&"PRE"==d.tagName){var h=[];if(i.util.isActive(o,"match-braces")&&h.push("(","[","{"),0!=h.length){d.__listenerAdded||(d.addEventListener("mousedown",(function(){var e=d.querySelector("code"),t=s("brace-selected");Array.prototype.slice.call(e.querySelectorAll("."+t)).forEach((function(e){e.classList.remove(t)}))})),Object.defineProperty(d,"__listenerAdded",{value:!0}));var p=Array.prototype.slice.call(o.querySelectorAll("span."+s("token")+"."+s("punctuation"))),g=[];h.forEach((function(i){for(var a=e[i],o=s(t[i]),d=[],h=[],f=0;f<p.length;f++){var m=p[f];if(0==m.childElementCount){var b=m.textContent;(b=n[b]||b)===i?(g.push({index:f,open:!0,element:m}),m.classList.add(o),m.classList.add(s("brace-open")),h.push(f)):b===a&&(g.push({index:f,open:!1,element:m}),m.classList.add(o),m.classList.add(s("brace-close")),h.length&&d.push([f,h.pop()]))}}d.forEach((function(e){var t="pair-"+r+++"-",n=p[e[0]],i=p[e[1]];n.id=t+"open",i.id=t+"close",[n,i].forEach((function(e){e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",c),e.addEventListener("click",u)}))}))}));var f=0;g.sort((function(e,t){return e.index-t.index})),g.forEach((function(e){e.open?(e.element.classList.add(s("brace-level-"+(f%12+1))),f++):(f=Math.max(0,f-1),e.element.classList.add(s("brace-level-"+(f%12+1))))}))}}}))}function s(e){var t=i.plugins.customClass;return t?t.apply(e,"none"):e}function o(e){var t=a.exec(e.id);return document.querySelector("#"+t[1]+("open"==t[2]?"close":"open"))}function l(){i.util.isActive(this,"brace-hover",!0)&&[this,o(this)].forEach((function(e){e.classList.add(s("brace-hover"))}))}function c(){[this,o(this)].forEach((function(e){e.classList.remove(s("brace-hover"))}))}function u(){i.util.isActive(this,"brace-select",!0)&&[this,o(this)].forEach((function(e){e.classList.add(s("brace-selected"))}))}}();const r=n=>class extends((0,t.Z)(n||HTMLElement)){static get observedAttributes(){return["name","editable","placeholder"]}connectedCallback(){this._lang="javascript",this._editable=this.getAttribute("editable"),this._styledBlock=this.getAttribute("styled-block")||"pre",this._div=document.createElement("div"),this._preBlock=this._div.appendChild(document.createElement("pre")),this._codeBlock=this._preBlock.appendChild(document.createElement("code")),this._div.classList.add("line-numbers"),this._div.classList.add("container"),this._lang&&(this._preBlock.classList.add("language-"+this._lang),this._codeBlock.classList.add("language-"+this._lang)),this._contentSlot=document.createElement("slot"),this._contentSlot.setAttribute("aria-hidden","true"),this._contentSlot.setAttribute("hidden","true"),this._initialSlotEvent=!1,this._contentSlot.addEventListener("slotchange",(()=>{let t=this._contentSlot.assignedNodes().reduce(((e,t)=>e+(t.outerHTML||t.nodeValue||"")),"");this._initialSlotEvent||(t=(0,e.B)(t),this._initialSlotEvent=!0),this._textarea&&(this._textarea.value=t),this.source=(e=>e.replace(new RegExp("&","g"),"&amp;").replace(new RegExp("<","g"),"&lt;"))(t)})),"true"===this._editable&&this._addEditor(),this.shadowRoot.append(this._contentSlot,this._textarea||"",this._div),super.connectedCallback()}get source(){return this._codeBlock.textContent}set source(e){e.endsWith("\n")&&(e+=" "),this._codeBlock.innerHTML="",this._codeBlock.innerHTML=e,this._highlightCodeBlock(),this._syncScrolling()}get name(){return this._name}set name(e){return this.setAttribute("name",e)}get placeholder(){return this._placeholder}set placeholder(e){return this.setAttribute("placeholder",e)}get editable(){return this._editable}set editable(e){return this.setAttribute("editable",!0===e?"true":!1===e?"false":e)}_addEditor(){this._placeholder=this.getAttribute("placeholder"),this._name=this.getAttribute("name"),this._textarea=this._div.appendChild(document.createElement("textarea")),this._textarea.placeholder=this._placeholder||this._lang,this._textarea.spellcheck=!1,this._textarea.name=this._name||"",this._textarea.value=this._codeBlock.textContent,this._preBlock.setAttribute("aria-hidden","true"),this._scrollBlock="code"===this.getAttribute("scroll-block")?this._codeBlock:this._preBlock,this._textarea.addEventListener("input",(e=>{this.source=e.target.value})),this._textarea.addEventListener("input",(()=>this._syncScrolling())),this._textarea.addEventListener("scroll",(()=>this._syncScrolling())),this._textarea.addEventListener("keydown",(e=>this._handleTabKeyEvent(e)))}_handleTabKeyEvent(e){if(!this._textarea)return;if("Tab"!==e.key)return;e.preventDefault();let t=this._textarea.value,n=this._textarea.selectionStart,i=this._textarea.selectionEnd;if(n===i){let e=t.slice(0,n),r=t.slice(i,t.length),a=i+1;this._textarea.value=e+"\t"+r,this._textarea.selectionStart=a,this._textarea.selectionEnd=a}else{let r=t.split("\n"),a=0,s=0,o=0;for(let t=0;t<r.length;t++)a+=r[t].length,n<a&&i>a-r[t].length&&(e.shiftKey?"\t"===r[t][0]&&(r[t]=r[t].slice(1),0===s&&o--,s--):(r[t]="\t"+r[t],0===s&&o++,s++));this._textarea.value=r.join("\n"),this._textarea.selectionStart=n+o,this._textarea.selectionEnd=i+s}this.source=this._textarea.value}_syncScrolling(){this._scrollBlock&&(this._scrollBlock.scrollTop=this._textarea.scrollTop,this._scrollBlock.scrollLeft=this._textarea.scrollLeft)}_highlightCodeBlock(){Prism.highlightElement(this._codeBlock)}disconnectedCallback(){Array.from(this.shadowRoot.childNodes).forEach((e=>e.remove()))}attributeChangedCallback(e,t,n){if(this.childNodes.length)switch(e){case"name":this._name=n,this._textarea.name=n;break;case"placeholder":this._placeholder=n,this._textarea.placeholder=n;break;case"editable":this._editable=n,this._textarea?this._textarea.disabled="false"===n:"true"===n&&this._addEditor(),"true"===n&&this._textarea.focus()}}get css(){return["https://unpkg.com/@webqit/subscript/src/console/assets/prism.css","https://unpkg.com/@webqit/subscript/src/console/assets/vs-code-dark.css",`\n * {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n :host {\n /* Allow other elems to be inside */\n position: relative;\n top: 0;\n left: 0;\n display: block;\n \n /* Normal inline styles */\n \n font-size: 0.8rem;\n font-family: monospace;\n line-height: 1.2rem;\n tab-size: 2;\n caret-color: darkgrey;\n white-space: pre;\n overflow: hidden;\n }\n .container {\n min-height: 100%;\n width: 100%;\n display: flex;\n }\n .container > * {\n width: 100%;\n }\n \n textarea, ${this._styledBlock} {\n /* Both elements need the same text and space styling so they are directly on top of each other */\n margin: 0px !important;\n padding-top: var(--vertical-padding, 1.5rem) !important;\n padding-bottom: var(--vertical-padding, 1.5rem) !important;\n padding-left: var(--horizontal-padding, 1rem) !important;\n padding-right: var(--horizontal-padding, 1rem) !important;\n border: 0 !important;\n width: 100% !important;\n height: 100% !important;\n }\n ${"code"===this._styledBlock?"pre":"code"} {\n margin: 0px !important;\n border: 0px !important;\n padding: 0px !important;\n overflow: auto !important;\n width: 100% !important;\n height: 100% !important;\n }\n .line-numbers :is(textarea, pre[class*=language-]) {\n padding-left:3.8rem !important;\n }\n textarea, pre, pre * {\n /* Also add text styles to highlighing tokens */\n font-size: inherit !important;\n font-family: inherit !important;\n line-height: inherit !important;\n tab-size: inherit !important;\n }\n \n textarea, pre {\n /* In the same place */\n position: absolute;\n top: 0;\n left: 0;\n }\n textarea[disabled] {\n pointer-events: none !important;\n }\n \n /* Move the textarea in front of the result */\n \n textarea {\n z-index: 1;\n }\n pre {\n z-index: 0;\n }\n \n /* Make textarea almost completely transparent */\n \n textarea {\n color: transparent;\n background: transparent;\n caret-color: inherit!important; /* Or choose your favourite color */\n }\n \n /* Can be scrolled */\n textarea, pre {\n overflow: auto !important;\n \n white-space: inherit !important;\n word-spacing: normal !important;\n word-break: normal !important;\n word-wrap: normal !important;\n }\n \n /* No resize on textarea; stop outline */\n textarea {\n resize: none;\n outline: none !important;\n }\n .line-numbers-rows {\n border: none !important;\n color: dimgray !important;\n }\n `]}},a=e=>class extends(e||class{}){setStateCallback(e,t,n,i=100,r){this._timeouts||(this._timeouts={}),e in this._timeouts||(this._timeouts[e]=[]),n?(this._timeouts[e].length||r(),i?this._timeouts[e].unshift(setTimeout((()=>this.setState(e,t,!1)),i)):this._timeouts[e].unshift(null),this._related&&this._related.setState(e,t,!0,i)):(this._timeouts[e].shift(),this._timeouts[e].length||(r(),this._related&&this._related.setState(e,t,!1)))}};class s extends(a()){bind(e){Object.assign(this,e),this.fullPaths=[],this.$fullPaths=[],this.ownerReference.assignee&&this.ownerReference.assignee.refs.forEach((e=>{e.depth&&this.fullPaths.push([...this.path,...e.depth])})),this.fullPaths.length||(this.fullPaths=[this.path]),this.fullPaths.forEach(((e,t)=>{this.$fullPaths.push(e.map((e=>"memoId"in e?"[[computed]]":e.name)).join(".")),e.forEach((e=>{e.anchor.classList.add("ref-identifier"),e.anchor.classList.add(this.subscriptions?"effect":"signal");let n=e.anchor.getAttribute("title"),i="> "+this.$fullPaths[t]+(this.subscriptions?" (Effect Ref)":" (Signal Ref)");e.anchor.setAttribute("title",n?n+"\n"+i:i)})),this._on(t,"mouseenter",(()=>{this._setState(t,"path","hover",!0,0)}))._on(t,"mouseleave",(()=>{this._setState(t,"path","hover",!1)})),this.subscriptions&&this._on(t,"click",(()=>{this.ownerReference.ownerUnit.runThread(e)}))}))}_setState(e,t,n,i,r=100){this.setStateCallback(e+"|"+t,n,i,r,(()=>{i?this.fullPaths[e].forEach((e=>e.anchor.classList.add(`${t}-${n}`))):this.fullPaths[e].forEach((e=>e.anchor.classList.remove(`${t}-${n}`)))}))}setState(e,t,n,i=100){let[r,a]=e.split("|");if(void 0!==a)return this._setState(r,a,t,n,i);this.fullPaths.forEach(((r,a)=>{this._setState(a,e,t,n,i)}))}_on(e,t,n){return this.fullPaths[e].forEach((e=>e.anchor.addEventListener(t,n.bind(this)))),this}on(e,t){this.fullPaths.forEach(((n,i)=>{this._on(i,e,t)}))}}class o extends(a(HTMLElement)){bind(e){if(Object.assign(this,e),!this.graph)return;this.subUnits&&this.subUnits.forEach((e=>{e.replaceWith(...e.childNodes)})),this.subUnits=new Map,this._textNodes=this.getTextNodes();for(let e in this.graph.subUnits){let t=this.graph.subUnits[e],n=this.createSubUnit({ownerUnit:this,graph:t});this.subUnits.set(t.id,n)}if(this.effects=new Map,this.signals=new Map,this.refAnchors)for(let e in this.refAnchors){let t=this.refAnchors[e];t.replaceWith(...t.childNodes)}this.refAnchors={},this._textNodes=this.getTextNodes();const t=e=>{for(let t in this.graph[e]){let n=this.createReference({ownerUnit:this,...this.graph[e][t]});this[e].set(t,n)}};t("effects"),t("signals"),this.setAttribute("title",this.graph.type),this.on("mouseenter",(()=>{this.setState("block","hover",!0,0)})).on("mouseleave",(()=>{this.setState("block","hover",!1)})),this.observe(((e,t)=>{this.setState("block","runtime-active",!0,100),t.forEach((e=>{let t=this.signals.get(e.referenceId+"");t&&t.refs.get(e.id).setState("path","runtime-active",!0,100)}))}))}get program(){return this.ownerUnit?this.ownerUnit.program:this.runtime}runThread(...e){let t=this.program.locate(this.graph.lineage);if(t)return t.thread(...e)}observe(e){return this.program.observe(this.graph.lineage,e)}createSubUnit(e){let t=document.createElement("subscript-unit");return this.insertNode(t,e.graph.loc,"unit"),t.bind(e),t}createReference(e){let t={...e,refs:new Map};"assignee"in e&&(t.assignee=this.effects.get(e.assignee+""));for(let n of e.refs){let e=this.createRef({ownerReference:t,...n});t.refs.set(n.id,e)}return t}createRef(e){let t=new s;const n=e=>{let[t,n]=e.loc,i=t+"-"+n,r=this.refAnchors[i];return r||(r=document.createElement("span"),this.insertNode(r,[t,n],"ref"),this.refAnchors[i]=r),r};return(e={...e,path:e.path.map((e=>({anchor:n(e),...e})))}).depth&&(e.depth=e.depth.map((e=>({anchor:n(e),...e})))),t.bind(e),t}insertNode(e,t,n){let[i,r]=t,a=this.graph.loc?this.graph.loc[0]:0,[s,o]=this.resolveOffset(i-a),[l,c]=this.resolveOffset(r-a,!1),u=new Range;return"unit"===n?(0===o&&"SPAN"===s.parentNode.nodeName?u.setStartBefore(s.parentNode):u.setStart(s,o),c===(l.nodeValue||"").length&&"SPAN"===l.parentNode.nodeName?u.setEndAfter(l.parentNode):u.setEnd(l,c)):(u.setStart(s,o),u.setEnd(l,c)),u.surroundContents(e),e}resolveOffset(e,t=!0){return this._textNodes.reduce((([n,i,r],a)=>{if(null===i){let s=r+a.length;if(e<=s&&!a.isBlank){let i=e-r;if(!t&&0===i)return[n.node,n.length];if(!t||i<a.length)return[a.node,i]}[n,i,r]=[a,i,s]}return[n,i,r]}),[null,null,0])}getTextNodes(e=this){let t,n={acceptNode:function(e){if("SCRIPT"!==e.parentNode.nodeName)return window.NodeFilter.FILTER_ACCEPT}},i=window.document.createTreeWalker(e||this,window.NodeFilter.SHOW_TEXT,n,!1),r=[];for(;t=i.nextNode();){let e=t.nodeValue||"";r.push({node:t,length:e.length,isBlank:0===e.trim().length})}return r}setState(e,t,n,i=100){n&&this.ownerUnit&&this.ownerUnit.setState(e,t,!1),this.setStateCallback(e,t,n,i,(()=>{n?this.classList.add(`${e}-${t}`):this.classList.remove(`${e}-${t}`)}))}on(e,t){return this.addEventListener(e,t.bind(this)),this}}class l extends(r(o)){bind(e,t=!0){t&&(this.innerHTML=e.originalSource),setTimeout((()=>{if(!this._codeBlock.textContent.length)return;let t=e.runtime;super.bind({runtime:t,graph:t.graph})}),0)}createRef(e){}getTextNodes(e=null){return super.getTextNodes(e||this._codeBlock)}get css(){return super.css.concat(["\n .ref-identifier.path-runtime-active {\n text-decoration: underline;\n }\n .ref-identifier:is(.path-runtime-active) {\n }\n\n .ref-identifier.cause {\n cursor: default;\n }\n\n .ref-identifier.effect {\n cursor: pointer;\n }\n\n .ref-identifier.cause:is(.path-hover, .path-runtime-active) {\n color: aqua;\n }\n .token.keyword .ref-identifier.cause:is(.path-hover, .path-runtime-active) {\n color: mediumturquoise;\n }\n \n .ref-identifier.effect:is(.path-hover, .path-runtime-active) {\n color: yellowgreen;\n text-decoration: underline;\n }\n\n .ref-identifier.cause.effect:is(.path-hover, .path-runtime-active) {\n color: lightgreen;\n }\n\n subscript-unit.block-hover,\n subscript-unit.block-runtime-active {\n outline: 1px dashed gray;\n outline-offset: 0.1rem;\n border-radius: 0.1rem;\n /*\n background-color: darkblue;\n */\n }\n subscript-unit.block-runtime-active {\n background-color: rgba(100, 100, 100, 0.35);\n }\n "])}}customElements.define("subscript-codeblock",r()),customElements.define("subscript-unit",o),customElements.define("subscript-console",l)})()})();
(()=>{"use strict";var e={829:(e,t,n)=>{n.d(t,{Z:()=>r});const r=e=>class extends e{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){[].concat(this.css).forEach((e=>{if(e.includes("{")&&e.includes(":")&&e.includes(";"))this.shadowRoot.appendChild(document.createElement("style")).textContent=e;else{let t=this.shadowRoot.appendChild(document.createElement("link"));t.setAttribute("rel","stylesheet"),t.setAttribute("href",e)}}))}get css(){return[]}}},790:(e,t,n)=>{function r(e,t=!1){let n=e.split(/\n/g);if(n.length>1){for(;!n[0].trim().length;)n.shift();let e=n[t?1:0].split(/[^\s]/)[0].length;if(e)return n.map(((t,r)=>{let a=t.substring(0,e);return a.trim().length?"}"===a.trim()&&r===n.length-1?"}":t:t.substring(e)})).join("\n")}return e}n.d(t,{B:()=>r})}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e=n(790),t=n(829),r=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var r,i;switch(n=n||{},a.util.type(t)){case"Object":if(i=a.util.objId(t),n[i])return n[i];for(var s in r={},n[i]=r,t)t.hasOwnProperty(s)&&(r[s]=e(t[s],n));return r;case"Array":return i=a.util.objId(t),n[i]?n[i]:(r=[],n[i]=r,t.forEach((function(t,a){r[a]=e(t,n)})),r);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+n)},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r="no-"+t;e;){var a=e.classList;if(a.contains(t))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=a.util.clone(a.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){var i=(r=r||a.languages)[e],s={};for(var o in i)if(i.hasOwnProperty(o)){if(o==t)for(var l in n)n.hasOwnProperty(l)&&(s[l]=n[l]);n.hasOwnProperty(o)||(s[o]=i[o])}var c=r[e];return r[e]=s,a.languages.DFS(a.languages,(function(t,n){n===c&&t!=e&&(this[t]=s)})),s},DFS:function e(t,n,r,i){i=i||{};var s=a.util.objId;for(var o in t)if(t.hasOwnProperty(o)){n.call(t,o,t[o],r||o);var l=t[o],c=a.util.type(l);"Object"!==c||i[s(l)]?"Array"!==c||i[s(l)]||(i[s(l)]=!0,e(l,n,o,i)):(i[s(l)]=!0,e(l,n,null,i))}}},plugins:{},highlightAll:function(e,t){a.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),a.hooks.run("before-all-elements-highlight",r);for(var i,s=0;i=r.elements[s++];)a.highlightElement(i,!0===t,r.callback)},highlightElement:function(t,n,r){var i=a.util.getLanguage(t),s=a.languages[i];a.util.setLanguage(t,i);var o=t.parentElement;o&&"pre"===o.nodeName.toLowerCase()&&a.util.setLanguage(o,i);var l={element:t,language:i,grammar:s,code:t.textContent};function c(e){l.highlightedCode=e,a.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,a.hooks.run("after-highlight",l),a.hooks.run("complete",l),r&&r.call(l.element)}if(a.hooks.run("before-sanity-check",l),(o=l.element.parentElement)&&"pre"===o.nodeName.toLowerCase()&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","0"),!l.code)return a.hooks.run("complete",l),void(r&&r.call(l.element));if(a.hooks.run("before-highlight",l),l.grammar)if(n&&e.Worker){var u=new Worker(a.filename);u.onmessage=function(e){c(e.data)},u.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else c(a.highlight(l.code,l.grammar,l.language));else c(a.util.encode(l.code))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(a.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=a.tokenize(r.code,r.grammar),a.hooks.run("after-tokenize",r),i.stringify(a.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var u=new o;return l(u,u.head,e),function e(t,n,r,o,u,d){for(var h in r)if(r.hasOwnProperty(h)&&r[h]){var p=r[h];p=Array.isArray(p)?p:[p];for(var g=0;g<p.length;++g){if(d&&d.cause==h+","+g)return;var f=p[g],m=f.inside,b=!!f.lookbehind,v=!!f.greedy,y=f.alias;if(v&&!f.pattern.global){var x=f.pattern.toString().match(/[imsuy]*$/)[0];f.pattern=RegExp(f.pattern.source,x+"g")}for(var k=f.pattern||f,w=o.next,_=u;w!==n.tail&&!(d&&_>=d.reach);_+=w.value.length,w=w.next){var A=w.value;if(n.length>t.length)return;if(!(A instanceof i)){var E,F=1;if(v){if(!(E=s(k,_,t,b))||E.index>=t.length)break;var S=E.index,C=E.index+E[0].length,L=_;for(L+=w.value.length;L<=S;)L+=(w=w.next).value.length;if(_=L-=w.value.length,w.value instanceof i)continue;for(var N=w;N!==n.tail&&(L<C||"string"==typeof N.value);N=N.next)F++,L+=N.value.length;F--,A=t.slice(_,L),E.index-=_}else if(!(E=s(k,0,A,b)))continue;S=E.index;var $=E[0],T=A.slice(0,S),B=A.slice(S+$.length),z=_+A.length;d&&z>d.reach&&(d.reach=z);var P=w.prev;if(T&&(P=l(n,P,T),_+=T.length),c(n,P,F),w=l(n,P,new i(h,m?a.tokenize($,m):$,y,$)),B&&l(n,w,B),1<F){var j={cause:h+","+g,reach:z};e(t,n,r,w.prev,_,j),d&&j.reach>d.reach&&(d.reach=j.reach)}}}}}}(e,u,t,u.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(u)},hooks:{all:{},add:function(e,t){var n=a.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=a.hooks.all[e];if(n&&n.length)for(var r,i=0;r=n[i++];)r(t)}},Token:i};function i(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function s(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function o(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function c(e,t,n){for(var r=t.next,a=0;a<n&&r!==e.tail;a++)r=r.next;(t.next=r).prev=t,e.length-=a}if(e.Prism=a,i.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var r="";return t.forEach((function(t){r+=e(t,n)})),r}var i={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(i.classes,s):i.classes.push(s)),a.hooks.run("wrap",i);var o="";for(var l in i.attributes)o+=" "+l+'="'+(i.attributes[l]||"").replace(/"/g,"&quot;")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+o+">"+i.content+"</"+i.tag+">"},!e.document)return e.addEventListener&&(a.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,i=n.code,s=n.immediateClose;e.postMessage(a.highlight(i,a.languages[r],r)),s&&e.close()}),!1)),a;var u=a.util.currentScript();function d(){a.manual||a.highlightAll()}if(u&&(a.filename=u.src,u.hasAttribute("data-manual")&&(a.manual=!0)),!a.manual){var h=document.readyState;"loading"===h||"interactive"===h&&u&&u.defer?document.addEventListener("DOMContentLoaded",d):window.requestAnimationFrame?window.requestAnimationFrame(d):window.setTimeout(d,16)}return a}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});"undefined"!=typeof module&&module.exports&&(module.exports=r),"undefined"!=typeof global&&(global.Prism=r),r.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},r.languages.markup.tag.inside["attr-value"].inside.entity=r.languages.markup.entity,r.languages.markup.doctype.inside["internal-subset"].inside=r.languages.markup,r.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))})),Object.defineProperty(r.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:r.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var a={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};a["language-"+t]={pattern:/[\s\S]+/,inside:r.languages[t]};var i={};i[e]={pattern:RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])*?(?=</__>)".replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:a},r.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(r.languages.markup.tag,"addAttribute",{value:function(e,t){r.languages.markup.tag.inside["special-attr"].push({pattern:RegExp("(^|[\"'\\s])(?:"+e+")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))","i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:r.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.xml=r.languages.extend("markup",{}),r.languages.ssml=r.languages.xml,r.languages.atom=r.languages.xml,r.languages.rss=r.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|(?:[^\\\\\r\n()\"']|\\\\[^])*)\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(r),r.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},r.languages.javascript=r.languages.extend("clike",{"class-name":[r.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),r.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,r.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:r.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:r.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:r.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:r.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?: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|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:r.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),r.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),r.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),r.languages.markup&&(r.languages.markup.tag.addInlined("script","javascript"),r.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)","javascript")),r.languages.js=r.languages.javascript,function(){if(void 0!==r&&"undefined"!=typeof document&&document.querySelector){var e,t="line-numbers",n="linkable-line-numbers",a=function(){if(void 0===e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding="0",t.style.border="0",t.innerHTML="&nbsp;<br />&nbsp;",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e},i=!0;r.plugins.lineHighlight={highlightLines:function(e,s,u){var d=(s="string"==typeof s?s:e.getAttribute("data-line")||"").replace(/\s+/g,"").split(",").filter(Boolean),h=+e.getAttribute("data-line-offset")||0,p=(a()?parseInt:parseFloat)(getComputedStyle(e).lineHeight),g=r.util.isActive(e,t),f=e.querySelector("code"),m=g?e:f||e,b=[],v=f&&m!=f?function(e,t){var n=getComputedStyle(e),r=getComputedStyle(t);function a(e){return+e.substr(0,e.length-2)}return t.offsetTop+a(r.borderTopWidth)+a(r.paddingTop)-a(n.paddingTop)}(e,f):0;d.forEach((function(t){var n=t.split("-"),a=+n[0],i=+n[1]||a,s=e.querySelector('.line-highlight[data-range="'+t+'"]')||document.createElement("div");if(b.push((function(){s.setAttribute("aria-hidden","true"),s.setAttribute("data-range",t),s.className=(u||"")+" line-highlight"})),g&&r.plugins.lineNumbers){var o=r.plugins.lineNumbers.getLine(e,a),l=r.plugins.lineNumbers.getLine(e,i);if(o){var c=o.offsetTop+v+"px";b.push((function(){s.style.top=c}))}if(l){var d=l.offsetTop-o.offsetTop+l.offsetHeight+"px";b.push((function(){s.style.height=d}))}}else b.push((function(){s.setAttribute("data-start",String(a)),a<i&&s.setAttribute("data-end",String(i)),s.style.top=(a-h-1)*p+v+"px",s.textContent=new Array(i-a+2).join(" \n")}));b.push((function(){s.style.width=e.scrollWidth+"px"})),b.push((function(){m.appendChild(s)}))}));var y=e.id;if(g&&r.util.isActive(e,n)&&y){l(e,n)||b.push((function(){e.classList.add(n)}));var x=parseInt(e.getAttribute("data-start")||"1");o(".line-numbers-rows > span",e).forEach((function(e,t){var n=t+x;e.onclick=function(){var e=y+"."+n;i=!1,location.hash=e,setTimeout((function(){i=!0}),1)}}))}return function(){b.forEach(c)}}};var s=0;r.hooks.add("before-sanity-check",(function(e){var t=e.element.parentElement;if(u(t)){var n=0;o(".line-highlight",t).forEach((function(e){n+=e.textContent.length,e.parentNode.removeChild(e)})),n&&/^(?: \n)+$/.test(e.code.slice(-n))&&(e.code=e.code.slice(0,-n))}})),r.hooks.add("complete",(function e(n){var a=n.element.parentElement;if(u(a)){clearTimeout(s);var i=r.plugins.lineNumbers,o=n.plugins&&n.plugins.lineNumbers;l(a,t)&&i&&!o?r.hooks.add("line-numbers",e):(r.plugins.lineHighlight.highlightLines(a)(),s=setTimeout(d,1))}})),window.addEventListener("hashchange",d),window.addEventListener("resize",(function(){o("pre").filter(u).map((function(e){return r.plugins.lineHighlight.highlightLines(e)})).forEach(c)}))}function o(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function l(e,t){return e.classList.contains(t)}function c(e){e()}function u(e){return!!(e&&/pre/i.test(e.nodeName)&&(e.hasAttribute("data-line")||e.id&&r.util.isActive(e,n)))}function d(){var e=location.hash.slice(1);o(".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",""),r.plugins.lineHighlight.highlightLines(a,t,"temporary ")(),i&&document.querySelector(".temporary.line-highlight").scrollIntoView())}}}(),function(){if(void 0!==r&&"undefined"!=typeof document){var e="line-numbers",t=/\n(?!$)/g,n=r.plugins.lineNumbers={getLine:function(t,n){if("PRE"===t.tagName&&t.classList.contains(e)){var r=t.querySelector(".line-numbers-rows");if(r){var a=parseInt(t.getAttribute("data-start"),10)||1,i=a+(r.children.length-1);n<a&&(n=a),i<n&&(n=i);var s=n-a;return r.children[s]}}},resize:function(e){i([e])},assumeViewportIndependence:!0},a=void 0;window.addEventListener("resize",(function(){n.assumeViewportIndependence&&a===window.innerWidth||(a=window.innerWidth,i(Array.prototype.slice.call(document.querySelectorAll("pre."+e))))})),r.hooks.add("complete",(function(n){if(n.code){var a=n.element,s=a.parentNode;if(s&&/pre/i.test(s.nodeName)&&!a.querySelector(".line-numbers-rows")&&r.util.isActive(a,e)){a.classList.remove(e),s.classList.add(e);var o,l=n.code.match(t),c=l?l.length+1:1,u=new Array(c+1).join("<span></span>");(o=document.createElement("span")).setAttribute("aria-hidden","true"),o.className="line-numbers-rows",o.innerHTML=u,s.hasAttribute("data-start")&&(s.style.counterReset="linenumber "+(parseInt(s.getAttribute("data-start"),10)-1)),n.element.appendChild(o),i([s]),r.hooks.run("line-numbers",n)}}})),r.hooks.add("line-numbers",(function(e){e.plugins=e.plugins||{},e.plugins.lineNumbers=!0}))}function i(e){if(0!=(e=e.filter((function(e){var t=function(e){return e?window.getComputedStyle?getComputedStyle(e):e.currentStyle||null:null}(e)["white-space"];return"pre-wrap"===t||"pre-line"===t}))).length){var n=e.map((function(e){var n=e.querySelector("code"),r=e.querySelector(".line-numbers-rows");if(n&&r){var a=e.querySelector(".line-numbers-sizer"),i=n.textContent.split(t);a||((a=document.createElement("span")).className="line-numbers-sizer",n.appendChild(a)),a.innerHTML="0",a.style.display="block";var s=a.getBoundingClientRect().height;return a.innerHTML="",{element:e,lines:i,lineHeights:[],oneLinerHeight:s,sizer:a}}})).filter(Boolean);n.forEach((function(e){var t=e.sizer,n=e.lines,r=e.lineHeights,a=e.oneLinerHeight;r[n.length-1]=void 0,n.forEach((function(e,n){if(e&&1<e.length){var i=t.appendChild(document.createElement("span"));i.style.display="block",i.textContent=e}else r[n]=a}))})),n.forEach((function(e){for(var t=e.sizer,n=e.lineHeights,r=0,a=0;a<n.length;a++)void 0===n[a]&&(n[a]=t.children[r++].getBoundingClientRect().height)})),n.forEach((function(e){var t=e.sizer,n=e.element.querySelector(".line-numbers-rows");t.style.display="none",t.innerHTML="",e.lineHeights.forEach((function(e,t){n.children[t].style.height=e+"px"}))}))}}}(),function(){if(void 0!==r&&"undefined"!=typeof document){var e=[],t={},n=function(){};r.plugins.toolbar={};var a=r.plugins.toolbar.registerButton=function(n,r){var a;a="function"==typeof r?r:function(e){var t;return"function"==typeof r.onClick?((t=document.createElement("button")).type="button",t.addEventListener("click",(function(){r.onClick.call(this,e)}))):"string"==typeof r.url?(t=document.createElement("a")).href=r.url:t=document.createElement("span"),r.className&&t.classList.add(r.className),t.textContent=r.text,t},n in t?console.warn('There is a button with the key "'+n+'" registered already.'):e.push(t[n]=a)},i=r.plugins.toolbar.hook=function(r){var a=r.element.parentNode;if(a&&/pre/i.test(a.nodeName)&&!a.parentNode.classList.contains("code-toolbar")){var i=document.createElement("div");i.classList.add("code-toolbar"),a.parentNode.insertBefore(i,a),i.appendChild(a);var s=document.createElement("div");s.classList.add("toolbar");var o=e,l=function(e){for(;e;){var t=e.getAttribute("data-toolbar-order");if(null!=t)return(t=t.trim()).length?t.split(/\s*,\s*/g):[];e=e.parentElement}}(r.element);l&&(o=l.map((function(e){return t[e]||n}))),o.forEach((function(e){var t=e(r);if(t){var n=document.createElement("div");n.classList.add("toolbar-item"),n.appendChild(t),s.appendChild(n)}})),i.appendChild(s)}};a("label",(function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&t.hasAttribute("data-label")){var n,r,a=t.getAttribute("data-label");try{r=document.querySelector("template#"+a)}catch(e){}return r?n=r.content:(t.hasAttribute("data-url")?(n=document.createElement("a")).href=t.getAttribute("data-url"):n=document.createElement("span"),n.textContent=a),n}})),r.hooks.add("complete",i)}}(),function(){function e(e,n){e.addEventListener("click",(function(){!function(e){navigator.clipboard?navigator.clipboard.writeText(e.getText()).then(e.success,(function(){t(e)})):t(e)}(n)}))}function t(e){var t=document.createElement("textarea");t.value=e.getText(),t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{var n=document.execCommand("copy");setTimeout((function(){n?e.success():e.error()}),1)}catch(t){setTimeout((function(){e.error(t)}),1)}document.body.removeChild(t)}void 0!==r&&"undefined"!=typeof document&&(r.plugins.toolbar?r.plugins.toolbar.registerButton("copy-to-clipboard",(function(t){var n=t.element,r=function(e){var t={copy:"Copy","copy-error":"Press Ctrl+C to copy","copy-success":"Copied!","copy-timeout":5e3};for(var n in t){for(var r="data-prismjs-"+n,a=e;a&&!a.hasAttribute(r);)a=a.parentElement;a&&(t[n]=a.getAttribute(r))}return t}(n),a=document.createElement("button");a.className="copy-to-clipboard-button",a.setAttribute("type","button");var i=document.createElement("span");return a.appendChild(i),o("copy"),e(a,{getText:function(){return n.textContent},success:function(){o("copy-success"),s()},error:function(){o("copy-error"),setTimeout((function(){!function(e){window.getSelection().selectAllChildren(e)}(n)}),1),s()}}),a;function s(){setTimeout((function(){o("copy")}),r["copy-timeout"])}function o(e){i.textContent=r[e],a.setAttribute("data-copy-state",e)}})):console.warn("Copy to Clipboard plugin loaded before Toolbar plugin."))}(),function(){if(void 0!==r&&"undefined"!=typeof document){var e={"(":")","[":"]","{":"}"},t={"(":"brace-round","[":"brace-square","{":"brace-curly"},n={"${":"{"},a=0,i=/^(pair-\d+-)(close|open)$/;r.hooks.add("complete",(function(i){var o=i.element,d=o.parentElement;if(d&&"PRE"==d.tagName){var h=[];if(r.util.isActive(o,"match-braces")&&h.push("(","[","{"),0!=h.length){d.__listenerAdded||(d.addEventListener("mousedown",(function(){var e=d.querySelector("code"),t=s("brace-selected");Array.prototype.slice.call(e.querySelectorAll("."+t)).forEach((function(e){e.classList.remove(t)}))})),Object.defineProperty(d,"__listenerAdded",{value:!0}));var p=Array.prototype.slice.call(o.querySelectorAll("span."+s("token")+"."+s("punctuation"))),g=[];h.forEach((function(r){for(var i=e[r],o=s(t[r]),d=[],h=[],f=0;f<p.length;f++){var m=p[f];if(0==m.childElementCount){var b=m.textContent;(b=n[b]||b)===r?(g.push({index:f,open:!0,element:m}),m.classList.add(o),m.classList.add(s("brace-open")),h.push(f)):b===i&&(g.push({index:f,open:!1,element:m}),m.classList.add(o),m.classList.add(s("brace-close")),h.length&&d.push([f,h.pop()]))}}d.forEach((function(e){var t="pair-"+a+++"-",n=p[e[0]],r=p[e[1]];n.id=t+"open",r.id=t+"close",[n,r].forEach((function(e){e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",c),e.addEventListener("click",u)}))}))}));var f=0;g.sort((function(e,t){return e.index-t.index})),g.forEach((function(e){e.open?(e.element.classList.add(s("brace-level-"+(f%12+1))),f++):(f=Math.max(0,f-1),e.element.classList.add(s("brace-level-"+(f%12+1))))}))}}}))}function s(e){var t=r.plugins.customClass;return t?t.apply(e,"none"):e}function o(e){var t=i.exec(e.id);return document.querySelector("#"+t[1]+("open"==t[2]?"close":"open"))}function l(){r.util.isActive(this,"brace-hover",!0)&&[this,o(this)].forEach((function(e){e.classList.add(s("brace-hover"))}))}function c(){[this,o(this)].forEach((function(e){e.classList.remove(s("brace-hover"))}))}function u(){r.util.isActive(this,"brace-select",!0)&&[this,o(this)].forEach((function(e){e.classList.add(s("brace-selected"))}))}}();const a=n=>class extends((0,t.Z)(n||HTMLElement)){static get observedAttributes(){return["name","editable","placeholder"]}connectedCallback(){this._lang="javascript",this._editable=this.getAttribute("editable"),this._styledBlock=this.getAttribute("styled-block")||"pre",this._div=document.createElement("div"),this._preBlock=this._div.appendChild(document.createElement("pre")),this._codeBlock=this._preBlock.appendChild(document.createElement("code")),this._div.classList.add("line-numbers"),this._div.classList.add("container"),this._lang&&(this._preBlock.classList.add("language-"+this._lang),this._codeBlock.classList.add("language-"+this._lang)),this._contentSlot=document.createElement("slot"),this._contentSlot.setAttribute("aria-hidden","true"),this._contentSlot.setAttribute("hidden","true"),this._initialSlotEvent=!1,this._contentSlot.addEventListener("slotchange",(()=>{let t=this._contentSlot.assignedNodes().reduce(((e,t)=>e+(t.outerHTML||t.nodeValue||"")),"");this._initialSlotEvent||(t=(0,e.B)(t),this._initialSlotEvent=!0),this._textarea&&(this._textarea.value=t),this.source=(e=>e.replace(new RegExp("&","g"),"&amp;").replace(new RegExp("<","g"),"&lt;"))(t)})),"true"===this._editable&&this._addEditor(),this.shadowRoot.append(this._contentSlot,this._textarea||"",this._div),super.connectedCallback()}get source(){return this._codeBlock.textContent}set source(e){e.endsWith("\n")&&(e+=" "),this._codeBlock.innerHTML="",this._codeBlock.innerHTML=e,this._highlightCodeBlock(),this._syncScrolling()}get name(){return this._name}set name(e){return this.setAttribute("name",e)}get placeholder(){return this._placeholder}set placeholder(e){return this.setAttribute("placeholder",e)}get editable(){return this._editable}set editable(e){return this.setAttribute("editable",!0===e?"true":!1===e?"false":e)}_addEditor(){this._placeholder=this.getAttribute("placeholder"),this._name=this.getAttribute("name"),this._textarea=this._div.appendChild(document.createElement("textarea")),this._textarea.placeholder=this._placeholder||this._lang,this._textarea.spellcheck=!1,this._textarea.name=this._name||"",this._textarea.value=this._codeBlock.textContent,this._preBlock.setAttribute("aria-hidden","true"),this._scrollBlock="code"===this.getAttribute("scroll-block")?this._codeBlock:this._preBlock,this._textarea.addEventListener("input",(e=>{this.source=e.target.value})),this._textarea.addEventListener("input",(()=>this._syncScrolling())),this._textarea.addEventListener("scroll",(()=>this._syncScrolling())),this._textarea.addEventListener("keydown",(e=>this._handleTabKeyEvent(e)))}_handleTabKeyEvent(e){if(!this._textarea)return;if("Tab"!==e.key)return;e.preventDefault();let t=this._textarea.value,n=this._textarea.selectionStart,r=this._textarea.selectionEnd;if(n===r){let e=t.slice(0,n),a=t.slice(r,t.length),i=r+1;this._textarea.value=e+"\t"+a,this._textarea.selectionStart=i,this._textarea.selectionEnd=i}else{let a=t.split("\n"),i=0,s=0,o=0;for(let t=0;t<a.length;t++)i+=a[t].length,n<i&&r>i-a[t].length&&(e.shiftKey?"\t"===a[t][0]&&(a[t]=a[t].slice(1),0===s&&o--,s--):(a[t]="\t"+a[t],0===s&&o++,s++));this._textarea.value=a.join("\n"),this._textarea.selectionStart=n+o,this._textarea.selectionEnd=r+s}this.source=this._textarea.value}_syncScrolling(){this._scrollBlock&&(this._scrollBlock.scrollTop=this._textarea.scrollTop,this._scrollBlock.scrollLeft=this._textarea.scrollLeft)}_highlightCodeBlock(){Prism.highlightElement(this._codeBlock)}disconnectedCallback(){Array.from(this.shadowRoot.childNodes).forEach((e=>e.remove()))}attributeChangedCallback(e,t,n){if(this.childNodes.length)switch(e){case"name":this._name=n,this._textarea.name=n;break;case"placeholder":this._placeholder=n,this._textarea.placeholder=n;break;case"editable":this._editable=n,this._textarea?this._textarea.disabled="false"===n:"true"===n&&this._addEditor(),"true"===n&&this._textarea.focus()}}get css(){return["https://unpkg.com/@webqit/subscript/src/console/assets/prism.css","https://unpkg.com/@webqit/subscript/src/console/assets/vs-code-dark.css",`\n * {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n :host {\n /* Allow other elems to be inside */\n position: relative;\n top: 0;\n left: 0;\n display: block;\n \n /* Normal inline styles */\n \n font-size: 0.8rem;\n font-family: monospace;\n line-height: 1.2rem;\n tab-size: 2;\n caret-color: darkgrey;\n white-space: pre;\n overflow: hidden;\n }\n .container {\n min-height: 100%;\n width: 100%;\n display: flex;\n }\n .container > * {\n width: 100%;\n }\n \n textarea, ${this._styledBlock} {\n /* Both elements need the same text and space styling so they are directly on top of each other */\n margin: 0px !important;\n padding-top: var(--vertical-padding, 1.5rem) !important;\n padding-bottom: var(--vertical-padding, 1.5rem) !important;\n padding-left: var(--horizontal-padding, 1rem) !important;\n padding-right: var(--horizontal-padding, 1rem) !important;\n border: 0 !important;\n width: 100% !important;\n height: 100% !important;\n }\n ${"code"===this._styledBlock?"pre":"code"} {\n margin: 0px !important;\n border: 0px !important;\n padding: 0px !important;\n overflow: auto !important;\n width: 100% !important;\n height: 100% !important;\n }\n .line-numbers :is(textarea, pre[class*=language-]) {\n padding-left:3.8rem !important;\n }\n textarea, pre, pre * {\n /* Also add text styles to highlighing tokens */\n font-size: inherit !important;\n font-family: inherit !important;\n line-height: inherit !important;\n tab-size: inherit !important;\n }\n \n textarea, pre {\n /* In the same place */\n position: absolute;\n top: 0;\n left: 0;\n }\n textarea[disabled] {\n pointer-events: none !important;\n }\n \n /* Move the textarea in front of the result */\n \n textarea {\n z-index: 1;\n }\n pre {\n z-index: 0;\n }\n \n /* Make textarea almost completely transparent */\n \n textarea {\n color: transparent;\n background: transparent;\n caret-color: inherit!important; /* Or choose your favourite color */\n }\n \n /* Can be scrolled */\n textarea, pre {\n overflow: auto !important;\n \n white-space: inherit !important;\n word-spacing: normal !important;\n word-break: normal !important;\n word-wrap: normal !important;\n }\n \n /* No resize on textarea; stop outline */\n textarea {\n resize: none;\n outline: none !important;\n }\n .line-numbers-rows {\n border: none !important;\n color: dimgray !important;\n }\n `]}},i=e=>class extends(e||class{}){setStateCallback(e,t,n,r=100,a){this._timeouts||(this._timeouts={}),e in this._timeouts||(this._timeouts[e]=[]),n?(this._timeouts[e].length||a(),r?this._timeouts[e].unshift(setTimeout((()=>this.setState(e,t,!1)),r)):this._timeouts[e].unshift(null),this._related&&this._related.setState(e,t,!0,r)):(this._timeouts[e].shift(),this._timeouts[e].length||(a(),this._related&&this._related.setState(e,t,!1)))}};class s extends(i()){bind(e){Object.assign(this,e),this.fullPaths=[],this.$fullPaths=[],this.ownerReference.assignee&&this.ownerReference.assignee.refs.forEach((e=>{e.depth&&this.fullPaths.push([...this.path,...e.depth])})),this.fullPaths.length||(this.fullPaths=[this.path]),this.fullPaths.forEach(((e,t)=>{this.$fullPaths.push(e.map((e=>"memoId"in e?"[[computed]]":e.name)).join(".")),e.forEach((e=>{e.anchor.classList.add("ref-identifier"),e.anchor.classList.add(this.subscriptions?"effect":"signal");let n=e.anchor.getAttribute("title"),r="> "+this.$fullPaths[t]+(this.subscriptions?" (Effect Ref)":" (Signal Ref)");e.anchor.setAttribute("title",n?n+"\n"+r:r)})),this._on(t,"mouseenter",(()=>{this._setState(t,"path","hover",!0,0)}))._on(t,"mouseleave",(()=>{this._setState(t,"path","hover",!1)})),this.subscriptions&&this._on(t,"click",(()=>{this.ownerReference.ownerContract.runThread(e)}))}))}_setState(e,t,n,r,a=100){this.setStateCallback(e+"|"+t,n,r,a,(()=>{r?this.fullPaths[e].forEach((e=>e.anchor.classList.add(`${t}-${n}`))):this.fullPaths[e].forEach((e=>e.anchor.classList.remove(`${t}-${n}`)))}))}setState(e,t,n,r=100){let[a,i]=e.split("|");if(void 0!==i)return this._setState(a,i,t,n,r);this.fullPaths.forEach(((a,i)=>{this._setState(i,e,t,n,r)}))}_on(e,t,n){return this.fullPaths[e].forEach((e=>e.anchor.addEventListener(t,n.bind(this)))),this}on(e,t){this.fullPaths.forEach(((n,r)=>{this._on(r,e,t)}))}}class o extends(i(HTMLElement)){bind(e){if(Object.assign(this,e),!this.graph)return;this.subContracts&&this.subContracts.forEach((e=>{e.replaceWith(...e.childNodes)})),this.subContracts=new Map,this._textNodes=this.getTextNodes();for(let e in this.graph.subContracts){let t=this.graph.subContracts[e],n=this.createSubContract({ownerContract:this,graph:t});this.subContracts.set(t.id,n)}if(this.effects=new Map,this.signals=new Map,this.refAnchors)for(let e in this.refAnchors){let t=this.refAnchors[e];t.replaceWith(...t.childNodes)}this.refAnchors={},this._textNodes=this.getTextNodes();const t=e=>{for(let t in this.graph[e]){let n=this.createReference({ownerContract:this,...this.graph[e][t]});this[e].set(t,n)}};t("effects"),t("signals"),this.setAttribute("title",this.graph.type),this.on("mouseenter",(()=>{this.setState("block","hover",!0,0)})).on("mouseleave",(()=>{this.setState("block","hover",!1)})),this.observe(((e,t)=>{this.setState("block","runtime-active",!0,100),t.forEach((e=>{let t=this.signals.get(e.referenceId+"");t&&t.refs.get(e.id).setState("path","runtime-active",!0,100)}))}))}get program(){return this.ownerContract?this.ownerContract.program:this.runtime}runThread(...e){let t=this.program.locate(this.graph.lineage);if(t)return t.thread(...e)}observe(e){return this.program.observe(this.graph.lineage,e)}createSubContract(e){let t=document.createElement("subscript-contract");return this.insertNode(t,e.graph.loc,"contract"),t.bind(e),t}createReference(e){let t={...e,refs:new Map};"assignee"in e&&(t.assignee=this.effects.get(e.assignee+""));for(let n of e.refs){let e=this.createRef({ownerReference:t,...n});t.refs.set(n.id,e)}return t}createRef(e){let t=new s;const n=e=>{let[t,n]=e.loc,r=t+"-"+n,a=this.refAnchors[r];return a||(a=document.createElement("span"),this.insertNode(a,[t,n],"ref"),this.refAnchors[r]=a),a};return(e={...e,path:e.path.map((e=>({anchor:n(e),...e})))}).depth&&(e.depth=e.depth.map((e=>({anchor:n(e),...e})))),t.bind(e),t}insertNode(e,t,n){let[r,a]=t,i=this.graph.loc?this.graph.loc[0]:0,[s,o]=this.resolveOffset(r-i),[l,c]=this.resolveOffset(a-i,!1),u=new Range;return"contract"===n?(0===o&&"SPAN"===s.parentNode.nodeName?u.setStartBefore(s.parentNode):u.setStart(s,o),c===(l.nodeValue||"").length&&"SPAN"===l.parentNode.nodeName?u.setEndAfter(l.parentNode):u.setEnd(l,c)):(u.setStart(s,o),u.setEnd(l,c)),u.surroundContents(e),e}resolveOffset(e,t=!0){return this._textNodes.reduce((([n,r,a],i)=>{if(null===r){let s=a+i.length;if(e<=s&&!i.isBlank){let r=e-a;if(!t&&0===r)return[n.node,n.length];if(!t||r<i.length)return[i.node,r]}[n,r,a]=[i,r,s]}return[n,r,a]}),[null,null,0])}getTextNodes(e=this){let t,n={acceptNode:function(e){if("SCRIPT"!==e.parentNode.nodeName)return window.NodeFilter.FILTER_ACCEPT}},r=window.document.createTreeWalker(e||this,window.NodeFilter.SHOW_TEXT,n,!1),a=[];for(;t=r.nextNode();){let e=t.nodeValue||"";a.push({node:t,length:e.length,isBlank:0===e.trim().length})}return a}setState(e,t,n,r=100){n&&this.ownerContract&&this.ownerContract.setState(e,t,!1),this.setStateCallback(e,t,n,r,(()=>{n?this.classList.add(`${e}-${t}`):this.classList.remove(`${e}-${t}`)}))}on(e,t){return this.addEventListener(e,t.bind(this)),this}}class l extends(a(o)){bind(e,t=!0){t&&(this.innerHTML=e.originalSource),setTimeout((()=>{if(!this._codeBlock.textContent.length)return;let t=e.runtime;super.bind({runtime:t,graph:t.graph})}),0)}createRef(e){}getTextNodes(e=null){return super.getTextNodes(e||this._codeBlock)}get css(){return super.css.concat(["\n .ref-identifier.path-runtime-active {\n text-decoration: underline;\n }\n .ref-identifier:is(.path-runtime-active) {\n }\n\n .ref-identifier.cause {\n cursor: default;\n }\n\n .ref-identifier.effect {\n cursor: pointer;\n }\n\n .ref-identifier.cause:is(.path-hover, .path-runtime-active) {\n color: aqua;\n }\n .token.keyword .ref-identifier.cause:is(.path-hover, .path-runtime-active) {\n color: mediumturquoise;\n }\n \n .ref-identifier.effect:is(.path-hover, .path-runtime-active) {\n color: yellowgreen;\n text-decoration: underline;\n }\n\n .ref-identifier.cause.effect:is(.path-hover, .path-runtime-active) {\n color: lightgreen;\n }\n\n subscript-contract.block-hover,\n subscript-contract.block-runtime-active {\n outline: 1px dashed gray;\n outline-offset: 0.1rem;\n border-radius: 0.1rem;\n /*\n background-color: darkblue;\n */\n }\n subscript-contract.block-runtime-active {\n background-color: rgba(100, 100, 100, 0.35);\n }\n "])}}customElements.define("subscript-codeblock",a()),customElements.define("subscript-contract",o),customElements.define("subscript-console",l)})()})();
//# sourceMappingURL=console-element.js.map

@@ -11,3 +11,3 @@ {

"homepage": "https://webqit.io/tooling/subscript",
"version": "2.1.13",
"version": "2.1.14-0",
"license": "MIT",

@@ -14,0 +14,0 @@ "repository": {

@@ -41,3 +41,3 @@

let globalContext = new Context( null, '#', { ...def, params: this.params, } );
globalContext.defineSubscriptIdentifier( '$unit', [ '$x' ] );
globalContext.defineSubscriptIdentifier( '$contract', [ '$x' ] );
let [ ast ] = globalContext.createScope( def, () => this.generateNodes( globalContext, [ nodes ] ) );

@@ -48,3 +48,3 @@ this.deferredTasks.forEach( task => task() );

graph: globalContext.toJson( false ),
identifier: globalContext.getSubscriptIdentifier( '$unit' ),
identifier: globalContext.getSubscriptIdentifier( '$contract' ),
locations: this.locations,

@@ -147,32 +147,32 @@ ast,

const generateId = ( id, context ) => !id ? [ id ] : context.effectReference( { type: node.type }, () => this.generateNodes( context, [ id ] ), false );
const generateFunction = ( id, params, body ) => context.defineContext( { type: node.type, isSubscriptFunction: node.isSubscriptFunction }, functionUnit => {
return functionUnit.createScope( { type: node.type }, () => {
const generateFunction = ( id, params, body ) => context.defineContext( { type: node.type, isSubscriptFunction: node.isSubscriptFunction }, functionContract => {
return functionContract.createScope( { type: node.type }, () => {
// FunctionExpressions have their IDs in function scope
id = generateId( id, functionUnit )[ 0 ];
id = generateId( id, functionContract )[ 0 ];
// Function params go into function scope
params = params.map( param => {
if ( param.type === 'AssignmentPattern' ) {
let right = this.generateNode( functionUnit, param.right );
let right = this.generateNode( functionContract, param.right );
let def = { type: param.left.type };
let [ left ] = functionUnit.effectReference( def, () => this.generateNodes( functionUnit, [ param.left ] ), false );
let [ left ] = functionContract.effectReference( def, () => this.generateNodes( functionContract, [ param.left ] ), false );
return Node.assignmentPattern( left, right );
}
let def = { type: param.type };
[ param ] = functionUnit.effectReference( def, () => this.generateNodes( functionUnit, [ param ] ), false );
[ param ] = functionContract.effectReference( def, () => this.generateNodes( functionContract, [ param ] ), false );
return param;
} );
if ( node.type === 'ArrowFunctionExpression' && node.expression ) {
body = this.generateNode( functionUnit, Node.blockStmt( [ Node.returnStmt( body ) ] ) );
body = this.generateNode( functionContract, Node.blockStmt( [ Node.returnStmt( body ) ] ) );
} else {
body = this.generateNode( functionUnit, body );
body = this.generateNode( functionContract, body );
}
return [ functionUnit, id, params, body ];
return [ functionContract, id, params, body ];
} );
} );
let subscript$unit = Node.identifier( context.getSubscriptIdentifier( '$unit', true ) );
let unitCreate = ( generate, functionUnit, funcName, params, body ) => functionUnit.generate(
generate.call( Node, funcName, [ subscript$unit ].concat( params ), body, node.async, node.expression, node.generator ), {
let subscript$contract = Node.identifier( context.getSubscriptIdentifier( '$contract', true ) );
let contractCreate = ( generate, functionContract, funcName, params, body ) => functionContract.generate(
generate.call( Node, funcName, [ subscript$contract ].concat( params ), body, node.async, node.expression, node.generator ), {
args: [ Node.literal( node.type ), Node.identifier( node.isSubscriptFunction ? 'true' : 'false' ) ],
isFunctionUnit: true,
isFunctionContract: true,
generateForArgument: true

@@ -182,10 +182,10 @@ }

let resultNode, functionUnit, id, params, body;
let resultNode, functionContract, id, params, body;
if ( node.type === 'FunctionDeclaration' ) {
// FunctionDeclarations have their IDs in current scope
[ id ] = generateId( node.id, context );
[ functionUnit, , params, body ] = generateFunction( null, node.params, node.body );
resultNode = unitCreate( Node.funcExpr, functionUnit, null, params, body );
[ functionContract, , params, body ] = generateFunction( null, node.params, node.body );
resultNode = contractCreate( Node.funcExpr, functionContract, null, params, body );
// We'll physically do hoisting
let definitionRef = Node.memberExpr( subscript$unit, Node.identifier( 'functions' ) );
let definitionRef = Node.memberExpr( subscript$contract, Node.identifier( 'functions' ) );
let definitionCall = ( method, ...args ) => Node.callExpr( Node.memberExpr( definitionRef, Node.identifier( method ) ), [ id, ...args ] );

@@ -203,9 +203,9 @@ // Generate now

// FunctionExpressions and ArrowFunctionExpressions are quite simpler
[ functionUnit, id, params, body ] = generateFunction( node.id, node.params, node.body );
resultNode = unitCreate( generate, functionUnit, id, params, body );
[ functionContract, id, params, body ] = generateFunction( node.id, node.params, node.body );
resultNode = contractCreate( generate, functionContract, id, params, body );
}
this.deferredTasks.unshift( () => {
functionUnit.sideEffects.forEach( sideEffect => {
functionUnit.ownerScope.doSideEffectUpdates( sideEffect.reference, sideEffect.remainderRefs );
functionContract.sideEffects.forEach( sideEffect => {
functionContract.ownerScope.doSideEffectUpdates( sideEffect.reference, sideEffect.remainderRefs );
} );

@@ -225,7 +225,7 @@ } );

let assignmentRefactors = [];
let exec = ( unit, declarator, isForLoopInit ) => {
let initReference, [ init ] = unit.signalReference( def, reference => ( initReference = reference, this.generateNodes( context, [ declarator.init ] ) ) );
let idReference, [ id ] = unit.effectReference( def, reference => ( idReference = reference, this.generateNodes( context, [ declarator.id ] ) ) );
let exec = ( contract, declarator, isForLoopInit ) => {
let initReference, [ init ] = contract.signalReference( def, reference => ( initReference = reference, this.generateNodes( context, [ declarator.init ] ) ) );
let idReference, [ id ] = contract.effectReference( def, reference => ( idReference = reference, this.generateNodes( context, [ declarator.id ] ) ) );
initReference.setAssignee( idReference );
this.setLocation( unit, declarator );
this.setLocation( contract, declarator );
if ( isForLoopInit

@@ -235,3 +235,3 @@ || node.kind === 'const'

// note that we're not asking initReference.refs.size
|| ( !this.params.devMode && !unit.references.filter( reference => reference instanceof SignalReference ).length )
|| ( !this.params.devMode && !contract.references.filter( reference => reference instanceof SignalReference ).length )
) {

@@ -252,12 +252,12 @@ // init might still have effects

if ( assignmentRefactors.length ) {
assignmentRefactors.push( Node.varDeclaration( node.kind, declarations ), ...unit.generate( Node.exprStmt( assignmentExpr ) ) );
assignmentRefactors.push( Node.varDeclaration( node.kind, declarations ), ...contract.generate( Node.exprStmt( assignmentExpr ) ) );
return [];
}
assignmentRefactors.push( ...unit.generate( Node.exprStmt( assignmentExpr ) ) );
assignmentRefactors.push( ...contract.generate( Node.exprStmt( assignmentExpr ) ) );
return declarations;
}
let isForLoopInit = context.currentUnit && [ 'ForStatement', 'ForOfStatement', 'ForInStatement' ].includes( context.currentUnit.type );
let isForLoopInit = context.currentContract && [ 'ForStatement', 'ForOfStatement', 'ForInStatement' ].includes( context.currentContract.type );
let declarations = node.declarations.reduce( ( declarators, declarator ) => {
if ( isForLoopInit ) return declarators.concat( exec( context.currentUnit, declarator, true ) );
return context.defineUnit( def, unit => declarators.concat( exec( unit, declarator ) ) );
if ( isForLoopInit ) return declarators.concat( exec( context.currentContract, declarator, true ) );
return context.defineContract( def, contract => declarators.concat( exec( contract, declarator ) ) );
}, [] );

@@ -275,5 +275,5 @@ if ( !declarations.length ) return assignmentRefactors;

let def = { type: node.type };
return context.defineUnit( def, unit => {
return context.defineContract( def, contract => {
let { consequent, alternate } = node;
let [ test ] = unit.signalReference( def, () => this.generateNodes( context, [ node.test ] ) ),
let [ test ] = contract.signalReference( def, () => this.generateNodes( context, [ node.test ] ) ),
[ $test, memo ] = context.defineMemo( { expr: test } ).generate();

@@ -294,5 +294,5 @@ consequent = context.createCondition( { when: memo }, () => this.generateNodes( context, [ node.consequent ] ) );

}
this.setLocation( unit, node );
this.setLocation( contract, node );
this.setLocation( memo, node.test );
return unit.generate( Node.ifStmt( $test, consequent, alternate ) );
return contract.generate( Node.ifStmt( $test, consequent, alternate ) );
} );

@@ -308,4 +308,4 @@ }

let def = { type: node.type };
return context.defineUnit( def, unit => {
let [ discriminant ] = unit.signalReference( def, () => this.generateNodes( context, [ node.discriminant ] ) );
return context.defineContract( def, contract => {
let [ discriminant ] = contract.signalReference( def, () => this.generateNodes( context, [ node.discriminant ] ) );
let [ $discriminant, memo ] = context.defineMemo( { expr: discriminant } ).generate();

@@ -316,3 +316,3 @@

let hasBreak = caseNode.consequent.some( stmt => stmt.type === 'BreakStatement' );
let [ test ] = unit.signalReference( { type: caseNode.type }, () => this.generateNodes( context, [ caseNode.test ] ) );
let [ test ] = contract.signalReference( { type: caseNode.type }, () => this.generateNodes( context, [ caseNode.test ] ) );
let [ $test, _memo ] = context.defineMemo( { expr: test } ).generate();

@@ -330,5 +330,5 @@ let condition = { switch: memo, cases: [ _memo ] };

this.setLocation( unit, node );
this.setLocation( contract, node );
this.setLocation( memo, node.discriminant );
return unit.generate( Node.switchStmt( $discriminant, $cases ) );
return contract.generate( Node.switchStmt( $discriminant, $cases ) );
} );

@@ -349,5 +349,5 @@ }

let def = { type: node.type };
return context.defineUnit( { type: node.type }, iteratorUnit => {
this.setLocation( iteratorUnit, node );
iteratorUnit.defineSubscriptIdentifier( '$counter', [ '$x_index' ] );
return context.defineContract( { type: node.type }, iteratorContract => {
this.setLocation( iteratorContract, node );
iteratorContract.defineSubscriptIdentifier( '$counter', [ '$x_index' ] );
// A scope for variables declared in header

@@ -358,6 +358,6 @@ return context.createScope( { type: 'Iteration' }, () => {

if ( node.type === 'ForStatement' ) {
[ init, test, update ] = iteratorUnit.signalReference( def, () => this.generateNodes( context, [ node.init, node.test, node.update ] ) );
[ init, test, update ] = iteratorContract.signalReference( def, () => this.generateNodes( context, [ node.init, node.test, node.update ] ) );
createNodeCallback = $body => generate.call( Node, init, test, update, $body );
} else {
[ test ] = iteratorUnit.signalReference( def, () => this.generateNodes( context, [ node.test ] ) );
[ test ] = iteratorContract.signalReference( def, () => this.generateNodes( context, [ node.test ] ) );
createNodeCallback = $body => generate.call( Node, test, $body );

@@ -374,3 +374,3 @@ }

let statements = [].concat( preIterationDeclarations || [] ).concat( createNodeCallback( Node.blockStmt( body ) ) );
return iteratorUnit.generate( statements );
return iteratorContract.generate( statements );
} );

@@ -390,3 +390,3 @@

let preIterationDeclarations = [], iterationDeclarations = [];
let iterationBody = [], unitBody = body.body.slice( 0 );
let iterationBody = [], contractBody = body.body.slice( 0 );
// Counter?

@@ -408,3 +408,3 @@ if ( !params.iterationId ) {

// Main
iterationBody.push( ...iterationContext.generate( unitBody, { args: [ params.iterationId ], disposeCallback } ) );
iterationBody.push( ...iterationContext.generate( contractBody, { args: [ params.iterationId ], disposeCallback } ) );

@@ -431,5 +431,5 @@ // Convert to actual declaration

let def = { type: node.type };
return context.defineUnit( { type: node.type }, iteratorUnit => {
this.setLocation( iteratorUnit, node );
iteratorUnit.defineSubscriptIdentifier( '$counter', [ node.type === 'ForInStatement' ? '$x_key' : '$x_index' ] );
return context.defineContract( { type: node.type }, iteratorContract => {
this.setLocation( iteratorContract, node );
iteratorContract.defineSubscriptIdentifier( '$counter', [ node.type === 'ForInStatement' ? '$x_key' : '$x_index' ] );
// A scope for variables declared in header

@@ -443,6 +443,6 @@ return context.createScope( { type: 'Iteration' }, () => {

} else {
[ left ] = iteratorUnit.affectedsReference( def, () => this.generateNodes( context, [ node.left ] ) );
[ left ] = iteratorContract.affectedsReference( def, () => this.generateNodes( context, [ node.left ] ) );
iterationId = left;
}
let [ right ] = iteratorUnit.signalReference( def, () => this.generateNodes( context, [ node.right ] ) );
let [ right ] = iteratorContract.signalReference( def, () => this.generateNodes( context, [ node.right ] ) );

@@ -482,3 +482,3 @@ return context.defineContext( { type: 'Iteration', isIteration: true }, iterationContext => {

return iteratorUnit.generate( [].concat( preIterationDeclarations || [] ).concat( forStatement ) );
return iteratorContract.generate( [].concat( preIterationDeclarations || [] ).concat( forStatement ) );
} );

@@ -499,6 +499,6 @@

if ( !node.body.type.endsWith( 'Statement' ) ) {
return context.defineUnit( def, unit => {
this.setLocation( unit, node.body );
return context.defineContract( def, contract => {
this.setLocation( contract, node.body );
let [ body ] = this.generateNodes( context, [ node.body ] );
return Node.labeledStmt( node.label, unit.generate( body ) );
return Node.labeledStmt( node.label, contract.generate( body ) );
} );

@@ -526,15 +526,15 @@ }

generateExitStmt( generate, context, node ) {
let nearestExitTarget = context.currentUnit.closest( [ 'Iteration', 'SwitchStatement', 'LabeledStatement' ] );
let nearestExitTarget = context.currentContract.closest( [ 'Iteration', 'SwitchStatement', 'LabeledStatement' ] );
if ( nearestExitTarget && nearestExitTarget.type === 'SwitchStatement' && node.type === 'BreakStatement' && !node.label ) {
return generate.call( Node, null );
}
let subscript$unit = Node.identifier( context.getSubscriptIdentifier( '$unit', true ) );
let subscript$contract = Node.identifier( context.getSubscriptIdentifier( '$contract', true ) );
let keyword = Node.literal( node.type === 'BreakStatement' ? 'break' : 'continue' );
let label = node.label ? Node.literal( node.label.name ) : Node.identifier( 'null' );
let exitCall = Node.exprStmt(
Node.callExpr( Node.memberExpr( subscript$unit, Node.identifier( 'exit' ) ), [ keyword, label ] ),
Node.callExpr( Node.memberExpr( subscript$contract, Node.identifier( 'exit' ) ), [ keyword, label ] ),
);
// Break / continue statement hoisting
context.currentUnit.hoistExitStatement( keyword, label );
// unit.subscriptIdentifiersNoConflict() wont be necessary
context.currentContract.hoistExitStatement( keyword, label );
// contract.subscriptIdentifiersNoConflict() wont be necessary
// as the label definition would have had the same earlier

@@ -551,13 +551,13 @@ return [ exitCall, Node.returnStmt() ];

let def = { type: node.type };
return context.defineUnit( def, unit => {
let [ argument ] = unit.signalReference( def, () => this.generateNodes( context, [ node.argument ] ) );
let subscript$unit = Node.identifier( context.getSubscriptIdentifier( '$unit', true ) );
return context.defineContract( def, contract => {
let [ argument ] = contract.signalReference( def, () => this.generateNodes( context, [ node.argument ] ) );
let subscript$contract = Node.identifier( context.getSubscriptIdentifier( '$contract', true ) );
let keyword = Node.literal( 'return' );
let arg = argument || Node.identifier( 'undefined' );
let exitCall = Node.exprStmt(
Node.callExpr( Node.memberExpr( subscript$unit, Node.identifier( 'exit' ) ), [ keyword, arg ] ),
Node.callExpr( Node.memberExpr( subscript$contract, Node.identifier( 'exit' ) ), [ keyword, arg ] ),
);
// Return statement hoisting
unit.hoistExitStatement( keyword, Node.identifier( 'true' ) );
return unit.generate( [ exitCall, Node.returnStmt() ] );
contract.hoistExitStatement( keyword, Node.identifier( 'true' ) );
return contract.generate( [ exitCall, Node.returnStmt() ] );
} );

@@ -586,6 +586,6 @@ }

let def = { type: node.type };
return context.defineUnit( def, unit => {
this.setLocation( unit, node.expression );
let [ expression ] = unit.signalReference( def, () => this.generateNodes( context, [ node.expression ] ) );
return unit.generate( Node.exprStmt( expression ) );
return context.defineContract( def, contract => {
this.setLocation( contract, node.expression );
let [ expression ] = contract.signalReference( def, () => this.generateNodes( context, [ node.expression ] ) );
return contract.generate( Node.exprStmt( expression ) );
} );

@@ -606,9 +606,9 @@ }

if ( i === node.expressions.length - 1 ) {
[ expr ] = context.currentUnit.chainableReference( def, () => this.generateNodes( context, [ expr ] ) );
[ expr ] = context.currentContract.chainableReference( def, () => this.generateNodes( context, [ expr ] ) );
return expr;
}
return context.defineUnit( def, unit => {
this.setLocation( unit, expr );
[ expr ] = unit.signalReference( def, () => this.generateNodes( context, [ expr ] ) );
return expr.type === 'Identifier' ? expr : unit.generate( expr );
return context.defineContract( def, contract => {
this.setLocation( contract, expr );
[ expr ] = contract.signalReference( def, () => this.generateNodes( context, [ expr ] ) );
return expr.type === 'Identifier' ? expr : contract.generate( expr );
} );

@@ -626,4 +626,4 @@ } );

let def = { type: node.type, kind: node.operator };
let rightReference, [ right ] = context.currentUnit.signalReference( def, reference => ( rightReference = reference, this.generateNodes( context, [ node.right ] ) ) );
let leftReference, [ left ] = context.currentUnit.embeddableEffectReference( def, reference => ( leftReference = reference, this.generateNodes( context, [ node.left ] ) ) );
let rightReference, [ right ] = context.currentContract.signalReference( def, reference => ( rightReference = reference, this.generateNodes( context, [ node.right ] ) ) );
let leftReference, [ left ] = context.currentContract.embeddableEffectReference( def, reference => ( leftReference = reference, this.generateNodes( context, [ node.left ] ) ) );
rightReference.setAssignee( leftReference );

@@ -643,3 +643,3 @@ return Node.assignmentExpr( left, right, node.operator );

let def = { type: node.type, kind: node.operator };
let [ argument ] = context.currentUnit.signalReference( def, () => this.generateNodes( context, [ node.argument ] ) );
let [ argument ] = context.currentContract.signalReference( def, () => this.generateNodes( context, [ node.argument ] ) );
return Node.unaryExpr( node.operator, argument, node.prefix );

@@ -649,3 +649,3 @@ }

let def = { type: node.type, kind: node.operator };
let [ argument ] = context.currentUnit.effectReference( def, () => this.generateNodes( context, [ node.argument ] ) );
let [ argument ] = context.currentContract.effectReference( def, () => this.generateNodes( context, [ node.argument ] ) );
return generate.call( Node, node.operator, argument, node.prefix );

@@ -660,4 +660,4 @@ }

generateBinaryExpression( context, node ) {
let [ left ] = context.currentUnit.signalReference( { type: node.type }, () => this.generateNodes( context, [ node.left ] ) );
let [ right ] = context.currentUnit.signalReference( { type: node.type }, () => this.generateNodes( context, [ node.right ] ) );
let [ left ] = context.currentContract.signalReference( { type: node.type }, () => this.generateNodes( context, [ node.left ] ) );
let [ right ] = context.currentContract.signalReference( { type: node.type }, () => this.generateNodes( context, [ node.right ] ) );
return Node.binaryExpr( node.operator, left, right );

@@ -673,7 +673,7 @@ }

let def = { type: node.type, kind: node.operator };
let [ left ] = context.currentUnit.chainableReference( def, () => this.generateNodes( context, [ node.left ] ) );
let [ left ] = context.currentContract.chainableReference( def, () => this.generateNodes( context, [ node.left ] ) );
let [ $left, memo ] = context.defineMemo( { expr: left } ).generate();
let conditionAdjacent = node.operator === '||' ? { whenNot: memo } : { when: memo };
let [ right ] = context.createCondition( conditionAdjacent, () => {
return context.currentUnit.chainableReference( def, () => this.generateNodes( context, [ node.right ] ) )
return context.currentContract.chainableReference( def, () => this.generateNodes( context, [ node.right ] ) )
} );

@@ -691,6 +691,6 @@ this.setLocation( memo, node.left );

let def = { type: node.type };
let [ test ] = context.currentUnit.signalReference( def, () => this.generateNodes( context, [ node.test ] ) ),
let [ test ] = context.currentContract.signalReference( def, () => this.generateNodes( context, [ node.test ] ) ),
[ $test, memo ] = context.defineMemo( { expr: test } ).generate(),
[ consequent ] = context.createCondition( { when: memo }, () => context.currentUnit.chainableReference( def, () => this.generateNodes( context, [ node.consequent ] ) ) ),
[ alternate ] = context.createCondition( { whenNot: memo }, () => context.currentUnit.chainableReference( def, () => this.generateNodes( context, [ node.alternate ] ) ) );
[ consequent ] = context.createCondition( { when: memo }, () => context.currentContract.chainableReference( def, () => this.generateNodes( context, [ node.consequent ] ) ) ),
[ alternate ] = context.createCondition( { whenNot: memo }, () => context.currentContract.chainableReference( def, () => this.generateNodes( context, [ node.alternate ] ) ) );
this.setLocation( memo, node.test );

@@ -707,3 +707,3 @@ return Node.condExpr( $test, consequent, alternate );

let elements = node.elements.map( ( element, i ) => {
[ element ] = context.currentUnit.currentReference.withDestructure( { name: i }, () => this.generateNodes( context, [ element ] ) );
[ element ] = context.currentContract.currentReference.withDestructure( { name: i }, () => this.generateNodes( context, [ element ] ) );
return element;

@@ -723,3 +723,3 @@ } );

if ( property.computed ) {
[ key ] = context.currentUnit.signalReference( { type: key.type }, () => this.generateNodes( context, [ key ] ) );
[ key ] = context.currentContract.signalReference( { type: key.type }, () => this.generateNodes( context, [ key ] ) );
}

@@ -734,3 +734,3 @@ let element = { name: property.key.name };

}
[ value ] = context.currentUnit.currentReference.withDestructure( element, () => this.generateNodes( context, [ value ] ) );
[ value ] = context.currentContract.currentReference.withDestructure( element, () => this.generateNodes( context, [ value ] ) );
this.setLocation( element, property.key );

@@ -750,3 +750,3 @@ return Node.property( key, value, property.kind, property.shorthand, property.computed, property.method );

if ( node.computed ) {
[ property ] = context.currentUnit.signalReference( { type: property.type }, () => this.generateNodes( context, [ property ] ) );
[ property ] = context.currentContract.signalReference( { type: property.type }, () => this.generateNodes( context, [ property ] ) );
}

@@ -761,3 +761,3 @@ let element = { name: node.property.name };

}
let [ object ] = context.currentUnit.currentReference.withProperty( element, () => this.generateNodes( context, [ node.object ] ) );
let [ object ] = context.currentContract.currentReference.withProperty( element, () => this.generateNodes( context, [ node.object ] ) );
this.setLocation( element, node.property );

@@ -785,3 +785,3 @@ return Node.memberExpr( object, property, node.computed, node.optional );

const closestFunction = context.closestFunction();
let reference = ( context.currentUnit || context ).currentReference;
let reference = ( context.currentContract || context ).currentReference;
if ( reference ) {

@@ -805,7 +805,7 @@ do {

generateAwaitExpression( context, node ) {
context.currentUnit.hoistAwaitKeyword();
context.currentContract.hoistAwaitKeyword();
return this.generateArgumentExpr( Node.awaitExpr, ...arguments );
}
generateArgumentExpr( generate, context, node ) {
let [ argument ] = context.currentUnit.signalReference( { type: node.type }, () => this.generateNodes( context, [ node.argument ] ) );
let [ argument ] = context.currentContract.signalReference( { type: node.type }, () => this.generateNodes( context, [ node.argument ] ) );
return generate.call( Node, argument );

@@ -824,4 +824,4 @@ }

// The ongoing reference must be used for callee
let [ callee ] = context.currentUnit.signalReference( { type: node.callee.type }, () => this.generateNodes( context, [ node.callee ] ) );
let args = node.arguments.map( argument => context.currentUnit.signalReference( { type: argument.type }, () => this.generateNodes( context, [ argument ] )[ 0 ] ) );
let [ callee ] = context.currentContract.signalReference( { type: node.callee.type }, () => this.generateNodes( context, [ node.callee ] ) );
let args = node.arguments.map( argument => context.currentContract.signalReference( { type: argument.type }, () => this.generateNodes( context, [ argument ] )[ 0 ] ) );
return generate.call( Node, callee, args, node.optional );

@@ -850,3 +850,3 @@ }

generateArrayExpression( context, node ) {
let elements = node.elements.map( element => context.currentUnit.signalReference( { type: element.type }, () => this.generateNodes( context, [ element ] )[ 0 ] ) );
let elements = node.elements.map( element => context.currentContract.signalReference( { type: element.type }, () => this.generateNodes( context, [ element ] )[ 0 ] ) );
return Node.arrayExpr( elements );

@@ -873,5 +873,5 @@ }

if ( node.computed ) {
[ key ] = context.currentUnit.signalReference( { type: key.type }, () => this.generateNodes( context, [ key ] ) );
[ key ] = context.currentContract.signalReference( { type: key.type }, () => this.generateNodes( context, [ key ] ) );
}
[ value ] = context.currentUnit.signalReference( { type: value.type }, () => this.generateNodes( context, [ value ] ) );
[ value ] = context.currentContract.signalReference( { type: value.type }, () => this.generateNodes( context, [ value ] ) );
return Node.property( key, value, node.kind, node.shorthand, node.computed, false/*node.method*/ );

@@ -886,3 +886,3 @@ }

generateTaggedTemplateExpression( context, node ) {
let [ tag, quasi ] = context.currentUnit.signalReference( { type: node.type }, () => this.generateNodes( context, [ node.tag, node.quasi ] ) );
let [ tag, quasi ] = context.currentContract.signalReference( { type: node.type }, () => this.generateNodes( context, [ node.tag, node.quasi ] ) );
return Node.taggedTemplateExpr( tag, quasi );

@@ -897,3 +897,3 @@ }

generateTemplateLiteral( context, node ) {
let expressions = node.expressions.map( expression => context.currentUnit.signalReference( { type: node.type }, () => this.generateNodes( context, [ expression ] )[ 0 ] ) );
let expressions = node.expressions.map( expression => context.currentContract.signalReference( { type: node.type }, () => this.generateNodes( context, [ expression ] )[ 0 ] ) );
return Node.templateLiteral( node.quasis, expressions );

@@ -900,0 +900,0 @@ }

@@ -17,3 +17,3 @@

this.ownerContext = ownerContext;
this.ownerUnit = ownerContext.currentUnit || ownerContext;
this.ownerContract = ownerContext.currentContract || ownerContext;
this.parent = ownerContext.currentCondition;

@@ -34,3 +34,3 @@ }

get lineage() {
return `${ this.ownerUnit.lineage }:${ this.id }`;
return `${ this.ownerContract.lineage }:${ this.id }`;
}

@@ -49,6 +49,6 @@

if ( this.parent ) {
if ( this.parent.ownerUnit.id === this.ownerUnit.id ) {
if ( this.parent.ownerContract.id === this.ownerContract.id ) {
json.parent = this.parent.id;
} else {
json.parent = `${ this.parent.ownerUnit.lineage }:${ this.parent.id }`;
json.parent = `${ this.parent.ownerContract.lineage }:${ this.parent.id }`;
}

@@ -55,0 +55,0 @@ }

@@ -5,4 +5,4 @@

*/
import Unit from './Unit.js';
import Contract from './Contract.js';
export default class Context extends Unit {}
export default class Context extends Contract {}

@@ -10,4 +10,4 @@

constructor( ownerUnit, id, def ) {
super( ownerUnit, id, def );
constructor( ownerContract, id, def ) {
super( ownerContract, id, def );
this.destructuringStack = [];

@@ -75,3 +75,3 @@ }

let ret = super.inUse( ...arguments );
this.ownerUnit.inUse( ...arguments );
this.ownerContract.inUse( ...arguments );
return ret;

@@ -78,0 +78,0 @@ }

@@ -22,5 +22,5 @@

if ( !this.expr ) /* such as case: null / default: */ return [ this.expr, this ];
let subscript$unit = Node.identifier( this.ownerContext.getSubscriptIdentifier( '$unit', true ) );
let subscript$contract = Node.identifier( this.ownerContext.getSubscriptIdentifier( '$contract', true ) );
let ref = Node.memberExpr(
Node.memberExpr( subscript$unit, Node.identifier( 'memo' ) ),
Node.memberExpr( subscript$contract, Node.identifier( 'memo' ) ),
Node.literal( this.id ),

@@ -27,0 +27,0 @@ true

@@ -13,3 +13,3 @@

this.ownerReference = ownerReference;
this.condition = this.ownerUnit.currentCondition;
this.condition = this.ownerContract.currentCondition;
this.path = [];

@@ -19,4 +19,4 @@ this.isDotSafe = true;

get ownerUnit() {
return this.ownerReference.ownerUnit;
get ownerContract() {
return this.ownerReference.ownerContract;
}

@@ -23,0 +23,0 @@

@@ -9,5 +9,5 @@

constructor( ownerUnit, id, def = {} ) {
constructor( ownerContract, id, def = {} ) {
super( id, def );
this.ownerUnit = ownerUnit;
this.ownerContract = ownerContract;
this.refs = new Set;

@@ -28,3 +28,3 @@ this.propertyStack = [];

get lineage() {
return `${ this.ownerUnit.lineage }:${ this.id }`;
return `${ this.ownerContract.lineage }:${ this.id }`;
}

@@ -38,3 +38,3 @@

refs: Array.from( this.refs ).map( ref => ref.toJson( filter ) ),
unitId: this.ownerUnit.id,
contractId: this.ownerContract.id,
};

@@ -41,0 +41,0 @@ }

@@ -61,3 +61,3 @@

if ( _effectReference.type === 'VariableDeclaration' /* and ofcourse, kind: var */ ) return;
_effectReference.ownerUnit.$sideEffects = true;
_effectReference.ownerContract.$sideEffects = true;
let sideEffects = remainderRefs.length && remainderRefs || [ ..._effectReference.refs ];

@@ -64,0 +64,0 @@ return this.ownerContext.sideEffects.push( { reference: _effectReference, remainderRefs: sideEffects } ), true;

@@ -6,3 +6,3 @@

import CodeBlock from './CodeBlock.js';
import Unit from './Unit.js';
import Contract from './Contract.js';

@@ -12,3 +12,3 @@ /**

*/
export default class Console extends CodeBlock( Unit ) {
export default class Console extends CodeBlock( Contract ) {

@@ -72,4 +72,4 @@ bind( subscriptFunction, autoRender = true ) {

subscript-unit.block-hover,
subscript-unit.block-runtime-active {
subscript-contract.block-hover,
subscript-contract.block-runtime-active {
outline: 1px dashed gray;

@@ -82,3 +82,3 @@ outline-offset: 0.1rem;

}
subscript-unit.block-runtime-active {
subscript-contract.block-runtime-active {
background-color: rgba(100, 100, 100, 0.35);

@@ -96,3 +96,3 @@ }

customElements.define( 'subscript-codeblock', CodeBlock() );
customElements.define( 'subscript-unit', Unit );
customElements.define( 'subscript-contract', Contract );
customElements.define( 'subscript-console', Console );

@@ -47,3 +47,3 @@ /**

this._on( pathIndex, 'click', () => {
this.ownerReference.ownerUnit.runThread( fullPath );
this.ownerReference.ownerContract.runThread( fullPath );
} );

@@ -50,0 +50,0 @@ }

@@ -5,5 +5,5 @@

*/
import Unit from './Unit.js';
import Contract from './Contract.js';
export default class Runtime extends Unit {
export default class Runtime extends Contract {

@@ -19,8 +19,8 @@ static create( compilation, parameters = [], runtimeParams = {} ) {

constructor( ownerUnit, graph, callee, runtimeParams = {}, exits = null ) {
super( ownerUnit, graph, callee, runtimeParams = {}, exits );
constructor( ownerContract, graph, callee, runtimeParams = {}, exits = null ) {
super( ownerContract, graph, callee, runtimeParams = {}, exits );
this.observers = [];
}
observe( unitUrl, callback ) {
observe( contractUrl, callback ) {
if ( !this.params.devMode ) {

@@ -30,8 +30,8 @@ // Only allow observers in dev mode

}
this.observers.push( { unitUrl, callback } );
this.observers.push( { contractUrl, callback } );
}
fire( unitUrl, event, refs ) {
fire( contractUrl, event, refs ) {
( this.observers || [] ).forEach( observer => {
if ( observer.unitUrl !== unitUrl ) return;
if ( observer.contractUrl !== contractUrl ) return;
observer.callback( event, refs );

@@ -38,0 +38,0 @@ } );

@@ -15,6 +15,6 @@

group( `Form NO reactive units for non-reactive declarations.`, function() {
group( `Form NO reactive contracts for non-reactive declarations.`, function() {
add(
`Uninitialized variables form NO reactive unit.`,
`Uninitialized variables form NO reactive contract.`,
`

@@ -29,3 +29,3 @@ let a;

add(
`Variables initialized with a Literal form NO reactive unit.`,
`Variables initialized with a Literal form NO reactive contract.`,
`

@@ -40,3 +40,3 @@ let b = 2;

add(
`Const variables form NO reactive unit.`,
`Const variables form NO reactive contract.`,
`

@@ -52,6 +52,6 @@ const c = d;

group( `Form reactive units for reactive declarations.`, function() {
group( `Form reactive contracts for reactive declarations.`, function() {
add(
`Variables bound to references form a reactive unit.`,
`Variables bound to references form a reactive contract.`,
`

@@ -70,3 +70,3 @@ let e = f;

add(
`Destructured variables bound to references form an equivalent reactive unit.`,
`Destructured variables bound to references form an equivalent reactive contract.`,
`

@@ -109,6 +109,6 @@ let { a, b, c: { d, e: [ f ] } } = g;

group( `Form reactive units for assignments (every assignment is reactive).`, function() {
group( `Form reactive contracts for assignments (every assignment is reactive).`, function() {
add(
`Assignment of a Literal forms a reactive unit.`,
`Assignment of a Literal forms a reactive contract.`,
`

@@ -126,3 +126,3 @@ b = 2;

add(
`assignments bound to references forms a reactive unit.`,
`assignments bound to references forms a reactive contract.`,
`

@@ -158,3 +158,3 @@ e = f;

group( `Form NO reactive units for non-reactive "test" expressions.`, function() {
group( `Form NO reactive contracts for non-reactive "test" expressions.`, function() {

@@ -175,3 +175,3 @@ add(

add(
`Descendant expressions/statements may form their own units.`,
`Descendant expressions/statements may form their own contracts.`,
`

@@ -208,3 +208,3 @@ if ( 1 ) {

group( `Form reactive units for reactive "test" expressions.`, function() {
group( `Form reactive contracts for reactive "test" expressions.`, function() {

@@ -267,3 +267,3 @@ add(

group( `Form NO reactive units for non-reactive "discriminant" expressions.`, function() {
group( `Form NO reactive contracts for non-reactive "discriminant" expressions.`, function() {

@@ -300,3 +300,3 @@ add(

add(
`Descendant expressions/statements may form their own units.`,
`Descendant expressions/statements may form their own contracts.`,
`

@@ -323,3 +323,3 @@ switch ( 1 ) {

group( `Form reactive units for reactive "discriminant" expressions.`, function() {
group( `Form reactive contracts for reactive "discriminant" expressions.`, function() {

@@ -409,3 +409,3 @@ add(

add(
`Form a reactive unit where contains references.`,
`Form a reactive contract where contains references.`,
`

@@ -423,3 +423,3 @@ a ? 0 : 1;

add(
`Reactive units are formed at statement level.`,
`Reactive contracts are formed at statement level.`,
`

@@ -463,3 +463,3 @@ let b = a ? 0 : 1;

add(
`Form a reactive unit where contains references.`,
`Form a reactive contract where contains references.`,
`

@@ -477,3 +477,3 @@ a && 1;

add(
`Reactive units are formed at statement level.`,
`Reactive contracts are formed at statement level.`,
`

@@ -480,0 +480,0 @@ let b = a && 1;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc