mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-13 00:44:25 +00:00
3 lines
600 KiB
JavaScript
3 lines
600 KiB
JavaScript
|
/*! For license information please see gotty.js.LICENSE.txt */
|
||
|
(()=>{var e={276:e=>{"use strict";if(void 0!==t)throw new Error('Global "lib" object already exists.');var t={runtimeDependencies_:{},initCallbacks_:[],rtdep:function(e){var r;try{throw new Error}catch(e){var i=e.stack.split("\n");r=i.length>=3?i[2].replace(/^\s*at\s+/,""):i[1].replace(/^\s*global code@/,"")}for(var o=0;o<arguments.length;o++){var n=arguments[o];if(n instanceof Array)t.rtdep.apply(t,n);else{var s=this.runtimeDependencies_[n];s||(s=this.runtimeDependencies_[n]=[]),s.push(r)}}},ensureRuntimeDependencies_:function(){var e=!0;for(var r in t.runtimeDependencies_)for(var i=t.runtimeDependencies_[r],o=r.split("."),n=window||self,s=0;s<o.length;s++){if(!(o[s]in n)){console.warn('Missing "'+r+'" is needed by',i),e=!1;break}n=n[o[s]]}if(!e)throw new Error("Failed runtime dependency check")},registerInit:function(e,r){return t.initCallbacks_.push([e,r]),r},init:function(e,r){var i=t.initCallbacks_,o=function(){if(i.length){var n=i.shift();r&&r("init: "+n[0]),n[1](t.f.alarm(o))}else e()};if("function"!=typeof e)throw new Error("Missing or invalid argument: onInit");t.ensureRuntimeDependencies_(),setTimeout(o,0)}};String.prototype.padStart||(String.prototype.padStart=function(e,t){return(e-=this.length)<=0?String(this):(void 0===t&&(t=" "),e>t.length&&(t=t.repeat(e/t.length+1)),t.slice(0,e)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(e,t){return(e-=this.length)<=0?String(this):(void 0===t&&(t=" "),e>t.length&&(t=t.repeat(e/t.length+1)),String(this)+t.slice(0,e))}),t.colors={},t.colors.re_={hex16:/#([a-f0-9])([a-f0-9])([a-f0-9])/i,hex24:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/i,rgb:new RegExp("^/s*rgb/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*/)/s*$".replace(/\//g,"\\"),"i"),rgba:new RegExp("^/s*rgba/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*(?:,/s*(/d+(?:/./d+)?)/s*)/)/s*$".replace(/\//g,"\\"),"i"),rgbx:new RegExp("^/s*rgba?/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*(?:,/s*(/d+(?:/./d+)?)/s*)?/)/s*$".replace(/\//g,"\\"),"i"),x11rgb:/^\s*rgb:([a-f0-9]{1,4})\/([a-f0-9]{1,4})\/([a-f0-9]{1,4})\s*$/i,name:/[a-z][a-z0-9\s]+/},t.colors.rgbToX11=function(e){function r(e){return e=(257*Math.min(e,255)).toString(16),t.f.zpad(e,4)}var i=e.match(t.colors.re_.rgbx);return i?"rgb:"+r(i[1])+"/"+r(i[2])+"/"+r(i[3]):null},t.colors.x11HexToCSS=function(e){if(!e.startsWith("#"))return null;if(e=e.substr(1),-1==[3,6,9,12].indexOf(e.length))return null;if(e.match(/[^a-f0-9]/i))return null;var r=e.length/3,i=e.substr(0,r),o=e.substr(r,r),n=e.substr(r+r,r);return t.colors.arrayToRGBA([i,o,n].map((function(e){return e=parseInt(e,16),2==r?e:1==r?e<<4:e>>4*(r-2)})))},t.colors.x11ToCSS=function(e){var r=e.match(t.colors.re_.x11rgb);return r?(r.splice(0,1),t.colors.arrayToRGBA(r.map((function(e){return 1==e.length?parseInt(e+e,16):2==e.length?parseInt(e,16):(3==e.length&&(e+=e.substr(2)),Math.round(parseInt(e,16)/257))})))):e.startsWith("#")?t.colors.x11HexToCSS(e):t.colors.nameToRGB(e)},t.colors.hexToRGB=function(e){var r=t.colors.re_.hex16,i=t.colors.re_.hex24;function o(e){4==e.length&&(e=e.replace(r,(function(e,t,r,i){return"#"+t+t+r+r+i+i})));var t=e.match(i);return t?"rgb("+parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16)+")":null}if(e instanceof Array)for(var n=0;n<e.length;n++)e[n]=o(e[n]);else e=o(e);return e},t.colors.rgbToHex=function(e){function r(e){var r=t.colors.crackRGB(e);return r?"#"+t.f.zpad((parseInt(r[0])<<16|parseInt(r[1])<<8|parseInt(r[2])<<0).toString(16),6):null}if(e instanceof Array)for(var i=0;i<e.length;i++)e[i]=r(e[i]);else e=r(e);return e},t.colors.normalizeCSS=function(e){return e.startsWith("#")?t.colors.hexToRGB(e):t.colors.re_.rgbx.test(e)?e:t.colors.nameToRGB(e)},t.colors.arrayToRGBA=function(e){var t=e.length>3?e[3]:1;return"rgba("+e[0]+", "+e[1]+", "+e[2]+", "+t+")"},t.colors.setAlpha=function(e,r){var i=t.colors.crackRGB(e);return i[3]=r,t.colors.arrayToRGBA(i)},t.colors.mix=function(e,r,i){for(var o=t.colors.crackRGB(e),n=t.colors.crackRGB(r),s=0;s<4;++s){var a=n[s]-o[s];o[s]=Math.round(parseInt(o[s])+a*i)}return t.colors.arrayToRG
|
||
|
//# sourceMappingURL=gotty.js.map
|