-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.min.js
1 lines (1 loc) · 2.96 KB
/
index.min.js
1
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((n="undefined"!=typeof globalThis?globalThis:n||self).hljs=n.hljs||{},n.hljs.LineNumberPlugin=t())}(this,(function(){"use strict";var n=function(n){return Array.isArray(n)},t=function(n){return void 0!==n},r=function(n,t){return void 0===t&&(t=!0),"object"==typeof n&&(!t||function(n,t){return n&&e(t)&&n instanceof t}(n,Object))},e=function(n){return t(n)&&!function(n){return null===n}(n)},u=function(n){return"string"==typeof n},i=function(n){return n.replace(/[-_.](\w)/g,(function(n,t){return o(t)}))},o=function(n){return n.toUpperCase()},f=function t(e){if(n(e))return e.map((function(n){return t(n)}));if(function(n){return/^-?(?:\d*.)?\d+$/.test(n+"")}(e))return function(n,t){return void 0===t&&(t=10),t?parseInt(n,t):parseFloat(n)}(e);if(r(e)){for(var u in e)e[u]=t(e[u]);return e}return"false"!==e&&("null"===e?null:"true"===e||e)},l=function t(e){if(n(e))return e.map((function(n){return t(e)}));if(r(e)){for(var u in e)e[u]=t(e[u]);return e}return!1===e?"false":null===e?"null":!0===e?"true":""+e},s=document,c=window,a=function(n){return(n&&n.nodeName||"").toLowerCase()||null},d=function(n,t){return n.removeAttribute(t),n},p=function(n,t){return n.style[i(t)]=null,n},v=function(n,t,r){return!0===r&&(r=t),n.setAttribute(t,l(r)),n},h=function(n,t,e){return n=u(n)?s.createElement(n):n,r(t)&&(e=t,t=!1),u(t)&&g(n,t),r(e)&&function(n,t){var r;for(var e in t)(r=t[e])||""===r||0===r?v(n,e,r):d(n,e)}(n,e),n},g=function(n,t,r){if(void 0===r&&(r=!0),null===t)return n;var e="innerHTML";return function(n,t){return t in n}(n,e)&&(n[e]=r?t.trim():t),n},m=function(n,t,r){return"number"==typeof r&&(r+="px"),n.style[i(t)]=l(r),n},y=function(n,t){var r;for(var e in t)(r=t[e])||""===r||0===r?m(n,e,r):p(n,e);return n};function b(n){var t,r=function(n,t,r){void 0===r&&(r=!0);var e=c.getComputedStyle(n).getPropertyValue(t);return r&&(e=f(e)),e||""===e||0===e?e:null}(n,"color")||"";return(t=r.match(/^rgba\s*\(\s*([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\s*[, ]\s*([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\s*[, ]\s*([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\s*[, ]\s*([01]|0?\.\d+)\s*\)$/i))?[+t[1],+t[2],+t[3],+t[4]]:(t=r.match(/^rgb\s*\(\s*([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\s*[, ]\s*([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\s*[, ]\s*([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\s*\)$/i))?[+t[1],+t[2],+t[3],1]:[0,0,0,1]}var j={"after:highlightElement":function(n){var t=n.el,r=n.result,e=n.text,u=t,i=h(a(t)),o=[],f=t.parentNode||null;if(f&&"pre"===a(f)){for(var l=0,s=e.split(/\n/).length;l<s;++l)o.push("<span>"+(l+1)+"</span>");f.insertBefore(i,u),y(u,{flex:"1"}),y(f,{direction:"ltr",display:"flex"}),g(i,o.join("\n")),function(n,t){n.classList.add(t)}(i,"hljs");var c=b(i),d=c[0],p=c[1],v=c[2],m=c[3];y(i,{"border-right":"2px solid rgba("+d+","+p+","+v+","+m/10+")","text-align":"right","user-select":"none"})}return{el:t,result:r,text:e}}};return t(c)&&t(c.hljs)&&c.hljs.addPlugin(j),j}));