hugo-theme-terminal/static/assets/prism.js

1 line
174 KiB
JavaScript
Raw Normal View History

!function(){var e={213:function(e,t,n){var a,i,r,o,s,l,d=function(e){var t=/\blang(?:uage)?-([\w-]+)\b/i,n=0,a={},i={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,"&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 a,r;switch(n=n||{},i.util.type(t)){case"Object":if(r=i.util.objId(t),n[r])return n[r];for(var o in a={},n[r]=a,t)t.hasOwnProperty(o)&&(a[o]=e(t[o],n));return a;case"Array":return r=i.util.objId(t),n[r]?n[r]:(a=[],n[r]=a,t.forEach((function(t,i){a[i]=e(t,n)})),a);default:return t}},getLanguage:function(e){for(;e&&!t.test(e.className);)e=e.parentElement;return e?(e.className.match(t)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(a){var e=(/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(a.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 a="no-"+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(a))return!1;e=e.parentElement}return!!n}},languages:{plain:a,plaintext:a,text:a,txt:a,extend:function(e,t){var n=i.util.clone(i.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(e,t,n,a){var r=(a=a||i.languages)[e],o={};for(var s in r)if(r.hasOwnProperty(s)){if(s==t)for(var l in n)n.hasOwnProperty(l)&&(o[l]=n[l]);n.hasOwnProperty(s)||(o[s]=r[s])}var d=a[e];return a[e]=o,i.languages.DFS(i.languages,(function(t,n){n===d&&t!=e&&(this[t]=o)})),o},DFS:function e(t,n,a,r){r=r||{};var o=i.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],a||s);var l=t[s],d=i.util.type(l);"Object"!==d||r[o(l)]?"Array"!==d||r[o(l)]||(r[o(l)]=!0,e(l,n,s,r)):(r[o(l)]=!0,e(l,n,null,r))}}},plugins:{},highlightAll:function(e,t){i.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var a={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};i.hooks.run("before-highlightall",a),a.elements=Array.prototype.slice.apply(a.container.querySelectorAll(a.selector)),i.hooks.run("before-all-elements-highlight",a);for(var r,o=0;r=a.elements[o++];)i.highlightElement(r,!0===t,a.callback)},highlightElement:function(n,a,r){var o=i.util.getLanguage(n),s=i.languages[o];n.className=n.className.replace(t,"").replace(/\s+/g," ")+" language-"+o;var l=n.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&(l.className=l.className.replace(t,"").replace(/\s+/g," ")+" language-"+o);var d={element:n,language:o,grammar:s,code:n.textContent};function u(e){d.highlightedCode=e,i.hooks.run("before-insert",d),d.element.innerHTML=d.highlightedCode,i.hooks.run("after-highlight",d),i.hooks.run("complete",d),r&&r.call(d.element)}if(i.hooks.run("before-sanity-check",d),(l=d.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!d.code)return i.hooks.run("complete",d),void(r&&r.call(d.element));if(i.hooks.run("before-highlight",d),d.grammar)if(a&&e.Worker){var c=new Worker(i.filename);c.onmessage=function(e){u(e.data)},c.postMessage(JSON.stringify({language:d.language,code:d.code,immediateClose:!0}))}else u(i.highlight(d.code,d.grammar,d.language));else u(i.util.encode(d.code))},highlight:function(e,t,n){var a={code:e,grammar:t,language:n};return i.hooks.run("before-tokenize",a),a.tokens=i.tokenize(a.code,a.grammar),i.hooks.run("after-tokenize",a),r.stringify(i.util.encode(a.tokens),a.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var a in n)t[a]=n[a];delete t.rest}var u=new s;return l(u,u.head,e),function e(t,n,a,s,u,c){for(var p in a)if(a.hasOwnProperty(p)&&a[p]){var g=a[p];g=Array