From 1ab71b4771fd0cdb25ad5e3eab7951177efd4841 Mon Sep 17 00:00:00 2001 From: Calum Knott Date: Sun, 28 Jan 2024 16:20:16 +0000 Subject: [PATCH] fixed issue with linenumbers and no display of line numners --- dist/codecup.bundle.js | 2 +- example/index.html | 4 ++-- package.json | 2 +- src/codecup.js | 9 ++++++--- src/styles/editor.js | 4 ++++ 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/dist/codecup.bundle.js b/dist/codecup.bundle.js index e293740..5f55c72 100644 --- a/dist/codecup.bundle.js +++ b/dist/codecup.bundle.js @@ -1,2 +1,2 @@ /*! For license information please see codecup.bundle.js.LICENSE.txt */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.codecup=t():e.codecup=t()}(self,(()=>(()=>{var e={475:()=>{!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e={javascript:"clike",actionscript:"javascript",apex:["clike","sql"],arduino:"cpp",aspnet:["markup","csharp"],birb:"clike",bison:"c",c:"clike",csharp:"clike",cpp:"c",cfscript:"clike",chaiscript:["clike","cpp"],cilkc:"c",cilkcpp:"cpp",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",django:"markup-templating",ejs:["javascript","markup-templating"],etlua:["lua","markup-templating"],erb:["ruby","markup-templating"],fsharp:"clike","firestore-security-rules":"clike",flow:"javascript",ftl:"markup-templating",gml:"clike",glsl:"c",go:"clike",gradle:"clike",groovy:"clike",haml:"ruby",handlebars:"markup-templating",haxe:"clike",hlsl:"c",idris:"haskell",java:"clike",javadoc:["markup","java","javadoclike"],jolie:"clike",jsdoc:["javascript","javadoclike","typescript"],"js-extras":"javascript",json5:"json",jsonp:"json","js-templates":"javascript",kotlin:"clike",latte:["clike","markup-templating","php"],less:"css",lilypond:"scheme",liquid:"markup-templating",markdown:"markup","markup-templating":"markup",mongodb:"javascript",n4js:"javascript",objectivec:"c",opencl:"c",parser:"markup",php:"markup-templating",phpdoc:["php","javadoclike"],"php-extras":"php",plsql:"sql",processing:"clike",protobuf:"clike",pug:["markup","javascript"],purebasic:"clike",purescript:"haskell",qsharp:"clike",qml:"javascript",qore:"clike",racket:"scheme",cshtml:["markup","csharp"],jsx:["markup","javascript"],tsx:["jsx","typescript"],reason:"clike",ruby:"clike",sass:"css",scss:"css",scala:"java","shell-session":"bash",smarty:"markup-templating",solidity:"clike",soy:"markup-templating",sparql:"turtle",sqf:"clike",squirrel:"clike",stata:["mata","java","python"],"t4-cs":["t4-templating","csharp"],"t4-vb":["t4-templating","vbnet"],tap:"yaml",tt2:["clike","markup-templating"],textile:"markup",twig:"markup-templating",typescript:"javascript",v:"clike",vala:"clike",vbnet:"basic",velocity:"markup",wiki:"markup",xeora:"markup","xml-doc":"markup",xquery:"markup"},t={html:"markup",xml:"markup",svg:"markup",mathml:"markup",ssml:"markup",atom:"markup",rss:"markup",js:"javascript",g4:"antlr4",ino:"arduino","arm-asm":"armasm",art:"arturo",adoc:"asciidoc",avs:"avisynth",avdl:"avro-idl",gawk:"awk",sh:"bash",shell:"bash",shortcode:"bbcode",rbnf:"bnf",oscript:"bsl",cs:"csharp",dotnet:"csharp",cfc:"cfscript","cilk-c":"cilkc","cilk-cpp":"cilkcpp",cilk:"cilkcpp",coffee:"coffeescript",conc:"concurnas",jinja2:"django","dns-zone":"dns-zone-file",dockerfile:"docker",gv:"dot",eta:"ejs",xlsx:"excel-formula",xls:"excel-formula",gamemakerlanguage:"gml",po:"gettext",gni:"gn",ld:"linker-script","go-mod":"go-module",hbs:"handlebars",mustache:"handlebars",hs:"haskell",idr:"idris",gitignore:"ignore",hgignore:"ignore",npmignore:"ignore",webmanifest:"json",kt:"kotlin",kts:"kotlin",kum:"kumir",tex:"latex",context:"latex",ly:"lilypond",emacs:"lisp",elisp:"lisp","emacs-lisp":"lisp",md:"markdown",moon:"moonscript",n4jsd:"n4js",nani:"naniscript",objc:"objectivec",qasm:"openqasm",objectpascal:"pascal",px:"pcaxis",pcode:"peoplecode",plantuml:"plant-uml",pq:"powerquery",mscript:"powerquery",pbfasm:"purebasic",purs:"purescript",py:"python",qs:"qsharp",rkt:"racket",razor:"cshtml",rpy:"renpy",res:"rescript",robot:"robotframework",rb:"ruby","sh-session":"shell-session",shellsession:"shell-session",smlnj:"sml",sol:"solidity",sln:"solution-file",rq:"sparql",sclang:"supercollider",t4:"t4-cs",trickle:"tremor",troy:"tremor",trig:"turtle",ts:"typescript",tsconfig:"typoscript",uscript:"unrealscript",uc:"unrealscript",url:"uri",vb:"visual-basic",vba:"visual-basic",webidl:"web-idl",mathematica:"wolfram",nb:"wolfram",wl:"wolfram",xeoracube:"xeora",yml:"yaml"},n={},a="components/",s=Prism.util.currentScript();if(s){var r=/\bplugins\/autoloader\/prism-autoloader\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,i=/(^|\/)[\w-]+\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,o=s.getAttribute("data-autoloader-path");if(null!=o)a=o.trim().replace(/\/?$/,"/");else{var l=s.src;r.test(l)?a=l.replace(r,"components/"):i.test(l)&&(a=l.replace(i,"$1components/"))}}var c=Prism.plugins.autoloader={languages_path:a,use_minified:!0,loadLanguages:p};Prism.hooks.add("complete",(function(e){var t=e.element,n=e.language;if(t&&n&&"none"!==n){var a=function(e){var t=(e.getAttribute("data-dependencies")||"").trim();if(!t){var n=e.parentElement;n&&"pre"===n.tagName.toLowerCase()&&(t=(n.getAttribute("data-dependencies")||"").trim())}return t?t.split(/\s*,\s*/g):[]}(t);/^diff-./i.test(n)?(a.push("diff"),a.push(n.substr(5))):a.push(n),a.every(u)||p(a,(function(){Prism.highlightElement(t)}))}}))}function u(e){if(e.indexOf("!")>=0)return!1;if((e=t[e]||e)in Prism.languages)return!0;var a=n[e];return a&&!a.error&&!1===a.loading}function p(a,s,r){"string"==typeof a&&(a=[a]);var i=a.length,o=0,l=!1;function h(){l||++o===i&&s&&s(a)}0!==i?a.forEach((function(a){!function(a,s,r){var i=a.indexOf("!")>=0;function o(){var e=n[a];e||(e=n[a]={callbacks:[]}),e.callbacks.push({success:s,error:r}),!i&&u(a)?d(a,"success"):!i&&e.error?d(a,"error"):!i&&e.loading||(e.loading=!0,e.error=!1,function(e,t,n){var a=document.createElement("script");a.src=e,a.async=!0,a.onload=function(){document.body.removeChild(a),t&&t()},a.onerror=function(){document.body.removeChild(a),n&&n()},document.body.appendChild(a)}(function(e){return c.languages_path+"prism-"+e+(c.use_minified?".min":"")+".js"}(a),(function(){e.loading=!1,d(a,"success")}),(function(){e.loading=!1,e.error=!0,d(a,"error")})))}a=a.replace("!",""),a=t[a]||a;var l=e[a];l&&l.length?p(l,o,r):o()}(a,h,(function(){l||(l=!0,r&&r(a))}))})):s&&setTimeout(s,0)}function d(e,t){if(n[e]){for(var a=n[e].callbacks,s=0,r=a.length;s{var a=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,a={},s={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof r?new r(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=p.reach);F+=w.value.length,w=w.next){var A=w.value;if(t.length>e.length)return;if(!(A instanceof r)){var C,j=1;if(y){if(!(C=i(x,F,e,b))||C.index>=e.length)break;var L=C.index,_=C.index+C[0].length,E=F;for(E+=w.value.length;L>=E;)E+=(w=w.next).value.length;if(F=E-=w.value.length,w.value instanceof r)continue;for(var $=w;$!==t.tail&&(E<_||"string"==typeof $.value);$=$.next)j++,E+=$.value.length;j--,A=e.slice(F,E),C.index-=F}else if(!(C=i(x,0,A,b)))continue;L=C.index;var T=C[0],S=A.slice(0,L),N=A.slice(L+T.length),M=F+A.length;p&&M>p.reach&&(p.reach=M);var z=w.prev;if(S&&(z=c(t,z,S),F+=S.length),u(t,z,j),w=c(t,z,new r(d,f?s.tokenize(T,f):T,v,T)),N&&c(t,w,N),j>1){var P={cause:d+","+g,reach:M};o(e,t,n,w.prev,F,P),p&&P.reach>p.reach&&(p.reach=P.reach)}}}}}}function l(){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 c(e,t,n){var a=t.next,s={value:n,prev:t,next:a};return t.next=s,a.prev=s,e.length++,s}function u(e,t,n){for(var a=t.next,s=0;s"+r.content+""},!e.document)return e.addEventListener?(s.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),a=n.language,r=n.code,i=n.immediateClose;e.postMessage(s.highlight(r,s.languages[a],a)),i&&e.close()}),!1),s):s;var p=s.util.currentScript();function d(){s.manual||s.highlightAll()}if(p&&(s.filename=p.src,p.hasAttribute("data-manual")&&(s.manual=!0)),!s.manual){var h=document.readyState;"loading"===h||"interactive"===h&&p&&p.defer?document.addEventListener("DOMContentLoaded",d):window.requestAnimationFrame?window.requestAnimationFrame(d):window.setTimeout(d,16)}return s}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=a),void 0!==n.g&&(n.g.Prism=a),a.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\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://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"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:a.languages[t]},n.cdata=/^$/i;var s={"included-cdata":{pattern://i,inside:n}};s["language-"+t]={pattern:/[\s\S]+/,inside:a.languages[t]};var r={};r[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:s},a.languages.insertBefore("markup","cdata",r)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(e,t){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"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:a.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.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:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),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()"']|\\[\s\S])*/.source+")\\)","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"))}(a),a.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:/[{}[\];(),.:]/},a.languages.javascript=a.languages.extend("clike",{"class-name":[a.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$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:a.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:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.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:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.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:a.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"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.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)/.source,"javascript")),a.languages.js=a.languages.javascript,function(){if(void 0!==a&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",n="loading",s="loaded",r="pre[data-src]:not(["+t+'="'+s+'"]):not(['+t+'="'+n+'"])';a.hooks.add("before-highlightall",(function(e){e.selector+=", "+r})),a.hooks.add("before-sanity-check",(function(i){var o=i.element;if(o.matches(r)){i.code="",o.setAttribute(t,n);var l=o.appendChild(document.createElement("CODE"));l.textContent="Loading…";var c=o.getAttribute("data-src"),u=i.language;if("none"===u){var p=(/\.(\w+)$/.exec(c)||[,"none"])[1];u=e[p]||p}a.util.setLanguage(l,u),a.util.setLanguage(o,u);var d=a.plugins.autoloader;d&&d.loadLanguages(u),function(e,n,r){var i=new XMLHttpRequest;i.open("GET",e,!0),i.onreadystatechange=function(){4==i.readyState&&(i.status<400&&i.responseText?function(e){o.setAttribute(t,s);var n=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var n=Number(t[1]),a=t[2],s=t[3];return a?s?[n,Number(s)]:[n,void 0]:[n,n]}}(o.getAttribute("data-range"));if(n){var r=e.split(/\r\n?|\n/g),i=n[0],c=null==n[1]?r.length:n[1];i<0&&(i+=r.length),i=Math.max(0,Math.min(i-1,r.length)),c<0&&(c+=r.length),c=Math.max(0,Math.min(c,r.length)),e=r.slice(i,c).join("\n"),o.hasAttribute("data-start")||o.setAttribute("data-start",String(i+1))}l.textContent=e,a.highlightElement(l)}(i.responseText):i.status>=400?r("✖ Error "+i.status+" while fetching file: "+i.statusText):r("✖ Error: File does not exist or is empty"))},i.send(null)}(c,0,(function(e){o.setAttribute(t,"failed"),l.textContent=e}))}})),a.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(r),s=0;t=n[s++];)a.highlightElement(t)}};var i=!1;a.fileHighlight=function(){i||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),i=!0),a.plugins.fileHighlight.highlight.apply(this,arguments)}}}()}},t={};function n(a){var s=t[a];if(void 0!==s)return s.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var a={};return(()=>{"use strict";n.d(a,{default:()=>m});const e="#fff",t="20px",s=`\n.codecup {\n background: ${e};\n color: #4f559c;\n}\n\n.codecup .token.punctuation {\n color: #4a4a4a;\n}\n\n.codecup .token.keyword {\n color: #8500ff;\n}\n\n.codecup .token.operator {\n color: #ff5598;\n}\n\n.codecup .token.string {\n color: #41ad8f;\n}\n\n.codecup .token.comment {\n color: #9badb7;\n}\n\n.codecup .token.function {\n color: #8500ff;\n}\n\n.codecup .token.boolean {\n color: #8500ff;\n}\n\n.codecup .token.number {\n color: #8500ff;\n}\n\n.codecup .token.selector {\n color: #8500ff;\n}\n\n.codecup .token.property {\n color: #8500ff;\n}\n\n.codecup .token.tag {\n color: #8500ff;\n}\n\n.codecup .token.attr-value {\n color: #8500ff;\n}\n`,r='"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace';var i,o;const l="40px",c=`\n .codecup {\n width: 100%;\n height: 100%;\n overflow: hidden;\n }\n\n .codecup, .codecup * {\n box-sizing: border-box;\n }\n\n .codecup__pre {\n pointer-events: none;\n z-index: 3;\n overflow: hidden;\n }\n\n .codecup__textarea {\n background: none;\n border: none;\n color: ${i="caret-color","#000",("undefined"!=typeof CSS?CSS.supports(i,"#000"):"undefined"!=typeof document&&(o=(o=i).split("-").filter((e=>!!e)).map((e=>e[0].toUpperCase()+e.substr(1))).join(""))[0].toLowerCase()+o.substr(1)in document.body.style)?e:"#ccc"};\n z-index: 1;\n resize: none;\n font-family: ${r};\n -webkit-appearance: pre;\n caret-color: #111;\n z-index: 2;\n width: 100%;\n height: 100%;\n }\n\n .codecup--has-line-numbers .codecup__textarea {\n width: calc(100% - ${l});\n }\n\n .codecup__code {\n display: block;\n font-family: ${r};\n overflow: hidden;\n }\n\n .codecup__flatten {\n padding: 10px;\n font-size: 13px;\n line-height: ${t};\n white-space: pre;\n position: absolute;\n top: 0;\n left: 0;\n overflow: auto;\n margin: 0 !important;\n outline: none;\n text-align: left;\n }\n\n .codecup--has-line-numbers .codecup__flatten {\n width: calc(100% - ${l});\n left: ${l};\n }\n\n .codecup__line-highlight {\n position: absolute;\n top: 10px;\n left: 0;\n width: 100%;\n height: ${t};\n background: rgba(0,0,0,0.1);\n z-index: 1;\n }\n\n .codecup__lines {\n padding: 10px 4px;\n font-size: 12px;\n line-height: ${t};\n font-family: 'Cousine', monospace;\n position: absolute;\n left: 0;\n top: 0;\n width: ${l};\n height: 100%;\n text-align: right;\n color: #999;\n z-index: 2;\n }\n\n .codecup__lines__line {\n display: block;\n }\n\n .codecup.codecup--has-line-numbers {\n padding-left: ${l};\n }\n\n .codecup.codecup--has-line-numbers:before {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n width: ${l};\n height: 100%;\n // background: #eee;\n background: #dcdfe6;\n z-index: 1;\n }\n\n .codecup__copyButton{\n position: absolute;\n right: 5px;\n top: 5px;\n z-index: 3;\n background: #EAEEFB;\n border: none;\n color: #999;\n cursor: pointer;\n outline: none;\n width: 22px;\n height: 22px;\n border-radius: 4px;\n }\n\n .codecup__copyMessage{\n position: absolute;\n right: 32px;\n top: 5px;\n z-index: 3;\n background: #EAEEFB;\n border: none;\n color: #999;\n cursor: pointer;\n outline: none;\n width: 55px;\n height: 22px;\n line-height: 22px;\n border-radius: 4px;\n font-size: 12px;\n text-align: center;\n font-family: 'Cousine', monospace;\n }\n\n`;function u(e,t,n){const a=t||"codecup-style",s=n||document.head;if(!e)return!1;if(document.getElementById(a))return!0;const r=document.createElement("style");return r.innerHTML=e,r.id=a,s.appendChild(r),!0}const p={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function d(e){return String(e).replace(/[&<>"'`=/]/g,(function(e){return p[e]}))}var h=n(660),g=n.n(h);n(475),g().plugins.autoloader.languages_path="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/";class m{constructor(e,t){if(!e)throw Error("codecup expects a parameter which is Element or a String selector");if(!t)throw Error("codecup expects an object containing options as second parameter");if(e.nodeType)this.editorRoot=e;else{const t=document.querySelector(e);t&&(this.editorRoot=t)}this.opts=t,this.events={},this.startEditor()}startEditor(){if(!u(c,null,this.opts.styleParent))throw Error("Failed to inject codecup CSS.");this.createWrapper(),this.createTextarea(),this.createPre(),this.createCode(),this.runOptions(),this.listenTextarea(),this.populateDefault(),this.updateCode(this.code)}createWrapper(){this.code=this.editorRoot.innerHTML,this.editorRoot.innerHTML="",this.elWrapper=this.createElement("div",this.editorRoot),this.elWrapper.classList.add("codecup")}createTextarea(){this.elTextarea=this.createElement("textarea",this.elWrapper),this.elTextarea.classList.add("codecup__textarea","codecup__flatten")}createPre(){this.elPre=this.createElement("pre",this.elWrapper),this.elPre.classList.add("codecup__pre","codecup__flatten")}createCode(){this.elCode=this.createElement("code",this.elPre),this.elCode.classList.add("codecup__code",`language-${this.opts.language||"html"}`)}createLineNumbers(){this.elLineNumbers=this.createElement("div",this.elWrapper),this.elLineNumbers.classList.add("codecup__lines"),this.elWrapper.classList.add("codecup--has-line-numbers"),this.setLineNumber()}createCopyButton(){this.elCopyButtonMessage=this.createElement("div",this.elWrapper),this.elCopyButtonMessage.classList.add("codecup__copyMessage"),this.elCopyButtonMessage.innerHTML="Copied!",this.elCopyButtonMessage.style.display="none",this.elCopyButton=this.createElement("div",this.elWrapper),this.elCopyButton.classList.add("codecup__copyButton"),this.elCopyButton.innerHTML='',this.elCopyButton.addEventListener("click",(()=>{navigator.clipboard.writeText(this.code).then((()=>{this.elCopyButtonMessage.style.display="block",setTimeout((()=>{this.elCopyButtonMessage.style.display="none"}),1e3)}))}))}destroyLineNumbers(){this.elWrapper.classList.remove("codecup--has-line-numbers"),this.elLineNumbers.remove()}createElement(e,t){const n=document.createElement(e);return t.appendChild(n),n}runOptions(){this.opts.rtl=this.opts.rtl||!1,this.opts.tabSize=this.opts.tabSize||2,this.opts.enableAutocorrect=this.opts.enableAutocorrect||!1,this.opts.lineNumbers=this.opts.lineNumbers||!1,this.opts.defaultTheme=!1!==this.opts.defaultTheme,this.opts.areaId=this.opts.areaId||null,this.opts.ariaLabelledby=this.opts.ariaLabelledby||null,this.opts.readonly=this.opts.readonly||!1,this.opts.copyButton=this.opts.copyButton||!1,this.opts.maxLines=this.opts.maxLines||100,this.opts.minLines=this.opts.minLines||1,"boolean"!=typeof this.opts.handleTabs&&(this.opts.handleTabs=!0),"boolean"!=typeof this.opts.handleSelfClosingCharacters&&(this.opts.handleSelfClosingCharacters=!0),"boolean"!=typeof this.opts.handleNewLineIndentation&&(this.opts.handleNewLineIndentation=!0),!0===this.opts.rtl&&(this.elTextarea.setAttribute("dir","rtl"),this.elPre.setAttribute("dir","rtl")),!1===this.opts.enableAutocorrect&&(this.elTextarea.setAttribute("spellcheck","false"),this.elTextarea.setAttribute("autocapitalize","off"),this.elTextarea.setAttribute("autocomplete","off"),this.elTextarea.setAttribute("autocorrect","off")),this.opts.lineNumbers&&this.createLineNumbers(),this.opts.defaultTheme&&u(s,"theme-default",this.opts.styleParent),this.opts.areaId&&this.elTextarea.setAttribute("id",this.opts.areaId),this.opts.ariaLabelledby&&this.elTextarea.setAttribute("aria-labelledby",this.opts.ariaLabelledby),this.opts.readonly&&this.enableReadonlyMode(),this.opts.copyButton&&this.createCopyButton(),this.updateLineNumbersCount()}updateLineNumbersCount(){let e="";for(let t=1;t<=this.lineNumber;t++)e+=`${t}`;this.elLineNumbers.innerHTML=e,console.log(this.opts);let t=this.opts.maxLines,n=this.opts.minLines,a=this.lineNumber;a>t?a=t:a{this.opts.readonly||(this.code=e.target.value,this.elCode.innerHTML=d(e.target.value),this.highlight(),setTimeout((()=>{this.runUpdate(),this.setLineNumber()}),1))}),this.elTextarea.addEventListener("keydown",this.events._keydown=e=>{this.opts.readonly||(this.handleTabs(e),this.handleSelfClosingCharacters(e),this.handleNewLineIndentation(e))}),this.elTextarea.addEventListener("scroll",this.events._scroll=e=>{this.elPre.style.transform=`translate3d(-${e.target.scrollLeft}px, -${e.target.scrollTop}px, 0)`,this.elLineNumbers&&(this.elLineNumbers.style.transform=`translate3d(0, -${e.target.scrollTop}px, 0)`)})}handleTabs(e){if(this.opts.handleTabs){if(9!==e.keyCode)return;e.preventDefault();var t=this.elTextarea,n=t.selectionDirection,a=t.selectionStart,s=t.selectionEnd,r=t.value,i=r.substr(0,a),o=r.substring(a,s),l=r.substring(s);const h=" ".repeat(this.opts.tabSize);if(a!==s&&o.length>=h.length){var c=a-i.split("\n").pop().length,u=h.length,p=h.length;e.shiftKey?(r.substr(c,h.length)===h?(u=-u,c>a?(o=o.substring(0,c)+o.substring(c+h.length),p=0):c===a?(u=0,p=0,o=o.substring(h.length)):(p=-p,i=i.substring(0,c)+i.substring(c+h.length))):(u=0,p=0),o=o.replace(new RegExp("\n"+h.split("").join("\\"),"g"),"\n")):(i=i.substr(0,c)+h+i.substring(c,a),o=o.replace(/\n/g,"\n"+h)),t.value=i+o+l,t.selectionStart=a+u,t.selectionEnd=a+o.length+p,t.selectionDirection=n}else t.value=i+h+l,t.selectionStart=a+h.length,t.selectionEnd=a+h.length;var d=t.value;this.updateCode(d),this.elTextarea.selectionEnd=s+this.opts.tabSize}}handleSelfClosingCharacters(e){if(!this.opts.handleSelfClosingCharacters)return;const t=e.key;if(["(","[","{","<","'",'"'].includes(t)||[")","]","}",">","'",'"'].includes(t))switch(t){case"(":case")":case"[":case"]":case"{":case"}":case"<":case">":case"'":case'"':this.closeCharacter(t)}}setLineNumber(){this.lineNumber=this.code.split("\n").length,this.opts.lineNumbers&&this.updateLineNumbersCount()}handleNewLineIndentation(e){if(this.opts.handleNewLineIndentation&&13===e.keyCode){e.preventDefault();var t=this.elTextarea,n=t.selectionStart,a=t.selectionEnd,s=t.value,r=s.substr(0,n),i=s.substring(a),o=s.lastIndexOf("\n",n-1),l=o+s.slice(o+1).search(/[^ ]|$/),c=l>o?l-o:0,u=r+"\n"+" ".repeat(c)+i;t.value=u,t.selectionStart=n+c+1,t.selectionEnd=n+c+1,this.updateCode(t.value)}}closeCharacter(e){const t=this.elTextarea.selectionStart,n=this.elTextarea.selectionEnd;if(this.skipCloseChar(e)){const a=this.code.substr(n,1)===e,s=a?n+1:n,r=!a&&["'",'"'].includes(e)?e:"",i=`${this.code.substring(0,t)}${r}${this.code.substring(s)}`;this.updateCode(i),this.elTextarea.selectionEnd=++this.elTextarea.selectionStart}else{let a=e;switch(e){case"(":a=String.fromCharCode(e.charCodeAt()+1);break;case"<":case"{":case"[":a=String.fromCharCode(e.charCodeAt()+2)}const s=this.code.substring(t,n),r=`${this.code.substring(0,t)}${s}${a}${this.code.substring(n)}`;this.updateCode(r)}this.elTextarea.selectionEnd=t}skipCloseChar(e){const t=this.elTextarea.selectionStart,n=this.elTextarea.selectionEnd,a=Math.abs(n-t)>0;return[")","}","]",">"].includes(e)||["'",'"'].includes(e)&&!a}updateCode(e){this.code=e,this.elTextarea.value=e,this.elCode.innerHTML=d(e),this.highlight(),this.setLineNumber(),setTimeout(this.runUpdate.bind(this),1)}updateLanguage(e){const t=this.opts.language;this.elCode.classList.remove(`language-${t}`),this.elCode.classList.add(`language-${e}`),this.opts.language=e,this.highlight()}populateDefault(){this.updateCode(this.code)}highlight(){g().highlightElement(this.elCode,!1)}onUpdate(e){if(e&&"[object Function]"!=={}.toString.call(e))throw Error("codecup expects callback of type Function");this.updateCallBack=e}getCode(){return this.code}runUpdate(){this.updateCallBack&&this.updateCallBack(this.code)}enableReadonlyMode(){this.elTextarea.setAttribute("readonly",!0),this.opts.readonly=!0}disableReadonlyMode(){this.elTextarea.removeAttribute("readonly"),this.opts.readonly=!1}toggleReadonlyMode(){this.opts.readonly?this.disableReadonlyMode():this.enableReadonlyMode()}enableLineNumbers(){this.opts.lineNumbers=!0,this.destroyLineNumbers(),this.createLineNumbers(),this.updateLineNumbersCount()}disableLineNumbers(){this.opts.lineNumbers=!1,this.destroyLineNumbers()}toggleLineNumbers(){this.opts.lineNumbers?this.disableLineNumbers():this.enableLineNumbers()}dispose(){this.elTextarea.removeEventListener("input",this.events._input),this.elTextarea.removeEventListener("keydown",this.events._keydown),this.elTextarea.removeEventListener("scroll",this.events._scroll),this.elWrapper.remove()}}})(),a.default})())); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.codecup=t():e.codecup=t()}(self,(()=>(()=>{var e={475:()=>{!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e={javascript:"clike",actionscript:"javascript",apex:["clike","sql"],arduino:"cpp",aspnet:["markup","csharp"],birb:"clike",bison:"c",c:"clike",csharp:"clike",cpp:"c",cfscript:"clike",chaiscript:["clike","cpp"],cilkc:"c",cilkcpp:"cpp",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",django:"markup-templating",ejs:["javascript","markup-templating"],etlua:["lua","markup-templating"],erb:["ruby","markup-templating"],fsharp:"clike","firestore-security-rules":"clike",flow:"javascript",ftl:"markup-templating",gml:"clike",glsl:"c",go:"clike",gradle:"clike",groovy:"clike",haml:"ruby",handlebars:"markup-templating",haxe:"clike",hlsl:"c",idris:"haskell",java:"clike",javadoc:["markup","java","javadoclike"],jolie:"clike",jsdoc:["javascript","javadoclike","typescript"],"js-extras":"javascript",json5:"json",jsonp:"json","js-templates":"javascript",kotlin:"clike",latte:["clike","markup-templating","php"],less:"css",lilypond:"scheme",liquid:"markup-templating",markdown:"markup","markup-templating":"markup",mongodb:"javascript",n4js:"javascript",objectivec:"c",opencl:"c",parser:"markup",php:"markup-templating",phpdoc:["php","javadoclike"],"php-extras":"php",plsql:"sql",processing:"clike",protobuf:"clike",pug:["markup","javascript"],purebasic:"clike",purescript:"haskell",qsharp:"clike",qml:"javascript",qore:"clike",racket:"scheme",cshtml:["markup","csharp"],jsx:["markup","javascript"],tsx:["jsx","typescript"],reason:"clike",ruby:"clike",sass:"css",scss:"css",scala:"java","shell-session":"bash",smarty:"markup-templating",solidity:"clike",soy:"markup-templating",sparql:"turtle",sqf:"clike",squirrel:"clike",stata:["mata","java","python"],"t4-cs":["t4-templating","csharp"],"t4-vb":["t4-templating","vbnet"],tap:"yaml",tt2:["clike","markup-templating"],textile:"markup",twig:"markup-templating",typescript:"javascript",v:"clike",vala:"clike",vbnet:"basic",velocity:"markup",wiki:"markup",xeora:"markup","xml-doc":"markup",xquery:"markup"},t={html:"markup",xml:"markup",svg:"markup",mathml:"markup",ssml:"markup",atom:"markup",rss:"markup",js:"javascript",g4:"antlr4",ino:"arduino","arm-asm":"armasm",art:"arturo",adoc:"asciidoc",avs:"avisynth",avdl:"avro-idl",gawk:"awk",sh:"bash",shell:"bash",shortcode:"bbcode",rbnf:"bnf",oscript:"bsl",cs:"csharp",dotnet:"csharp",cfc:"cfscript","cilk-c":"cilkc","cilk-cpp":"cilkcpp",cilk:"cilkcpp",coffee:"coffeescript",conc:"concurnas",jinja2:"django","dns-zone":"dns-zone-file",dockerfile:"docker",gv:"dot",eta:"ejs",xlsx:"excel-formula",xls:"excel-formula",gamemakerlanguage:"gml",po:"gettext",gni:"gn",ld:"linker-script","go-mod":"go-module",hbs:"handlebars",mustache:"handlebars",hs:"haskell",idr:"idris",gitignore:"ignore",hgignore:"ignore",npmignore:"ignore",webmanifest:"json",kt:"kotlin",kts:"kotlin",kum:"kumir",tex:"latex",context:"latex",ly:"lilypond",emacs:"lisp",elisp:"lisp","emacs-lisp":"lisp",md:"markdown",moon:"moonscript",n4jsd:"n4js",nani:"naniscript",objc:"objectivec",qasm:"openqasm",objectpascal:"pascal",px:"pcaxis",pcode:"peoplecode",plantuml:"plant-uml",pq:"powerquery",mscript:"powerquery",pbfasm:"purebasic",purs:"purescript",py:"python",qs:"qsharp",rkt:"racket",razor:"cshtml",rpy:"renpy",res:"rescript",robot:"robotframework",rb:"ruby","sh-session":"shell-session",shellsession:"shell-session",smlnj:"sml",sol:"solidity",sln:"solution-file",rq:"sparql",sclang:"supercollider",t4:"t4-cs",trickle:"tremor",troy:"tremor",trig:"turtle",ts:"typescript",tsconfig:"typoscript",uscript:"unrealscript",uc:"unrealscript",url:"uri",vb:"visual-basic",vba:"visual-basic",webidl:"web-idl",mathematica:"wolfram",nb:"wolfram",wl:"wolfram",xeoracube:"xeora",yml:"yaml"},n={},a="components/",s=Prism.util.currentScript();if(s){var r=/\bplugins\/autoloader\/prism-autoloader\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,i=/(^|\/)[\w-]+\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,o=s.getAttribute("data-autoloader-path");if(null!=o)a=o.trim().replace(/\/?$/,"/");else{var l=s.src;r.test(l)?a=l.replace(r,"components/"):i.test(l)&&(a=l.replace(i,"$1components/"))}}var c=Prism.plugins.autoloader={languages_path:a,use_minified:!0,loadLanguages:p};Prism.hooks.add("complete",(function(e){var t=e.element,n=e.language;if(t&&n&&"none"!==n){var a=function(e){var t=(e.getAttribute("data-dependencies")||"").trim();if(!t){var n=e.parentElement;n&&"pre"===n.tagName.toLowerCase()&&(t=(n.getAttribute("data-dependencies")||"").trim())}return t?t.split(/\s*,\s*/g):[]}(t);/^diff-./i.test(n)?(a.push("diff"),a.push(n.substr(5))):a.push(n),a.every(u)||p(a,(function(){Prism.highlightElement(t)}))}}))}function u(e){if(e.indexOf("!")>=0)return!1;if((e=t[e]||e)in Prism.languages)return!0;var a=n[e];return a&&!a.error&&!1===a.loading}function p(a,s,r){"string"==typeof a&&(a=[a]);var i=a.length,o=0,l=!1;function h(){l||++o===i&&s&&s(a)}0!==i?a.forEach((function(a){!function(a,s,r){var i=a.indexOf("!")>=0;function o(){var e=n[a];e||(e=n[a]={callbacks:[]}),e.callbacks.push({success:s,error:r}),!i&&u(a)?d(a,"success"):!i&&e.error?d(a,"error"):!i&&e.loading||(e.loading=!0,e.error=!1,function(e,t,n){var a=document.createElement("script");a.src=e,a.async=!0,a.onload=function(){document.body.removeChild(a),t&&t()},a.onerror=function(){document.body.removeChild(a),n&&n()},document.body.appendChild(a)}(function(e){return c.languages_path+"prism-"+e+(c.use_minified?".min":"")+".js"}(a),(function(){e.loading=!1,d(a,"success")}),(function(){e.loading=!1,e.error=!0,d(a,"error")})))}a=a.replace("!",""),a=t[a]||a;var l=e[a];l&&l.length?p(l,o,r):o()}(a,h,(function(){l||(l=!0,r&&r(a))}))})):s&&setTimeout(s,0)}function d(e,t){if(n[e]){for(var a=n[e].callbacks,s=0,r=a.length;s{var a=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,a={},s={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof r?new r(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=p.reach);F+=w.value.length,w=w.next){var A=w.value;if(t.length>e.length)return;if(!(A instanceof r)){var C,j=1;if(v){if(!(C=i(x,F,e,b))||C.index>=e.length)break;var L=C.index,E=C.index+C[0].length,_=F;for(_+=w.value.length;L>=_;)_+=(w=w.next).value.length;if(F=_-=w.value.length,w.value instanceof r)continue;for(var $=w;$!==t.tail&&(_p.reach&&(p.reach=M);var z=w.prev;if(S&&(z=c(t,z,S),F+=S.length),u(t,z,j),w=c(t,z,new r(d,f?s.tokenize(T,f):T,y,T)),N&&c(t,w,N),j>1){var P={cause:d+","+g,reach:M};o(e,t,n,w.prev,F,P),p&&P.reach>p.reach&&(p.reach=P.reach)}}}}}}function l(){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 c(e,t,n){var a=t.next,s={value:n,prev:t,next:a};return t.next=s,a.prev=s,e.length++,s}function u(e,t,n){for(var a=t.next,s=0;s"+r.content+""},!e.document)return e.addEventListener?(s.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),a=n.language,r=n.code,i=n.immediateClose;e.postMessage(s.highlight(r,s.languages[a],a)),i&&e.close()}),!1),s):s;var p=s.util.currentScript();function d(){s.manual||s.highlightAll()}if(p&&(s.filename=p.src,p.hasAttribute("data-manual")&&(s.manual=!0)),!s.manual){var h=document.readyState;"loading"===h||"interactive"===h&&p&&p.defer?document.addEventListener("DOMContentLoaded",d):window.requestAnimationFrame?window.requestAnimationFrame(d):window.setTimeout(d,16)}return s}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=a),void 0!==n.g&&(n.g.Prism=a),a.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\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://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"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:a.languages[t]},n.cdata=/^$/i;var s={"included-cdata":{pattern://i,inside:n}};s["language-"+t]={pattern:/[\s\S]+/,inside:a.languages[t]};var r={};r[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:s},a.languages.insertBefore("markup","cdata",r)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(e,t){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"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:a.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.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:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),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()"']|\\[\s\S])*/.source+")\\)","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"))}(a),a.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:/[{}[\];(),.:]/},a.languages.javascript=a.languages.extend("clike",{"class-name":[a.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$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:a.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:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.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:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.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:a.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"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.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)/.source,"javascript")),a.languages.js=a.languages.javascript,function(){if(void 0!==a&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",n="loading",s="loaded",r="pre[data-src]:not(["+t+'="'+s+'"]):not(['+t+'="'+n+'"])';a.hooks.add("before-highlightall",(function(e){e.selector+=", "+r})),a.hooks.add("before-sanity-check",(function(i){var o=i.element;if(o.matches(r)){i.code="",o.setAttribute(t,n);var l=o.appendChild(document.createElement("CODE"));l.textContent="Loading…";var c=o.getAttribute("data-src"),u=i.language;if("none"===u){var p=(/\.(\w+)$/.exec(c)||[,"none"])[1];u=e[p]||p}a.util.setLanguage(l,u),a.util.setLanguage(o,u);var d=a.plugins.autoloader;d&&d.loadLanguages(u),function(e,n,r){var i=new XMLHttpRequest;i.open("GET",e,!0),i.onreadystatechange=function(){4==i.readyState&&(i.status<400&&i.responseText?function(e){o.setAttribute(t,s);var n=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var n=Number(t[1]),a=t[2],s=t[3];return a?s?[n,Number(s)]:[n,void 0]:[n,n]}}(o.getAttribute("data-range"));if(n){var r=e.split(/\r\n?|\n/g),i=n[0],c=null==n[1]?r.length:n[1];i<0&&(i+=r.length),i=Math.max(0,Math.min(i-1,r.length)),c<0&&(c+=r.length),c=Math.max(0,Math.min(c,r.length)),e=r.slice(i,c).join("\n"),o.hasAttribute("data-start")||o.setAttribute("data-start",String(i+1))}l.textContent=e,a.highlightElement(l)}(i.responseText):i.status>=400?r("✖ Error "+i.status+" while fetching file: "+i.statusText):r("✖ Error: File does not exist or is empty"))},i.send(null)}(c,0,(function(e){o.setAttribute(t,"failed"),l.textContent=e}))}})),a.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(r),s=0;t=n[s++];)a.highlightElement(t)}};var i=!1;a.fileHighlight=function(){i||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),i=!0),a.plugins.fileHighlight.highlight.apply(this,arguments)}}}()}},t={};function n(a){var s=t[a];if(void 0!==s)return s.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var a={};return(()=>{"use strict";n.d(a,{default:()=>m});const e="#fff",t="20px",s=`\n.codecup {\n background: ${e};\n color: #4f559c;\n}\n\n.codecup .token.punctuation {\n color: #4a4a4a;\n}\n\n.codecup .token.keyword {\n color: #8500ff;\n}\n\n.codecup .token.operator {\n color: #ff5598;\n}\n\n.codecup .token.string {\n color: #41ad8f;\n}\n\n.codecup .token.comment {\n color: #9badb7;\n}\n\n.codecup .token.function {\n color: #8500ff;\n}\n\n.codecup .token.boolean {\n color: #8500ff;\n}\n\n.codecup .token.number {\n color: #8500ff;\n}\n\n.codecup .token.selector {\n color: #8500ff;\n}\n\n.codecup .token.property {\n color: #8500ff;\n}\n\n.codecup .token.tag {\n color: #8500ff;\n}\n\n.codecup .token.attr-value {\n color: #8500ff;\n}\n`,r='"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace';var i,o;const l="40px",c=`\n\n .codecup {\n width: 100%;\n height: 100%;\n overflow: hidden;\n border : 1px solid #EAEEFB;\n border-radius: 4px;\n position: relative;\n }\n\n .codecup, .codecup * {\n box-sizing: border-box;\n }\n\n .codecup__pre {\n pointer-events: none;\n z-index: 3;\n overflow: hidden;\n }\n\n .codecup__textarea {\n background: none;\n border: none;\n color: ${i="caret-color","#000",("undefined"!=typeof CSS?CSS.supports(i,"#000"):"undefined"!=typeof document&&(o=(o=i).split("-").filter((e=>!!e)).map((e=>e[0].toUpperCase()+e.substr(1))).join(""))[0].toLowerCase()+o.substr(1)in document.body.style)?e:"#ccc"};\n z-index: 1;\n resize: none;\n font-family: ${r};\n -webkit-appearance: pre;\n caret-color: #111;\n z-index: 2;\n width: 100%;\n height: 100%;\n }\n\n .codecup--has-line-numbers .codecup__textarea {\n width: calc(100% - ${l});\n }\n\n .codecup__code {\n display: block;\n font-family: ${r};\n overflow: hidden;\n }\n\n .codecup__flatten {\n padding: 10px;\n font-size: 13px;\n line-height: ${t};\n white-space: pre;\n position: absolute;\n top: 0;\n left: 0;\n overflow: auto;\n margin: 0 !important;\n outline: none;\n text-align: left;\n }\n\n .codecup--has-line-numbers .codecup__flatten {\n width: calc(100% - ${l});\n left: ${l};\n }\n\n .codecup__line-highlight {\n position: absolute;\n top: 10px;\n left: 0;\n width: 100%;\n height: ${t};\n background: rgba(0,0,0,0.1);\n z-index: 1;\n }\n\n .codecup__lines {\n padding: 10px 4px;\n font-size: 12px;\n line-height: ${t};\n font-family: 'Cousine', monospace;\n position: absolute;\n left: 0;\n top: 0;\n width: ${l};\n height: 100%;\n text-align: right;\n color: #999;\n z-index: 2;\n }\n\n .codecup__lines__line {\n display: block;\n }\n\n .codecup.codecup--has-line-numbers {\n padding-left: ${l};\n }\n\n .codecup.codecup--has-line-numbers:before {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n width: ${l};\n height: 100%;\n // background: #eee;\n background: #dcdfe6;\n z-index: 1;\n }\n\n .codecup__copyButton{\n position: absolute;\n right: 5px;\n top: 5px;\n z-index: 3;\n background: #EAEEFB;\n border: none;\n color: #999;\n cursor: pointer;\n outline: none;\n width: 22px;\n height: 22px;\n border-radius: 4px;\n }\n\n .codecup__copyMessage{\n position: absolute;\n right: 32px;\n top: 5px;\n z-index: 3;\n background: #EAEEFB;\n border: none;\n color: #999;\n cursor: pointer;\n outline: none;\n width: 55px;\n height: 22px;\n line-height: 22px;\n border-radius: 4px;\n font-size: 12px;\n text-align: center;\n font-family: 'Cousine', monospace;\n }\n\n`;function u(e,t,n){const a=t||"codecup-style",s=n||document.head;if(!e)return!1;if(document.getElementById(a))return!0;const r=document.createElement("style");return r.innerHTML=e,r.id=a,s.appendChild(r),!0}const p={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function d(e){return String(e).replace(/[&<>"'`=/]/g,(function(e){return p[e]}))}var h=n(660),g=n.n(h);n(475),g().plugins.autoloader.languages_path="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/";class m{constructor(e,t){if(!e)throw Error("codecup expects a parameter which is Element or a String selector");if(!t)throw Error("codecup expects an object containing options as second parameter");if(e.nodeType)this.editorRoot=e;else{const t=document.querySelector(e);t&&(this.editorRoot=t)}this.opts=t,this.events={},this.startEditor()}startEditor(){if(!u(c,null,this.opts.styleParent))throw Error("Failed to inject codecup CSS.");this.createWrapper(),this.createTextarea(),this.createPre(),this.createCode(),this.runOptions(),this.listenTextarea(),this.populateDefault(),this.updateCode(this.code)}createWrapper(){this.code=this.editorRoot.innerHTML,this.editorRoot.innerHTML="",this.elWrapper=this.createElement("div",this.editorRoot),this.elWrapper.classList.add("codecup")}createTextarea(){this.elTextarea=this.createElement("textarea",this.elWrapper),this.elTextarea.classList.add("codecup__textarea","codecup__flatten")}createPre(){this.elPre=this.createElement("pre",this.elWrapper),this.elPre.classList.add("codecup__pre","codecup__flatten")}createCode(){this.elCode=this.createElement("code",this.elPre),this.elCode.classList.add("codecup__code",`language-${this.opts.language||"html"}`)}createLineNumbers(){this.elLineNumbers=this.createElement("div",this.elWrapper),this.elLineNumbers.classList.add("codecup__lines"),this.elWrapper.classList.add("codecup--has-line-numbers"),this.setLineNumber()}createCopyButton(){this.elCopyButtonMessage=this.createElement("div",this.elWrapper),this.elCopyButtonMessage.classList.add("codecup__copyMessage"),this.elCopyButtonMessage.innerHTML="Copied!",this.elCopyButtonMessage.style.display="none",this.elCopyButton=this.createElement("div",this.elWrapper),this.elCopyButton.classList.add("codecup__copyButton"),this.elCopyButton.innerHTML='',this.elCopyButton.addEventListener("click",(()=>{navigator.clipboard.writeText(this.code).then((()=>{this.elCopyButtonMessage.style.display="block",setTimeout((()=>{this.elCopyButtonMessage.style.display="none"}),1e3)}))}))}destroyLineNumbers(){this.elWrapper.classList.remove("codecup--has-line-numbers"),this.elLineNumbers.remove()}createElement(e,t){const n=document.createElement(e);return t.appendChild(n),n}runOptions(){this.opts.rtl=this.opts.rtl||!1,this.opts.tabSize=this.opts.tabSize||2,this.opts.enableAutocorrect=this.opts.enableAutocorrect||!1,this.opts.lineNumbers=this.opts.lineNumbers||!1,this.opts.defaultTheme=!1!==this.opts.defaultTheme,this.opts.areaId=this.opts.areaId||null,this.opts.ariaLabelledby=this.opts.ariaLabelledby||null,this.opts.readonly=this.opts.readonly||!1,this.opts.copyButton=this.opts.copyButton||!1,this.opts.maxLines=this.opts.maxLines||100,this.opts.minLines=this.opts.minLines||1,"boolean"!=typeof this.opts.handleTabs&&(this.opts.handleTabs=!0),"boolean"!=typeof this.opts.handleSelfClosingCharacters&&(this.opts.handleSelfClosingCharacters=!0),"boolean"!=typeof this.opts.handleNewLineIndentation&&(this.opts.handleNewLineIndentation=!0),!0===this.opts.rtl&&(this.elTextarea.setAttribute("dir","rtl"),this.elPre.setAttribute("dir","rtl")),!1===this.opts.enableAutocorrect&&(this.elTextarea.setAttribute("spellcheck","false"),this.elTextarea.setAttribute("autocapitalize","off"),this.elTextarea.setAttribute("autocomplete","off"),this.elTextarea.setAttribute("autocorrect","off")),this.opts.lineNumbers&&this.createLineNumbers(),this.opts.defaultTheme&&u(s,"theme-default",this.opts.styleParent),this.opts.areaId&&this.elTextarea.setAttribute("id",this.opts.areaId),this.opts.ariaLabelledby&&this.elTextarea.setAttribute("aria-labelledby",this.opts.ariaLabelledby),this.opts.readonly&&this.enableReadonlyMode(),this.opts.copyButton&&this.createCopyButton(),this.updateLineNumbersCount()}updateLineNumbersCount(){let e="";for(let t=1;t<=this.lineNumber;t++)e+=`${t}`;this.elLineNumbers.innerHTML=e}updateEditorHeight(){let e=this.opts.maxLines,t=this.opts.minLines,n=this.lineNumber;n>e?n=e:n{this.opts.readonly||(this.code=e.target.value,this.elCode.innerHTML=d(e.target.value),this.highlight(),setTimeout((()=>{this.runUpdate(),this.setLineNumber()}),1))}),this.elTextarea.addEventListener("keydown",this.events._keydown=e=>{this.opts.readonly||(this.handleTabs(e),this.handleSelfClosingCharacters(e),this.handleNewLineIndentation(e))}),this.elTextarea.addEventListener("scroll",this.events._scroll=e=>{this.elPre.style.transform=`translate3d(-${e.target.scrollLeft}px, -${e.target.scrollTop}px, 0)`,this.elLineNumbers&&(this.elLineNumbers.style.transform=`translate3d(0, -${e.target.scrollTop}px, 0)`)})}handleTabs(e){if(this.opts.handleTabs){if(9!==e.keyCode)return;e.preventDefault();var t=this.elTextarea,n=t.selectionDirection,a=t.selectionStart,s=t.selectionEnd,r=t.value,i=r.substr(0,a),o=r.substring(a,s),l=r.substring(s);const h=" ".repeat(this.opts.tabSize);if(a!==s&&o.length>=h.length){var c=a-i.split("\n").pop().length,u=h.length,p=h.length;e.shiftKey?(r.substr(c,h.length)===h?(u=-u,c>a?(o=o.substring(0,c)+o.substring(c+h.length),p=0):c===a?(u=0,p=0,o=o.substring(h.length)):(p=-p,i=i.substring(0,c)+i.substring(c+h.length))):(u=0,p=0),o=o.replace(new RegExp("\n"+h.split("").join("\\"),"g"),"\n")):(i=i.substr(0,c)+h+i.substring(c,a),o=o.replace(/\n/g,"\n"+h)),t.value=i+o+l,t.selectionStart=a+u,t.selectionEnd=a+o.length+p,t.selectionDirection=n}else t.value=i+h+l,t.selectionStart=a+h.length,t.selectionEnd=a+h.length;var d=t.value;this.updateCode(d),this.elTextarea.selectionEnd=s+this.opts.tabSize}}handleSelfClosingCharacters(e){if(!this.opts.handleSelfClosingCharacters)return;const t=e.key;if(["(","[","{","<","'",'"'].includes(t)||[")","]","}",">","'",'"'].includes(t))switch(t){case"(":case")":case"[":case"]":case"{":case"}":case"<":case">":case"'":case'"':this.closeCharacter(t)}}setLineNumber(){this.lineNumber=this.code.split("\n").length,this.opts.lineNumbers&&this.updateLineNumbersCount(),this.updateEditorHeight()}handleNewLineIndentation(e){if(this.opts.handleNewLineIndentation&&13===e.keyCode){e.preventDefault();var t=this.elTextarea,n=t.selectionStart,a=t.selectionEnd,s=t.value,r=s.substr(0,n),i=s.substring(a),o=s.lastIndexOf("\n",n-1),l=o+s.slice(o+1).search(/[^ ]|$/),c=l>o?l-o:0,u=r+"\n"+" ".repeat(c)+i;t.value=u,t.selectionStart=n+c+1,t.selectionEnd=n+c+1,this.updateCode(t.value),this.updateEditorHeight()}}closeCharacter(e){const t=this.elTextarea.selectionStart,n=this.elTextarea.selectionEnd;if(this.skipCloseChar(e)){const a=this.code.substr(n,1)===e,s=a?n+1:n,r=!a&&["'",'"'].includes(e)?e:"",i=`${this.code.substring(0,t)}${r}${this.code.substring(s)}`;this.updateCode(i),this.elTextarea.selectionEnd=++this.elTextarea.selectionStart}else{let a=e;switch(e){case"(":a=String.fromCharCode(e.charCodeAt()+1);break;case"<":case"{":case"[":a=String.fromCharCode(e.charCodeAt()+2)}const s=this.code.substring(t,n),r=`${this.code.substring(0,t)}${s}${a}${this.code.substring(n)}`;this.updateCode(r)}this.elTextarea.selectionEnd=t}skipCloseChar(e){const t=this.elTextarea.selectionStart,n=this.elTextarea.selectionEnd,a=Math.abs(n-t)>0;return[")","}","]",">"].includes(e)||["'",'"'].includes(e)&&!a}updateCode(e){this.code=e,this.elTextarea.value=e,this.elCode.innerHTML=d(e),this.highlight(),this.setLineNumber(),setTimeout(this.runUpdate.bind(this),1)}updateLanguage(e){const t=this.opts.language;this.elCode.classList.remove(`language-${t}`),this.elCode.classList.add(`language-${e}`),this.opts.language=e,this.highlight()}populateDefault(){this.updateCode(this.code)}highlight(){g().highlightElement(this.elCode,!1)}onUpdate(e){if(e&&"[object Function]"!=={}.toString.call(e))throw Error("codecup expects callback of type Function");this.updateCallBack=e}getCode(){return this.code}runUpdate(){this.updateCallBack&&this.updateCallBack(this.code)}enableReadonlyMode(){this.elTextarea.setAttribute("readonly",!0),this.opts.readonly=!0}disableReadonlyMode(){this.elTextarea.removeAttribute("readonly"),this.opts.readonly=!1}toggleReadonlyMode(){this.opts.readonly?this.disableReadonlyMode():this.enableReadonlyMode()}enableLineNumbers(){this.opts.lineNumbers=!0,this.destroyLineNumbers(),this.createLineNumbers(),this.updateLineNumbersCount()}disableLineNumbers(){this.opts.lineNumbers=!1,this.destroyLineNumbers()}toggleLineNumbers(){this.opts.lineNumbers?this.disableLineNumbers():this.enableLineNumbers()}dispose(){this.elTextarea.removeEventListener("input",this.events._input),this.elTextarea.removeEventListener("keydown",this.events._keydown),this.elTextarea.removeEventListener("scroll",this.events._scroll),this.elWrapper.remove()}}})(),a.default})())); \ No newline at end of file diff --git a/example/index.html b/example/index.html index e330ace..cdae199 100644 --- a/example/index.html +++ b/example/index.html @@ -95,13 +95,13 @@ width: 800px; padding:20px; } - +/* #cf_holder{ overflow: hidden; border : 1px solid #EAEEFB; border-radius: 4px; position: relative; - } + } */ button { background-color: #fff; diff --git a/package.json b/package.json index 985991d..870190a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@calumk/codecup", - "version": "1.9.1", + "version": "1.9.2", "description": "A micro code-editor for awesome web pages", "main": "dist/codecup.bundle.js", "files": [ diff --git a/src/codecup.js b/src/codecup.js index af61d51..56c14ce 100644 --- a/src/codecup.js +++ b/src/codecup.js @@ -203,10 +203,10 @@ export default class codecup { } this.elLineNumbers.innerHTML = numberList + + } - console.log(this.opts) - - // limit the number of lines between max and min line numbers. + updateEditorHeight () { let maxLineNumber = this.opts.maxLines let minLineNumber = this.opts.minLines let limitedLineNumber = this.lineNumber @@ -218,6 +218,7 @@ export default class codecup { this.elWrapper.style.height = (limitedLineNumber*20) + 20 + 'px' } + listenTextarea () { this.elTextarea.addEventListener('input', this.events._input = (e) => { // console.log() @@ -370,6 +371,7 @@ export default class codecup { if (this.opts.lineNumbers) { this.updateLineNumbersCount() } + this.updateEditorHeight() } handleNewLineIndentation (e) { @@ -397,6 +399,7 @@ export default class codecup { input.selectionEnd = selStartPos + indent + 1 this.updateCode(input.value) + this.updateEditorHeight() } closeCharacter (char) { diff --git a/src/styles/editor.js b/src/styles/editor.js index 1cae7b5..e9b3f2f 100644 --- a/src/styles/editor.js +++ b/src/styles/editor.js @@ -8,10 +8,14 @@ const LINE_NUMBER_WIDTH = '40px' export const editorCss = ` + .codecup { width: 100%; height: 100%; overflow: hidden; + border : 1px solid #EAEEFB; + border-radius: 4px; + position: relative; } .codecup, .codecup * {