mp-darkmode 1.2.3-beta.0 → 1.2.3-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Darkmode",[],e):"object"==typeof exports?exports.Darkmode=e():t.Darkmode=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=9)}([function(t,e,r){"use strict";var n=r(3),a=r(6),o=[].slice,i=["keyword","gray","hex"],l={};Object.keys(a).forEach((function(t){l[o.call(a[t].labels).sort().join("")]=t}));var u={};function s(t,e){if(!(this instanceof s))return new s(t,e);if(e&&e in i&&(e=null),e&&!(e in a))throw new Error("Unknown model: "+e);var r,c;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof s)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var h=n.get(t);if(null===h)throw new Error("Unable to parse color from string: "+t);this.model=h.model,c=a[this.model].channels,this.color=h.value.slice(0,c),this.valpha="number"==typeof h.value[c]?h.value[c]:1}else if(t.length){this.model=e||"rgb",c=a[this.model].channels;var f=o.call(t,0,c);this.color=d(f,c),this.valpha="number"==typeof t[c]?t[c]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var g=Object.keys(t);"alpha"in t&&(g.splice(g.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var b=g.sort().join("");if(!(b in l))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=l[b];var p=a[this.model].labels,y=[];for(r=0;r<p.length;r++)y.push(t[p[r]]);this.color=d(y)}if(u[this.model])for(c=a[this.model].channels,r=0;r<c;r++){var m=u[this.model][r];m&&(this.color[r]=m(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function c(t,e,r){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(u[t]||(u[t]=[]))[e]=r})),t=t[0],function(n){var a;return arguments.length?(r&&(n=r(n)),(a=this[t]()).color[e]=n,a):(a=this[t]().color[e],r&&(a=r(a)),a)}}function h(t){return function(e){return Math.max(0,Math.min(t,e))}}function f(t){return Array.isArray(t)?t:[t]}function d(t,e){for(var r=0;r<e;r++)"number"!=typeof t[r]&&(t[r]=0);return t}s.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var e=this.model in n.to?this:this.rgb(),r=1===(e=e.round("number"==typeof t?t:1)).valpha?e.color:e.color.concat(this.valpha);return n.to[e.model](r)},percentString:function(t){var e=this.rgb().round("number"==typeof t?t:1),r=1===e.valpha?e.color:e.color.concat(this.valpha);return n.to.rgb.percent(r)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},e=a[this.model].channels,r=a[this.model].labels,n=0;n<e;n++)t[r[n]]=this.color[n];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new s(this.color.map(function(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new s(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:c("rgb",0,h(255)),green:c("rgb",1,h(255)),blue:c("rgb",2,h(255)),hue:c(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:c("hsl",1,h(100)),lightness:c("hsl",2,h(100)),saturationv:c("hsv",1,h(100)),value:c("hsv",2,h(100)),chroma:c("hcg",1,h(100)),gray:c("hcg",2,h(100)),white:c("hwb",1,h(100)),wblack:c("hwb",2,h(100)),cyan:c("cmyk",0,h(100)),magenta:c("cmyk",1,h(100)),yellow:c("cmyk",2,h(100)),black:c("cmyk",3,h(100)),x:c("xyz",0,h(100)),y:c("xyz",1,h(100)),z:c("xyz",2,h(100)),l:c("lab",0,h(100)),a:c("lab",1),b:c("lab",2),keyword:function(t){return arguments.length?new s(t):a[this.model].keyword(this.color)},hex:function(t){return arguments.length?new s(t):n.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity:function(){for(var t=this.rgb().color,e=[],r=0;r<t.length;r++){var n=t[r]/255;e[r]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),r=t.luminosity();return e>r?(e+.05)/(r+.05):(r+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten:function(t){var e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken:function(t){var e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate:function(t){var e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate:function(t){var e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten:function(t){var e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken:function(t){var e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale:function(){var t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return s.rgb(e,e,e)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var e=this.hsl(),r=e.color[0];return r=(r=(r+t)%360)<0?360+r:r,e.color[0]=r,e},mix:function(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);var r=t.rgb(),n=this.rgb(),a=void 0===e?.5:e,o=2*a-1,i=r.alpha()-n.alpha(),l=((o*i==-1?o:(o+i)/(1+o*i))+1)/2,u=1-l;return s.rgb(l*r.red()+u*n.red(),l*r.green()+u*n.green(),l*r.blue()+u*n.blue(),r.alpha()*a+n.alpha()*(1-a))}},Object.keys(a).forEach((function(t){if(-1===i.indexOf(t)){var e=a[t].channels;s.prototype[t]=function(){if(this.model===t)return new s(this);if(arguments.length)return new s(arguments,t);var r="number"==typeof arguments[e]?e:this.valpha;return new s(f(a[this.model][t].raw(this.color)).concat(r),t)},s[t]=function(r){return"number"==typeof r&&(r=d(o.call(arguments),e)),new s(r,t)}}})),t.exports=s},function(t,e,r){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},function(t,e,r){var n=r(7),a={};for(var o in n)n.hasOwnProperty(o)&&(a[n[o]]=o);var i=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var l in i)if(i.hasOwnProperty(l)){if(!("channels"in i[l]))throw new Error("missing channels property: "+l);if(!("labels"in i[l]))throw new Error("missing channel labels property: "+l);if(i[l].labels.length!==i[l].channels)throw new Error("channel and label counts mismatch: "+l);var u=i[l].channels,s=i[l].labels;delete i[l].channels,delete i[l].labels,Object.defineProperty(i[l],"channels",{value:u}),Object.defineProperty(i[l],"labels",{value:s})}i.rgb.hsl=function(t){var e,r,n=t[0]/255,a=t[1]/255,o=t[2]/255,i=Math.min(n,a,o),l=Math.max(n,a,o),u=l-i;return l===i?e=0:n===l?e=(a-o)/u:a===l?e=2+(o-n)/u:o===l&&(e=4+(n-a)/u),(e=Math.min(60*e,360))<0&&(e+=360),r=(i+l)/2,[e,100*(l===i?0:r<=.5?u/(l+i):u/(2-l-i)),100*r]},i.rgb.hsv=function(t){var e,r,n,a,o,i=t[0]/255,l=t[1]/255,u=t[2]/255,s=Math.max(i,l,u),c=s-Math.min(i,l,u),h=function(t){return(s-t)/6/c+.5};return 0===c?a=o=0:(o=c/s,e=h(i),r=h(l),n=h(u),i===s?a=n-r:l===s?a=1/3+e-n:u===s&&(a=2/3+r-e),a<0?a+=1:a>1&&(a-=1)),[360*a,100*o,100*s]},i.rgb.hwb=function(t){var e=t[0],r=t[1],n=t[2];return[i.rgb.hsl(t)[0],100*(1/255*Math.min(e,Math.min(r,n))),100*(n=1-1/255*Math.max(e,Math.max(r,n)))]},i.rgb.cmyk=function(t){var e,r=t[0]/255,n=t[1]/255,a=t[2]/255;return[100*((1-r-(e=Math.min(1-r,1-n,1-a)))/(1-e)||0),100*((1-n-e)/(1-e)||0),100*((1-a-e)/(1-e)||0),100*e]},i.rgb.keyword=function(t){var e=a[t];if(e)return e;var r,o,i,l=1/0;for(var u in n)if(n.hasOwnProperty(u)){var s=n[u],c=(o=t,i=s,Math.pow(o[0]-i[0],2)+Math.pow(o[1]-i[1],2)+Math.pow(o[2]-i[2],2));c<l&&(l=c,r=u)}return r},i.keyword.rgb=function(t){return n[t]},i.rgb.xyz=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*e+.7152*r+.0722*n),100*(.0193*e+.1192*r+.9505*n)]},i.rgb.lab=function(t){var e=i.rgb.xyz(t),r=e[0],n=e[1],a=e[2];return n/=100,a/=108.883,r=(r/=95.047)>.008856?Math.pow(r,1/3):7.787*r+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(r-n),200*(n-(a=a>.008856?Math.pow(a,1/3):7.787*a+16/116))]},i.hsl.rgb=function(t){var e,r,n,a,o,i=t[0]/360,l=t[1]/100,u=t[2]/100;if(0===l)return[o=255*u,o,o];e=2*u-(r=u<.5?u*(1+l):u+l-u*l),a=[0,0,0];for(var s=0;s<3;s++)(n=i+1/3*-(s-1))<0&&n++,n>1&&n--,o=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,a[s]=255*o;return a},i.hsl.hsv=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,a=r,o=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,a*=o<=1?o:2-o,[e,100*(0===n?2*a/(o+a):2*r/(n+r)),100*((n+r)/2)]},i.hsv.rgb=function(t){var e=t[0]/60,r=t[1]/100,n=t[2]/100,a=Math.floor(e)%6,o=e-Math.floor(e),i=255*n*(1-r),l=255*n*(1-r*o),u=255*n*(1-r*(1-o));switch(n*=255,a){case 0:return[n,u,i];case 1:return[l,n,i];case 2:return[i,n,u];case 3:return[i,l,n];case 4:return[u,i,n];case 5:return[n,i,l]}},i.hsv.hsl=function(t){var e,r,n,a=t[0],o=t[1]/100,i=t[2]/100,l=Math.max(i,.01);return n=(2-o)*i,r=o*l,[a,100*(r=(r/=(e=(2-o)*l)<=1?e:2-e)||0),100*(n/=2)]},i.hwb.rgb=function(t){var e,r,n,a,o,i,l,u=t[0]/360,s=t[1]/100,c=t[2]/100,h=s+c;switch(h>1&&(s/=h,c/=h),n=6*u-(e=Math.floor(6*u)),0!=(1&e)&&(n=1-n),a=s+n*((r=1-c)-s),e){default:case 6:case 0:o=r,i=a,l=s;break;case 1:o=a,i=r,l=s;break;case 2:o=s,i=r,l=a;break;case 3:o=s,i=a,l=r;break;case 4:o=a,i=s,l=r;break;case 5:o=r,i=s,l=a}return[255*o,255*i,255*l]},i.cmyk.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,a=t[3]/100;return[255*(1-Math.min(1,e*(1-a)+a)),255*(1-Math.min(1,r*(1-a)+a)),255*(1-Math.min(1,n*(1-a)+a))]},i.xyz.rgb=function(t){var e,r,n,a=t[0]/100,o=t[1]/100,i=t[2]/100;return r=-.9689*a+1.8758*o+.0415*i,n=.0557*a+-.204*o+1.057*i,e=(e=3.2406*a+-1.5372*o+-.4986*i)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(e=Math.min(Math.max(0,e),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]},i.xyz.lab=function(t){var e=t[0],r=t[1],n=t[2];return r/=100,n/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(e-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},i.lab.xyz=function(t){var e,r,n,a=t[0];e=t[1]/500+(r=(a+16)/116),n=r-t[2]/200;var o=Math.pow(r,3),i=Math.pow(e,3),l=Math.pow(n,3);return r=o>.008856?o:(r-16/116)/7.787,e=i>.008856?i:(e-16/116)/7.787,n=l>.008856?l:(n-16/116)/7.787,[e*=95.047,r*=100,n*=108.883]},i.lab.lch=function(t){var e,r=t[0],n=t[1],a=t[2];return(e=360*Math.atan2(a,n)/2/Math.PI)<0&&(e+=360),[r,Math.sqrt(n*n+a*a),e]},i.lch.lab=function(t){var e,r=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[r,n*Math.cos(e),n*Math.sin(e)]},i.rgb.ansi16=function(t){var e=t[0],r=t[1],n=t[2],a=1 in arguments?arguments[1]:i.rgb.hsv(t)[2];if(0===(a=Math.round(a/50)))return 30;var o=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(e/255));return 2===a&&(o+=60),o},i.hsv.ansi16=function(t){return i.rgb.ansi16(i.hsv.rgb(t),t[2])},i.rgb.ansi256=function(t){var e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},i.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),[e=e/10.5*255,e,e];var r=.5*(1+~~(t>50));return[(1&e)*r*255,(e>>1&1)*r*255,(e>>2&1)*r*255]},i.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var r;return t-=16,[Math.floor(t/36)/5*255,Math.floor((r=t%36)/6)/5*255,r%6/5*255]},i.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},i.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var r=e[0];3===e[0].length&&(r=r.split("").map((function(t){return t+t})).join(""));var n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},i.rgb.hcg=function(t){var e,r=t[0]/255,n=t[1]/255,a=t[2]/255,o=Math.max(Math.max(r,n),a),i=Math.min(Math.min(r,n),a),l=o-i;return e=l<=0?0:o===r?(n-a)/l%6:o===n?2+(a-r)/l:4+(r-n)/l+4,e/=6,[360*(e%=1),100*l,100*(l<1?i/(1-l):0)]},i.hsl.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1,a=0;return(n=r<.5?2*e*r:2*e*(1-r))<1&&(a=(r-.5*n)/(1-n)),[t[0],100*n,100*a]},i.hsv.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=e*r,a=0;return n<1&&(a=(r-n)/(1-n)),[t[0],100*n,100*a]},i.hcg.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100;if(0===r)return[255*n,255*n,255*n];var a,o=[0,0,0],i=e%1*6,l=i%1,u=1-l;switch(Math.floor(i)){case 0:o[0]=1,o[1]=l,o[2]=0;break;case 1:o[0]=u,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=l;break;case 3:o[0]=0,o[1]=u,o[2]=1;break;case 4:o[0]=l,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=u}return a=(1-r)*n,[255*(r*o[0]+a),255*(r*o[1]+a),255*(r*o[2]+a)]},i.hcg.hsv=function(t){var e=t[1]/100,r=e+t[2]/100*(1-e),n=0;return r>0&&(n=e/r),[t[0],100*n,100*r]},i.hcg.hsl=function(t){var e=t[1]/100,r=t[2]/100*(1-e)+.5*e,n=0;return r>0&&r<.5?n=e/(2*r):r>=.5&&r<1&&(n=e/(2*(1-r))),[t[0],100*n,100*r]},i.hcg.hwb=function(t){var e=t[1]/100,r=e+t[2]/100*(1-e);return[t[0],100*(r-e),100*(1-r)]},i.hwb.hcg=function(t){var e=t[1]/100,r=1-t[2]/100,n=r-e,a=0;return n<1&&(a=(r-n)/(1-n)),[t[0],100*n,100*a]},i.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},i.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},i.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},i.gray.hsl=i.gray.hsv=function(t){return[0,0,t[0]]},i.gray.hwb=function(t){return[0,100,t[0]]},i.gray.cmyk=function(t){return[0,0,0,t[0]]},i.gray.lab=function(t){return[t[0],0,0]},i.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),r=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(r.length)+r},i.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}},function(t,e,r){var n=r(1),a=r(4),o=Object.hasOwnProperty,i={};for(var l in n)o.call(n,l)&&(i[n[l]]=l);var u=t.exports={to:{},get:{}};function s(t,e,r){return Math.min(Math.max(e,t),r)}function c(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}u.get=function(t){var e,r;switch(t.substring(0,3).toLowerCase()){case"hsl":e=u.get.hsl(t),r="hsl";break;case"hwb":e=u.get.hwb(t),r="hwb";break;default:e=u.get.rgb(t),r="rgb"}return e?{model:r,value:e}:null},u.get.rgb=function(t){if(!t)return null;var e,r,a,i=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(a=e[2],e=e[1],r=0;r<3;r++){var l=2*r;i[r]=parseInt(e.slice(l,l+2),16)}a&&(i[3]=parseInt(a,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(a=(e=e[1])[3],r=0;r<3;r++)i[r]=parseInt(e[r]+e[r],16);a&&(i[3]=parseInt(a+a,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(r=0;r<3;r++)i[r]=parseInt(e[r+1],0);e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:o.call(n,e[1])?((i=n[e[1]])[3]=1,i):null:null;for(r=0;r<3;r++)i[r]=Math.round(2.55*parseFloat(e[r+1]));e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}for(r=0;r<3;r++)i[r]=s(i[r],0,255);return i[3]=s(i[3],0,1),i},u.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var r=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,s(parseFloat(e[2]),0,100),s(parseFloat(e[3]),0,100),s(isNaN(r)?1:r,0,1)]}return null},u.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var r=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,s(parseFloat(e[2]),0,100),s(parseFloat(e[3]),0,100),s(isNaN(r)?1:r,0,1)]}return null},u.to.hex=function(){var t=a(arguments);return"#"+c(t[0])+c(t[1])+c(t[2])+(t[3]<1?c(Math.round(255*t[3])):"")},u.to.rgb=function(){var t=a(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},u.to.rgb.percent=function(){var t=a(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"},u.to.hsl=function(){var t=a(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},u.to.hwb=function(){var t=a(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},u.to.keyword=function(t){return i[t.slice(0,3)]}},function(t,e,r){"use strict";var n=r(5),a=Array.prototype.concat,o=Array.prototype.slice,i=t.exports=function(t){for(var e=[],r=0,i=t.length;r<i;r++){var l=t[r];n(l)?e=a.call(e,o.call(l)):e.push(l)}return e};i.wrap=function(t){return function(){return t(i(arguments))}}},function(t,e){t.exports=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))}},function(t,e,r){var n=r(2),a=r(8),o={};Object.keys(n).forEach((function(t){o[t]={},Object.defineProperty(o[t],"channels",{value:n[t].channels}),Object.defineProperty(o[t],"labels",{value:n[t].labels});var e=a(t);Object.keys(e).forEach((function(r){var n=e[r];o[t][r]=function(t){var e=function(e){if(null==e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var r=t(e);if("object"==typeof r)for(var n=r.length,a=0;a<n;a++)r[a]=Math.round(r[a]);return r};return"conversion"in t&&(e.conversion=t.conversion),e}(n),o[t][r].raw=function(t){var e=function(e){return null==e?e:(arguments.length>1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(n)}))})),t.exports=o},function(t,e,r){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},function(t,e,r){var n=r(2);function a(t){var e=function(){for(var t={},e=Object.keys(n),r=e.length,a=0;a<r;a++)t[e[a]]={distance:-1,parent:null};return t}(),r=[t];for(e[t].distance=0;r.length;)for(var a=r.pop(),o=Object.keys(n[a]),i=o.length,l=0;l<i;l++){var u=o[l],s=e[u];-1===s.distance&&(s.distance=e[a].distance+1,s.parent=a,r.unshift(u))}return e}function o(t,e){return function(r){return e(t(r))}}function i(t,e){for(var r=[e[t].parent,t],a=n[e[t].parent][t],i=e[t].parent;e[i].parent;)r.unshift(e[i].parent),a=o(n[e[i].parent][i],a),i=e[i].parent;return a.conversion=r,a}t.exports=function(t){for(var e=a(t),r={},n=Object.keys(e),o=n.length,l=0;l<o;l++){var u=n[l];null!==e[u].parent&&(r[u]=i(u,e))}return r}},function(t,e,r){"use strict";r.r(e),r.d(e,"run",(function(){return me})),r.d(e,"init",(function(){return ve})),r.d(e,"convertBg",(function(){return ke})),r.d(e,"updateStyle",(function(){return we})),r.d(e,"getContrast",(function(){return xe})),r.d(e,"extend",(function(){return Me}));var n={};r.r(n),r.d(n,"color",(function(){return Kt})),r.d(n,"colorBurn",(function(){return Nt})),r.d(n,"colorDodge",(function(){return Ft})),r.d(n,"darken",(function(){return Tt})),r.d(n,"difference",(function(){return qt})),r.d(n,"exclusion",(function(){return Rt})),r.d(n,"hardLight",(function(){return Lt})),r.d(n,"hue",(function(){return $t})),r.d(n,"lighten",(function(){return Dt})),r.d(n,"luminosity",(function(){return zt})),r.d(n,"multiply",(function(){return Pt})),r.d(n,"normal",(function(){return Bt})),r.d(n,"overlay",(function(){return At})),r.d(n,"saturation",(function(){return Vt})),r.d(n,"screen",(function(){return Et})),r.d(n,"softLight",(function(){return It}));var a="(prefers-color-scheme: dark)",o=new RegExp("".concat("js_darkmode__","\\d+")),i="data_color_scheme_dark",l="".concat(1*new Date).concat(Math.round(10*Math.random())),u="data-darkmode-color-".concat(l),s="data-darkmode-bgcolor-".concat(l),c="data-darkmode-original-color-".concat(l),h="data-darkmode-original-bgcolor-".concat(l),f="data-darkmode-bgimage-".concat(l),d="data-darkmode-complementary-bgimagecolor-".concat(l),g=window.getInnerHeight&&window.getInnerHeight()||window.innerHeight||document.documentElement.clientHeight,b={BG_COLOR:["background-color","background-image","background"],TEXT_SHADOW:["text-shadow"],TEXT_COLOR:["-webkit-text-stroke","-webkit-text-stroke-color","text-decoration","text-decoration-color","text-emphasis-color","color","-webkit-text-fill-color"],BORDER_COLOR:["border-image","-webkit-border-image","border","border-top","border-right","border-bottom","border-left","border-color","border-top-color","border-right-color","border-bottom-color","border-left-color","border-block-color","border-block-start-color","border-block-end-color","border-inline-color","border-inline-start-color","border-inline-end-color","outline","outline-color","box-shadow","column-rule","column-rule-color"]},p=Object.keys(b).map((function(t){return b[t].join("|")})).join("|").split("|"),y=["TABLE","TR","TD","TH"],m=/ !important$/,v=/<\$#_SEMICOLON_#\$>/g,k=/\brgba?\([^)]+\)/i,w=/\brgba?\([^)]+\)/gi,x={hasInit:!1,begin:null,showFirstPage:null,error:null,mode:"",whitelist:{tagName:["MPCPS","IFRAME"],attribute:[]},needJudgeFirstPage:!0,delayBgJudge:!1,container:null,cssSelectorsPrefix:"",defaultLightTextColor:"#191919",defaultLightBgColor:"#fff",defaultDarkTextColor:"#a3a3a3",defaultDarkBgColor:"#191919",set:function(t,e,r){var n=e[r];switch(t){case"boolean":"boolean"==typeof n&&(this[r]=n);break;case"string":"string"==typeof n&&""!==n&&(this[r]=n);break;case"function":"function"==typeof n&&(this[r]=n);break;case"dom":n instanceof HTMLElement&&(this[r]=n)}}};function M(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function C(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function O(t,e,r){return e&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var S=[],j=[],B=function(){function t(){C(this,t)}return O(t,[{key:"loopTimes",get:function(){return le.loopTimes}},{key:"isDarkmode",get:function(){return fe.isDarkmode}},{key:"addCss",value:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(r?S:j).push(ce.genCss(t,e.map((function(t){var e=t.key,r=t.value;return ce.genCssKV(e,r)})).join("")))}}]),t}(),P=function(){function t(){C(this,t),M(this,"_plugins",[]),M(this,"length",0),M(this,"loopTimes",0),M(this,"firstPageStyle",""),M(this,"otherPageStyle",""),M(this,"firstPageStyleNoMQ",""),M(this,"otherPageStyleNoMQ","")}return O(t,[{key:"extend",value:function(t){this._plugins.push(new(t(B))),this.length++}},{key:"emit",value:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];this._plugins.forEach((function(e){"function"==typeof e[t]&&e[t].apply(e,r)}))}},{key:"addCss",value:function(t){t?(this.firstPageStyle+=S.join(""),this.firstPageStyleNoMQ+=j.join("")):(this.otherPageStyle+=S.join(""),this.otherPageStyleNoMQ+=j.join(""))}},{key:"resetCss",value:function(){S=[],j=[]}}]),t}();function E(t){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function A(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function T(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var D=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),T(this,"_queue",[]),T(this,"_idx",0),this._prefix=e}var e,r,n;return e=t,(r=[{key:"length",get:function(){return this._queue.length}},{key:"push",value:function(t){var e="".concat(this._prefix).concat(this._idx++);t.classList.add(e),this._queue.push({el:t,className:e,updated:!x.delayBgJudge})}},{key:"forEach",value:function(t){var e=[];for(this._queue.forEach((function(r,n){r.updated&&(e.unshift(n),E(t)&&t(r.el))}));e.length;)this._queue.splice(e.shift(),1)}},{key:"update",value:function(t){this._queue.forEach((function(e){e.updated||Array.prototype.some.call(t,(function(t){return!(1!==t.nodeType||!t.classList.contains(e.className)||(e.el=t,e.updated=!0,0))}))}))}}])&&A(e.prototype,r),n&&A(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function F(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function N(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var L=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),N(this,"_stack",[]),N(this,"_idx",0),this._prefix=e,this.classNameReg=new RegExp("".concat(this._prefix,"\\d+"))}var e,r,n;return e=t,(r=[{key:"push",value:function(t,e,r){var n="".concat(this._prefix).concat(this._idx++);t.classList.add(n),this._stack.unshift({elOld:t,el:t,className:n,cssKV:e,updated:!x.delayBgJudge,cb:r})}},{key:"contains",value:function(t,e){var r=t.getBoundingClientRect(),n=[];for(this._stack.forEach((function(t,e){if(t.updated){t.rect||(t.rect=t.el.getBoundingClientRect());var a=t.rect;r.top>=a.bottom||r.bottom<=a.top||r.left>=a.right||r.right<=a.left||n.unshift(e)}}));n.length;){var a=n.shift(),o=this._stack.splice(a,1)[0];"function"==typeof e&&e(o)}}},{key:"update",value:function(t){this._stack.forEach((function(e){e.updated||Array.prototype.some.call(t,(function(t){return!(1!==t.nodeType||!t.classList.contains(e.className)||(e.el=t,e.updated=!0,0))}))}))}}])&&F(e.prototype,r),n&&F(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function I(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);i=!0);}catch(t){l=!0,a=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return q(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function R(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function $(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var V=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),$(this,"_firstPageStyle",""),$(this,"_otherPageStyle",""),$(this,"_watcher",{}),$(this,"isFinish",!1)}var e,r,n;return e=t,(r=[{key:"genCssKV",value:function(t,e){var r,n;return null===(r=(n=this._watcher)[t])||void 0===r||r.call(n),"".concat(t,": ").concat(e," !important;")}},{key:"genCss",value:function(t,e){return"".concat("dark"===x.mode?"html.".concat(i," "):"").concat(x.cssSelectorsPrefix&&"".concat(x.cssSelectorsPrefix," "),".").concat(t,"{").concat(e,"}")}},{key:"addCss",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this[e?"_firstPageStyle":"_otherPageStyle"]+=t,le.addCss(e)}},{key:"writeStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];!t&&fe.isDarkmode&&(this.isFinish=!0);var e=(fe.isDarkmode?[{target:this,key:["_firstPageStyle","_otherPageStyle"],needMediaQuery:!0}]:[]).concat([{target:le,key:["firstPageStyle","otherPageStyle"],needMediaQuery:!0},{target:le,key:["firstPageStyleNoMQ","otherPageStyleNoMQ"],needMediaQuery:!1}]).map((function(e){var r=e.target,n=I(e.key,2),o=n[0],i=n[1],l=e.needMediaQuery,u="";t?u=o:(r[i]=r[o]+r[i],r[o]="",u=i);var s=r[u];return s?(r[u]="","dark"!==x.mode&&l?"@media ".concat(a," {").concat(s,"}"):s):""})).join("");e&&document.head.insertAdjacentHTML("beforeend",'<style type="text/css">'.concat(e,"</style>"))}},{key:"watch",value:function(t,e){this._watcher[t]=e}},{key:"unwatch",value:function(t){delete this._watcher[t]}}])&&R(e.prototype,r),n&&R(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function K(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function z(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function H(t){return function(t){if(Array.isArray(t))return J(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return J(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return J(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function U(t){var e,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(e=r?[]:[t]).concat.apply(e,H(t.querySelectorAll("*")))}var Q={"ue-table-interlace-color-single":"#fcfcfc","ue-table-interlace-color-double":"#f7faff"};var G=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),z(this,"_els",[]),z(this,"_firstPageEls",[]),z(this,"_delayEls",[]),z(this,"showFirstPage",!1)}var e,r,n;return e=t,(r=[{key:"length",get:function(){return this._els.length}},{key:"set",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._els=t}},{key:"get",value:function(){var t=[];return this._els.length?(t=this._els,fe.isDarkmode&&(this._els=[])):this._delayEls.length?(t=this._delayEls,this._delayEls=[]):x.container&&(t=x.container.querySelectorAll("*")),t}},{key:"delay",value:function(){var t=this;Array.prototype.forEach.call(this._els,(function(e){return t._delayEls.push(e)})),this._els=[]}},{key:"hasDelay",value:function(){return!this._els.length&&(this._delayEls.length>0||null!==x.container)}},{key:"addFirstPageNode",value:function(t){this._firstPageEls.push(t)}},{key:"showFirstPageNodes",value:function(){this._firstPageEls.forEach((function(t){return!t.style.visibility&&(t.style.visibility="visible")})),this.showFirstPage=!0}},{key:"emptyFirstPageNodes",value:function(){this._firstPageEls=[]}}])&&K(e.prototype,r),n&&K(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=r(0),X=r.n(W),Y=r(1),Z=r.n(Y);function tt(t,e,r){return{r:255*r(t.r/255,e.r/255),g:255*r(t.g/255,e.g/255),b:255*r(t.b/255,e.b/255)}}function et(t,e){return e}function rt(t,e){return t*e}function nt(t,e){return t+e-t*e}function at(t,e){return st(e,t)}function ot(t,e){return Math.min(t,e)}function it(t,e){return Math.min(Math.max(t,e),1)}function lt(t,e){return 0===t?0:1===e?1:Math.min(1,t/(1-e))}function ut(t,e){return 1===t?1:0===e?0:1-Math.min(1,(1-t)/e)}function st(t,e){return e<=.5?rt(t,2*e):nt(t,2*e-1)}function ct(t,e){return e<=.5?t-(1-2*e)*t*(1-t):t+(2*e-1)*((t<=.25?((16*t-12)*t+4)*t:Math.sqrt(t))-t)}function ht(t,e){return Math.abs(t-e)}function ft(t,e){return t+e-2*t*e}function dt(t,e,r){return Math.min(Math.max(t||0,e),r)}function gt(t){return{r:dt(t.r,0,255),g:dt(t.g,0,255),b:dt(t.b,0,255),a:dt(t.a,0,1)}}function bt(t){return{r:255*t.r,g:255*t.g,b:255*t.b,a:t.a}}function pt(t){return{r:t.r/255,g:t.g/255,b:t.b/255,a:t.a}}function yt(t,e){void 0===e&&(e=0);var r=Math.pow(10,e);return{r:Math.round(t.r*r)/r,g:Math.round(t.g*r)/r,b:Math.round(t.b*r)/r,a:t.a}}function mt(t,e,r,n,a,o){return(1-e/r)*n+e/r*Math.round((1-t)*a+t*o)}function vt(t,e,r,n,a){void 0===a&&(a={unitInput:!1,unitOutput:!1,roundOutput:!0}),a.unitInput&&(t=bt(t),e=bt(e)),t=gt(t);var o=(e=gt(e)).a+t.a-e.a*t.a,i=r(t,e,n),l=gt({r:mt(t.a,e.a,o,t.r,e.r,i.r),g:mt(t.a,e.a,o,t.g,e.g,i.g),b:mt(t.a,e.a,o,t.b,e.b,i.b),a:o});return l=a.unitOutput?pt(l):a.roundOutput?yt(l):function(t){return yt(t,9)}(l)}function kt(t,e,r){return bt(r(pt(t),pt(e)))}function wt(t){return.3*t.r+.59*t.g+.11*t.b}function xt(t,e){var r=e-wt(t);return function(t){var e=wt(t),r=t.r,n=t.g,a=t.b,o=Math.min(r,n,a),i=Math.max(r,n,a);function l(t){return e+(t-e)*e/(e-o)}function u(t){return e+(t-e)*(1-e)/(i-e)}return o<0&&(r=l(r),n=l(n),a=l(a)),i>1&&(r=u(r),n=u(n),a=u(a)),{r:r,g:n,b:a}}({r:t.r+r,g:t.g+r,b:t.b+r})}function Mt(t){return Math.max(t.r,t.g,t.b)-Math.min(t.r,t.g,t.b)}function Ct(t,e){var r=["r","g","b"].sort((function(e,r){return t[e]-t[r]})),n=r[0],a=r[1],o=r[2],i={r:t.r,g:t.g,b:t.b};return i[o]>i[n]?(i[a]=(i[a]-i[n])*e/(i[o]-i[n]),i[o]=e):i[a]=i[o]=0,i[n]=0,i}function _t(t,e){return xt(Ct(e,Mt(t)),wt(t))}function Ot(t,e){return xt(Ct(t,Mt(e)),wt(t))}function St(t,e){return xt(e,wt(t))}function jt(t,e){return xt(t,wt(e))}function Bt(t,e){return vt(t,e,tt,et)}function Pt(t,e){return vt(t,e,tt,rt)}function Et(t,e){return vt(t,e,tt,nt)}function At(t,e){return vt(t,e,tt,at)}function Tt(t,e){return vt(t,e,tt,ot)}function Dt(t,e){return vt(t,e,tt,it)}function Ft(t,e){return vt(t,e,tt,lt)}function Nt(t,e){return vt(t,e,tt,ut)}function Lt(t,e){return vt(t,e,tt,st)}function It(t,e){return vt(t,e,tt,ct)}function qt(t,e){return vt(t,e,tt,ht)}function Rt(t,e){return vt(t,e,tt,ft)}function $t(t,e){return vt(t,e,kt,_t)}function Vt(t,e){return vt(t,e,kt,Ot)}function Kt(t,e){return vt(t,e,kt,St)}function zt(t,e){return vt(t,e,kt,jt)}Z.a.windowtext=[0,0,0],Z.a.transparent=[255,255,255,0];var Ht=new RegExp(Object.keys(Z.a).map((function(t){return"\\b".concat(t,"\\b")})).join("|"),"ig"),Jt=function(t){var e=t.object();return e.a=e.alpha||1,delete e.alpha,e},Ut=function(t){return t.alpha=t.a,delete t.a,Qt(t)},Qt=function(t){var e=null;try{e=t instanceof X.a?t:X()(t)}catch(e){console.log("ignore the invalid color: `".concat(t,"`"))}return e},Gt=function(t,e){return t.replace(m,"").replace(Ht,(function(t){if(!e&&"transparent"===t)return t;var r=Z.a[t.toLowerCase()];return"".concat(r.length>3?"rgba":"rgb","(").concat(r.toString(),")")}))},Wt=function(t){var e=Gt(t);return k.test(e)?e:""},Xt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"mix";if("[object Array]"!==Object.prototype.toString.call(t)||t.length<1)return null;if(1===t.length)return t[0];for(var r=Qt(t.shift()),a=Qt(t.shift());a;){if(!r&&a)r=a;else if(r||a)r&&a&&(r="mix"===e?r.mix(a,a.alpha()):Ut(n[e](Jt(r),Jt(a))));else{if(0===t.length)break;r=Qt(t.shift())}if(0===t.length)break;a=Qt(t.shift())}return r||null},Yt=function(t){return(299*t[0]+587*t[1]+114*t[2])/1e3},Zt=function(t,e){var r=t/Yt(e),n=Math.min(255,e[0]*r),a=Math.min(255,e[1]*r),o=Math.min(255,e[2]*r);return 0===a||255===n||255===o?a=(1e3*t-299*n-114*o)/587:0===n?n=(1e3*t-587*a-114*o)/299:0!==o&&255!==a||(o=(1e3*t-299*n-587*a)/114),X.a.rgb(n,a,o)};function te(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);i=!0);}catch(t){l=!0,a=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}(t,e)||re(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ee(t){return function(t){if(Array.isArray(t))return ne(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||re(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function re(t,e){if(t){if("string"==typeof t)return ne(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ne(t,e):void 0}}function ne(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ae(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function oe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var ie=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),oe(this,"_idx",0),oe(this,"_defaultDarkTextColorRgb",null),oe(this,"_defaultDarkBgColorRgb",null),oe(this,"_defaultDarkBgColorHSL",null),oe(this,"_defaultDarkTextColorBrightness",null),oe(this,"_defaultDarkBgColorBrightness",null),oe(this,"_defaultDarkBgColorHslBrightness",null),oe(this,"_maxLimitOffsetBrightness",null),oe(this,"isDarkmode",!1)}var e,r,n;return e=t,(r=[{key:"_adjustBrightness",value:function(t,e,r,n,a){var o,i=t.alpha(),l="";if(r.isBgColor){if(i>=.05&&(e[f]&&delete e[f],e[d])){if(e[d]===t.toString()||this.getContrast(e[d],t.toString())<1.1)return{newColor:a?t.toString():"",extStyle:l};U(e).forEach((function(t){delete t[d]}))}if(o=this._adjustBackgroundBrightness(t),!r.hasInlineColor){var u=e[c]||x.defaultLightTextColor,h=Qt(u);if(h){var g=this._adjustBrightness(h,e,{isTextColor:!0,parentElementBgColorStr:o||t},n,a);g.newColor?l+=ce.genCssKV("color",g.newColor):l+=ce.genCssKV("color",h)}}}else if(r.isTextColor||r.isBorderColor){var b=r.parentElementBgColorStr||r.isTextColor&&e[s]||x.defaultDarkBgColor,p=Qt(b);if(p&&!e[f]){o=this._adjustTextBrightness(t,p);var y="";n?y="ByUpdateStyle":a&&(y="ByReset"),le.emit("afterConvertTextColor".concat(y),e,{fontColor:o,bgColor:p})}}else r.isTextShadow&&(e[f]||(o=this._adjustBackgroundBrightness(t)));return{newColor:o&&t.toString()!==o.toString()&&o.alpha(i).rgb(),extStyle:l}}},{key:"_adjustTextBrightness",value:function(t,e){var r=e.rgb().array(),n=e.alpha(),a=Yt(r)*n+this._defaultDarkBgColorBrightness*(1-n),o=t.rgb().array(),i=t.hsl().array(),l=t.alpha(),u=Yt(o),s=Math.abs(a-u);if(u>=250)return t;if(s>this._maxLimitOffsetBrightness&&a<=this._defaultDarkBgColorBrightness+2)return Zt(this._maxLimitOffsetBrightness+a,o).alpha(l);if(s>=65)return t;if(a>=100){if(i[2]>50){i[2]=90-i[2];var c=X.a.hsl.apply(X.a,ee(i)).alpha(l);return this._adjustTextBrightness(c,e)}return Zt(Math.min(this._maxLimitOffsetBrightness,a-65),o).alpha(l)}if(i[2]<=40){i[2]=90-i[2];var h=X.a.hsl.apply(X.a,ee(i)).alpha(l);return this._adjustTextBrightness(h,e)}return Zt(Math.min(this._maxLimitOffsetBrightness,a+65),o).alpha(l)}},{key:"_adjustBackgroundBrightness",value:function(t){var e=t.rgb().array(),r=t.hsl().array(),n=t.alpha(),a=Yt(e),o=t;return 0===r[1]&&r[2]>40||a>250?o=X.a.hsl(0,0,Math.min(100,100+this._defaultDarkBgColorHslBrightness-r[2])):a>190?o=Zt(190,e).alpha(n):r[2]<22&&(r[2]=22,o=X.a.hsl.apply(X.a,ee(r))),o.alpha(n).rgb()}},{key:"_updateBgWithGradient",value:function(t,e,r,n,a,o,i){var l=Xt([e[s]||x.defaultDarkBgColor,t],"normal"),u=(e[h]||x.defaultLightBgColor).split("|").concat(t.toString()).join("|");U(e).forEach((function(t){t[s]=l,t[h]=u}));var c=n.slice(-1)[0];if("color"===c[0]){var f=this._adjustBrightness(Qt(Gt(c[1])),e,{isBgColor:!1,isTextShadow:!1,isTextColor:!0,isBorderColor:!1,hasInlineColor:a},o,i);if(f.newColor)return ce.genCss(r,ce.genCssKV("color",f.newColor))}return""}},{key:"_try",value:function(t){try{return t()}catch(t){console.log("An error occurred when running the dark mode conversion algorithm\n",t),"function"==typeof x.error&&x.error(t)}}},{key:"init",value:function(){this._defaultDarkTextColorRgb=Qt(x.defaultDarkTextColor).rgb().array(),this._defaultDarkBgColorRgb=Qt(x.defaultDarkBgColor).rgb().array(),this._defaultDarkBgColorHSL=Qt(x.defaultDarkBgColor).hsl().array(),this._defaultDarkTextColorBrightness=Yt(this._defaultDarkTextColorRgb),this._defaultDarkBgColorBrightness=Yt(this._defaultDarkBgColorRgb),this._defaultDarkBgColorHslBrightness=this._defaultDarkBgColorHSL[2],this._maxLimitOffsetBrightness=this._defaultDarkTextColorBrightness-this._defaultDarkBgColorBrightness}},{key:"convert",value:function(t,e,r,n){var a=this;le.resetCss();var i="";r?i="ByUpdateStyle":n&&(i="ByReset"),le.emit("beforeConvertNode".concat(i),t);var l="",g="";if(this.isDarkmode||r||n){var M=t.nodeName;if(x.whitelist.tagName.indexOf(M)>-1)return"";if(x.whitelist.attribute.some((function(e){return t.hasAttribute(e)})))return"";var C=t.style;e||(e=(C.cssText&&C.cssText.replace(/("[^;]*);([^;]*")|('[^;]*);([^;]*')/g,"$1$3".concat("<$#_SEMICOLON_#$>","$2$4")).split(";")||[]).map((function(t){var e=t.indexOf(":");return[t.slice(0,e).toLowerCase(),t.slice(e+1).replace(v,";")].map((function(t){return(t||"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}))})));var _=!1,O=!1,S=!1,j=null,B=null;e=e.filter((function(t){var e=te(t,2),r=e[0],n=e[1];return"color"===r?_=!0:/background/i.test(r)&&(O=!0,"background-position"===r?j=n:"background-size"===r&&(B=n)),(/background/i.test(r)||/^(-webkit-)?border-image/.test(r))&&/url\([^)]*\)/i.test(n)&&(S=!0),p.indexOf(r)>-1})).sort((function(t,e){var r=te(t,1)[0],n=te(e,1)[0];return"color"===r||"background-image"===r&&"background-color"===n||0===n.indexOf("-webkit-text")?1:-1})),y.indexOf(M)>-1&&!O&&this._try((function(){var r=function(t){var e=null;return Array.prototype.some.call(t.classList,(function(t){return!!Q[t]&&(e=Q[t],!0)})),e}(t);if(r||(r=t.getAttribute("bgcolor")),r){var n=Qt(r);n&&(e.unshift(["background-color",n.toString()]),O=!0)}})),"FONT"!==M||_||this._try((function(){var r=t.getAttribute("color");if(r){var n=Qt(r);n&&(e.push(["color",n.toString()]),_=!0)}}));var P="",E="",A=0;e.some((function(t,e){var r=te(t,2),n=r[0],o=r[1];return a._try((function(){if(0!==n.indexOf("-webkit-text"))return A=e,!0;switch(n){case"-webkit-text-fill-color":P=Wt(o);break;case"-webkit-text-stroke":var t=o.split(" ");2===t.length&&(E=Wt(t[1]));break;case"-webkit-text-stroke-color":E=Wt(o)}return!1}))})),P&&(_?e[e.length-1]=["-webkit-text-fill-color",P]:(e.push(["-webkit-text-fill-color",P]),_=!0)),A&&(e.splice(0,A),E&&e.unshift(["-webkit-text-stroke-color",E]));var T="",D="";if((r||n)&&t.className&&"string"==typeof t.className){var F=t.className.match(o);F&&(T=F[0]),(F=t.className.match(se.classNameReg))&&(D=F[0])}var N="",L=n;L&&ce.watch("color",(function(){L=!1,ce.unwatch("color")})),e.forEach((function(o){var i=te(o,2),p=i[0],y=i[1];return a._try((function(){var o,i=y,v=!1,M=b.BG_COLOR.indexOf(p)>-1,P=b.TEXT_SHADOW.indexOf(p)>-1,E=b.TEXT_COLOR.indexOf(p),A=b.BORDER_COLOR.indexOf(p)>-1,T=/gradient/.test(y),F=[],I="";if(y=Gt(y,T),k.test(y)){if(T){for(var q=w.exec(y);q;)F.push(q[0]),q=w.exec(y);o=Xt(F)}var R=0;y=y.replace(w,(function(e){T&&(e=o,v=!0);var i=Qt(e);if((null==i?void 0:i.alpha())>=.05){var l=a._adjustBrightness(i,t,{isBgColor:M,isTextShadow:P,isTextColor:E>-1,isBorderColor:A,hasInlineColor:_},r,n),d=!S&&l.newColor;if(I+=l.extStyle,M||E>=5){var g=d?d.toString():e;0===R&&U(t).forEach((function(t){M?(t[s]=g,t[h]=(t[h]||x.defaultLightBgColor).split("|").concat(e).join("|")):(t[u]=g,t[c]=e);var r=Qt(g);M&&(null==r?void 0:r.alpha())>=.05&&t[f]&&delete t[f]}))}return d&&(v=!0),R++,d||e}return e})).replace(/\s?!\s?important/gi,"")}if(I&&(N+=I),!(t instanceof SVGElement)){var $=/^background/.test(p),V=/^(-webkit-)?border-image/.test(p);if(($||V)&&/url\([^)]*\)/i.test(y)){v=!0;var K=Xt((t[h]||x.defaultLightBgColor).split("|"),"normal").toString();if(y=y.replace(/^(.*?)url\(([^)]*)\)(.*)$/i,(function(e){var r=e,a="";return t[f]||U(t).forEach((function(t){t[f]=!0})),$?(a=ce.genCssKV(p,K?"".concat(r,",linear-gradient(").concat(K,", ").concat(K,")"):r),j&&(N+=ce.genCssKV("background-position",j),a+=ce.genCssKV("background-position",K?"".concat(j,",top left"):j)),B&&(N+=ce.genCssKV("background-size",B),a+=ce.genCssKV("background-size",K?"".concat(B,",100%"):B)),n||(D?(g+=ce.genCss(D,a),U(t).forEach((function(t){t[d]=K||r}))):se.push(t,a,(function(){U(t).forEach((function(t){t[d]=K||r}))})))):!K||O||n||(a=ce.genCssKV("background-image","linear-gradient(".concat(K,", ").concat(K,")")),D?g+=ce.genCss(D,a):se.push(t,a)),r})),!_){var z=t[c]||x.defaultLightTextColor;N+=ce.genCssKV("color",z),U(t).forEach((function(t){t[u]=z}))}}}(v||n)&&(!r&&!n&&m.test(i)&&(C[p]=i.replace(m,"")),T?n||(D?(g+=ce.genCss(D,ce.genCssKV(p,y)),/^background/.test(p)&&!/url\([^)]*\)/i.test(y)&&(l+=a._updateBgWithGradient(o,t,D,e,_,r,n))):se.push(t,ce.genCssKV(p,y),(function(i){/^background/.test(p)&&!/url\([^)]*\)/i.test(y)&&(l+=a._updateBgWithGradient(o,t,i.className,e,_,r,n))}))):("color"===p&&(L=!1,ce.unwatch("color")),N+=ce.genCssKV(p,!v&&n?t.style[p]:y)))}))})),L&&(N+=ce.genCssKV("color",t.style.color||t[u]||x.defaultDarkTextColor),ce.unwatch("color")),N&&(T||(T="".concat("js_darkmode__").concat(this._idx++),t.classList.add(T)),l+=N?ce.genCss(T,N):""),l+=g,r||!function(t){return t.textContent.replace(/\s/g,"").length>0}(t)||n||(x.delayBgJudge?ue.push(t):se.contains(t,(function(t){l+=ce.genCss(t.className,t.cssKV),"function"==typeof t.cb&&t.cb(t)})))}return le.emit("afterConvertNode".concat(i),t),l}},{key:"getContrast",value:function(t,e){var r=Qt(t),n=Qt(e);return r&&n?r.contrast(n):0}}])&&ae(e.prototype,r),n&&ae(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),le=new P,ue=new D("".concat("js_darkmode__","text__")),se=new L("".concat("js_darkmode__","bg__")),ce=new V,he=new G,fe=new ie;function de(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);i=!0);}catch(t){l=!0,a=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ge(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ge(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ge(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var be=new RegExp("".concat("js_darkmode__","[^ ]+"),"g"),pe=null,ye=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{type:"dom"};if(e.force&&(ce.isFinish=!1),!ce.isFinish)try{fe.isDarkmode=x.mode?"dark"===x.mode:t.matches,"dom"===e.type?(fe.isDarkmode&&"function"==typeof x.begin&&x.begin(he.hasDelay()),Array.prototype.forEach.call(he.get(),(function(t){if(fe.isDarkmode&&t.className&&"string"==typeof t.className&&(t.className=t.className.replace(be,"")),fe.isDarkmode||le.length)if(x.needJudgeFirstPage){var e=t.getBoundingClientRect(),r=e.top,n=e.bottom;r<=0&&n<=0?ce.addCss(fe.convert(t)):r>0&&r<g||n>0&&n<g?(he.addFirstPageNode(t),ce.addCss(fe.convert(t),!0)):(x.needJudgeFirstPage=!1,ce.writeStyle(!0),he.showFirstPageNodes(),"function"==typeof x.showFirstPage&&x.showFirstPage(),ce.addCss(fe.convert(t)))}else ce.addCss(fe.convert(t))})),le.loopTimes++):"bg"===e.type&&fe.isDarkmode&&ue.forEach((function(t){return se.contains(t,(function(t){ce.addCss(ce.genCss(t.className,t.cssKV)),"function"==typeof t.cb&&t.cb(t),[t.elOld,t.el].forEach((function(t){var e,r,n,a,o,i,l=[[u,null!==(e=t[u])&&void 0!==e?e:null],[s,null!==(r=t[s])&&void 0!==r?r:null],[c,null!==(n=t[c])&&void 0!==n?n:null],[h,null!==(a=t[h])&&void 0!==a?a:null],[f,null!==(o=t[f])&&void 0!==o?o:null],[d,null!==(i=t[d])&&void 0!==i?i:null]],g=U(t,!0);g.forEach((function(t){l.forEach((function(e){var r=de(e,2),n=r[0],a=r[1];null===a?delete t[n]:t[n]=a}))})),g.forEach((function(t){ce.addCss(fe.convert(t,void 0,!1,!0))}))}))}))})),(x.needJudgeFirstPage||!x.needJudgeFirstPage&&!he.showFirstPage)&&"function"==typeof x.showFirstPage&&x.showFirstPage(),ce.writeStyle(),he.emptyFirstPageNodes(),fe.isDarkmode||(x.needJudgeFirstPage=!1,x.delayBgJudge=!1,null===x.container&&"dom"===e.type&&he.length&&he.delay())}catch(t){console.log("An error occurred when running the dark mode conversion algorithm\n",t),"function"==typeof x.error&&x.error(t)}};function me(t,e){ve(e),he.set(t),ye(pe,{force:!0,type:"dom"})}function ve(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!x.hasInit){x.hasInit=!0;var e=x.whitelist.tagName,r=x.whitelist.attribute;t.whitelist&&(t.whitelist.tagName instanceof Array&&t.whitelist.tagName.forEach((function(t){t=t.toUpperCase(),-1===e.indexOf(t)&&e.push(t)})),t.whitelist.attribute instanceof Array&&t.whitelist.attribute.forEach((function(t){-1===r.indexOf(t)&&r.push(t)}))),["dark","light"].indexOf(t.mode)>-1&&(x.set("string",t,"mode"),"dark"===t.mode&&document.getElementsByTagName("html")[0].classList.add(i)),x.set("function",t,"begin"),x.set("function",t,"showFirstPage"),x.set("function",t,"error"),x.set("boolean",t,"needJudgeFirstPage"),x.set("boolean",t,"delayBgJudge"),x.set("dom",t,"container"),x.set("string",t,"cssSelectorsPrefix"),x.set("string",t,"defaultLightTextColor"),x.set("string",t,"defaultLightBgColor"),x.set("string",t,"defaultDarkTextColor"),x.set("string",t,"defaultDarkBgColor"),fe.init(),!x.mode&&null===pe&&window.matchMedia&&(pe=window.matchMedia(a)).addListener(ye)}}function ke(t){he.set(t),null!==x.container&&(se.update(t),ue.update(t)),ye(pe,{force:!0,type:"bg"})}function we(t,e){ce.isFinish&&(ce.addCss(fe.convert(t,e?Object.keys(e).map((function(t){return[t,e[t]]})):void 0,!0),!1),ce.writeStyle())}function xe(t,e){return fe.getContrast(t,e)}function Me(t){t.forEach((function(t){return le.extend(t)}))}}])}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Darkmode",[],e):"object"==typeof exports?exports.Darkmode=e():t.Darkmode=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=9)}([function(t,e,r){"use strict";var n=r(3),a=r(6),o=[].slice,i=["keyword","gray","hex"],l={};Object.keys(a).forEach((function(t){l[o.call(a[t].labels).sort().join("")]=t}));var u={};function s(t,e){if(!(this instanceof s))return new s(t,e);if(e&&e in i&&(e=null),e&&!(e in a))throw new Error("Unknown model: "+e);var r,c;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof s)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var h=n.get(t);if(null===h)throw new Error("Unable to parse color from string: "+t);this.model=h.model,c=a[this.model].channels,this.color=h.value.slice(0,c),this.valpha="number"==typeof h.value[c]?h.value[c]:1}else if(t.length){this.model=e||"rgb",c=a[this.model].channels;var f=o.call(t,0,c);this.color=d(f,c),this.valpha="number"==typeof t[c]?t[c]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var g=Object.keys(t);"alpha"in t&&(g.splice(g.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var b=g.sort().join("");if(!(b in l))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=l[b];var p=a[this.model].labels,y=[];for(r=0;r<p.length;r++)y.push(t[p[r]]);this.color=d(y)}if(u[this.model])for(c=a[this.model].channels,r=0;r<c;r++){var m=u[this.model][r];m&&(this.color[r]=m(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function c(t,e,r){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(u[t]||(u[t]=[]))[e]=r})),t=t[0],function(n){var a;return arguments.length?(r&&(n=r(n)),(a=this[t]()).color[e]=n,a):(a=this[t]().color[e],r&&(a=r(a)),a)}}function h(t){return function(e){return Math.max(0,Math.min(t,e))}}function f(t){return Array.isArray(t)?t:[t]}function d(t,e){for(var r=0;r<e;r++)"number"!=typeof t[r]&&(t[r]=0);return t}s.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var e=this.model in n.to?this:this.rgb(),r=1===(e=e.round("number"==typeof t?t:1)).valpha?e.color:e.color.concat(this.valpha);return n.to[e.model](r)},percentString:function(t){var e=this.rgb().round("number"==typeof t?t:1),r=1===e.valpha?e.color:e.color.concat(this.valpha);return n.to.rgb.percent(r)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},e=a[this.model].channels,r=a[this.model].labels,n=0;n<e;n++)t[r[n]]=this.color[n];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new s(this.color.map(function(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new s(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:c("rgb",0,h(255)),green:c("rgb",1,h(255)),blue:c("rgb",2,h(255)),hue:c(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:c("hsl",1,h(100)),lightness:c("hsl",2,h(100)),saturationv:c("hsv",1,h(100)),value:c("hsv",2,h(100)),chroma:c("hcg",1,h(100)),gray:c("hcg",2,h(100)),white:c("hwb",1,h(100)),wblack:c("hwb",2,h(100)),cyan:c("cmyk",0,h(100)),magenta:c("cmyk",1,h(100)),yellow:c("cmyk",2,h(100)),black:c("cmyk",3,h(100)),x:c("xyz",0,h(100)),y:c("xyz",1,h(100)),z:c("xyz",2,h(100)),l:c("lab",0,h(100)),a:c("lab",1),b:c("lab",2),keyword:function(t){return arguments.length?new s(t):a[this.model].keyword(this.color)},hex:function(t){return arguments.length?new s(t):n.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity:function(){for(var t=this.rgb().color,e=[],r=0;r<t.length;r++){var n=t[r]/255;e[r]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),r=t.luminosity();return e>r?(e+.05)/(r+.05):(r+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten:function(t){var e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken:function(t){var e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate:function(t){var e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate:function(t){var e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten:function(t){var e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken:function(t){var e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale:function(){var t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return s.rgb(e,e,e)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var e=this.hsl(),r=e.color[0];return r=(r=(r+t)%360)<0?360+r:r,e.color[0]=r,e},mix:function(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);var r=t.rgb(),n=this.rgb(),a=void 0===e?.5:e,o=2*a-1,i=r.alpha()-n.alpha(),l=((o*i==-1?o:(o+i)/(1+o*i))+1)/2,u=1-l;return s.rgb(l*r.red()+u*n.red(),l*r.green()+u*n.green(),l*r.blue()+u*n.blue(),r.alpha()*a+n.alpha()*(1-a))}},Object.keys(a).forEach((function(t){if(-1===i.indexOf(t)){var e=a[t].channels;s.prototype[t]=function(){if(this.model===t)return new s(this);if(arguments.length)return new s(arguments,t);var r="number"==typeof arguments[e]?e:this.valpha;return new s(f(a[this.model][t].raw(this.color)).concat(r),t)},s[t]=function(r){return"number"==typeof r&&(r=d(o.call(arguments),e)),new s(r,t)}}})),t.exports=s},function(t,e,r){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},function(t,e,r){var n=r(7),a={};for(var o in n)n.hasOwnProperty(o)&&(a[n[o]]=o);var i=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var l in i)if(i.hasOwnProperty(l)){if(!("channels"in i[l]))throw new Error("missing channels property: "+l);if(!("labels"in i[l]))throw new Error("missing channel labels property: "+l);if(i[l].labels.length!==i[l].channels)throw new Error("channel and label counts mismatch: "+l);var u=i[l].channels,s=i[l].labels;delete i[l].channels,delete i[l].labels,Object.defineProperty(i[l],"channels",{value:u}),Object.defineProperty(i[l],"labels",{value:s})}i.rgb.hsl=function(t){var e,r,n=t[0]/255,a=t[1]/255,o=t[2]/255,i=Math.min(n,a,o),l=Math.max(n,a,o),u=l-i;return l===i?e=0:n===l?e=(a-o)/u:a===l?e=2+(o-n)/u:o===l&&(e=4+(n-a)/u),(e=Math.min(60*e,360))<0&&(e+=360),r=(i+l)/2,[e,100*(l===i?0:r<=.5?u/(l+i):u/(2-l-i)),100*r]},i.rgb.hsv=function(t){var e,r,n,a,o,i=t[0]/255,l=t[1]/255,u=t[2]/255,s=Math.max(i,l,u),c=s-Math.min(i,l,u),h=function(t){return(s-t)/6/c+.5};return 0===c?a=o=0:(o=c/s,e=h(i),r=h(l),n=h(u),i===s?a=n-r:l===s?a=1/3+e-n:u===s&&(a=2/3+r-e),a<0?a+=1:a>1&&(a-=1)),[360*a,100*o,100*s]},i.rgb.hwb=function(t){var e=t[0],r=t[1],n=t[2];return[i.rgb.hsl(t)[0],100*(1/255*Math.min(e,Math.min(r,n))),100*(n=1-1/255*Math.max(e,Math.max(r,n)))]},i.rgb.cmyk=function(t){var e,r=t[0]/255,n=t[1]/255,a=t[2]/255;return[100*((1-r-(e=Math.min(1-r,1-n,1-a)))/(1-e)||0),100*((1-n-e)/(1-e)||0),100*((1-a-e)/(1-e)||0),100*e]},i.rgb.keyword=function(t){var e=a[t];if(e)return e;var r,o,i,l=1/0;for(var u in n)if(n.hasOwnProperty(u)){var s=n[u],c=(o=t,i=s,Math.pow(o[0]-i[0],2)+Math.pow(o[1]-i[1],2)+Math.pow(o[2]-i[2],2));c<l&&(l=c,r=u)}return r},i.keyword.rgb=function(t){return n[t]},i.rgb.xyz=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*e+.7152*r+.0722*n),100*(.0193*e+.1192*r+.9505*n)]},i.rgb.lab=function(t){var e=i.rgb.xyz(t),r=e[0],n=e[1],a=e[2];return n/=100,a/=108.883,r=(r/=95.047)>.008856?Math.pow(r,1/3):7.787*r+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(r-n),200*(n-(a=a>.008856?Math.pow(a,1/3):7.787*a+16/116))]},i.hsl.rgb=function(t){var e,r,n,a,o,i=t[0]/360,l=t[1]/100,u=t[2]/100;if(0===l)return[o=255*u,o,o];e=2*u-(r=u<.5?u*(1+l):u+l-u*l),a=[0,0,0];for(var s=0;s<3;s++)(n=i+1/3*-(s-1))<0&&n++,n>1&&n--,o=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,a[s]=255*o;return a},i.hsl.hsv=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,a=r,o=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,a*=o<=1?o:2-o,[e,100*(0===n?2*a/(o+a):2*r/(n+r)),100*((n+r)/2)]},i.hsv.rgb=function(t){var e=t[0]/60,r=t[1]/100,n=t[2]/100,a=Math.floor(e)%6,o=e-Math.floor(e),i=255*n*(1-r),l=255*n*(1-r*o),u=255*n*(1-r*(1-o));switch(n*=255,a){case 0:return[n,u,i];case 1:return[l,n,i];case 2:return[i,n,u];case 3:return[i,l,n];case 4:return[u,i,n];case 5:return[n,i,l]}},i.hsv.hsl=function(t){var e,r,n,a=t[0],o=t[1]/100,i=t[2]/100,l=Math.max(i,.01);return n=(2-o)*i,r=o*l,[a,100*(r=(r/=(e=(2-o)*l)<=1?e:2-e)||0),100*(n/=2)]},i.hwb.rgb=function(t){var e,r,n,a,o,i,l,u=t[0]/360,s=t[1]/100,c=t[2]/100,h=s+c;switch(h>1&&(s/=h,c/=h),n=6*u-(e=Math.floor(6*u)),0!=(1&e)&&(n=1-n),a=s+n*((r=1-c)-s),e){default:case 6:case 0:o=r,i=a,l=s;break;case 1:o=a,i=r,l=s;break;case 2:o=s,i=r,l=a;break;case 3:o=s,i=a,l=r;break;case 4:o=a,i=s,l=r;break;case 5:o=r,i=s,l=a}return[255*o,255*i,255*l]},i.cmyk.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,a=t[3]/100;return[255*(1-Math.min(1,e*(1-a)+a)),255*(1-Math.min(1,r*(1-a)+a)),255*(1-Math.min(1,n*(1-a)+a))]},i.xyz.rgb=function(t){var e,r,n,a=t[0]/100,o=t[1]/100,i=t[2]/100;return r=-.9689*a+1.8758*o+.0415*i,n=.0557*a+-.204*o+1.057*i,e=(e=3.2406*a+-1.5372*o+-.4986*i)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(e=Math.min(Math.max(0,e),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]},i.xyz.lab=function(t){var e=t[0],r=t[1],n=t[2];return r/=100,n/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(e-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},i.lab.xyz=function(t){var e,r,n,a=t[0];e=t[1]/500+(r=(a+16)/116),n=r-t[2]/200;var o=Math.pow(r,3),i=Math.pow(e,3),l=Math.pow(n,3);return r=o>.008856?o:(r-16/116)/7.787,e=i>.008856?i:(e-16/116)/7.787,n=l>.008856?l:(n-16/116)/7.787,[e*=95.047,r*=100,n*=108.883]},i.lab.lch=function(t){var e,r=t[0],n=t[1],a=t[2];return(e=360*Math.atan2(a,n)/2/Math.PI)<0&&(e+=360),[r,Math.sqrt(n*n+a*a),e]},i.lch.lab=function(t){var e,r=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[r,n*Math.cos(e),n*Math.sin(e)]},i.rgb.ansi16=function(t){var e=t[0],r=t[1],n=t[2],a=1 in arguments?arguments[1]:i.rgb.hsv(t)[2];if(0===(a=Math.round(a/50)))return 30;var o=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(e/255));return 2===a&&(o+=60),o},i.hsv.ansi16=function(t){return i.rgb.ansi16(i.hsv.rgb(t),t[2])},i.rgb.ansi256=function(t){var e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},i.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),[e=e/10.5*255,e,e];var r=.5*(1+~~(t>50));return[(1&e)*r*255,(e>>1&1)*r*255,(e>>2&1)*r*255]},i.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var r;return t-=16,[Math.floor(t/36)/5*255,Math.floor((r=t%36)/6)/5*255,r%6/5*255]},i.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},i.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var r=e[0];3===e[0].length&&(r=r.split("").map((function(t){return t+t})).join(""));var n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},i.rgb.hcg=function(t){var e,r=t[0]/255,n=t[1]/255,a=t[2]/255,o=Math.max(Math.max(r,n),a),i=Math.min(Math.min(r,n),a),l=o-i;return e=l<=0?0:o===r?(n-a)/l%6:o===n?2+(a-r)/l:4+(r-n)/l+4,e/=6,[360*(e%=1),100*l,100*(l<1?i/(1-l):0)]},i.hsl.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1,a=0;return(n=r<.5?2*e*r:2*e*(1-r))<1&&(a=(r-.5*n)/(1-n)),[t[0],100*n,100*a]},i.hsv.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=e*r,a=0;return n<1&&(a=(r-n)/(1-n)),[t[0],100*n,100*a]},i.hcg.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100;if(0===r)return[255*n,255*n,255*n];var a,o=[0,0,0],i=e%1*6,l=i%1,u=1-l;switch(Math.floor(i)){case 0:o[0]=1,o[1]=l,o[2]=0;break;case 1:o[0]=u,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=l;break;case 3:o[0]=0,o[1]=u,o[2]=1;break;case 4:o[0]=l,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=u}return a=(1-r)*n,[255*(r*o[0]+a),255*(r*o[1]+a),255*(r*o[2]+a)]},i.hcg.hsv=function(t){var e=t[1]/100,r=e+t[2]/100*(1-e),n=0;return r>0&&(n=e/r),[t[0],100*n,100*r]},i.hcg.hsl=function(t){var e=t[1]/100,r=t[2]/100*(1-e)+.5*e,n=0;return r>0&&r<.5?n=e/(2*r):r>=.5&&r<1&&(n=e/(2*(1-r))),[t[0],100*n,100*r]},i.hcg.hwb=function(t){var e=t[1]/100,r=e+t[2]/100*(1-e);return[t[0],100*(r-e),100*(1-r)]},i.hwb.hcg=function(t){var e=t[1]/100,r=1-t[2]/100,n=r-e,a=0;return n<1&&(a=(r-n)/(1-n)),[t[0],100*n,100*a]},i.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},i.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},i.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},i.gray.hsl=i.gray.hsv=function(t){return[0,0,t[0]]},i.gray.hwb=function(t){return[0,100,t[0]]},i.gray.cmyk=function(t){return[0,0,0,t[0]]},i.gray.lab=function(t){return[t[0],0,0]},i.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),r=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(r.length)+r},i.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}},function(t,e,r){var n=r(1),a=r(4),o=Object.hasOwnProperty,i={};for(var l in n)o.call(n,l)&&(i[n[l]]=l);var u=t.exports={to:{},get:{}};function s(t,e,r){return Math.min(Math.max(e,t),r)}function c(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}u.get=function(t){var e,r;switch(t.substring(0,3).toLowerCase()){case"hsl":e=u.get.hsl(t),r="hsl";break;case"hwb":e=u.get.hwb(t),r="hwb";break;default:e=u.get.rgb(t),r="rgb"}return e?{model:r,value:e}:null},u.get.rgb=function(t){if(!t)return null;var e,r,a,i=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(a=e[2],e=e[1],r=0;r<3;r++){var l=2*r;i[r]=parseInt(e.slice(l,l+2),16)}a&&(i[3]=parseInt(a,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(a=(e=e[1])[3],r=0;r<3;r++)i[r]=parseInt(e[r]+e[r],16);a&&(i[3]=parseInt(a+a,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(r=0;r<3;r++)i[r]=parseInt(e[r+1],0);e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:o.call(n,e[1])?((i=n[e[1]])[3]=1,i):null:null;for(r=0;r<3;r++)i[r]=Math.round(2.55*parseFloat(e[r+1]));e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}for(r=0;r<3;r++)i[r]=s(i[r],0,255);return i[3]=s(i[3],0,1),i},u.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var r=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,s(parseFloat(e[2]),0,100),s(parseFloat(e[3]),0,100),s(isNaN(r)?1:r,0,1)]}return null},u.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var r=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,s(parseFloat(e[2]),0,100),s(parseFloat(e[3]),0,100),s(isNaN(r)?1:r,0,1)]}return null},u.to.hex=function(){var t=a(arguments);return"#"+c(t[0])+c(t[1])+c(t[2])+(t[3]<1?c(Math.round(255*t[3])):"")},u.to.rgb=function(){var t=a(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},u.to.rgb.percent=function(){var t=a(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"},u.to.hsl=function(){var t=a(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},u.to.hwb=function(){var t=a(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},u.to.keyword=function(t){return i[t.slice(0,3)]}},function(t,e,r){"use strict";var n=r(5),a=Array.prototype.concat,o=Array.prototype.slice,i=t.exports=function(t){for(var e=[],r=0,i=t.length;r<i;r++){var l=t[r];n(l)?e=a.call(e,o.call(l)):e.push(l)}return e};i.wrap=function(t){return function(){return t(i(arguments))}}},function(t,e){t.exports=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))}},function(t,e,r){var n=r(2),a=r(8),o={};Object.keys(n).forEach((function(t){o[t]={},Object.defineProperty(o[t],"channels",{value:n[t].channels}),Object.defineProperty(o[t],"labels",{value:n[t].labels});var e=a(t);Object.keys(e).forEach((function(r){var n=e[r];o[t][r]=function(t){var e=function(e){if(null==e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var r=t(e);if("object"==typeof r)for(var n=r.length,a=0;a<n;a++)r[a]=Math.round(r[a]);return r};return"conversion"in t&&(e.conversion=t.conversion),e}(n),o[t][r].raw=function(t){var e=function(e){return null==e?e:(arguments.length>1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(n)}))})),t.exports=o},function(t,e,r){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},function(t,e,r){var n=r(2);function a(t){var e=function(){for(var t={},e=Object.keys(n),r=e.length,a=0;a<r;a++)t[e[a]]={distance:-1,parent:null};return t}(),r=[t];for(e[t].distance=0;r.length;)for(var a=r.pop(),o=Object.keys(n[a]),i=o.length,l=0;l<i;l++){var u=o[l],s=e[u];-1===s.distance&&(s.distance=e[a].distance+1,s.parent=a,r.unshift(u))}return e}function o(t,e){return function(r){return e(t(r))}}function i(t,e){for(var r=[e[t].parent,t],a=n[e[t].parent][t],i=e[t].parent;e[i].parent;)r.unshift(e[i].parent),a=o(n[e[i].parent][i],a),i=e[i].parent;return a.conversion=r,a}t.exports=function(t){for(var e=a(t),r={},n=Object.keys(e),o=n.length,l=0;l<o;l++){var u=n[l];null!==e[u].parent&&(r[u]=i(u,e))}return r}},function(t,e,r){"use strict";r.r(e),r.d(e,"run",(function(){return me})),r.d(e,"init",(function(){return ve})),r.d(e,"convertBg",(function(){return ke})),r.d(e,"updateStyle",(function(){return we})),r.d(e,"getContrast",(function(){return xe})),r.d(e,"extend",(function(){return Me}));var n={};r.r(n),r.d(n,"color",(function(){return Kt})),r.d(n,"colorBurn",(function(){return Nt})),r.d(n,"colorDodge",(function(){return Ft})),r.d(n,"darken",(function(){return Tt})),r.d(n,"difference",(function(){return qt})),r.d(n,"exclusion",(function(){return Rt})),r.d(n,"hardLight",(function(){return Lt})),r.d(n,"hue",(function(){return $t})),r.d(n,"lighten",(function(){return Dt})),r.d(n,"luminosity",(function(){return zt})),r.d(n,"multiply",(function(){return Pt})),r.d(n,"normal",(function(){return Bt})),r.d(n,"overlay",(function(){return At})),r.d(n,"saturation",(function(){return Vt})),r.d(n,"screen",(function(){return Et})),r.d(n,"softLight",(function(){return It}));var a="(prefers-color-scheme: dark)",o=new RegExp("".concat("js_darkmode__","\\d+")),i="data_color_scheme_dark",l="".concat(1*new Date).concat(Math.round(10*Math.random())),u="data-darkmode-color-".concat(l),s="data-darkmode-bgcolor-".concat(l),c="data-darkmode-original-color-".concat(l),h="data-darkmode-original-bgcolor-".concat(l),f="data-darkmode-bgimage-".concat(l),d="data-darkmode-complementary-bgimagecolor-".concat(l),g=window.getInnerHeight&&window.getInnerHeight()||window.innerHeight||document.documentElement.clientHeight,b={BG_COLOR:["background-color","background-image","background"],TEXT_SHADOW:["text-shadow"],TEXT_COLOR:["-webkit-text-stroke","-webkit-text-stroke-color","text-decoration","text-decoration-color","text-emphasis-color","color","-webkit-text-fill-color"],BORDER_COLOR:["border-image","-webkit-border-image","border","border-top","border-right","border-bottom","border-left","border-color","border-top-color","border-right-color","border-bottom-color","border-left-color","border-block-color","border-block-start-color","border-block-end-color","border-inline-color","border-inline-start-color","border-inline-end-color","outline","outline-color","box-shadow","column-rule","column-rule-color"]},p=Object.keys(b).map((function(t){return b[t].join("|")})).join("|").split("|"),y=["TABLE","TR","TD","TH"],m=/ !important$/,v=/<\$#_SEMICOLON_#\$>/g,k=/\brgba?\([^)]+\)/i,w=/\brgba?\([^)]+\)/gi,x={hasInit:!1,begin:null,showFirstPage:null,error:null,mode:"",whitelist:{tagName:["MPCPS","IFRAME"],attribute:[]},needJudgeFirstPage:!0,delayBgJudge:!1,container:null,cssSelectorsPrefix:"",defaultLightTextColor:"#191919",defaultLightBgColor:"#fff",defaultDarkTextColor:"#a3a3a3",defaultDarkBgColor:"#191919",set:function(t,e,r){var n=e[r];switch(t){case"boolean":"boolean"==typeof n&&(this[r]=n);break;case"string":"string"==typeof n&&""!==n&&(this[r]=n);break;case"function":"function"==typeof n&&(this[r]=n);break;case"dom":n instanceof HTMLElement&&(this[r]=n)}}};function M(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function C(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function O(t,e,r){return e&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var S=[],j=[],B=function(){function t(){C(this,t)}return O(t,[{key:"loopTimes",get:function(){return le.loopTimes}},{key:"isDarkmode",get:function(){return fe.isDarkmode}},{key:"addCss",value:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(r?S:j).push(ce.genCss(t,e.map((function(t){var e=t.key,r=t.value;return ce.genCssKV(e,r)})).join("")))}}]),t}(),P=function(){function t(){C(this,t),M(this,"_plugins",[]),M(this,"length",0),M(this,"loopTimes",0),M(this,"firstPageStyle",""),M(this,"otherPageStyle",""),M(this,"firstPageStyleNoMQ",""),M(this,"otherPageStyleNoMQ","")}return O(t,[{key:"extend",value:function(t){this._plugins.push(new(t(B))),this.length++}},{key:"emit",value:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];this._plugins.forEach((function(e){"function"==typeof e[t]&&e[t].apply(e,r)}))}},{key:"addCss",value:function(t){t?(this.firstPageStyle+=S.join(""),this.firstPageStyleNoMQ+=j.join("")):(this.otherPageStyle+=S.join(""),this.otherPageStyleNoMQ+=j.join(""))}},{key:"resetCss",value:function(){S=[],j=[]}}]),t}();function E(t){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function A(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function T(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var D=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),T(this,"_queue",[]),T(this,"_idx",0),this._prefix=e}var e,r,n;return e=t,(r=[{key:"length",get:function(){return this._queue.length}},{key:"push",value:function(t){var e="".concat(this._prefix).concat(this._idx++);t.classList.add(e),this._queue.push({el:t,className:e,updated:!x.delayBgJudge})}},{key:"forEach",value:function(t){var e=[];for(this._queue.forEach((function(r,n){r.updated&&(e.unshift(n),E(t)&&t(r.el))}));e.length;)this._queue.splice(e.shift(),1)}},{key:"update",value:function(t){this._queue.forEach((function(e){e.updated||Array.prototype.some.call(t,(function(t){return!(1!==t.nodeType||!t.classList.contains(e.className)||(e.el=t,e.updated=!0,0))}))}))}}])&&A(e.prototype,r),n&&A(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function F(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function N(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var L=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),N(this,"_stack",[]),N(this,"_idx",0),this._prefix=e,this.classNameReg=new RegExp("".concat(this._prefix,"\\d+"))}var e,r,n;return e=t,(r=[{key:"push",value:function(t,e,r){var n="".concat(this._prefix).concat(this._idx++);t.classList.add(n),this._stack.unshift({elOld:t,el:t,className:n,cssKV:e,updated:!x.delayBgJudge,cb:r})}},{key:"contains",value:function(t,e){var r=t.getBoundingClientRect(),n=[];for(this._stack.forEach((function(t,e){if(t.updated){t.rect||(t.rect=t.el.getBoundingClientRect());var a=t.rect;r.top>=a.bottom||r.bottom<=a.top||r.left>=a.right||r.right<=a.left||n.unshift(e)}}));n.length;){var a=n.shift(),o=this._stack.splice(a,1)[0];"function"==typeof e&&e(o)}}},{key:"update",value:function(t){this._stack.forEach((function(e){e.updated||Array.prototype.some.call(t,(function(t){return!(1!==t.nodeType||!t.classList.contains(e.className)||(e.el=t,e.updated=!0,0))}))}))}}])&&F(e.prototype,r),n&&F(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function I(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);i=!0);}catch(t){l=!0,a=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return q(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function R(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function $(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var V=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),$(this,"_firstPageStyle",""),$(this,"_otherPageStyle",""),$(this,"_watcher",{}),$(this,"isFinish",!1)}var e,r,n;return e=t,(r=[{key:"genCssKV",value:function(t,e){var r,n;return null===(r=(n=this._watcher)[t])||void 0===r||r.call(n),"".concat(t,": ").concat(e," !important;")}},{key:"genCss",value:function(t,e){return"".concat("dark"===x.mode?"html.".concat(i," "):"").concat(x.cssSelectorsPrefix&&"".concat(x.cssSelectorsPrefix," "),".").concat(t,"{").concat(e,"}")}},{key:"addCss",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this[e?"_firstPageStyle":"_otherPageStyle"]+=t,le.addCss(e)}},{key:"writeStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];!t&&fe.isDarkmode&&(this.isFinish=!0);var e=(fe.isDarkmode?[{target:this,key:["_firstPageStyle","_otherPageStyle"],needMediaQuery:!0}]:[]).concat([{target:le,key:["firstPageStyle","otherPageStyle"],needMediaQuery:!0},{target:le,key:["firstPageStyleNoMQ","otherPageStyleNoMQ"],needMediaQuery:!1}]).map((function(e){var r=e.target,n=I(e.key,2),o=n[0],i=n[1],l=e.needMediaQuery,u="";t?u=o:(r[i]=r[o]+r[i],r[o]="",u=i);var s=r[u];return s?(r[u]="","dark"!==x.mode&&l?"@media ".concat(a," {").concat(s,"}"):s):""})).join("");e&&document.head.insertAdjacentHTML("beforeend",'<style type="text/css">'.concat(e,"</style>"))}},{key:"watch",value:function(t,e){this._watcher[t]=e}},{key:"unwatch",value:function(t){delete this._watcher[t]}}])&&R(e.prototype,r),n&&R(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function K(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function z(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function H(t){return function(t){if(Array.isArray(t))return J(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return J(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return J(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function U(t){var e,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(e=r?[]:[t]).concat.apply(e,H(t.querySelectorAll("*")))}var Q={"ue-table-interlace-color-single":"#fcfcfc","ue-table-interlace-color-double":"#f7faff"};var G=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),z(this,"_els",[]),z(this,"_firstPageEls",[]),z(this,"_delayEls",[]),z(this,"showFirstPage",!1)}var e,r,n;return e=t,(r=[{key:"length",get:function(){return this._els.length}},{key:"set",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._els=t}},{key:"get",value:function(){var t=[];return this._els.length?(t=this._els,fe.isDarkmode&&(this._els=[])):this._delayEls.length?(t=this._delayEls,this._delayEls=[]):x.container&&(t=x.container.querySelectorAll("*")),t}},{key:"delay",value:function(){var t=this;Array.prototype.forEach.call(this._els,(function(e){return t._delayEls.push(e)})),this._els=[]}},{key:"hasDelay",value:function(){return!this._els.length&&(this._delayEls.length>0||null!==x.container)}},{key:"addFirstPageNode",value:function(t){this._firstPageEls.push(t)}},{key:"showFirstPageNodes",value:function(){this._firstPageEls.forEach((function(t){return!t.style.visibility&&(t.style.visibility="visible")})),this.showFirstPage=!0}},{key:"emptyFirstPageNodes",value:function(){this._firstPageEls=[]}}])&&K(e.prototype,r),n&&K(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=r(0),X=r.n(W),Y=r(1),Z=r.n(Y);function tt(t,e,r){return{r:255*r(t.r/255,e.r/255),g:255*r(t.g/255,e.g/255),b:255*r(t.b/255,e.b/255)}}function et(t,e){return e}function rt(t,e){return t*e}function nt(t,e){return t+e-t*e}function at(t,e){return st(e,t)}function ot(t,e){return Math.min(t,e)}function it(t,e){return Math.min(Math.max(t,e),1)}function lt(t,e){return 0===t?0:1===e?1:Math.min(1,t/(1-e))}function ut(t,e){return 1===t?1:0===e?0:1-Math.min(1,(1-t)/e)}function st(t,e){return e<=.5?rt(t,2*e):nt(t,2*e-1)}function ct(t,e){return e<=.5?t-(1-2*e)*t*(1-t):t+(2*e-1)*((t<=.25?((16*t-12)*t+4)*t:Math.sqrt(t))-t)}function ht(t,e){return Math.abs(t-e)}function ft(t,e){return t+e-2*t*e}function dt(t,e,r){return Math.min(Math.max(t||0,e),r)}function gt(t){return{r:dt(t.r,0,255),g:dt(t.g,0,255),b:dt(t.b,0,255),a:dt(t.a,0,1)}}function bt(t){return{r:255*t.r,g:255*t.g,b:255*t.b,a:t.a}}function pt(t){return{r:t.r/255,g:t.g/255,b:t.b/255,a:t.a}}function yt(t,e){void 0===e&&(e=0);var r=Math.pow(10,e);return{r:Math.round(t.r*r)/r,g:Math.round(t.g*r)/r,b:Math.round(t.b*r)/r,a:t.a}}function mt(t,e,r,n,a,o){return(1-e/r)*n+e/r*Math.round((1-t)*a+t*o)}function vt(t,e,r,n,a){void 0===a&&(a={unitInput:!1,unitOutput:!1,roundOutput:!0}),a.unitInput&&(t=bt(t),e=bt(e)),t=gt(t);var o=(e=gt(e)).a+t.a-e.a*t.a,i=r(t,e,n),l=gt({r:mt(t.a,e.a,o,t.r,e.r,i.r),g:mt(t.a,e.a,o,t.g,e.g,i.g),b:mt(t.a,e.a,o,t.b,e.b,i.b),a:o});return l=a.unitOutput?pt(l):a.roundOutput?yt(l):function(t){return yt(t,9)}(l)}function kt(t,e,r){return bt(r(pt(t),pt(e)))}function wt(t){return.3*t.r+.59*t.g+.11*t.b}function xt(t,e){var r=e-wt(t);return function(t){var e=wt(t),r=t.r,n=t.g,a=t.b,o=Math.min(r,n,a),i=Math.max(r,n,a);function l(t){return e+(t-e)*e/(e-o)}function u(t){return e+(t-e)*(1-e)/(i-e)}return o<0&&(r=l(r),n=l(n),a=l(a)),i>1&&(r=u(r),n=u(n),a=u(a)),{r:r,g:n,b:a}}({r:t.r+r,g:t.g+r,b:t.b+r})}function Mt(t){return Math.max(t.r,t.g,t.b)-Math.min(t.r,t.g,t.b)}function Ct(t,e){var r=["r","g","b"].sort((function(e,r){return t[e]-t[r]})),n=r[0],a=r[1],o=r[2],i={r:t.r,g:t.g,b:t.b};return i[o]>i[n]?(i[a]=(i[a]-i[n])*e/(i[o]-i[n]),i[o]=e):i[a]=i[o]=0,i[n]=0,i}function _t(t,e){return xt(Ct(e,Mt(t)),wt(t))}function Ot(t,e){return xt(Ct(t,Mt(e)),wt(t))}function St(t,e){return xt(e,wt(t))}function jt(t,e){return xt(t,wt(e))}function Bt(t,e){return vt(t,e,tt,et)}function Pt(t,e){return vt(t,e,tt,rt)}function Et(t,e){return vt(t,e,tt,nt)}function At(t,e){return vt(t,e,tt,at)}function Tt(t,e){return vt(t,e,tt,ot)}function Dt(t,e){return vt(t,e,tt,it)}function Ft(t,e){return vt(t,e,tt,lt)}function Nt(t,e){return vt(t,e,tt,ut)}function Lt(t,e){return vt(t,e,tt,st)}function It(t,e){return vt(t,e,tt,ct)}function qt(t,e){return vt(t,e,tt,ht)}function Rt(t,e){return vt(t,e,tt,ft)}function $t(t,e){return vt(t,e,kt,_t)}function Vt(t,e){return vt(t,e,kt,Ot)}function Kt(t,e){return vt(t,e,kt,St)}function zt(t,e){return vt(t,e,kt,jt)}Z.a.windowtext=[0,0,0],Z.a.transparent=[255,255,255,0];var Ht=new RegExp(Object.keys(Z.a).map((function(t){return"\\b".concat(t,"\\b")})).join("|"),"ig"),Jt=function(t){var e=t.object();return e.a=e.alpha||1,delete e.alpha,e},Ut=function(t){return t.alpha=t.a,delete t.a,Qt(t)},Qt=function(t){var e=null;try{e=t instanceof X.a?t:X()(t)}catch(e){console.log("ignore the invalid color: `".concat(t,"`"))}return e},Gt=function(t,e){return t.replace(m,"").replace(Ht,(function(t){if(!e&&"transparent"===t)return t;var r=Z.a[t.toLowerCase()];return"".concat(r.length>3?"rgba":"rgb","(").concat(r.toString(),")")}))},Wt=function(t){var e=Gt(t);return k.test(e)?e:""},Xt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"mix";if("[object Array]"!==Object.prototype.toString.call(t)||t.length<1)return null;if(1===t.length)return t[0];for(var r=Qt(t.shift()),a=Qt(t.shift());a;){if(!r&&a)r=a;else if(r||a)r&&a&&(r="mix"===e?r.mix(a,a.alpha()):Ut(n[e](Jt(r),Jt(a))));else{if(0===t.length)break;r=Qt(t.shift())}if(0===t.length)break;a=Qt(t.shift())}return r||null},Yt=function(t){return(299*t[0]+587*t[1]+114*t[2])/1e3},Zt=function(t,e){var r=t/Yt(e),n=Math.min(255,e[0]*r),a=Math.min(255,e[1]*r),o=Math.min(255,e[2]*r);return 0===a||255===n||255===o?a=(1e3*t-299*n-114*o)/587:0===n?n=(1e3*t-587*a-114*o)/299:0!==o&&255!==a||(o=(1e3*t-299*n-587*a)/114),X.a.rgb(n,a,o)};function te(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);i=!0);}catch(t){l=!0,a=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}(t,e)||re(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ee(t){return function(t){if(Array.isArray(t))return ne(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||re(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function re(t,e){if(t){if("string"==typeof t)return ne(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ne(t,e):void 0}}function ne(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ae(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function oe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var ie=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),oe(this,"_idx",0),oe(this,"_defaultDarkTextColorRgb",null),oe(this,"_defaultDarkBgColorRgb",null),oe(this,"_defaultDarkBgColorHSL",null),oe(this,"_defaultDarkTextColorBrightness",null),oe(this,"_defaultDarkBgColorBrightness",null),oe(this,"_defaultDarkBgColorHslBrightness",null),oe(this,"_maxLimitOffsetBrightness",null),oe(this,"isDarkmode",!1)}var e,r,n;return e=t,(r=[{key:"_adjustBrightness",value:function(t,e,r,n,a){var o,i=t.alpha(),l="";if(r.isBgColor){if(i>=.05&&(e[f]&&delete e[f],e[d])){if(e[d]===t.toString()||this.getContrast(e[d],t.toString())<1.1)return{newColor:a?t.toString():"",extStyle:l};U(e).forEach((function(t){delete t[d]}))}if(o=this._adjustBackgroundBrightness(t),!r.hasInlineColor){var u=e[c]||x.defaultLightTextColor,h=Qt(u);if(h){var g=this._adjustBrightness(h,e,{isTextColor:!0,parentElementBgColorStr:o||t},n,a);g.newColor?l+=ce.genCssKV("color",g.newColor):l+=ce.genCssKV("color",h)}}}else if(r.isTextColor||r.isBorderColor){var b=r.parentElementBgColorStr||r.isTextColor&&e[s]||x.defaultDarkBgColor,p=Qt(b);if(p&&!e[f]){o=this._adjustTextBrightness(t,p);var y="";n?y="ByUpdateStyle":a&&(y="ByReset"),le.emit("afterConvertTextColor".concat(y),e,{fontColor:o,bgColor:p})}}else r.isTextShadow&&(e[f]||(o=this._adjustBackgroundBrightness(t)));return{newColor:o&&t.toString()!==o.toString()&&o.alpha(i).rgb(),extStyle:l}}},{key:"_adjustTextBrightness",value:function(t,e){var r=e.rgb().array(),n=e.alpha(),a=Yt(r)*n+this._defaultDarkBgColorBrightness*(1-n),o=t.rgb().array(),i=t.hsl().array(),l=t.alpha(),u=Yt(o),s=Math.abs(a-u);if(u>=250)return t;if(s>this._maxLimitOffsetBrightness&&a<=this._defaultDarkBgColorBrightness+2)return Zt(this._maxLimitOffsetBrightness+a,o).alpha(l);if(s>=65)return t;if(a>=100){if(i[2]>50){i[2]=90-i[2];var c=X.a.hsl.apply(X.a,ee(i)).alpha(l);return this._adjustTextBrightness(c,e)}return Zt(Math.min(this._maxLimitOffsetBrightness,a-65),o).alpha(l)}if(i[2]<=40){i[2]=90-i[2];var h=X.a.hsl.apply(X.a,ee(i)).alpha(l);return this._adjustTextBrightness(h,e)}return Zt(Math.min(this._maxLimitOffsetBrightness,a+65),o).alpha(l)}},{key:"_adjustBackgroundBrightness",value:function(t){var e=t.rgb().array(),r=t.hsl().array(),n=t.alpha(),a=Yt(e),o=t;return 0===r[1]&&r[2]>40||a>250?o=X.a.hsl(0,0,Math.min(100,100+this._defaultDarkBgColorHslBrightness-r[2])):a>190?o=Zt(190,e).alpha(n):r[2]<22&&(r[2]=22,o=X.a.hsl.apply(X.a,ee(r))),o.alpha(n).rgb()}},{key:"_updateBgWithGradient",value:function(t,e,r,n,a,o,i){var l=Xt([e[s]||x.defaultDarkBgColor,t],"normal"),u=(e[h]||x.defaultLightBgColor).split("|").concat(t.toString()).join("|");U(e).forEach((function(t){t[s]=l,t[h]=u}));var c=n.slice(-1)[0];if("color"===c[0]){var f=this._adjustBrightness(Qt(Gt(c[1])),e,{isBgColor:!1,isTextShadow:!1,isTextColor:!0,isBorderColor:!1,hasInlineColor:a},o,i);if(f.newColor)return ce.genCss(r,ce.genCssKV("color",f.newColor))}return""}},{key:"_try",value:function(t){try{return t()}catch(t){console.log("An error occurred when running the dark mode conversion algorithm\n",t),"function"==typeof x.error&&x.error(t)}}},{key:"init",value:function(){this._defaultDarkTextColorRgb=Qt(x.defaultDarkTextColor).rgb().array(),this._defaultDarkBgColorRgb=Qt(x.defaultDarkBgColor).rgb().array(),this._defaultDarkBgColorHSL=Qt(x.defaultDarkBgColor).hsl().array(),this._defaultDarkTextColorBrightness=Yt(this._defaultDarkTextColorRgb),this._defaultDarkBgColorBrightness=Yt(this._defaultDarkBgColorRgb),this._defaultDarkBgColorHslBrightness=this._defaultDarkBgColorHSL[2],this._maxLimitOffsetBrightness=this._defaultDarkTextColorBrightness-this._defaultDarkBgColorBrightness}},{key:"convert",value:function(t,e,r,n){var a=this;le.resetCss();var i="";r?i="ByUpdateStyle":n&&(i="ByReset"),le.emit("beforeConvertNode".concat(i),t);var l="",g="";if(this.isDarkmode||r||n){var M=t.nodeName;if(x.whitelist.tagName.indexOf(M)>-1)return"";if(x.whitelist.attribute.some((function(e){return t.hasAttribute(e)})))return"";var C=t.style;e||(e=(C.cssText&&C.cssText.replace(/("[^;]*);([^;]*")|('[^;]*);([^;]*')/g,"$1$3".concat("<$#_SEMICOLON_#$>","$2$4")).split(";")||[]).map((function(t){var e=t.indexOf(":");return[t.slice(0,e).toLowerCase(),t.slice(e+1).replace(v,";")].map((function(t){return(t||"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}))})));var _=!1,O=!1,S=!1,j=null,B=null;e=e.filter((function(t){var e=te(t,2),r=e[0],n=e[1];return"color"===r?_=!0:/background/i.test(r)&&(O=!0,"background-position"===r?j=n:"background-size"===r&&(B=n)),(/background/i.test(r)||/^(-webkit-)?border-image/.test(r))&&/url\([^)]*\)/i.test(n)&&(S=!0),p.indexOf(r)>-1})).sort((function(t,e){var r=te(t,1)[0],n=te(e,1)[0];return"color"===r||"background-image"===r&&"background-color"===n||0===n.indexOf("-webkit-text")?1:-1})),y.indexOf(M)>-1&&!O&&this._try((function(){var r=function(t){var e=null;return Array.prototype.some.call(t.classList,(function(t){return!!Q[t]&&(e=Q[t],!0)})),e}(t);if(r||(r=t.getAttribute("bgcolor")),r){var n=Qt(r);n&&(e.unshift(["background-color",n.toString()]),O=!0)}})),"FONT"!==M||_||this._try((function(){var r=t.getAttribute("color");if(r){var n=Qt(r);n&&(e.push(["color",n.toString()]),_=!0)}}));var P="",E="",A=0;e.some((function(t,e){var r=te(t,2),n=r[0],o=r[1];return a._try((function(){if(0!==n.indexOf("-webkit-text"))return A=e,!0;switch(n){case"-webkit-text-fill-color":P=Wt(o);break;case"-webkit-text-stroke":var t=o.split(" ");2===t.length&&(E=Wt(t[1]));break;case"-webkit-text-stroke-color":E=Wt(o)}return!1}))})),P&&(_?e[e.length-1]=["-webkit-text-fill-color",P]:(e.push(["-webkit-text-fill-color",P]),_=!0)),A&&(e.splice(0,A),E&&e.unshift(["-webkit-text-stroke-color",E]));var T="",D="";if((r||n)&&t.className&&"string"==typeof t.className){var F=t.className.match(o);F&&(T=F[0]),(F=t.className.match(se.classNameReg))&&(D=F[0])}var N="",L=n;L&&ce.watch("color",(function(){L=!1,ce.unwatch("color")})),e.forEach((function(o){var i=te(o,2),p=i[0],y=i[1];return a._try((function(){var o,i=y,v=!1,M=b.BG_COLOR.indexOf(p)>-1,P=b.TEXT_SHADOW.indexOf(p)>-1,E=b.TEXT_COLOR.indexOf(p),A=b.BORDER_COLOR.indexOf(p)>-1,T=/gradient/.test(y),F=[],I="";if(y=Gt(y,T),k.test(y)){if(T){for(var q=w.exec(y);q;)F.push(q[0]),q=w.exec(y);o=Xt(F)}var R=0;y=y.replace(w,(function(e){T&&(e=o,v=!0);var i=Qt(e);if((null==i?void 0:i.alpha())>=.05){var l=a._adjustBrightness(i,t,{isBgColor:M,isTextShadow:P,isTextColor:E>-1,isBorderColor:A,hasInlineColor:_},r,n),d=!S&&l.newColor;if(I+=l.extStyle,M||E>=5){var g=d?d.toString():e;0===R&&U(t).forEach((function(t){M?(t[s]=g,t[h]=(t[h]||x.defaultLightBgColor).split("|").concat(e).join("|")):(t[u]=g,t[c]=e);var r=Qt(g);M&&(null==r?void 0:r.alpha())>=.05&&t[f]&&delete t[f]}))}return d&&(v=!0),R++,d||e}return e})).replace(/\s?!\s?important/gi,"")}if(I&&(N+=I),!(t instanceof SVGElement)){var $=/^background/.test(p),V=/^(-webkit-)?border-image/.test(p);if(($||V)&&/url\([^)]*\)/i.test(y)){v=!0;var K=Xt((t[h]||x.defaultLightBgColor).split("|"),"normal").toString();if(y=y.replace(/^(.*?)url\(([^)]*)\)(.*)$/i,(function(e){var r=e,a="";return t[f]||U(t).forEach((function(t){t[f]=!0})),$?(a=ce.genCssKV(p,K?"".concat(r,",linear-gradient(").concat(K,", ").concat(K,")"):r),j&&(N+=ce.genCssKV("background-position",j),a+=ce.genCssKV("background-position",K?"".concat(j,",top left"):j)),B&&(N+=ce.genCssKV("background-size",B),a+=ce.genCssKV("background-size",K?"".concat(B,",100%"):B)),n||(D?(g+=ce.genCss(D,a),U(t).forEach((function(t){t[d]=K||r}))):se.push(t,a,(function(t){[t.elOld,t.el].forEach((function(t){U(t).forEach((function(t){t[d]=K||r}))}))})))):!K||O||n||(a=ce.genCssKV("background-image","linear-gradient(".concat(K,", ").concat(K,")")),D?g+=ce.genCss(D,a):se.push(t,a)),r})),!_){var z=t[c]||x.defaultLightTextColor;N+=ce.genCssKV("color",z),U(t).forEach((function(t){t[u]=z}))}}}(v||n)&&(!r&&!n&&m.test(i)&&(C[p]=i.replace(m,"")),T?n||(D?(g+=ce.genCss(D,ce.genCssKV(p,y)),/^background/.test(p)&&!/url\([^)]*\)/i.test(y)&&(l+=a._updateBgWithGradient(o,t,D,e,_,r,n))):se.push(t,ce.genCssKV(p,y),(function(i){/^background/.test(p)&&!/url\([^)]*\)/i.test(y)&&(l+=a._updateBgWithGradient(o,t,i.className,e,_,r,n))}))):("color"===p&&(L=!1,ce.unwatch("color")),N+=ce.genCssKV(p,!v&&n?t.style[p]:y)))}))})),L&&(N+=ce.genCssKV("color",t.style.color||t[u]||x.defaultDarkTextColor),ce.unwatch("color")),N&&(T||(T="".concat("js_darkmode__").concat(this._idx++),t.classList.add(T)),l+=N?ce.genCss(T,N):""),l+=g,r||!function(t){return t.textContent.replace(/\s/g,"").length>0}(t)||n||(x.delayBgJudge?ue.push(t):se.contains(t,(function(t){l+=ce.genCss(t.className,t.cssKV),"function"==typeof t.cb&&t.cb(t)})))}return le.emit("afterConvertNode".concat(i),t),l}},{key:"getContrast",value:function(t,e){var r=Qt(t),n=Qt(e);return r&&n?r.contrast(n):0}}])&&ae(e.prototype,r),n&&ae(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),le=new P,ue=new D("".concat("js_darkmode__","text__")),se=new L("".concat("js_darkmode__","bg__")),ce=new V,he=new G,fe=new ie;function de(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);i=!0);}catch(t){l=!0,a=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ge(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ge(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ge(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var be=new RegExp("".concat("js_darkmode__","[^ ]+"),"g"),pe=null,ye=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{type:"dom"};if(e.force&&(ce.isFinish=!1),!ce.isFinish)try{fe.isDarkmode=x.mode?"dark"===x.mode:t.matches,"dom"===e.type?(fe.isDarkmode&&"function"==typeof x.begin&&x.begin(he.hasDelay()),Array.prototype.forEach.call(he.get(),(function(t){if(fe.isDarkmode&&t.className&&"string"==typeof t.className&&(t.className=t.className.replace(be,"")),fe.isDarkmode||le.length)if(x.needJudgeFirstPage){var e=t.getBoundingClientRect(),r=e.top,n=e.bottom;r<=0&&n<=0?ce.addCss(fe.convert(t)):r>0&&r<g||n>0&&n<g?(he.addFirstPageNode(t),ce.addCss(fe.convert(t),!0)):(x.needJudgeFirstPage=!1,ce.writeStyle(!0),he.showFirstPageNodes(),"function"==typeof x.showFirstPage&&x.showFirstPage(),ce.addCss(fe.convert(t)))}else ce.addCss(fe.convert(t))})),le.loopTimes++):"bg"===e.type&&fe.isDarkmode&&ue.forEach((function(t){return se.contains(t,(function(t){ce.addCss(ce.genCss(t.className,t.cssKV)),"function"==typeof t.cb&&t.cb(t),[t.elOld,t.el].forEach((function(t){var e,r,n,a,o,i,l=[[u,null!==(e=t[u])&&void 0!==e?e:null],[s,null!==(r=t[s])&&void 0!==r?r:null],[c,null!==(n=t[c])&&void 0!==n?n:null],[h,null!==(a=t[h])&&void 0!==a?a:null],[f,null!==(o=t[f])&&void 0!==o?o:null],[d,null!==(i=t[d])&&void 0!==i?i:null]],g=U(t,!0);g.forEach((function(t){l.forEach((function(e){var r=de(e,2),n=r[0],a=r[1];null===a?delete t[n]:t[n]=a}))})),g.forEach((function(t){ce.addCss(fe.convert(t,void 0,!1,!0))}))}))}))})),(x.needJudgeFirstPage||!x.needJudgeFirstPage&&!he.showFirstPage)&&"function"==typeof x.showFirstPage&&x.showFirstPage(),ce.writeStyle(),he.emptyFirstPageNodes(),fe.isDarkmode||(x.needJudgeFirstPage=!1,x.delayBgJudge=!1,null===x.container&&"dom"===e.type&&he.length&&he.delay())}catch(t){console.log("An error occurred when running the dark mode conversion algorithm\n",t),"function"==typeof x.error&&x.error(t)}};function me(t,e){ve(e),he.set(t),ye(pe,{force:!0,type:"dom"})}function ve(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!x.hasInit){x.hasInit=!0;var e=x.whitelist.tagName,r=x.whitelist.attribute;t.whitelist&&(t.whitelist.tagName instanceof Array&&t.whitelist.tagName.forEach((function(t){t=t.toUpperCase(),-1===e.indexOf(t)&&e.push(t)})),t.whitelist.attribute instanceof Array&&t.whitelist.attribute.forEach((function(t){-1===r.indexOf(t)&&r.push(t)}))),["dark","light"].indexOf(t.mode)>-1&&(x.set("string",t,"mode"),"dark"===t.mode&&document.getElementsByTagName("html")[0].classList.add(i)),x.set("function",t,"begin"),x.set("function",t,"showFirstPage"),x.set("function",t,"error"),x.set("boolean",t,"needJudgeFirstPage"),x.set("boolean",t,"delayBgJudge"),x.set("dom",t,"container"),x.set("string",t,"cssSelectorsPrefix"),x.set("string",t,"defaultLightTextColor"),x.set("string",t,"defaultLightBgColor"),x.set("string",t,"defaultDarkTextColor"),x.set("string",t,"defaultDarkBgColor"),fe.init(),!x.mode&&null===pe&&window.matchMedia&&(pe=window.matchMedia(a)).addListener(ye)}}function ke(t){he.set(t),null!==x.container&&(se.update(t),ue.update(t)),ye(pe,{force:!0,type:"bg"})}function we(t,e){ce.isFinish&&(ce.addCss(fe.convert(t,e?Object.keys(e).map((function(t){return[t,e[t]]})):void 0,!0),!1),ce.writeStyle())}function xe(t,e){return fe.getContrast(t,e)}function Me(t){t.forEach((function(t){return le.extend(t)}))}}])}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-darkmode",
3
- "version": "1.2.3-beta.0",
3
+ "version": "1.2.3-beta.2",
4
4
  "description": "微信公众平台 Dark Mode 转换算法",
5
5
  "main": "dist/darkmode.min.js",
6
6
  "dependencies": {