mp-darkmode 1.2.0-beta.0 → 1.2.0

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(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Darkmode",[],t):"object"==typeof exports?exports.Darkmode=t():e.Darkmode=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=9)}([function(e,t,r){"use strict";var n=r(3),a=r(6),o=[].slice,i=["keyword","gray","hex"],l={};Object.keys(a).forEach((function(e){l[o.call(a[e].labels).sort().join("")]=e}));var u={};function s(e,t){if(!(this instanceof s))return new s(e,t);if(t&&t in i&&(t=null),t&&!(t in a))throw new Error("Unknown model: "+t);var r,c;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof s)this.model=e.model,this.color=e.color.slice(),this.valpha=e.valpha;else if("string"==typeof e){var h=n.get(e);if(null===h)throw new Error("Unable to parse color from string: "+e);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(e.length){this.model=t||"rgb",c=a[this.model].channels;var f=o.call(e,0,c);this.color=d(f,c),this.valpha="number"==typeof e[c]?e[c]:1}else if("number"==typeof e)e&=16777215,this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;var g=Object.keys(e);"alpha"in e&&(g.splice(g.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);var b=g.sort().join("");if(!(b in l))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=l[b];var p=a[this.model].labels,y=[];for(r=0;r<p.length;r++)y.push(e[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(e,t,r){return(e=Array.isArray(e)?e:[e]).forEach((function(e){(u[e]||(u[e]=[]))[t]=r})),e=e[0],function(n){var a;return arguments.length?(r&&(n=r(n)),(a=this[e]()).color[t]=n,a):(a=this[e]().color[t],r&&(a=r(a)),a)}}function h(e){return function(t){return Math.max(0,Math.min(e,t))}}function f(e){return Array.isArray(e)?e:[e]}function d(e,t){for(var r=0;r<t;r++)"number"!=typeof e[r]&&(e[r]=0);return e}s.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(e){var t=this.model in n.to?this:this.rgb(),r=1===(t=t.round("number"==typeof e?e:1)).valpha?t.color:t.color.concat(this.valpha);return n.to[t.model](r)},percentString:function(e){var t=this.rgb().round("number"==typeof e?e:1),r=1===t.valpha?t.color:t.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 e={},t=a[this.model].channels,r=a[this.model].labels,n=0;n<t;n++)e[r[n]]=this.color[n];return 1!==this.valpha&&(e.alpha=this.valpha),e},unitArray:function(){var e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,1!==this.valpha&&e.push(this.valpha),e},unitObject:function(){var e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,1!==this.valpha&&(e.alpha=this.valpha),e},round:function(e){return e=Math.max(e||0,0),new s(this.color.map(function(e){return function(t){return function(e,t){return Number(e.toFixed(t))}(t,e)}}(e)).concat(this.valpha),this.model)},alpha:function(e){return arguments.length?new s(this.color.concat(Math.max(0,Math.min(1,e))),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(e){return(e%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(e){return arguments.length?new s(e):a[this.model].keyword(this.color)},hex:function(e){return arguments.length?new s(e):n.to.hex(this.rgb().round().color)},rgbNumber:function(){var e=this.rgb().color;return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},luminosity:function(){for(var e=this.rgb().color,t=[],r=0;r<e.length;r++){var n=e[r]/255;t[r]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return.2126*t[0]+.7152*t[1]+.0722*t[2]},contrast:function(e){var t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level:function(e){var t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark:function(){var e=this.rgb().color;return(299*e[0]+587*e[1]+114*e[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var e=this.rgb(),t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten:function(e){var t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken:function(e){var t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate:function(e){var t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate:function(e){var t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten:function(e){var t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken:function(e){var t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale:function(){var e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return s.rgb(t,t,t)},fade:function(e){return this.alpha(this.valpha-this.valpha*e)},opaquer:function(e){return this.alpha(this.valpha+this.valpha*e)},rotate:function(e){var t=this.hsl(),r=t.color[0];return r=(r=(r+e)%360)<0?360+r:r,t.color[0]=r,t},mix:function(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);var r=e.rgb(),n=this.rgb(),a=void 0===t?.5:t,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(e){if(-1===i.indexOf(e)){var t=a[e].channels;s.prototype[e]=function(){if(this.model===e)return new s(this);if(arguments.length)return new s(arguments,e);var r="number"==typeof arguments[t]?t:this.valpha;return new s(f(a[this.model][e].raw(this.color)).concat(r),e)},s[e]=function(r){return"number"==typeof r&&(r=d(o.call(arguments),t)),new s(r,e)}}})),e.exports=s},function(e,t,r){"use strict";e.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(e,t,r){var n=r(7),a={};for(var o in n)n.hasOwnProperty(o)&&(a[n[o]]=o);var i=e.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(e){var t,r,n=e[0]/255,a=e[1]/255,o=e[2]/255,i=Math.min(n,a,o),l=Math.max(n,a,o),u=l-i;return l===i?t=0:n===l?t=(a-o)/u:a===l?t=2+(o-n)/u:o===l&&(t=4+(n-a)/u),(t=Math.min(60*t,360))<0&&(t+=360),r=(i+l)/2,[t,100*(l===i?0:r<=.5?u/(l+i):u/(2-l-i)),100*r]},i.rgb.hsv=function(e){var t,r,n,a,o,i=e[0]/255,l=e[1]/255,u=e[2]/255,s=Math.max(i,l,u),c=s-Math.min(i,l,u),h=function(e){return(s-e)/6/c+.5};return 0===c?a=o=0:(o=c/s,t=h(i),r=h(l),n=h(u),i===s?a=n-r:l===s?a=1/3+t-n:u===s&&(a=2/3+r-t),a<0?a+=1:a>1&&(a-=1)),[360*a,100*o,100*s]},i.rgb.hwb=function(e){var t=e[0],r=e[1],n=e[2];return[i.rgb.hsl(e)[0],100*(1/255*Math.min(t,Math.min(r,n))),100*(n=1-1/255*Math.max(t,Math.max(r,n)))]},i.rgb.cmyk=function(e){var t,r=e[0]/255,n=e[1]/255,a=e[2]/255;return[100*((1-r-(t=Math.min(1-r,1-n,1-a)))/(1-t)||0),100*((1-n-t)/(1-t)||0),100*((1-a-t)/(1-t)||0),100*t]},i.rgb.keyword=function(e){var t=a[e];if(t)return t;var r,o,i,l=1/0;for(var u in n)if(n.hasOwnProperty(u)){var s=n[u],c=(o=e,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(e){return n[e]},i.rgb.xyz=function(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255;return[100*(.4124*(t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/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*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},i.rgb.lab=function(e){var t=i.rgb.xyz(e),r=t[0],n=t[1],a=t[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(e){var t,r,n,a,o,i=e[0]/360,l=e[1]/100,u=e[2]/100;if(0===l)return[o=255*u,o,o];t=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?t+6*(r-t)*n:2*n<1?r:3*n<2?t+(r-t)*(2/3-n)*6:t,a[s]=255*o;return a},i.hsl.hsv=function(e){var t=e[0],r=e[1]/100,n=e[2]/100,a=r,o=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,a*=o<=1?o:2-o,[t,100*(0===n?2*a/(o+a):2*r/(n+r)),100*((n+r)/2)]},i.hsv.rgb=function(e){var t=e[0]/60,r=e[1]/100,n=e[2]/100,a=Math.floor(t)%6,o=t-Math.floor(t),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(e){var t,r,n,a=e[0],o=e[1]/100,i=e[2]/100,l=Math.max(i,.01);return n=(2-o)*i,r=o*l,[a,100*(r=(r/=(t=(2-o)*l)<=1?t:2-t)||0),100*(n/=2)]},i.hwb.rgb=function(e){var t,r,n,a,o,i,l,u=e[0]/360,s=e[1]/100,c=e[2]/100,h=s+c;switch(h>1&&(s/=h,c/=h),n=6*u-(t=Math.floor(6*u)),0!=(1&t)&&(n=1-n),a=s+n*((r=1-c)-s),t){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(e){var t=e[0]/100,r=e[1]/100,n=e[2]/100,a=e[3]/100;return[255*(1-Math.min(1,t*(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(e){var t,r,n,a=e[0]/100,o=e[1]/100,i=e[2]/100;return r=-.9689*a+1.8758*o+.0415*i,n=.0557*a+-.204*o+1.057*i,t=(t=3.2406*a+-1.5372*o+-.4986*i)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,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*(t=Math.min(Math.max(0,t),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]},i.xyz.lab=function(e){var t=e[0],r=e[1],n=e[2];return r/=100,n/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(t-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},i.lab.xyz=function(e){var t,r,n,a=e[0];t=e[1]/500+(r=(a+16)/116),n=r-e[2]/200;var o=Math.pow(r,3),i=Math.pow(t,3),l=Math.pow(n,3);return r=o>.008856?o:(r-16/116)/7.787,t=i>.008856?i:(t-16/116)/7.787,n=l>.008856?l:(n-16/116)/7.787,[t*=95.047,r*=100,n*=108.883]},i.lab.lch=function(e){var t,r=e[0],n=e[1],a=e[2];return(t=360*Math.atan2(a,n)/2/Math.PI)<0&&(t+=360),[r,Math.sqrt(n*n+a*a),t]},i.lch.lab=function(e){var t,r=e[0],n=e[1];return t=e[2]/360*2*Math.PI,[r,n*Math.cos(t),n*Math.sin(t)]},i.rgb.ansi16=function(e){var t=e[0],r=e[1],n=e[2],a=1 in arguments?arguments[1]:i.rgb.hsv(e)[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(t/255));return 2===a&&(o+=60),o},i.hsv.ansi16=function(e){return i.rgb.ansi16(i.hsv.rgb(e),e[2])},i.rgb.ansi256=function(e){var t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},i.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},i.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var r;return e-=16,[Math.floor(e/36)/5*255,Math.floor((r=e%36)/6)/5*255,r%6/5*255]},i.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},i.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var r=t[0];3===t[0].length&&(r=r.split("").map((function(e){return e+e})).join(""));var n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},i.rgb.hcg=function(e){var t,r=e[0]/255,n=e[1]/255,a=e[2]/255,o=Math.max(Math.max(r,n),a),i=Math.min(Math.min(r,n),a),l=o-i;return t=l<=0?0:o===r?(n-a)/l%6:o===n?2+(a-r)/l:4+(r-n)/l+4,t/=6,[360*(t%=1),100*l,100*(l<1?i/(1-l):0)]},i.hsl.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=1,a=0;return(n=r<.5?2*t*r:2*t*(1-r))<1&&(a=(r-.5*n)/(1-n)),[e[0],100*n,100*a]},i.hsv.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=t*r,a=0;return n<1&&(a=(r-n)/(1-n)),[e[0],100*n,100*a]},i.hcg.rgb=function(e){var t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];var a,o=[0,0,0],i=t%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(e){var t=e[1]/100,r=t+e[2]/100*(1-t),n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},i.hcg.hsl=function(e){var t=e[1]/100,r=e[2]/100*(1-t)+.5*t,n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},i.hcg.hwb=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},i.hwb.hcg=function(e){var t=e[1]/100,r=1-e[2]/100,n=r-t,a=0;return n<1&&(a=(r-n)/(1-n)),[e[0],100*n,100*a]},i.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},i.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},i.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},i.gray.hsl=i.gray.hsv=function(e){return[0,0,e[0]]},i.gray.hwb=function(e){return[0,100,e[0]]},i.gray.cmyk=function(e){return[0,0,0,e[0]]},i.gray.lab=function(e){return[e[0],0,0]},i.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},i.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},function(e,t,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=e.exports={to:{},get:{}};function s(e,t,r){return Math.min(Math.max(t,e),r)}function c(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}u.get=function(e){var t,r;switch(e.substring(0,3).toLowerCase()){case"hsl":t=u.get.hsl(e),r="hsl";break;case"hwb":t=u.get.hwb(e),r="hwb";break;default:t=u.get.rgb(e),r="rgb"}return t?{model:r,value:t}:null},u.get.rgb=function(e){if(!e)return null;var t,r,a,i=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(a=t[2],t=t[1],r=0;r<3;r++){var l=2*r;i[r]=parseInt(t.slice(l,l+2),16)}a&&(i[3]=parseInt(a,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(a=(t=t[1])[3],r=0;r<3;r++)i[r]=parseInt(t[r]+t[r],16);a&&(i[3]=parseInt(a+a,16)/255)}else if(t=e.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(t[r+1],0);t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:o.call(n,t[1])?((i=n[t[1]])[3]=1,i):null:null;for(r=0;r<3;r++)i[r]=Math.round(2.55*parseFloat(t[r+1]));t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[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(e){if(!e)return null;var t=e.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(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,s(parseFloat(t[2]),0,100),s(parseFloat(t[3]),0,100),s(isNaN(r)?1:r,0,1)]}return null},u.get.hwb=function(e){if(!e)return null;var t=e.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(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,s(parseFloat(t[2]),0,100),s(parseFloat(t[3]),0,100),s(isNaN(r)?1:r,0,1)]}return null},u.to.hex=function(){var e=a(arguments);return"#"+c(e[0])+c(e[1])+c(e[2])+(e[3]<1?c(Math.round(255*e[3])):"")},u.to.rgb=function(){var e=a(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},u.to.rgb.percent=function(){var e=a(arguments),t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"},u.to.hsl=function(){var e=a(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},u.to.hwb=function(){var e=a(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},u.to.keyword=function(e){return i[e.slice(0,3)]}},function(e,t,r){"use strict";var n=r(5),a=Array.prototype.concat,o=Array.prototype.slice,i=e.exports=function(e){for(var t=[],r=0,i=e.length;r<i;r++){var l=e[r];n(l)?t=a.call(t,o.call(l)):t.push(l)}return t};i.wrap=function(e){return function(){return e(i(arguments))}}},function(e,t){e.exports=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))}},function(e,t,r){var n=r(2),a=r(8),o={};Object.keys(n).forEach((function(e){o[e]={},Object.defineProperty(o[e],"channels",{value:n[e].channels}),Object.defineProperty(o[e],"labels",{value:n[e].labels});var t=a(e);Object.keys(t).forEach((function(r){var n=t[r];o[e][r]=function(e){var t=function(t){if(null==t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var r=e(t);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 e&&(t.conversion=e.conversion),t}(n),o[e][r].raw=function(e){var t=function(t){return null==t?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)}))})),e.exports=o},function(e,t,r){"use strict";e.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(e,t,r){var n=r(2);function a(e){var t=function(){for(var e={},t=Object.keys(n),r=t.length,a=0;a<r;a++)e[t[a]]={distance:-1,parent:null};return e}(),r=[e];for(t[e].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=t[u];-1===s.distance&&(s.distance=t[a].distance+1,s.parent=a,r.unshift(u))}return t}function o(e,t){return function(r){return t(e(r))}}function i(e,t){for(var r=[t[e].parent,e],a=n[t[e].parent][e],i=t[e].parent;t[i].parent;)r.unshift(t[i].parent),a=o(n[t[i].parent][i],a),i=t[i].parent;return a.conversion=r,a}e.exports=function(e){for(var t=a(e),r={},n=Object.keys(t),o=n.length,l=0;l<o;l++){var u=n[l];null!==t[u].parent&&(r[u]=i(u,t))}return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"run",(function(){return bt})),r.d(t,"init",(function(){return pt})),r.d(t,"convertBg",(function(){return yt})),r.d(t,"updateStyle",(function(){return mt})),r.d(t,"getContrast",(function(){return vt})),r.d(t,"extend",(function(){return kt}));var n={};r.r(n),r.d(n,"color",(function(){return Ve})),r.d(n,"colorBurn",(function(){return Fe})),r.d(n,"colorDodge",(function(){return De})),r.d(n,"darken",(function(){return Ae})),r.d(n,"difference",(function(){return Ie})),r.d(n,"exclusion",(function(){return qe})),r.d(n,"hardLight",(function(){return Ne})),r.d(n,"hue",(function(){return Re})),r.d(n,"lighten",(function(){return Te})),r.d(n,"luminosity",(function(){return ze})),r.d(n,"multiply",(function(){return Be})),r.d(n,"normal",(function(){return Se})),r.d(n,"overlay",(function(){return Ee})),r.d(n,"saturation",(function(){return $e})),r.d(n,"screen",(function(){return Pe})),r.d(n,"softLight",(function(){return Le}));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=window.getInnerHeight&&window.getInnerHeight()||window.innerHeight||document.documentElement.clientHeight,g={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"]},b=Object.keys(g).map((function(e){return g[e].join("|")})).join("|").split("|"),p=["TABLE","TR","TD","TH"],y=/ !important$/,m=/<\$#_SEMICOLON_#\$>/g,v=/\brgba?\([^)]+\)/i,k=/\brgba?\([^)]+\)/gi,w={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(e,t,r){var n=t[r];switch(e){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 x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t,r){return t&&C(e.prototype,t),r&&C(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var O=[],j=[],S=function(){function e(){M(this,e)}return _(e,[{key:"loopTimes",get:function(){return it.loopTimes}},{key:"isDarkmode",get:function(){return ht.isDarkmode}},{key:"addCss",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(r?O:j).push(st.genCss(e,t.map((function(e){var t=e.key,r=e.value;return st.genCssKV(t,r)})).join("")))}}]),e}(),B=function(){function e(){M(this,e),x(this,"_plugins",[]),x(this,"length",0),x(this,"loopTimes",0),x(this,"firstPageStyle",""),x(this,"otherPageStyle",""),x(this,"firstPageStyleNoMQ",""),x(this,"otherPageStyleNoMQ","")}return _(e,[{key:"extend",value:function(e){this._plugins.push(new(e(S))),this.length++}},{key:"emit",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this._plugins.forEach((function(t){"function"==typeof t[e]&&t[e].apply(t,r)}))}},{key:"addCss",value:function(e){e?(this.firstPageStyle+=O.join(""),this.firstPageStyleNoMQ+=j.join("")):(this.otherPageStyle+=O.join(""),this.otherPageStyleNoMQ+=j.join(""))}},{key:"resetCss",value:function(){O=[],j=[]}}]),e}();function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function A(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),A(this,"_queue",[]),A(this,"_idx",0),this._prefix=t}var t,r,n;return t=e,(r=[{key:"push",value:function(e){var t="".concat(this._prefix).concat(this._idx++);e.classList.add(t),this._queue.push({el:e,className:t,updated:!w.delayBgJudge})}},{key:"forEach",value:function(e){var t=[];for(this._queue.forEach((function(r,n){r.updated&&(t.unshift(n),P(e)&&e(r.el))}));t.length;)this._queue.splice(t.shift(),1)}},{key:"update",value:function(e){this._queue.forEach((function(t){t.updated||Array.prototype.some.call(e,(function(e){return!(1!==e.nodeType||!e.classList.contains(t.className)||(t.el=e,t.updated=!0,0))}))}))}}])&&E(t.prototype,r),n&&E(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function D(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function F(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var N=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),F(this,"_stack",[]),F(this,"_idx",0),this._prefix=t,this.classNameReg=new RegExp("".concat(this._prefix,"\\d+"))}var t,r,n;return t=e,(r=[{key:"push",value:function(e,t,r){var n="".concat(this._prefix).concat(this._idx++);e.classList.add(n),this._stack.unshift({el:e,className:n,cssKV:t,updated:!w.delayBgJudge,cb:r})}},{key:"contains",value:function(e,t){var r=e.getBoundingClientRect(),n=[];for(this._stack.forEach((function(e,t){if(e.updated){e.rect||(e.rect=e.el.getBoundingClientRect());var a=e.rect;r.top>=a.bottom||r.bottom<=a.top||r.left>=a.right||r.right<=a.left||n.unshift(t)}}));n.length;){var a=this._stack.splice(n.shift(),1)[0];"function"==typeof t&&t(a)}}},{key:"update",value:function(e){this._stack.forEach((function(t){t.updated||Array.prototype.some.call(e,(function(e){return!(1!==e.nodeType||!e.classList.contains(t.className)||(t.el=e,t.updated=!0,0))}))}))}}])&&D(t.prototype,r),n&&D(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return I(e,t)}(e,t)||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 I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function q(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function R(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),R(this,"_firstPageStyle",""),R(this,"_otherPageStyle",""),R(this,"isFinish",!1)}var t,r,n;return t=e,(r=[{key:"genCssKV",value:function(e,t){return"".concat(e,": ").concat(t," !important;")}},{key:"genCss",value:function(e,t){return"".concat("dark"===w.mode?"html.".concat(i," "):"").concat(w.cssSelectorsPrefix&&"".concat(w.cssSelectorsPrefix," "),".").concat(e,"{").concat(t,"}")}},{key:"addCss",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this[t?"_firstPageStyle":"_otherPageStyle"]+=e,it.addCss(t)}},{key:"writeStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];!e&&ht.isDarkmode&&(this.isFinish=!0);var t=(ht.isDarkmode?[{target:this,key:["_firstPageStyle","_otherPageStyle"],needMediaQuery:!0}]:[]).concat([{target:it,key:["firstPageStyle","otherPageStyle"],needMediaQuery:!0},{target:it,key:["firstPageStyleNoMQ","otherPageStyleNoMQ"],needMediaQuery:!1}]).map((function(t){var r=t.target,n=L(t.key,2),o=n[0],i=n[1],l=t.needMediaQuery,u="";e?u=o:(r[i]=r[o]+r[i],r[o]="",u=i);var s=r[u];return s?(r[u]="","dark"!==w.mode&&l?"@media ".concat(a," {").concat(s,"}"):s):""})).join("");t&&document.head.insertAdjacentHTML("beforeend",'<style type="text/css">'.concat(t,"</style>"))}}])&&q(t.prototype,r),n&&q(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function V(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function K(e){return function(e){if(Array.isArray(e))return H(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return H(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H(e,t)}(e)||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 H(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function J(e){var t;return(t=[e]).concat.apply(t,K(e.querySelectorAll("*")))}var U={"ue-table-interlace-color-single":"#fcfcfc","ue-table-interlace-color-double":"#f7faff"};var Q=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),z(this,"_els",[]),z(this,"_firstPageEls",[]),z(this,"_delayEls",[]),z(this,"showFirstPage",!1)}var t,r,n;return t=e,(r=[{key:"length",get:function(){return this._els.length}},{key:"set",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._els=e}},{key:"get",value:function(){var e=[];return this._els.length?(e=this._els,ht.isDarkmode&&(this._els=[])):this._delayEls.length?(e=this._delayEls,this._delayEls=[]):w.container&&(e=w.container.querySelectorAll("*")),e}},{key:"delay",value:function(){var e=this;Array.prototype.forEach.call(this._els,(function(t){return e._delayEls.push(t)})),this._els=[]}},{key:"hasDelay",value:function(){return!this._els.length&&(this._delayEls.length>0||null!==w.container)}},{key:"addFirstPageNode",value:function(e){this._firstPageEls.push(e)}},{key:"showFirstPageNodes",value:function(){this._firstPageEls.forEach((function(e){return!e.style.visibility&&(e.style.visibility="visible")})),this.showFirstPage=!0}},{key:"emptyFirstPageNodes",value:function(){this._firstPageEls=[]}}])&&V(t.prototype,r),n&&V(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),G=r(0),W=r.n(G),X=r(1),Y=r.n(X);function Z(e,t,r){return{r:255*r(e.r/255,t.r/255),g:255*r(e.g/255,t.g/255),b:255*r(e.b/255,t.b/255)}}function ee(e,t){return t}function te(e,t){return e*t}function re(e,t){return e+t-e*t}function ne(e,t){return ue(t,e)}function ae(e,t){return Math.min(e,t)}function oe(e,t){return Math.min(Math.max(e,t),1)}function ie(e,t){return 0===e?0:1===t?1:Math.min(1,e/(1-t))}function le(e,t){return 1===e?1:0===t?0:1-Math.min(1,(1-e)/t)}function ue(e,t){return t<=.5?te(e,2*t):re(e,2*t-1)}function se(e,t){return t<=.5?e-(1-2*t)*e*(1-e):e+(2*t-1)*((e<=.25?((16*e-12)*e+4)*e:Math.sqrt(e))-e)}function ce(e,t){return Math.abs(e-t)}function he(e,t){return e+t-2*e*t}function fe(e,t,r){return Math.min(Math.max(e||0,t),r)}function de(e){return{r:fe(e.r,0,255),g:fe(e.g,0,255),b:fe(e.b,0,255),a:fe(e.a,0,1)}}function ge(e){return{r:255*e.r,g:255*e.g,b:255*e.b,a:e.a}}function be(e){return{r:e.r/255,g:e.g/255,b:e.b/255,a:e.a}}function pe(e,t){void 0===t&&(t=0);var r=Math.pow(10,t);return{r:Math.round(e.r*r)/r,g:Math.round(e.g*r)/r,b:Math.round(e.b*r)/r,a:e.a}}function ye(e,t,r,n,a,o){return(1-t/r)*n+t/r*Math.round((1-e)*a+e*o)}function me(e,t,r,n,a){void 0===a&&(a={unitInput:!1,unitOutput:!1,roundOutput:!0}),a.unitInput&&(e=ge(e),t=ge(t)),e=de(e);var o=(t=de(t)).a+e.a-t.a*e.a,i=r(e,t,n),l=de({r:ye(e.a,t.a,o,e.r,t.r,i.r),g:ye(e.a,t.a,o,e.g,t.g,i.g),b:ye(e.a,t.a,o,e.b,t.b,i.b),a:o});return l=a.unitOutput?be(l):a.roundOutput?pe(l):function(e){return pe(e,9)}(l)}function ve(e,t,r){return ge(r(be(e),be(t)))}function ke(e){return.3*e.r+.59*e.g+.11*e.b}function we(e,t){var r=t-ke(e);return function(e){var t=ke(e),r=e.r,n=e.g,a=e.b,o=Math.min(r,n,a),i=Math.max(r,n,a);function l(e){return t+(e-t)*t/(t-o)}function u(e){return t+(e-t)*(1-t)/(i-t)}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:e.r+r,g:e.g+r,b:e.b+r})}function xe(e){return Math.max(e.r,e.g,e.b)-Math.min(e.r,e.g,e.b)}function Me(e,t){var r=["r","g","b"].sort((function(t,r){return e[t]-e[r]})),n=r[0],a=r[1],o=r[2],i={r:e.r,g:e.g,b:e.b};return i[o]>i[n]?(i[a]=(i[a]-i[n])*t/(i[o]-i[n]),i[o]=t):i[a]=i[o]=0,i[n]=0,i}function Ce(e,t){return we(Me(t,xe(e)),ke(e))}function _e(e,t){return we(Me(e,xe(t)),ke(e))}function Oe(e,t){return we(t,ke(e))}function je(e,t){return we(e,ke(t))}function Se(e,t){return me(e,t,Z,ee)}function Be(e,t){return me(e,t,Z,te)}function Pe(e,t){return me(e,t,Z,re)}function Ee(e,t){return me(e,t,Z,ne)}function Ae(e,t){return me(e,t,Z,ae)}function Te(e,t){return me(e,t,Z,oe)}function De(e,t){return me(e,t,Z,ie)}function Fe(e,t){return me(e,t,Z,le)}function Ne(e,t){return me(e,t,Z,ue)}function Le(e,t){return me(e,t,Z,se)}function Ie(e,t){return me(e,t,Z,ce)}function qe(e,t){return me(e,t,Z,he)}function Re(e,t){return me(e,t,ve,Ce)}function $e(e,t){return me(e,t,ve,_e)}function Ve(e,t){return me(e,t,ve,Oe)}function ze(e,t){return me(e,t,ve,je)}Y.a.windowtext=[0,0,0],Y.a.transparent=[255,255,255,0];var Ke=new RegExp(Object.keys(Y.a).map((function(e){return"\\b".concat(e,"\\b")})).join("|"),"ig"),He=function(e){var t=e.object();return t.a=t.alpha||1,delete t.alpha,t},Je=function(e){return e.alpha=e.a,delete e.a,Ue(e)},Ue=function(e){var t=null;try{t=e instanceof W.a?e:W()(e)}catch(t){console.log("ignore the invalid color: `".concat(e,"`"))}return t},Qe=function(e,t){return e.replace(y,"").replace(Ke,(function(e){if(!t&&"transparent"===e)return e;var r=Y.a[e.toLowerCase()];return"".concat(r.length>3?"rgba":"rgb","(").concat(r.toString(),")")}))},Ge=function(e){var t=Qe(e);return v.test(t)?t:""},We=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"mix";if("[object Array]"!==Object.prototype.toString.call(e)||e.length<1)return null;if(1===e.length)return e[0];for(var r=Ue(e.shift()),a=Ue(e.shift());a;){if(!r&&a)r=a;else if(r||a)r&&a&&(r="mix"===t?r.mix(a,a.alpha()):Je(n[t](He(r),He(a))));else{if(0===e.length)break;r=Ue(e.shift())}if(0===e.length)break;a=Ue(e.shift())}return r||null},Xe=function(e){return(299*e[0]+587*e[1]+114*e[2])/1e3},Ye=function(e,t){var r=e/Xe(t),n=Math.min(255,t[0]*r),a=Math.min(255,t[1]*r),o=Math.min(255,t[2]*r);return 0===a||255===n||255===o?a=(1e3*e-299*n-114*o)/587:0===n?n=(1e3*e-587*a-114*o)/299:0!==o&&255!==a||(o=(1e3*e-299*n-587*a)/114),W.a.rgb(n,a,o)};function Ze(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}(e,t)||tt(e,t)||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 et(e){return function(e){if(Array.isArray(e))return rt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||tt(e)||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 tt(e,t){if(e){if("string"==typeof e)return rt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?rt(e,t):void 0}}function rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function nt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function at(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ot=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),at(this,"_idx",0),at(this,"_defaultDarkTextColorRgb",null),at(this,"_defaultDarkBgColorRgb",null),at(this,"_defaultDarkBgColorHSL",null),at(this,"_defaultDarkTextColorBrightness",null),at(this,"_defaultDarkBgColorBrightness",null),at(this,"_defaultDarkBgColorHslBrightness",null),at(this,"_maxLimitOffsetBrightness",null),at(this,"isDarkmode",!1)}var t,r,n;return t=e,(r=[{key:"_adjustBrightness",value:function(e,t,r,n){var a,o=e.alpha(),i="";if(r.isBgColor){if(t[f]&&o>=.05&&delete t[f],a=this._adjustBackgroundBrightness(e),!r.hasInlineColor){var l=t[c]||w.defaultLightTextColor,u=Ue(l);if(u){var h=this._adjustBrightness(u,t,{isTextColor:!0,parentElementBgColorStr:a||e},n);h.newColor?i+=st.genCssKV("color",h.newColor):i+=st.genCssKV("color",u)}}}else if(r.isTextColor||r.isBorderColor){var d=r.parentElementBgColorStr||r.isTextColor&&t[s]||w.defaultDarkBgColor,g=Ue(d);g&&!t[f]&&(a=this._adjustTextBrightness(e,g),it.emit("afterConvertTextColor".concat(n?"ByUpdateStyle":""),t,{fontColor:a,bgColor:g}))}else r.isTextShadow&&(t[f]||(a=this._adjustBackgroundBrightness(e)));return{newColor:a&&e.toString()!==a.toString()&&a.alpha(o).rgb(),extStyle:i}}},{key:"_adjustTextBrightness",value:function(e,t){var r=t.rgb().array(),n=t.alpha(),a=Xe(r)*n+this._defaultDarkBgColorBrightness*(1-n),o=e.rgb().array(),i=e.hsl().array(),l=e.alpha(),u=Xe(o),s=Math.abs(a-u);if(u>=250)return e;if(s>this._maxLimitOffsetBrightness&&a<=this._defaultDarkBgColorBrightness+2)return Ye(this._maxLimitOffsetBrightness+a,o).alpha(l);if(s>=65)return e;if(a>=100){if(i[2]>50){i[2]=90-i[2];var c=W.a.hsl.apply(W.a,et(i)).alpha(l);return this._adjustTextBrightness(c,t)}return Ye(Math.min(this._maxLimitOffsetBrightness,a-65),o).alpha(l)}if(i[2]<=40){i[2]=90-i[2];var h=W.a.hsl.apply(W.a,et(i)).alpha(l);return this._adjustTextBrightness(h,t)}return Ye(Math.min(this._maxLimitOffsetBrightness,a+65),o).alpha(l)}},{key:"_adjustBackgroundBrightness",value:function(e){var t=e.rgb().array(),r=e.hsl().array(),n=e.alpha(),a=Xe(t),o=e;return 0===r[1]&&r[2]>40||a>250?o=W.a.hsl(0,0,Math.min(100,100+this._defaultDarkBgColorHslBrightness-r[2])):a>190?o=Ye(190,t).alpha(n):r[2]<22&&(r[2]=22,o=W.a.hsl.apply(W.a,et(r))),o.alpha(n).rgb()}},{key:"_updateBgWithGradient",value:function(e,t,r,n,a,o){var i=We([t[s]||w.defaultDarkBgColor,e],"normal"),l=(t[h]||w.defaultLightBgColor).split("|").concat(e.toString()).join("|");J(t).forEach((function(e){e[s]=i,e[h]=l}));var u=n.slice(-1)[0];if("color"===u[0]){var c=this._adjustBrightness(Ue(Qe(u[1])),t,{isBgColor:!1,isTextShadow:!1,isTextColor:!0,isBorderColor:!1,hasInlineColor:a},o);if(c.newColor)return st.genCss(r,st.genCssKV("color",c.newColor))}return""}},{key:"_try",value:function(e){try{return e()}catch(e){console.log("An error occurred when running the dark mode conversion algorithm\n",e),"function"==typeof w.error&&w.error(e)}}},{key:"init",value:function(){this._defaultDarkTextColorRgb=Ue(w.defaultDarkTextColor).rgb().array(),this._defaultDarkBgColorRgb=Ue(w.defaultDarkBgColor).rgb().array(),this._defaultDarkBgColorHSL=Ue(w.defaultDarkBgColor).hsl().array(),this._defaultDarkTextColorBrightness=Xe(this._defaultDarkTextColorRgb),this._defaultDarkBgColorBrightness=Xe(this._defaultDarkBgColorRgb),this._defaultDarkBgColorHslBrightness=this._defaultDarkBgColorHSL[2],this._maxLimitOffsetBrightness=this._defaultDarkTextColorBrightness-this._defaultDarkBgColorBrightness}},{key:"convert",value:function(e,t,r){var n=this;it.resetCss(),it.emit("beforeConvertNode".concat(r?"ByUpdateStyle":""),e);var a="",i="";if(this.isDarkmode||r){var l=e.nodeName;if(w.whitelist.tagName.indexOf(l)>-1)return"";if(w.whitelist.attribute.some((function(t){return e.hasAttribute(t)})))return"";var d=e.style;t||(t=(d.cssText&&d.cssText.replace(/("[^;]*);([^;]*")|('[^;]*);([^;]*')/g,"$1$3".concat("<$#_SEMICOLON_#$>","$2$4")).split(";")||[]).map((function(e){var t=e.indexOf(":");return[e.slice(0,t).toLowerCase(),e.slice(t+1).replace(m,";")].map((function(e){return(e||"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}))})));var x=!1,M=!1,C=!1,_=null,O=null;t=t.filter((function(e){var t=Ze(e,2),r=t[0],n=t[1];return"color"===r?x=!0:/background/i.test(r)&&(M=!0,"background-position"===r?_=n:"background-size"===r&&(O=n)),(/background/i.test(r)||/^(-webkit-)?border-image/.test(r))&&/url\([^)]*\)/i.test(n)&&(C=!0),b.indexOf(r)>-1})).sort((function(e,t){var r=Ze(e,1)[0],n=Ze(t,1)[0];return"color"===r||"background-image"===r&&"background-color"===n||0===n.indexOf("-webkit-text")?1:-1})),p.indexOf(l)>-1&&!M&&this._try((function(){var r=function(e){var t=null;return Array.prototype.some.call(e.classList,(function(e){return!!U[e]&&(t=U[e],!0)})),t}(e);if(r||(r=e.getAttribute("bgcolor")),r){var n=Ue(r);n&&(t.unshift(["background-color",n.toString()]),M=!0)}})),"FONT"!==l||x||this._try((function(){var r=e.getAttribute("color");if(r){var n=Ue(r);n&&(t.push(["color",n.toString()]),x=!0)}}));var j="",S="",B=0;t.some((function(e,t){var r=Ze(e,2),a=r[0],o=r[1];return n._try((function(){if(0!==a.indexOf("-webkit-text"))return B=t,!0;switch(a){case"-webkit-text-fill-color":j=Ge(o);break;case"-webkit-text-stroke":var e=o.split(" ");2===e.length&&(S=Ge(e[1]));break;case"-webkit-text-stroke-color":S=Ge(o)}return!1}))})),j&&(x?t[t.length-1]=["-webkit-text-fill-color",j]:(t.push(["-webkit-text-fill-color",j]),x=!0)),B&&(t.splice(0,B),S&&t.unshift(["-webkit-text-stroke-color",S]));var P="",E="";if(r&&e.className&&"string"==typeof e.className){var A=e.className.match(o);A&&(P=A[0]),(A=e.className.match(ut.classNameReg))&&(E=A[0])}var T="";t.forEach((function(o){var l=Ze(o,2),b=l[0],p=l[1];return n._try((function(){var o,l=p,m=!1,j=g.BG_COLOR.indexOf(b)>-1,S=g.TEXT_SHADOW.indexOf(b)>-1,B=g.TEXT_COLOR.indexOf(b),P=g.BORDER_COLOR.indexOf(b)>-1,A=/gradient/.test(p),D=[],F="";if(p=Qe(p,A),v.test(p)){if(A){for(var N=k.exec(p);N;)D.push(N[0]),N=k.exec(p);o=We(D)}var L=0;p=p.replace(k,(function(t){A&&(t=o,m=!0);var a=Ue(t);if((null==a?void 0:a.alpha())>=.05){var i=n._adjustBrightness(a,e,{isBgColor:j,isTextShadow:S,isTextColor:B>-1,isBorderColor:P,hasInlineColor:x},r),l=!C&&i.newColor;if(F+=i.extStyle,j||B>=5){var d=l?l.toString():t;0===L&&J(e).forEach((function(e){j?(e[s]=d,e[h]=(e[h]||w.defaultLightBgColor).split("|").concat(t).join("|")):(e[u]=d,e[c]=t);var r=Ue(d);j&&(null==r?void 0:r.alpha())>=.05&&e[f]&&delete e[f]}))}return l&&(m=!0),L++,l||t}return t})).replace(/\s?!\s?important/gi,"")}if(F&&(T+=F),!(e instanceof SVGElement)){var I=/^background/.test(b),q=/^(-webkit-)?border-image/.test(b);if((I||q)&&/url\([^)]*\)/i.test(p)){m=!0;var R=We((e[h]||w.defaultLightBgColor).split("|"),"normal").toString();if(p=p.replace(/^(.*?)url\(([^)]*)\)(.*)$/i,(function(t){var r=t,n="";return e[f]||J(e).forEach((function(e){e[f]=!0})),I?(n=st.genCssKV(b,R?"".concat(r,",linear-gradient(").concat(R,", ").concat(R,")"):r),_&&(T+=st.genCssKV("background-position",_),n+=st.genCssKV("background-position",R?"".concat(_,",top left"):_)),O&&(T+=st.genCssKV("background-size",O),n+=st.genCssKV("background-size",R?"".concat(O,",100%"):O)),E?i+=st.genCss(E,n):ut.push(e,n)):R&&!M&&(n=st.genCssKV("background-image","linear-gradient(".concat(R,", ").concat(R,")")),E?i+=st.genCss(E,n):ut.push(e,n)),r})),!x){var $=e[c]||w.defaultLightTextColor;T+=st.genCssKV("color",$),J(e).forEach((function(e){e[u]=$}))}}}m&&(!r&&y.test(l)&&(d[b]=l.replace(y,"")),A?E?(i+=st.genCss(E,st.genCssKV(b,p)),/^background/.test(b)&&!/url\([^)]*\)/i.test(p)&&(a+=n._updateBgWithGradient(o,e,E,t,x,r))):ut.push(e,st.genCssKV(b,p),(function(i){/^background/.test(b)&&!/url\([^)]*\)/i.test(p)&&(a+=n._updateBgWithGradient(o,e,i.className,t,x,r))})):T+=st.genCssKV(b,p))}))})),T&&(P||(P="".concat("js_darkmode__").concat(this._idx++),e.classList.add(P)),a+=T?st.genCss(P,T):""),a+=i,!r&&function(e){return e.textContent.replace(/\s/g,"").length>0}(e)&&(w.delayBgJudge?lt.push(e):ut.contains(e,(function(e){a+=st.genCss(e.className,e.cssKV),"function"==typeof e.cb&&e.cb(e)})))}return it.emit("afterConvertNode".concat(r?"ByUpdateStyle":""),e),a}},{key:"getContrast",value:function(e,t){var r=Ue(e),n=Ue(t);return r&&n?r.contrast(n):0}}])&&nt(t.prototype,r),n&&nt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),it=new B,lt=new T("".concat("js_darkmode__","text__")),ut=new N("".concat("js_darkmode__","bg__")),st=new $,ct=new Q,ht=new ot,ft=new RegExp("".concat("js_darkmode__","[^ ]+"),"g"),dt=null,gt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{type:"dom"};if(t.force&&(st.isFinish=!1),!st.isFinish)try{ht.isDarkmode=w.mode?"dark"===w.mode:e.matches,"dom"===t.type?(ht.isDarkmode&&"function"==typeof w.begin&&w.begin(ct.hasDelay()),Array.prototype.forEach.call(ct.get(),(function(e){if(ht.isDarkmode&&e.className&&"string"==typeof e.className&&(e.className=e.className.replace(ft,"")),ht.isDarkmode||it.length)if(w.needJudgeFirstPage){var t=e.getBoundingClientRect(),r=t.top,n=t.bottom;r<=0&&n<=0?st.addCss(ht.convert(e)):r>0&&r<d||n>0&&n<d?(ct.addFirstPageNode(e),st.addCss(ht.convert(e),!0)):(w.needJudgeFirstPage=!1,st.writeStyle(!0),ct.showFirstPageNodes(),"function"==typeof w.showFirstPage&&w.showFirstPage(),st.addCss(ht.convert(e)))}else st.addCss(ht.convert(e))})),it.loopTimes++):"bg"===t.type&&ht.isDarkmode&&lt.forEach((function(e){return ut.contains(e,(function(e){st.addCss(st.genCss(e.className,e.cssKV))}))})),(w.needJudgeFirstPage||!w.needJudgeFirstPage&&!ct.showFirstPage)&&"function"==typeof w.showFirstPage&&w.showFirstPage(),st.writeStyle(),ct.emptyFirstPageNodes(),ht.isDarkmode||(w.needJudgeFirstPage=!1,w.delayBgJudge=!1,null===w.container&&"dom"===t.type&&ct.length&&ct.delay())}catch(e){console.log("An error occurred when running the dark mode conversion algorithm\n",e),"function"==typeof w.error&&w.error(e)}};function bt(e,t){pt(t),ct.set(e),gt(dt,{force:!0,type:"dom"})}function pt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!w.hasInit){w.hasInit=!0;var t=w.whitelist.tagName,r=w.whitelist.attribute;e.whitelist&&(e.whitelist.tagName instanceof Array&&e.whitelist.tagName.forEach((function(e){e=e.toUpperCase(),-1===t.indexOf(e)&&t.push(e)})),e.whitelist.attribute instanceof Array&&e.whitelist.attribute.forEach((function(e){-1===r.indexOf(e)&&r.push(e)}))),["dark","light"].indexOf(e.mode)>-1&&(w.set("string",e,"mode"),"dark"===e.mode&&document.getElementsByTagName("html")[0].classList.add(i)),w.set("function",e,"begin"),w.set("function",e,"showFirstPage"),w.set("function",e,"error"),w.set("boolean",e,"needJudgeFirstPage"),w.set("boolean",e,"delayBgJudge"),w.set("dom",e,"container"),w.set("string",e,"cssSelectorsPrefix"),w.set("string",e,"defaultLightTextColor"),w.set("string",e,"defaultLightBgColor"),w.set("string",e,"defaultDarkTextColor"),w.set("string",e,"defaultDarkBgColor"),ht.init(),!w.mode&&null===dt&&window.matchMedia&&(dt=window.matchMedia(a)).addListener(gt)}}function yt(e){ct.set(e),null!==w.container&&(ut.update(e),lt.update(e)),gt(dt,{force:!0,type:"bg"})}function mt(e,t){st.isFinish&&(st.addCss(ht.convert(e,t?Object.keys(t).map((function(e){return[e,t[e]]})):void 0,!0),!1),st.writeStyle())}function vt(e,t){return ht.getContrast(e,t)}function kt(e){e.forEach((function(e){return it.extend(e)}))}}])}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Darkmode",[],t):"object"==typeof exports?exports.Darkmode=t():e.Darkmode=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=9)}([function(e,t,r){"use strict";var n=r(3),a=r(6),o=[].slice,i=["keyword","gray","hex"],l={};Object.keys(a).forEach((function(e){l[o.call(a[e].labels).sort().join("")]=e}));var u={};function s(e,t){if(!(this instanceof s))return new s(e,t);if(t&&t in i&&(t=null),t&&!(t in a))throw new Error("Unknown model: "+t);var r,c;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof s)this.model=e.model,this.color=e.color.slice(),this.valpha=e.valpha;else if("string"==typeof e){var h=n.get(e);if(null===h)throw new Error("Unable to parse color from string: "+e);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(e.length){this.model=t||"rgb",c=a[this.model].channels;var f=o.call(e,0,c);this.color=d(f,c),this.valpha="number"==typeof e[c]?e[c]:1}else if("number"==typeof e)e&=16777215,this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;var g=Object.keys(e);"alpha"in e&&(g.splice(g.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);var b=g.sort().join("");if(!(b in l))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=l[b];var p=a[this.model].labels,y=[];for(r=0;r<p.length;r++)y.push(e[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(e,t,r){return(e=Array.isArray(e)?e:[e]).forEach((function(e){(u[e]||(u[e]=[]))[t]=r})),e=e[0],function(n){var a;return arguments.length?(r&&(n=r(n)),(a=this[e]()).color[t]=n,a):(a=this[e]().color[t],r&&(a=r(a)),a)}}function h(e){return function(t){return Math.max(0,Math.min(e,t))}}function f(e){return Array.isArray(e)?e:[e]}function d(e,t){for(var r=0;r<t;r++)"number"!=typeof e[r]&&(e[r]=0);return e}s.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(e){var t=this.model in n.to?this:this.rgb(),r=1===(t=t.round("number"==typeof e?e:1)).valpha?t.color:t.color.concat(this.valpha);return n.to[t.model](r)},percentString:function(e){var t=this.rgb().round("number"==typeof e?e:1),r=1===t.valpha?t.color:t.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 e={},t=a[this.model].channels,r=a[this.model].labels,n=0;n<t;n++)e[r[n]]=this.color[n];return 1!==this.valpha&&(e.alpha=this.valpha),e},unitArray:function(){var e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,1!==this.valpha&&e.push(this.valpha),e},unitObject:function(){var e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,1!==this.valpha&&(e.alpha=this.valpha),e},round:function(e){return e=Math.max(e||0,0),new s(this.color.map(function(e){return function(t){return function(e,t){return Number(e.toFixed(t))}(t,e)}}(e)).concat(this.valpha),this.model)},alpha:function(e){return arguments.length?new s(this.color.concat(Math.max(0,Math.min(1,e))),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(e){return(e%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(e){return arguments.length?new s(e):a[this.model].keyword(this.color)},hex:function(e){return arguments.length?new s(e):n.to.hex(this.rgb().round().color)},rgbNumber:function(){var e=this.rgb().color;return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},luminosity:function(){for(var e=this.rgb().color,t=[],r=0;r<e.length;r++){var n=e[r]/255;t[r]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return.2126*t[0]+.7152*t[1]+.0722*t[2]},contrast:function(e){var t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level:function(e){var t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark:function(){var e=this.rgb().color;return(299*e[0]+587*e[1]+114*e[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var e=this.rgb(),t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten:function(e){var t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken:function(e){var t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate:function(e){var t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate:function(e){var t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten:function(e){var t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken:function(e){var t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale:function(){var e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return s.rgb(t,t,t)},fade:function(e){return this.alpha(this.valpha-this.valpha*e)},opaquer:function(e){return this.alpha(this.valpha+this.valpha*e)},rotate:function(e){var t=this.hsl(),r=t.color[0];return r=(r=(r+e)%360)<0?360+r:r,t.color[0]=r,t},mix:function(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);var r=e.rgb(),n=this.rgb(),a=void 0===t?.5:t,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(e){if(-1===i.indexOf(e)){var t=a[e].channels;s.prototype[e]=function(){if(this.model===e)return new s(this);if(arguments.length)return new s(arguments,e);var r="number"==typeof arguments[t]?t:this.valpha;return new s(f(a[this.model][e].raw(this.color)).concat(r),e)},s[e]=function(r){return"number"==typeof r&&(r=d(o.call(arguments),t)),new s(r,e)}}})),e.exports=s},function(e,t,r){"use strict";e.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(e,t,r){var n=r(7),a={};for(var o in n)n.hasOwnProperty(o)&&(a[n[o]]=o);var i=e.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(e){var t,r,n=e[0]/255,a=e[1]/255,o=e[2]/255,i=Math.min(n,a,o),l=Math.max(n,a,o),u=l-i;return l===i?t=0:n===l?t=(a-o)/u:a===l?t=2+(o-n)/u:o===l&&(t=4+(n-a)/u),(t=Math.min(60*t,360))<0&&(t+=360),r=(i+l)/2,[t,100*(l===i?0:r<=.5?u/(l+i):u/(2-l-i)),100*r]},i.rgb.hsv=function(e){var t,r,n,a,o,i=e[0]/255,l=e[1]/255,u=e[2]/255,s=Math.max(i,l,u),c=s-Math.min(i,l,u),h=function(e){return(s-e)/6/c+.5};return 0===c?a=o=0:(o=c/s,t=h(i),r=h(l),n=h(u),i===s?a=n-r:l===s?a=1/3+t-n:u===s&&(a=2/3+r-t),a<0?a+=1:a>1&&(a-=1)),[360*a,100*o,100*s]},i.rgb.hwb=function(e){var t=e[0],r=e[1],n=e[2];return[i.rgb.hsl(e)[0],100*(1/255*Math.min(t,Math.min(r,n))),100*(n=1-1/255*Math.max(t,Math.max(r,n)))]},i.rgb.cmyk=function(e){var t,r=e[0]/255,n=e[1]/255,a=e[2]/255;return[100*((1-r-(t=Math.min(1-r,1-n,1-a)))/(1-t)||0),100*((1-n-t)/(1-t)||0),100*((1-a-t)/(1-t)||0),100*t]},i.rgb.keyword=function(e){var t=a[e];if(t)return t;var r,o,i,l=1/0;for(var u in n)if(n.hasOwnProperty(u)){var s=n[u],c=(o=e,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(e){return n[e]},i.rgb.xyz=function(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255;return[100*(.4124*(t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/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*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},i.rgb.lab=function(e){var t=i.rgb.xyz(e),r=t[0],n=t[1],a=t[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(e){var t,r,n,a,o,i=e[0]/360,l=e[1]/100,u=e[2]/100;if(0===l)return[o=255*u,o,o];t=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?t+6*(r-t)*n:2*n<1?r:3*n<2?t+(r-t)*(2/3-n)*6:t,a[s]=255*o;return a},i.hsl.hsv=function(e){var t=e[0],r=e[1]/100,n=e[2]/100,a=r,o=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,a*=o<=1?o:2-o,[t,100*(0===n?2*a/(o+a):2*r/(n+r)),100*((n+r)/2)]},i.hsv.rgb=function(e){var t=e[0]/60,r=e[1]/100,n=e[2]/100,a=Math.floor(t)%6,o=t-Math.floor(t),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(e){var t,r,n,a=e[0],o=e[1]/100,i=e[2]/100,l=Math.max(i,.01);return n=(2-o)*i,r=o*l,[a,100*(r=(r/=(t=(2-o)*l)<=1?t:2-t)||0),100*(n/=2)]},i.hwb.rgb=function(e){var t,r,n,a,o,i,l,u=e[0]/360,s=e[1]/100,c=e[2]/100,h=s+c;switch(h>1&&(s/=h,c/=h),n=6*u-(t=Math.floor(6*u)),0!=(1&t)&&(n=1-n),a=s+n*((r=1-c)-s),t){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(e){var t=e[0]/100,r=e[1]/100,n=e[2]/100,a=e[3]/100;return[255*(1-Math.min(1,t*(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(e){var t,r,n,a=e[0]/100,o=e[1]/100,i=e[2]/100;return r=-.9689*a+1.8758*o+.0415*i,n=.0557*a+-.204*o+1.057*i,t=(t=3.2406*a+-1.5372*o+-.4986*i)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,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*(t=Math.min(Math.max(0,t),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]},i.xyz.lab=function(e){var t=e[0],r=e[1],n=e[2];return r/=100,n/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(t-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},i.lab.xyz=function(e){var t,r,n,a=e[0];t=e[1]/500+(r=(a+16)/116),n=r-e[2]/200;var o=Math.pow(r,3),i=Math.pow(t,3),l=Math.pow(n,3);return r=o>.008856?o:(r-16/116)/7.787,t=i>.008856?i:(t-16/116)/7.787,n=l>.008856?l:(n-16/116)/7.787,[t*=95.047,r*=100,n*=108.883]},i.lab.lch=function(e){var t,r=e[0],n=e[1],a=e[2];return(t=360*Math.atan2(a,n)/2/Math.PI)<0&&(t+=360),[r,Math.sqrt(n*n+a*a),t]},i.lch.lab=function(e){var t,r=e[0],n=e[1];return t=e[2]/360*2*Math.PI,[r,n*Math.cos(t),n*Math.sin(t)]},i.rgb.ansi16=function(e){var t=e[0],r=e[1],n=e[2],a=1 in arguments?arguments[1]:i.rgb.hsv(e)[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(t/255));return 2===a&&(o+=60),o},i.hsv.ansi16=function(e){return i.rgb.ansi16(i.hsv.rgb(e),e[2])},i.rgb.ansi256=function(e){var t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},i.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},i.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var r;return e-=16,[Math.floor(e/36)/5*255,Math.floor((r=e%36)/6)/5*255,r%6/5*255]},i.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},i.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var r=t[0];3===t[0].length&&(r=r.split("").map((function(e){return e+e})).join(""));var n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},i.rgb.hcg=function(e){var t,r=e[0]/255,n=e[1]/255,a=e[2]/255,o=Math.max(Math.max(r,n),a),i=Math.min(Math.min(r,n),a),l=o-i;return t=l<=0?0:o===r?(n-a)/l%6:o===n?2+(a-r)/l:4+(r-n)/l+4,t/=6,[360*(t%=1),100*l,100*(l<1?i/(1-l):0)]},i.hsl.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=1,a=0;return(n=r<.5?2*t*r:2*t*(1-r))<1&&(a=(r-.5*n)/(1-n)),[e[0],100*n,100*a]},i.hsv.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=t*r,a=0;return n<1&&(a=(r-n)/(1-n)),[e[0],100*n,100*a]},i.hcg.rgb=function(e){var t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];var a,o=[0,0,0],i=t%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(e){var t=e[1]/100,r=t+e[2]/100*(1-t),n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},i.hcg.hsl=function(e){var t=e[1]/100,r=e[2]/100*(1-t)+.5*t,n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},i.hcg.hwb=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},i.hwb.hcg=function(e){var t=e[1]/100,r=1-e[2]/100,n=r-t,a=0;return n<1&&(a=(r-n)/(1-n)),[e[0],100*n,100*a]},i.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},i.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},i.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},i.gray.hsl=i.gray.hsv=function(e){return[0,0,e[0]]},i.gray.hwb=function(e){return[0,100,e[0]]},i.gray.cmyk=function(e){return[0,0,0,e[0]]},i.gray.lab=function(e){return[e[0],0,0]},i.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},i.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},function(e,t,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=e.exports={to:{},get:{}};function s(e,t,r){return Math.min(Math.max(t,e),r)}function c(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}u.get=function(e){var t,r;switch(e.substring(0,3).toLowerCase()){case"hsl":t=u.get.hsl(e),r="hsl";break;case"hwb":t=u.get.hwb(e),r="hwb";break;default:t=u.get.rgb(e),r="rgb"}return t?{model:r,value:t}:null},u.get.rgb=function(e){if(!e)return null;var t,r,a,i=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(a=t[2],t=t[1],r=0;r<3;r++){var l=2*r;i[r]=parseInt(t.slice(l,l+2),16)}a&&(i[3]=parseInt(a,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(a=(t=t[1])[3],r=0;r<3;r++)i[r]=parseInt(t[r]+t[r],16);a&&(i[3]=parseInt(a+a,16)/255)}else if(t=e.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(t[r+1],0);t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:o.call(n,t[1])?((i=n[t[1]])[3]=1,i):null:null;for(r=0;r<3;r++)i[r]=Math.round(2.55*parseFloat(t[r+1]));t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[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(e){if(!e)return null;var t=e.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(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,s(parseFloat(t[2]),0,100),s(parseFloat(t[3]),0,100),s(isNaN(r)?1:r,0,1)]}return null},u.get.hwb=function(e){if(!e)return null;var t=e.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(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,s(parseFloat(t[2]),0,100),s(parseFloat(t[3]),0,100),s(isNaN(r)?1:r,0,1)]}return null},u.to.hex=function(){var e=a(arguments);return"#"+c(e[0])+c(e[1])+c(e[2])+(e[3]<1?c(Math.round(255*e[3])):"")},u.to.rgb=function(){var e=a(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},u.to.rgb.percent=function(){var e=a(arguments),t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"},u.to.hsl=function(){var e=a(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},u.to.hwb=function(){var e=a(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},u.to.keyword=function(e){return i[e.slice(0,3)]}},function(e,t,r){"use strict";var n=r(5),a=Array.prototype.concat,o=Array.prototype.slice,i=e.exports=function(e){for(var t=[],r=0,i=e.length;r<i;r++){var l=e[r];n(l)?t=a.call(t,o.call(l)):t.push(l)}return t};i.wrap=function(e){return function(){return e(i(arguments))}}},function(e,t){e.exports=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))}},function(e,t,r){var n=r(2),a=r(8),o={};Object.keys(n).forEach((function(e){o[e]={},Object.defineProperty(o[e],"channels",{value:n[e].channels}),Object.defineProperty(o[e],"labels",{value:n[e].labels});var t=a(e);Object.keys(t).forEach((function(r){var n=t[r];o[e][r]=function(e){var t=function(t){if(null==t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var r=e(t);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 e&&(t.conversion=e.conversion),t}(n),o[e][r].raw=function(e){var t=function(t){return null==t?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)}))})),e.exports=o},function(e,t,r){"use strict";e.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(e,t,r){var n=r(2);function a(e){var t=function(){for(var e={},t=Object.keys(n),r=t.length,a=0;a<r;a++)e[t[a]]={distance:-1,parent:null};return e}(),r=[e];for(t[e].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=t[u];-1===s.distance&&(s.distance=t[a].distance+1,s.parent=a,r.unshift(u))}return t}function o(e,t){return function(r){return t(e(r))}}function i(e,t){for(var r=[t[e].parent,e],a=n[t[e].parent][e],i=t[e].parent;t[i].parent;)r.unshift(t[i].parent),a=o(n[t[i].parent][i],a),i=t[i].parent;return a.conversion=r,a}e.exports=function(e){for(var t=a(e),r={},n=Object.keys(t),o=n.length,l=0;l<o;l++){var u=n[l];null!==t[u].parent&&(r[u]=i(u,t))}return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"run",(function(){return pt})),r.d(t,"init",(function(){return yt})),r.d(t,"convertBg",(function(){return mt})),r.d(t,"updateStyle",(function(){return vt})),r.d(t,"getContrast",(function(){return kt})),r.d(t,"extend",(function(){return wt}));var n={};r.r(n),r.d(n,"color",(function(){return ze})),r.d(n,"colorBurn",(function(){return Ne})),r.d(n,"colorDodge",(function(){return Fe})),r.d(n,"darken",(function(){return Te})),r.d(n,"difference",(function(){return qe})),r.d(n,"exclusion",(function(){return Re})),r.d(n,"hardLight",(function(){return Le})),r.d(n,"hue",(function(){return $e})),r.d(n,"lighten",(function(){return De})),r.d(n,"luminosity",(function(){return Ke})),r.d(n,"multiply",(function(){return Pe})),r.d(n,"normal",(function(){return Be})),r.d(n,"overlay",(function(){return Ae})),r.d(n,"saturation",(function(){return Ve})),r.d(n,"screen",(function(){return Ee})),r.d(n,"softLight",(function(){return Ie}));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(e){return b[e].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(e,t,r){var n=t[r];switch(e){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(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function O(e,t,r){return t&&_(e.prototype,t),r&&_(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var j=[],S=[],B=function(){function e(){C(this,e)}return O(e,[{key:"loopTimes",get:function(){return lt.loopTimes}},{key:"isDarkmode",get:function(){return ft.isDarkmode}},{key:"addCss",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(r?j:S).push(ct.genCss(e,t.map((function(e){var t=e.key,r=e.value;return ct.genCssKV(t,r)})).join("")))}}]),e}(),P=function(){function e(){C(this,e),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(e,[{key:"extend",value:function(e){this._plugins.push(new(e(B))),this.length++}},{key:"emit",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this._plugins.forEach((function(t){"function"==typeof t[e]&&t[e].apply(t,r)}))}},{key:"addCss",value:function(e){e?(this.firstPageStyle+=j.join(""),this.firstPageStyleNoMQ+=S.join("")):(this.otherPageStyle+=j.join(""),this.otherPageStyleNoMQ+=S.join(""))}},{key:"resetCss",value:function(){j=[],S=[]}}]),e}();function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function A(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var D=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),T(this,"_queue",[]),T(this,"_idx",0),this._prefix=t}var t,r,n;return t=e,(r=[{key:"push",value:function(e){var t="".concat(this._prefix).concat(this._idx++);e.classList.add(t),this._queue.push({el:e,className:t,updated:!x.delayBgJudge})}},{key:"forEach",value:function(e){var t=[];for(this._queue.forEach((function(r,n){r.updated&&(t.unshift(n),E(e)&&e(r.el))}));t.length;)this._queue.splice(t.shift(),1)}},{key:"update",value:function(e){this._queue.forEach((function(t){t.updated||Array.prototype.some.call(e,(function(e){return!(1!==e.nodeType||!e.classList.contains(t.className)||(t.el=e,t.updated=!0,0))}))}))}}])&&A(t.prototype,r),n&&A(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function F(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var L=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),N(this,"_stack",[]),N(this,"_idx",0),this._prefix=t,this.classNameReg=new RegExp("".concat(this._prefix,"\\d+"))}var t,r,n;return t=e,(r=[{key:"push",value:function(e,t,r){var n="".concat(this._prefix).concat(this._idx++);e.classList.add(n),this._stack.unshift({el:e,className:n,cssKV:t,updated:!x.delayBgJudge,cb:r})}},{key:"contains",value:function(e,t){var r=e.getBoundingClientRect(),n=[];for(this._stack.forEach((function(e,t){if(e.updated){e.rect||(e.rect=e.el.getBoundingClientRect());var a=e.rect;r.top>=a.bottom||r.bottom<=a.top||r.left>=a.right||r.right<=a.left||n.unshift(t)}}));n.length;){var a=this._stack.splice(n.shift(),1)[0];"function"==typeof t&&t(a)}}},{key:"update",value:function(e){this._stack.forEach((function(t){t.updated||Array.prototype.some.call(e,(function(e){return!(1!==e.nodeType||!e.classList.contains(t.className)||(t.el=e,t.updated=!0,0))}))}))}}])&&F(t.prototype,r),n&&F(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(e,t)}(e,t)||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(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function $(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var V=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),$(this,"_firstPageStyle",""),$(this,"_otherPageStyle",""),$(this,"isFinish",!1)}var t,r,n;return t=e,(r=[{key:"genCssKV",value:function(e,t){return"".concat(e,": ").concat(t," !important;")}},{key:"genCss",value:function(e,t){return"".concat("dark"===x.mode?"html.".concat(i," "):"").concat(x.cssSelectorsPrefix&&"".concat(x.cssSelectorsPrefix," "),".").concat(e,"{").concat(t,"}")}},{key:"addCss",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this[t?"_firstPageStyle":"_otherPageStyle"]+=e,lt.addCss(t)}},{key:"writeStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];!e&&ft.isDarkmode&&(this.isFinish=!0);var t=(ft.isDarkmode?[{target:this,key:["_firstPageStyle","_otherPageStyle"],needMediaQuery:!0}]:[]).concat([{target:lt,key:["firstPageStyle","otherPageStyle"],needMediaQuery:!0},{target:lt,key:["firstPageStyleNoMQ","otherPageStyleNoMQ"],needMediaQuery:!1}]).map((function(t){var r=t.target,n=I(t.key,2),o=n[0],i=n[1],l=t.needMediaQuery,u="";e?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("");t&&document.head.insertAdjacentHTML("beforeend",'<style type="text/css">'.concat(t,"</style>"))}}])&&R(t.prototype,r),n&&R(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function K(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H(e){return function(e){if(Array.isArray(e))return J(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return J(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return J(e,t)}(e)||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(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function U(e){var t;return(t=[e]).concat.apply(t,H(e.querySelectorAll("*")))}var Q={"ue-table-interlace-color-single":"#fcfcfc","ue-table-interlace-color-double":"#f7faff"};var G=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),K(this,"_els",[]),K(this,"_firstPageEls",[]),K(this,"_delayEls",[]),K(this,"showFirstPage",!1)}var t,r,n;return t=e,(r=[{key:"length",get:function(){return this._els.length}},{key:"set",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._els=e}},{key:"get",value:function(){var e=[];return this._els.length?(e=this._els,ft.isDarkmode&&(this._els=[])):this._delayEls.length?(e=this._delayEls,this._delayEls=[]):x.container&&(e=x.container.querySelectorAll("*")),e}},{key:"delay",value:function(){var e=this;Array.prototype.forEach.call(this._els,(function(t){return e._delayEls.push(t)})),this._els=[]}},{key:"hasDelay",value:function(){return!this._els.length&&(this._delayEls.length>0||null!==x.container)}},{key:"addFirstPageNode",value:function(e){this._firstPageEls.push(e)}},{key:"showFirstPageNodes",value:function(){this._firstPageEls.forEach((function(e){return!e.style.visibility&&(e.style.visibility="visible")})),this.showFirstPage=!0}},{key:"emptyFirstPageNodes",value:function(){this._firstPageEls=[]}}])&&z(t.prototype,r),n&&z(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),W=r(0),X=r.n(W),Y=r(1),Z=r.n(Y);function ee(e,t,r){return{r:255*r(e.r/255,t.r/255),g:255*r(e.g/255,t.g/255),b:255*r(e.b/255,t.b/255)}}function te(e,t){return t}function re(e,t){return e*t}function ne(e,t){return e+t-e*t}function ae(e,t){return se(t,e)}function oe(e,t){return Math.min(e,t)}function ie(e,t){return Math.min(Math.max(e,t),1)}function le(e,t){return 0===e?0:1===t?1:Math.min(1,e/(1-t))}function ue(e,t){return 1===e?1:0===t?0:1-Math.min(1,(1-e)/t)}function se(e,t){return t<=.5?re(e,2*t):ne(e,2*t-1)}function ce(e,t){return t<=.5?e-(1-2*t)*e*(1-e):e+(2*t-1)*((e<=.25?((16*e-12)*e+4)*e:Math.sqrt(e))-e)}function he(e,t){return Math.abs(e-t)}function fe(e,t){return e+t-2*e*t}function de(e,t,r){return Math.min(Math.max(e||0,t),r)}function ge(e){return{r:de(e.r,0,255),g:de(e.g,0,255),b:de(e.b,0,255),a:de(e.a,0,1)}}function be(e){return{r:255*e.r,g:255*e.g,b:255*e.b,a:e.a}}function pe(e){return{r:e.r/255,g:e.g/255,b:e.b/255,a:e.a}}function ye(e,t){void 0===t&&(t=0);var r=Math.pow(10,t);return{r:Math.round(e.r*r)/r,g:Math.round(e.g*r)/r,b:Math.round(e.b*r)/r,a:e.a}}function me(e,t,r,n,a,o){return(1-t/r)*n+t/r*Math.round((1-e)*a+e*o)}function ve(e,t,r,n,a){void 0===a&&(a={unitInput:!1,unitOutput:!1,roundOutput:!0}),a.unitInput&&(e=be(e),t=be(t)),e=ge(e);var o=(t=ge(t)).a+e.a-t.a*e.a,i=r(e,t,n),l=ge({r:me(e.a,t.a,o,e.r,t.r,i.r),g:me(e.a,t.a,o,e.g,t.g,i.g),b:me(e.a,t.a,o,e.b,t.b,i.b),a:o});return l=a.unitOutput?pe(l):a.roundOutput?ye(l):function(e){return ye(e,9)}(l)}function ke(e,t,r){return be(r(pe(e),pe(t)))}function we(e){return.3*e.r+.59*e.g+.11*e.b}function xe(e,t){var r=t-we(e);return function(e){var t=we(e),r=e.r,n=e.g,a=e.b,o=Math.min(r,n,a),i=Math.max(r,n,a);function l(e){return t+(e-t)*t/(t-o)}function u(e){return t+(e-t)*(1-t)/(i-t)}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:e.r+r,g:e.g+r,b:e.b+r})}function Me(e){return Math.max(e.r,e.g,e.b)-Math.min(e.r,e.g,e.b)}function Ce(e,t){var r=["r","g","b"].sort((function(t,r){return e[t]-e[r]})),n=r[0],a=r[1],o=r[2],i={r:e.r,g:e.g,b:e.b};return i[o]>i[n]?(i[a]=(i[a]-i[n])*t/(i[o]-i[n]),i[o]=t):i[a]=i[o]=0,i[n]=0,i}function _e(e,t){return xe(Ce(t,Me(e)),we(e))}function Oe(e,t){return xe(Ce(e,Me(t)),we(e))}function je(e,t){return xe(t,we(e))}function Se(e,t){return xe(e,we(t))}function Be(e,t){return ve(e,t,ee,te)}function Pe(e,t){return ve(e,t,ee,re)}function Ee(e,t){return ve(e,t,ee,ne)}function Ae(e,t){return ve(e,t,ee,ae)}function Te(e,t){return ve(e,t,ee,oe)}function De(e,t){return ve(e,t,ee,ie)}function Fe(e,t){return ve(e,t,ee,le)}function Ne(e,t){return ve(e,t,ee,ue)}function Le(e,t){return ve(e,t,ee,se)}function Ie(e,t){return ve(e,t,ee,ce)}function qe(e,t){return ve(e,t,ee,he)}function Re(e,t){return ve(e,t,ee,fe)}function $e(e,t){return ve(e,t,ke,_e)}function Ve(e,t){return ve(e,t,ke,Oe)}function ze(e,t){return ve(e,t,ke,je)}function Ke(e,t){return ve(e,t,ke,Se)}Z.a.windowtext=[0,0,0],Z.a.transparent=[255,255,255,0];var He=new RegExp(Object.keys(Z.a).map((function(e){return"\\b".concat(e,"\\b")})).join("|"),"ig"),Je=function(e){var t=e.object();return t.a=t.alpha||1,delete t.alpha,t},Ue=function(e){return e.alpha=e.a,delete e.a,Qe(e)},Qe=function(e){var t=null;try{t=e instanceof X.a?e:X()(e)}catch(t){console.log("ignore the invalid color: `".concat(e,"`"))}return t},Ge=function(e,t){return e.replace(m,"").replace(He,(function(e){if(!t&&"transparent"===e)return e;var r=Z.a[e.toLowerCase()];return"".concat(r.length>3?"rgba":"rgb","(").concat(r.toString(),")")}))},We=function(e){var t=Ge(e);return k.test(t)?t:""},Xe=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"mix";if("[object Array]"!==Object.prototype.toString.call(e)||e.length<1)return null;if(1===e.length)return e[0];for(var r=Qe(e.shift()),a=Qe(e.shift());a;){if(!r&&a)r=a;else if(r||a)r&&a&&(r="mix"===t?r.mix(a,a.alpha()):Ue(n[t](Je(r),Je(a))));else{if(0===e.length)break;r=Qe(e.shift())}if(0===e.length)break;a=Qe(e.shift())}return r||null},Ye=function(e){return(299*e[0]+587*e[1]+114*e[2])/1e3},Ze=function(e,t){var r=e/Ye(t),n=Math.min(255,t[0]*r),a=Math.min(255,t[1]*r),o=Math.min(255,t[2]*r);return 0===a||255===n||255===o?a=(1e3*e-299*n-114*o)/587:0===n?n=(1e3*e-587*a-114*o)/299:0!==o&&255!==a||(o=(1e3*e-299*n-587*a)/114),X.a.rgb(n,a,o)};function et(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}(e,t)||rt(e,t)||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 tt(e){return function(e){if(Array.isArray(e))return nt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||rt(e)||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 rt(e,t){if(e){if("string"==typeof e)return nt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?nt(e,t):void 0}}function nt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function at(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ot(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var it=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ot(this,"_idx",0),ot(this,"_defaultDarkTextColorRgb",null),ot(this,"_defaultDarkBgColorRgb",null),ot(this,"_defaultDarkBgColorHSL",null),ot(this,"_defaultDarkTextColorBrightness",null),ot(this,"_defaultDarkBgColorBrightness",null),ot(this,"_defaultDarkBgColorHslBrightness",null),ot(this,"_maxLimitOffsetBrightness",null),ot(this,"isDarkmode",!1)}var t,r,n;return t=e,(r=[{key:"_adjustBrightness",value:function(e,t,r,n){var a,o=e.alpha(),i="";if(r.isBgColor){if(o>=.05&&(t[f]&&delete t[f],t[d])){if(t[d]===e.toString())return{newColor:"",extStyle:i};U(t).forEach((function(e){delete e[d]}))}if(a=this._adjustBackgroundBrightness(e),!r.hasInlineColor){var l=t[c]||x.defaultLightTextColor,u=Qe(l);if(u){var h=this._adjustBrightness(u,t,{isTextColor:!0,parentElementBgColorStr:a||e},n);h.newColor?i+=ct.genCssKV("color",h.newColor):i+=ct.genCssKV("color",u)}}}else if(r.isTextColor||r.isBorderColor){var g=r.parentElementBgColorStr||r.isTextColor&&t[s]||x.defaultDarkBgColor,b=Qe(g);b&&!t[f]&&(a=this._adjustTextBrightness(e,b),lt.emit("afterConvertTextColor".concat(n?"ByUpdateStyle":""),t,{fontColor:a,bgColor:b}))}else r.isTextShadow&&(t[f]||(a=this._adjustBackgroundBrightness(e)));return{newColor:a&&e.toString()!==a.toString()&&a.alpha(o).rgb(),extStyle:i}}},{key:"_adjustTextBrightness",value:function(e,t){var r=t.rgb().array(),n=t.alpha(),a=Ye(r)*n+this._defaultDarkBgColorBrightness*(1-n),o=e.rgb().array(),i=e.hsl().array(),l=e.alpha(),u=Ye(o),s=Math.abs(a-u);if(u>=250)return e;if(s>this._maxLimitOffsetBrightness&&a<=this._defaultDarkBgColorBrightness+2)return Ze(this._maxLimitOffsetBrightness+a,o).alpha(l);if(s>=65)return e;if(a>=100){if(i[2]>50){i[2]=90-i[2];var c=X.a.hsl.apply(X.a,tt(i)).alpha(l);return this._adjustTextBrightness(c,t)}return Ze(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,tt(i)).alpha(l);return this._adjustTextBrightness(h,t)}return Ze(Math.min(this._maxLimitOffsetBrightness,a+65),o).alpha(l)}},{key:"_adjustBackgroundBrightness",value:function(e){var t=e.rgb().array(),r=e.hsl().array(),n=e.alpha(),a=Ye(t),o=e;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=Ze(190,t).alpha(n):r[2]<22&&(r[2]=22,o=X.a.hsl.apply(X.a,tt(r))),o.alpha(n).rgb()}},{key:"_updateBgWithGradient",value:function(e,t,r,n,a,o){var i=Xe([t[s]||x.defaultDarkBgColor,e],"normal"),l=(t[h]||x.defaultLightBgColor).split("|").concat(e.toString()).join("|");U(t).forEach((function(e){e[s]=i,e[h]=l}));var u=n.slice(-1)[0];if("color"===u[0]){var c=this._adjustBrightness(Qe(Ge(u[1])),t,{isBgColor:!1,isTextShadow:!1,isTextColor:!0,isBorderColor:!1,hasInlineColor:a},o);if(c.newColor)return ct.genCss(r,ct.genCssKV("color",c.newColor))}return""}},{key:"_try",value:function(e){try{return e()}catch(e){console.log("An error occurred when running the dark mode conversion algorithm\n",e),"function"==typeof x.error&&x.error(e)}}},{key:"init",value:function(){this._defaultDarkTextColorRgb=Qe(x.defaultDarkTextColor).rgb().array(),this._defaultDarkBgColorRgb=Qe(x.defaultDarkBgColor).rgb().array(),this._defaultDarkBgColorHSL=Qe(x.defaultDarkBgColor).hsl().array(),this._defaultDarkTextColorBrightness=Ye(this._defaultDarkTextColorRgb),this._defaultDarkBgColorBrightness=Ye(this._defaultDarkBgColorRgb),this._defaultDarkBgColorHslBrightness=this._defaultDarkBgColorHSL[2],this._maxLimitOffsetBrightness=this._defaultDarkTextColorBrightness-this._defaultDarkBgColorBrightness}},{key:"convert",value:function(e,t,r){var n=this;lt.resetCss(),lt.emit("beforeConvertNode".concat(r?"ByUpdateStyle":""),e);var a="",i="";if(this.isDarkmode||r){var l=e.nodeName;if(x.whitelist.tagName.indexOf(l)>-1)return"";if(x.whitelist.attribute.some((function(t){return e.hasAttribute(t)})))return"";var g=e.style;t||(t=(g.cssText&&g.cssText.replace(/("[^;]*);([^;]*")|('[^;]*);([^;]*')/g,"$1$3".concat("<$#_SEMICOLON_#$>","$2$4")).split(";")||[]).map((function(e){var t=e.indexOf(":");return[e.slice(0,t).toLowerCase(),e.slice(t+1).replace(v,";")].map((function(e){return(e||"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}))})));var M=!1,C=!1,_=!1,O=null,j=null;t=t.filter((function(e){var t=et(e,2),r=t[0],n=t[1];return"color"===r?M=!0:/background/i.test(r)&&(C=!0,"background-position"===r?O=n:"background-size"===r&&(j=n)),(/background/i.test(r)||/^(-webkit-)?border-image/.test(r))&&/url\([^)]*\)/i.test(n)&&(_=!0),p.indexOf(r)>-1})).sort((function(e,t){var r=et(e,1)[0],n=et(t,1)[0];return"color"===r||"background-image"===r&&"background-color"===n||0===n.indexOf("-webkit-text")?1:-1})),y.indexOf(l)>-1&&!C&&this._try((function(){var r=function(e){var t=null;return Array.prototype.some.call(e.classList,(function(e){return!!Q[e]&&(t=Q[e],!0)})),t}(e);if(r||(r=e.getAttribute("bgcolor")),r){var n=Qe(r);n&&(t.unshift(["background-color",n.toString()]),C=!0)}})),"FONT"!==l||M||this._try((function(){var r=e.getAttribute("color");if(r){var n=Qe(r);n&&(t.push(["color",n.toString()]),M=!0)}}));var S="",B="",P=0;t.some((function(e,t){var r=et(e,2),a=r[0],o=r[1];return n._try((function(){if(0!==a.indexOf("-webkit-text"))return P=t,!0;switch(a){case"-webkit-text-fill-color":S=We(o);break;case"-webkit-text-stroke":var e=o.split(" ");2===e.length&&(B=We(e[1]));break;case"-webkit-text-stroke-color":B=We(o)}return!1}))})),S&&(M?t[t.length-1]=["-webkit-text-fill-color",S]:(t.push(["-webkit-text-fill-color",S]),M=!0)),P&&(t.splice(0,P),B&&t.unshift(["-webkit-text-stroke-color",B]));var E="",A="";if(r&&e.className&&"string"==typeof e.className){var T=e.className.match(o);T&&(E=T[0]),(T=e.className.match(st.classNameReg))&&(A=T[0])}var D="";t.forEach((function(o){var l=et(o,2),p=l[0],y=l[1];return n._try((function(){var o,l=y,v=!1,S=b.BG_COLOR.indexOf(p)>-1,B=b.TEXT_SHADOW.indexOf(p)>-1,P=b.TEXT_COLOR.indexOf(p),E=b.BORDER_COLOR.indexOf(p)>-1,T=/gradient/.test(y),F=[],N="";if(y=Ge(y,T),k.test(y)){if(T){for(var L=w.exec(y);L;)F.push(L[0]),L=w.exec(y);o=Xe(F)}var I=0;y=y.replace(w,(function(t){T&&(t=o,v=!0);var a=Qe(t);if((null==a?void 0:a.alpha())>=.05){var i=n._adjustBrightness(a,e,{isBgColor:S,isTextShadow:B,isTextColor:P>-1,isBorderColor:E,hasInlineColor:M},r),l=!_&&i.newColor;if(N+=i.extStyle,S||P>=5){var d=l?l.toString():t;0===I&&U(e).forEach((function(e){S?(e[s]=d,e[h]=(e[h]||x.defaultLightBgColor).split("|").concat(t).join("|")):(e[u]=d,e[c]=t);var r=Qe(d);S&&(null==r?void 0:r.alpha())>=.05&&e[f]&&delete e[f]}))}return l&&(v=!0),I++,l||t}return t})).replace(/\s?!\s?important/gi,"")}if(N&&(D+=N),!(e instanceof SVGElement)){var q=/^background/.test(p),R=/^(-webkit-)?border-image/.test(p);if((q||R)&&/url\([^)]*\)/i.test(y)){v=!0;var $=Xe((e[h]||x.defaultLightBgColor).split("|"),"normal").toString();if(y=y.replace(/^(.*?)url\(([^)]*)\)(.*)$/i,(function(t){var r=t,n="";return e[f]||U(e).forEach((function(e){e[f]=!0})),q?(n=ct.genCssKV(p,$?"".concat(r,",linear-gradient(").concat($,", ").concat($,")"):r),O&&(D+=ct.genCssKV("background-position",O),n+=ct.genCssKV("background-position",$?"".concat(O,",top left"):O)),j&&(D+=ct.genCssKV("background-size",j),n+=ct.genCssKV("background-size",$?"".concat(j,",100%"):j)),A?(i+=ct.genCss(A,n),U(e).forEach((function(e){e[d]=$||r}))):st.push(e,n,(function(){U(e).forEach((function(e){e[d]=$||r}))}))):$&&!C&&(n=ct.genCssKV("background-image","linear-gradient(".concat($,", ").concat($,")")),A?i+=ct.genCss(A,n):st.push(e,n)),r})),!M){var V=e[c]||x.defaultLightTextColor;D+=ct.genCssKV("color",V),U(e).forEach((function(e){e[u]=V}))}}}v&&(!r&&m.test(l)&&(g[p]=l.replace(m,"")),T?A?(i+=ct.genCss(A,ct.genCssKV(p,y)),/^background/.test(p)&&!/url\([^)]*\)/i.test(y)&&(a+=n._updateBgWithGradient(o,e,A,t,M,r))):st.push(e,ct.genCssKV(p,y),(function(i){/^background/.test(p)&&!/url\([^)]*\)/i.test(y)&&(a+=n._updateBgWithGradient(o,e,i.className,t,M,r))})):D+=ct.genCssKV(p,y))}))})),D&&(E||(E="".concat("js_darkmode__").concat(this._idx++),e.classList.add(E)),a+=D?ct.genCss(E,D):""),a+=i,!r&&function(e){return e.textContent.replace(/\s/g,"").length>0}(e)&&(x.delayBgJudge?ut.push(e):st.contains(e,(function(e){a+=ct.genCss(e.className,e.cssKV),"function"==typeof e.cb&&e.cb(e)})))}return lt.emit("afterConvertNode".concat(r?"ByUpdateStyle":""),e),a}},{key:"getContrast",value:function(e,t){var r=Qe(e),n=Qe(t);return r&&n?r.contrast(n):0}}])&&at(t.prototype,r),n&&at(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),lt=new P,ut=new D("".concat("js_darkmode__","text__")),st=new L("".concat("js_darkmode__","bg__")),ct=new V,ht=new G,ft=new it,dt=new RegExp("".concat("js_darkmode__","[^ ]+"),"g"),gt=null,bt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{type:"dom"};if(t.force&&(ct.isFinish=!1),!ct.isFinish)try{ft.isDarkmode=x.mode?"dark"===x.mode:e.matches,"dom"===t.type?(ft.isDarkmode&&"function"==typeof x.begin&&x.begin(ht.hasDelay()),Array.prototype.forEach.call(ht.get(),(function(e){if(ft.isDarkmode&&e.className&&"string"==typeof e.className&&(e.className=e.className.replace(dt,"")),ft.isDarkmode||lt.length)if(x.needJudgeFirstPage){var t=e.getBoundingClientRect(),r=t.top,n=t.bottom;r<=0&&n<=0?ct.addCss(ft.convert(e)):r>0&&r<g||n>0&&n<g?(ht.addFirstPageNode(e),ct.addCss(ft.convert(e),!0)):(x.needJudgeFirstPage=!1,ct.writeStyle(!0),ht.showFirstPageNodes(),"function"==typeof x.showFirstPage&&x.showFirstPage(),ct.addCss(ft.convert(e)))}else ct.addCss(ft.convert(e))})),lt.loopTimes++):"bg"===t.type&&ft.isDarkmode&&ut.forEach((function(e){return st.contains(e,(function(e){ct.addCss(ct.genCss(e.className,e.cssKV))}))})),(x.needJudgeFirstPage||!x.needJudgeFirstPage&&!ht.showFirstPage)&&"function"==typeof x.showFirstPage&&x.showFirstPage(),ct.writeStyle(),ht.emptyFirstPageNodes(),ft.isDarkmode||(x.needJudgeFirstPage=!1,x.delayBgJudge=!1,null===x.container&&"dom"===t.type&&ht.length&&ht.delay())}catch(e){console.log("An error occurred when running the dark mode conversion algorithm\n",e),"function"==typeof x.error&&x.error(e)}};function pt(e,t){yt(t),ht.set(e),bt(gt,{force:!0,type:"dom"})}function yt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!x.hasInit){x.hasInit=!0;var t=x.whitelist.tagName,r=x.whitelist.attribute;e.whitelist&&(e.whitelist.tagName instanceof Array&&e.whitelist.tagName.forEach((function(e){e=e.toUpperCase(),-1===t.indexOf(e)&&t.push(e)})),e.whitelist.attribute instanceof Array&&e.whitelist.attribute.forEach((function(e){-1===r.indexOf(e)&&r.push(e)}))),["dark","light"].indexOf(e.mode)>-1&&(x.set("string",e,"mode"),"dark"===e.mode&&document.getElementsByTagName("html")[0].classList.add(i)),x.set("function",e,"begin"),x.set("function",e,"showFirstPage"),x.set("function",e,"error"),x.set("boolean",e,"needJudgeFirstPage"),x.set("boolean",e,"delayBgJudge"),x.set("dom",e,"container"),x.set("string",e,"cssSelectorsPrefix"),x.set("string",e,"defaultLightTextColor"),x.set("string",e,"defaultLightBgColor"),x.set("string",e,"defaultDarkTextColor"),x.set("string",e,"defaultDarkBgColor"),ft.init(),!x.mode&&null===gt&&window.matchMedia&&(gt=window.matchMedia(a)).addListener(bt)}}function mt(e){ht.set(e),null!==x.container&&(st.update(e),ut.update(e)),bt(gt,{force:!0,type:"bg"})}function vt(e,t){ct.isFinish&&(ct.addCss(ft.convert(e,t?Object.keys(t).map((function(e){return[e,t[e]]})):void 0,!0),!1),ct.writeStyle())}function kt(e,t){return ft.getContrast(e,t)}function wt(e){e.forEach((function(e){return lt.extend(e)}))}}])}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-darkmode",
3
- "version": "1.2.0-beta.0",
3
+ "version": "1.2.0",
4
4
  "description": "微信公众平台图文 Dark Mode 转换算法",
5
5
  "main": "dist/darkmode.min.js",
6
6
  "dependencies": {