mp-darkmode 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(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)}))}}])}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Darkmode",[],e):"object"==typeof exports?exports.Darkmode=e():t.Darkmode=e()}(self,()=>(()=>{var t={31(t){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},40(t,e,r){var n=r(31),o={};for(var a in n)n.hasOwnProperty(a)&&(o[n[a]]=a);var i=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var l in i)if(i.hasOwnProperty(l)){if(!("channels"in i[l]))throw new Error("missing channels property: "+l);if(!("labels"in i[l]))throw new Error("missing channel labels property: "+l);if(i[l].labels.length!==i[l].channels)throw new Error("channel and label counts mismatch: "+l);var u=i[l].channels,s=i[l].labels;delete i[l].channels,delete i[l].labels,Object.defineProperty(i[l],"channels",{value:u}),Object.defineProperty(i[l],"labels",{value:s})}function c(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}i.rgb.hsl=function(t){var e,r,n=t[0]/255,o=t[1]/255,a=t[2]/255,i=Math.min(n,o,a),l=Math.max(n,o,a),u=l-i;return l===i?e=0:n===l?e=(o-a)/u:o===l?e=2+(a-n)/u:a===l&&(e=4+(n-o)/u),(e=Math.min(60*e,360))<0&&(e+=360),r=(i+l)/2,[e,100*(l===i?0:r<=.5?u/(l+i):u/(2-l-i)),100*r]},i.rgb.hsv=function(t){var e,r,n,o,a,i=t[0]/255,l=t[1]/255,u=t[2]/255,s=Math.max(i,l,u),c=s-Math.min(i,l,u),h=function(t){return(s-t)/6/c+.5};return 0===c?o=a=0:(a=c/s,e=h(i),r=h(l),n=h(u),i===s?o=n-r:l===s?o=1/3+e-n:u===s&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[360*o,100*a,100*s]},i.rgb.hwb=function(t){var e=t[0],r=t[1],n=t[2];return[i.rgb.hsl(t)[0],1/255*Math.min(e,Math.min(r,n))*100,100*(n=1-1/255*Math.max(e,Math.max(r,n)))]},i.rgb.cmyk=function(t){var e,r=t[0]/255,n=t[1]/255,o=t[2]/255;return[100*((1-r-(e=Math.min(1-r,1-n,1-o)))/(1-e)||0),100*((1-n-e)/(1-e)||0),100*((1-o-e)/(1-e)||0),100*e]},i.rgb.keyword=function(t){var e=o[t];if(e)return e;var r,a=1/0;for(var i in n)if(n.hasOwnProperty(i)){var l=c(t,n[i]);l<a&&(a=l,r=i)}return r},i.keyword.rgb=function(t){return n[t]},i.rgb.xyz=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*e+.7152*r+.0722*n),100*(.0193*e+.1192*r+.9505*n)]},i.rgb.lab=function(t){var e=i.rgb.xyz(t),r=e[0],n=e[1],o=e[2];return n/=100,o/=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-(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116))]},i.hsl.rgb=function(t){var e,r,n,o,a,i=t[0]/360,l=t[1]/100,u=t[2]/100;if(0===l)return[a=255*u,a,a];e=2*u-(r=u<.5?u*(1+l):u+l-u*l),o=[0,0,0];for(var s=0;s<3;s++)(n=i+1/3*-(s-1))<0&&n++,n>1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,o[s]=255*a;return o},i.hsl.hsv=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,o=r,a=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,o*=a<=1?a:2-a,[e,100*(0===n?2*o/(a+o):2*r/(n+r)),(n+r)/2*100]},i.hsv.rgb=function(t){var e=t[0]/60,r=t[1]/100,n=t[2]/100,o=Math.floor(e)%6,a=e-Math.floor(e),i=255*n*(1-r),l=255*n*(1-r*a),u=255*n*(1-r*(1-a));switch(n*=255,o){case 0:return[n,u,i];case 1:return[l,n,i];case 2:return[i,n,u];case 3:return[i,l,n];case 4:return[u,i,n];case 5:return[n,i,l]}},i.hsv.hsl=function(t){var e,r,n,o=t[0],a=t[1]/100,i=t[2]/100,l=Math.max(i,.01);return n=(2-a)*i,r=a*l,[o,100*(r=(r/=(e=(2-a)*l)<=1?e:2-e)||0),100*(n/=2)]},i.hwb.rgb=function(t){var e,r,n,o,a,i,l,u=t[0]/360,s=t[1]/100,c=t[2]/100,h=s+c;switch(h>1&&(s/=h,c/=h),n=6*u-(e=Math.floor(6*u)),1&e&&(n=1-n),o=s+n*((r=1-c)-s),e){default:case 6:case 0:a=r,i=o,l=s;break;case 1:a=o,i=r,l=s;break;case 2:a=s,i=r,l=o;break;case 3:a=s,i=o,l=r;break;case 4:a=o,i=s,l=r;break;case 5:a=r,i=s,l=o}return[255*a,255*i,255*l]},i.cmyk.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100;return[255*(1-Math.min(1,e*(1-o)+o)),255*(1-Math.min(1,r*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o))]},i.xyz.rgb=function(t){var e,r,n,o=t[0]/100,a=t[1]/100,i=t[2]/100;return r=-.9689*o+1.8758*a+.0415*i,n=.0557*o+-.204*a+1.057*i,e=(e=3.2406*o+-1.5372*a+-.4986*i)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(e=Math.min(Math.max(0,e),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]},i.xyz.lab=function(t){var e=t[0],r=t[1],n=t[2];return r/=100,n/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(e-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},i.lab.xyz=function(t){var e,r,n,o=t[0];e=t[1]/500+(r=(o+16)/116),n=r-t[2]/200;var a=Math.pow(r,3),i=Math.pow(e,3),l=Math.pow(n,3);return r=a>.008856?a:(r-16/116)/7.787,e=i>.008856?i:(e-16/116)/7.787,n=l>.008856?l:(n-16/116)/7.787,[e*=95.047,r*=100,n*=108.883]},i.lab.lch=function(t){var e,r=t[0],n=t[1],o=t[2];return(e=360*Math.atan2(o,n)/2/Math.PI)<0&&(e+=360),[r,Math.sqrt(n*n+o*o),e]},i.lch.lab=function(t){var e,r=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[r,n*Math.cos(e),n*Math.sin(e)]},i.rgb.ansi16=function(t){var e=t[0],r=t[1],n=t[2],o=1 in arguments?arguments[1]:i.rgb.hsv(t)[2];if(0===(o=Math.round(o/50)))return 30;var a=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(e/255));return 2===o&&(a+=60),a},i.hsv.ansi16=function(t){return i.rgb.ansi16(i.hsv.rgb(t),t[2])},i.rgb.ansi256=function(t){var e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},i.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),[e=e/10.5*255,e,e];var r=.5*(1+~~(t>50));return[(1&e)*r*255,(e>>1&1)*r*255,(e>>2&1)*r*255]},i.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var r;return t-=16,[Math.floor(t/36)/5*255,Math.floor((r=t%36)/6)/5*255,r%6/5*255]},i.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},i.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var r=e[0];3===e[0].length&&(r=r.split("").map(function(t){return t+t}).join(""));var n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},i.rgb.hcg=function(t){var e,r=t[0]/255,n=t[1]/255,o=t[2]/255,a=Math.max(Math.max(r,n),o),i=Math.min(Math.min(r,n),o),l=a-i;return e=l<=0?0:a===r?(n-o)/l%6:a===n?2+(o-r)/l:4+(r-n)/l+4,e/=6,[360*(e%=1),100*l,100*(l<1?i/(1-l):0)]},i.hsl.hcg=function(t){var e,r=t[1]/100,n=t[2]/100,o=0;return(e=n<.5?2*r*n:2*r*(1-n))<1&&(o=(n-.5*e)/(1-e)),[t[0],100*e,100*o]},i.hsv.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=e*r,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],100*n,100*o]},i.hcg.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100;if(0===r)return[255*n,255*n,255*n];var o,a=[0,0,0],i=e%1*6,l=i%1,u=1-l;switch(Math.floor(i)){case 0:a[0]=1,a[1]=l,a[2]=0;break;case 1:a[0]=u,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=l;break;case 3:a[0]=0,a[1]=u,a[2]=1;break;case 4:a[0]=l,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=u}return o=(1-r)*n,[255*(r*a[0]+o),255*(r*a[1]+o),255*(r*a[2]+o)]},i.hcg.hsv=function(t){var e=t[1]/100,r=e+t[2]/100*(1-e),n=0;return r>0&&(n=e/r),[t[0],100*n,100*r]},i.hcg.hsl=function(t){var e=t[1]/100,r=t[2]/100*(1-e)+.5*e,n=0;return r>0&&r<.5?n=e/(2*r):r>=.5&&r<1&&(n=e/(2*(1-r))),[t[0],100*n,100*r]},i.hcg.hwb=function(t){var e=t[1]/100,r=e+t[2]/100*(1-e);return[t[0],100*(r-e),100*(1-r)]},i.hwb.hcg=function(t){var e=t[1]/100,r=1-t[2]/100,n=r-e,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],100*n,100*o]},i.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},i.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},i.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},i.gray.hsl=i.gray.hsv=function(t){return[0,0,t[0]]},i.gray.hwb=function(t){return[0,100,t[0]]},i.gray.cmyk=function(t){return[0,0,0,t[0]]},i.gray.lab=function(t){return[t[0],0,0]},i.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),r=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(r.length)+r},i.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}},156(t){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},195(t){t.exports=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))}},507(t,e,r){var n=r(40);function o(t,e){return function(r){return e(t(r))}}function a(t,e){for(var r=[e[t].parent,t],a=n[e[t].parent][t],i=e[t].parent;e[i].parent;)r.unshift(e[i].parent),a=o(n[e[i].parent][i],a),i=e[i].parent;return a.conversion=r,a}t.exports=function(t){for(var e=function(t){var e=function(){for(var t={},e=Object.keys(n),r=e.length,o=0;o<r;o++)t[e[o]]={distance:-1,parent:null};return t}(),r=[t];for(e[t].distance=0;r.length;)for(var o=r.pop(),a=Object.keys(n[o]),i=a.length,l=0;l<i;l++){var u=a[l],s=e[u];-1===s.distance&&(s.distance=e[o].distance+1,s.parent=o,r.unshift(u))}return e}(t),r={},o=Object.keys(e),i=o.length,l=0;l<i;l++){var u=o[l];null!==e[u].parent&&(r[u]=a(u,e))}return r}},520(t,e,r){"use strict";var n=r(854),o=r(734),a=[].slice,i=["keyword","gray","hex"],l={};Object.keys(o).forEach(function(t){l[a.call(o[t].labels).sort().join("")]=t});var u={};function s(t,e){if(!(this instanceof s))return new s(t,e);if(e&&e in i&&(e=null),e&&!(e in o))throw new Error("Unknown model: "+e);var r,c;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof s)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var h=n.get(t);if(null===h)throw new Error("Unable to parse color from string: "+t);this.model=h.model,c=o[this.model].channels,this.color=h.value.slice(0,c),this.valpha="number"==typeof h.value[c]?h.value[c]:1}else if(t.length){this.model=e||"rgb",c=o[this.model].channels;var g=a.call(t,0,c);this.color=f(g,c),this.valpha="number"==typeof t[c]?t[c]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var d=Object.keys(t);"alpha"in t&&(d.splice(d.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var b=d.sort().join("");if(!(b in l))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=l[b];var y=o[this.model].labels,p=[];for(r=0;r<y.length;r++)p.push(t[y[r]]);this.color=f(p)}if(u[this.model])for(c=o[this.model].channels,r=0;r<c;r++){var m=u[this.model][r];m&&(this.color[r]=m(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function c(t,e,r){return(t=Array.isArray(t)?t:[t]).forEach(function(t){(u[t]||(u[t]=[]))[e]=r}),t=t[0],function(n){var o;return arguments.length?(r&&(n=r(n)),(o=this[t]()).color[e]=n,o):(o=this[t]().color[e],r&&(o=r(o)),o)}}function h(t){return function(e){return Math.max(0,Math.min(t,e))}}function f(t,e){for(var r=0;r<e;r++)"number"!=typeof t[r]&&(t[r]=0);return t}s.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var e=this.model in n.to?this:this.rgb(),r=1===(e=e.round("number"==typeof t?t:1)).valpha?e.color:e.color.concat(this.valpha);return n.to[e.model](r)},percentString:function(t){var e=this.rgb().round("number"==typeof t?t:1),r=1===e.valpha?e.color:e.color.concat(this.valpha);return n.to.rgb.percent(r)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},e=o[this.model].channels,r=o[this.model].labels,n=0;n<e;n++)t[r[n]]=this.color[n];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new s(this.color.map(function(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new s(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:c("rgb",0,h(255)),green:c("rgb",1,h(255)),blue:c("rgb",2,h(255)),hue:c(["hsl","hsv","hsl","hwb","hcg"],0,function(t){return(t%360+360)%360}),saturationl:c("hsl",1,h(100)),lightness:c("hsl",2,h(100)),saturationv:c("hsv",1,h(100)),value:c("hsv",2,h(100)),chroma:c("hcg",1,h(100)),gray:c("hcg",2,h(100)),white:c("hwb",1,h(100)),wblack:c("hwb",2,h(100)),cyan:c("cmyk",0,h(100)),magenta:c("cmyk",1,h(100)),yellow:c("cmyk",2,h(100)),black:c("cmyk",3,h(100)),x:c("xyz",0,h(100)),y:c("xyz",1,h(100)),z:c("xyz",2,h(100)),l:c("lab",0,h(100)),a:c("lab",1),b:c("lab",2),keyword:function(t){return arguments.length?new s(t):o[this.model].keyword(this.color)},hex:function(t){return arguments.length?new s(t):n.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity:function(){for(var t=this.rgb().color,e=[],r=0;r<t.length;r++){var n=t[r]/255;e[r]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),r=t.luminosity();return e>r?(e+.05)/(r+.05):(r+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten:function(t){var e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken:function(t){var e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate:function(t){var e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate:function(t){var e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten:function(t){var e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken:function(t){var e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale:function(){var t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return s.rgb(e,e,e)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var e=this.hsl(),r=e.color[0];return r=(r=(r+t)%360)<0?360+r:r,e.color[0]=r,e},mix:function(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);var r=t.rgb(),n=this.rgb(),o=void 0===e?.5:e,a=2*o-1,i=r.alpha()-n.alpha(),l=((a*i===-1?a:(a+i)/(1+a*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()*o+n.alpha()*(1-o))}},Object.keys(o).forEach(function(t){if(-1===i.indexOf(t)){var e=o[t].channels;s.prototype[t]=function(){if(this.model===t)return new s(this);if(arguments.length)return new s(arguments,t);var r,n="number"==typeof arguments[e]?e:this.valpha;return new s((r=o[this.model][t].raw(this.color),Array.isArray(r)?r:[r]).concat(n),t)},s[t]=function(r){return"number"==typeof r&&(r=f(a.call(arguments),e)),new s(r,t)}}}),t.exports=s},734(t,e,r){var n=r(40),o=r(507),a={};Object.keys(n).forEach(function(t){a[t]={},Object.defineProperty(a[t],"channels",{value:n[t].channels}),Object.defineProperty(a[t],"labels",{value:n[t].labels});var e=o(t);Object.keys(e).forEach(function(r){var n=e[r];a[t][r]=function(t){var e=function(e){if(null==e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var r=t(e);if("object"==typeof r)for(var n=r.length,o=0;o<n;o++)r[o]=Math.round(r[o]);return r};return"conversion"in t&&(e.conversion=t.conversion),e}(n),a[t][r].raw=function(t){var e=function(e){return null==e?e:(arguments.length>1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(n)})}),t.exports=a},854(t,e,r){var n=r(156),o=r(872),a=Object.hasOwnProperty,i=Object.create(null);for(var l in n)a.call(n,l)&&(i[n[l]]=l);var u=t.exports={to:{},get:{}};function s(t,e,r){return Math.min(Math.max(e,t),r)}function c(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}u.get=function(t){var e,r;switch(t.substring(0,3).toLowerCase()){case"hsl":e=u.get.hsl(t),r="hsl";break;case"hwb":e=u.get.hwb(t),r="hwb";break;default:e=u.get.rgb(t),r="rgb"}return e?{model:r,value:e}:null},u.get.rgb=function(t){if(!t)return null;var e,r,o,i=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(o=e[2],e=e[1],r=0;r<3;r++){var l=2*r;i[r]=parseInt(e.slice(l,l+2),16)}o&&(i[3]=parseInt(o,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(o=(e=e[1])[3],r=0;r<3;r++)i[r]=parseInt(e[r]+e[r],16);o&&(i[3]=parseInt(o+o,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(r=0;r<3;r++)i[r]=parseInt(e[r+1],0);e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:a.call(n,e[1])?((i=n[e[1]])[3]=1,i):null:null;for(r=0;r<3;r++)i[r]=Math.round(2.55*parseFloat(e[r+1]));e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}for(r=0;r<3;r++)i[r]=s(i[r],0,255);return i[3]=s(i[3],0,1),i},u.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var r=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,s(parseFloat(e[2]),0,100),s(parseFloat(e[3]),0,100),s(isNaN(r)?1:r,0,1)]}return null},u.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var r=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,s(parseFloat(e[2]),0,100),s(parseFloat(e[3]),0,100),s(isNaN(r)?1:r,0,1)]}return null},u.to.hex=function(){var t=o(arguments);return"#"+c(t[0])+c(t[1])+c(t[2])+(t[3]<1?c(Math.round(255*t[3])):"")},u.to.rgb=function(){var t=o(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},u.to.rgb.percent=function(){var t=o(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"},u.to.hsl=function(){var t=o(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},u.to.hwb=function(){var t=o(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},u.to.keyword=function(t){return i[t.slice(0,3)]}},872(t,e,r){"use strict";var n=r(195),o=Array.prototype.concat,a=Array.prototype.slice,i=t.exports=function(t){for(var e=[],r=0,i=t.length;r<i;r++){var l=t[r];n(l)?e=o.call(e,a.call(l)):e.push(l)}return e};i.wrap=function(t){return function(){return t(i(arguments))}}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{convertBg:()=>Be,extend:()=>Ae,getContrast:()=>Te,init:()=>Pe,run:()=>Oe,updateStyle:()=>Ee});var t={};r.r(t),r.d(t,{color:()=>Yt,colorBurn:()=>Jt,colorDodge:()=>zt,darken:()=>Vt,difference:()=>Qt,exclusion:()=>Gt,hardLight:()=>Ht,hue:()=>Wt,lighten:()=>Kt,luminosity:()=>Zt,multiply:()=>qt,normal:()=>It,overlay:()=>$t,saturation:()=>Xt,screen:()=>Rt,softLight:()=>Ut});var e="(prefers-color-scheme: dark)",o="js_darkmode__",a=new RegExp("".concat(o,"\\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),g="data-darkmode-complementary-bgimagecolor-".concat(l),d="|",b=.05,y=window.getInnerHeight&&window.getInnerHeight()||window.innerHeight||document.documentElement.clientHeight,p={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"]},m=Object.keys(p).map(function(t){return p[t].join("|")}).join("|").split("|"),v=["TABLE","TR","TD","TH"],w=/ !important$/,k=/<\$#_SEMICOLON_#\$>/g,x=/\brgba?\([^)]+\)/i,M=/\brgba?\([^)]+\)/gi;const C={hasInit:!1,begin:null,showFirstPage:null,error:null,mode:"",whitelist:{tagName:["MPCPS","IFRAME"],attribute:[]},needJudgeFirstPage:!0,delayBgJudge:!1,container:null,cssSelectorsPrefix:"",defaultLightTextColor:"#191919",defaultLightBgColor:"#fff",defaultDarkTextColor:"#a3a3a3",defaultDarkBgColor:"#191919",set:function(t,e,r){var n=e[r];switch(t){case"boolean":"boolean"==typeof n&&(this[r]=n);break;case"string":"string"==typeof n&&""!==n&&(this[r]=n);break;case"function":"function"==typeof n&&(this[r]=n);break;case"dom":n instanceof HTMLElement&&(this[r]=n)}}};function S(t,e,r){return(e=B(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _(t){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(t)}function j(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function O(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,B(n.key),n)}}function P(t,e,r){return e&&O(t.prototype,e),r&&O(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function B(t){var e=function(t){if("object"!=_(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_(e)?e:e+""}var E=[],T=[],A=function(){return P(function t(){j(this,t)},[{key:"loopTimes",get:function(){return me.loopTimes}},{key:"isDarkmode",get:function(){return Me.isDarkmode}},{key:"addCss",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]&&!arguments[2]?T:E).push(ke.genCss(t,e.map(function(t){var e=t.key,r=t.value;return ke.genCssKV(e,r)}).join("")))}}])}(),D=function(){return P(function t(){j(this,t),S(this,"_plugins",[]),S(this,"length",0),S(this,"loopTimes",0),S(this,"firstPageStyle",""),S(this,"otherPageStyle",""),S(this,"firstPageStyleNoMQ",""),S(this,"otherPageStyleNoMQ","")},[{key:"extend",value:function(t){this._plugins.push(new(t(A))),this.length++}},{key:"emit",value:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];this._plugins.forEach(function(e){"function"==typeof e[t]&&e[t].apply(e,r)})}},{key:"addCss",value:function(t){t?(this.firstPageStyle+=E.join(""),this.firstPageStyleNoMQ+=T.join("")):(this.otherPageStyle+=E.join(""),this.otherPageStyleNoMQ+=T.join(""))}},{key:"resetCss",value:function(){E=[],T=[]}}])}();function F(t){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F(t)}function N(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,I(n.key),n)}}function L(t,e,r){return(e=I(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function I(t){var e=function(t){if("object"!=F(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=F(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==F(e)?e:e+""}var q=function(){return function(t,e){return e&&N(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),L(this,"_queue",[]),L(this,"_idx",0),this._prefix=e},[{key:"length",get:function(){return this._queue.length}},{key:"push",value:function(t){var e="".concat(this._prefix).concat(this._idx++);t.classList.add(e),this._queue.push({el:t,className:e,updated:!C.delayBgJudge})}},{key:"forEach",value:function(t){var e=[];for(this._queue.forEach(function(r,n){r.updated&&(e.unshift(n),F(t)&&t(r.el))});e.length;)this._queue.splice(e.shift(),1)}},{key:"update",value:function(t){this._queue.forEach(function(e){e.updated||Array.prototype.some.call(t,function(t){return!(1!==t.nodeType||!t.classList.contains(e.className)||(e.el=t,e.updated=!0,0))})})}}])}();function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}function $(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,K(n.key),n)}}function V(t,e,r){return(e=K(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function K(t){var e=function(t){if("object"!=R(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==R(e)?e:e+""}var z=function(){return function(t,e){return e&&$(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),V(this,"_stack",[]),V(this,"_idx",0),this._prefix=e,this.classNameReg=new RegExp("".concat(this._prefix,"\\d+"))},[{key:"push",value:function(t,e,r){var n="".concat(this._prefix).concat(this._idx++);t.classList.add(n),this._stack.unshift({el:t,className:n,cssKV:e,updated:!C.delayBgJudge,cb:r})}},{key:"contains",value:function(t,e){var r=t.getBoundingClientRect(),n=[];for(this._stack.forEach(function(t,e){if(t.updated){t.rect||(t.rect=t.el.getBoundingClientRect());var o=t.rect;r.top>=o.bottom||r.bottom<=o.top||r.left>=o.right||r.right<=o.left||n.unshift(e)}});n.length;){var o,a=n.shift();o=C.delayBgJudge?this._stack[a]:this._stack.splice(a,1)[0],"function"==typeof e&&e(o)}}},{key:"update",value:function(t){this._stack.forEach(function(e){e.updated||Array.prototype.some.call(t,function(t){return!(1!==t.nodeType||!t.classList.contains(e.className)||(e.el=t,e.updated=!0,0))})})}},{key:"clear",value:function(){this._stack=[]}}])}();function J(t){return J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},J(t)}function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function U(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,G(n.key),n)}}function Q(t,e,r){return(e=G(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function G(t){var e=function(t){if("object"!=J(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=J(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==J(e)?e:e+""}var W=function(){return function(t,e){return e&&U(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Q(this,"_firstPageStyle",""),Q(this,"_otherPageStyle",""),Q(this,"_watcher",{}),Q(this,"isFinish",!1)},[{key:"genCssKV",value:function(t,e){var r,n;return null===(r=(n=this._watcher)[t])||void 0===r||r.call(n),"".concat(t,": ").concat(e," !important;")}},{key:"genCss",value:function(t,e){return"".concat("dark"===C.mode?"html.".concat(i," "):"").concat(C.cssSelectorsPrefix&&"".concat(C.cssSelectorsPrefix," "),".").concat(t,"{").concat(e,"}")}},{key:"addCss",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this[e?"_firstPageStyle":"_otherPageStyle"]+=t,me.addCss(e)}},{key:"writeStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];!t&&Me.isDarkmode&&(this.isFinish=!0);var r=(Me.isDarkmode?[{target:this,key:["_firstPageStyle","_otherPageStyle"],needMediaQuery:!0}]:[]).concat([{target:me,key:["firstPageStyle","otherPageStyle"],needMediaQuery:!0},{target:me,key:["firstPageStyleNoMQ","otherPageStyleNoMQ"],needMediaQuery:!1}]).map(function(r){var n=r.target,o=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return H(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?H(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r.key,2),a=o[0],i=o[1],l=r.needMediaQuery,u="";t?u=a:(n[i]=n[a]+n[i],n[a]="",u=i);var s=n[u];return s?(n[u]="","dark"!==C.mode&&l?"@media ".concat(e," {").concat(s,"}"):s):""}).join("");r&&document.head.insertAdjacentHTML("beforeend",'<style type="text/css">'.concat(r,"</style>"))}},{key:"watch",value:function(t,e){this._watcher[t]=e}},{key:"unwatch",value:function(t){delete this._watcher[t]}}])}();function X(t){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},X(t)}function Y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,tt(n.key),n)}}function Z(t,e,r){return(e=tt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function tt(t){var e=function(t){if("object"!=X(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=X(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==X(e)?e:e+""}function et(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function rt(t){var e;return(e=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?[]:[t]).concat.apply(e,function(t){return function(t){if(Array.isArray(t))return et(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return et(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?et(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.querySelectorAll("*")))}var nt={"ue-table-interlace-color-single":"#fcfcfc","ue-table-interlace-color-double":"#f7faff"},ot=function(){return function(t,e){return e&&Y(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Z(this,"_els",[]),Z(this,"_firstPageEls",[]),Z(this,"_delayEls",[]),Z(this,"showFirstPage",!1)},[{key:"length",get:function(){return this._els.length}},{key:"set",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._els=t}},{key:"get",value:function(){var t=[];return this._els.length?(t=this._els,Me.isDarkmode&&(this._els=[])):this._delayEls.length?(t=this._delayEls,this._delayEls=[]):C.container&&(t=C.container.querySelectorAll("*")),t}},{key:"delay",value:function(){var t=this;Array.prototype.forEach.call(this._els,function(e){return t._delayEls.push(e)}),this._els=[]}},{key:"hasDelay",value:function(){return!this._els.length&&(this._delayEls.length>0||null!==C.container)}},{key:"addFirstPageNode",value:function(t){this._firstPageEls.push(t)}},{key:"showFirstPageNodes",value:function(){this._firstPageEls.forEach(function(t){return!t.style.visibility&&(t.style.visibility="visible")}),this.showFirstPage=!0}},{key:"emptyFirstPageNodes",value:function(){this._firstPageEls=[]}}])}(),at=r(520),it=r.n(at),lt=r(156),ut=r.n(lt);function st(t,e,r){return{r:255*r(t.r/255,e.r/255),g:255*r(t.g/255,e.g/255),b:255*r(t.b/255,e.b/255)}}function ct(t,e){return e}function ht(t,e){return t*e}function ft(t,e){return t+e-t*e}function gt(t,e){return mt(e,t)}function dt(t,e){return Math.min(t,e)}function bt(t,e){return Math.min(Math.max(t,e),1)}function yt(t,e){return 0===t?0:1===e?1:Math.min(1,t/(1-e))}function pt(t,e){return 1===t?1:0===e?0:1-Math.min(1,(1-t)/e)}function mt(t,e){return e<=.5?ht(t,2*e):ft(t,2*e-1)}function vt(t,e){return e<=.5?t-(1-2*e)*t*(1-t):t+(2*e-1)*((t<=.25?((16*t-12)*t+4)*t:Math.sqrt(t))-t)}function wt(t,e){return Math.abs(t-e)}function kt(t,e){return t+e-2*t*e}function xt(t,e,r){return Math.min(Math.max(t||0,e),r)}function Mt(t){return{r:xt(t.r,0,255),g:xt(t.g,0,255),b:xt(t.b,0,255),a:xt(t.a,0,1)}}function Ct(t){return{r:255*t.r,g:255*t.g,b:255*t.b,a:t.a}}function St(t){return{r:t.r/255,g:t.g/255,b:t.b/255,a:t.a}}function _t(t,e){void 0===e&&(e=0);var r=Math.pow(10,e);return{r:Math.round(t.r*r)/r,g:Math.round(t.g*r)/r,b:Math.round(t.b*r)/r,a:t.a}}function jt(t,e,r,n,o,a){return(1-e/r)*n+e/r*Math.round((1-t)*o+t*a)}function Ot(t,e,r,n,o){void 0===o&&(o={unitInput:!1,unitOutput:!1,roundOutput:!0}),o.unitInput&&(t=Ct(t),e=Ct(e)),t=Mt(t);var a=(e=Mt(e)).a+t.a-e.a*t.a,i=r(t,e,n),l=Mt({r:jt(t.a,e.a,a,t.r,e.r,i.r),g:jt(t.a,e.a,a,t.g,e.g,i.g),b:jt(t.a,e.a,a,t.b,e.b,i.b),a});return l=o.unitOutput?St(l):o.roundOutput?_t(l):function(t){return _t(t,9)}(l),l}function Pt(t,e,r){return Ct(r(St(t),St(e)))}function Bt(t){return.3*t.r+.59*t.g+.11*t.b}function Et(t,e){var r=e-Bt(t);return function(t){var e=Bt(t),r=t.r,n=t.g,o=t.b,a=Math.min(r,n,o),i=Math.max(r,n,o);function l(t){return e+(t-e)*e/(e-a)}function u(t){return e+(t-e)*(1-e)/(i-e)}return a<0&&(r=l(r),n=l(n),o=l(o)),i>1&&(r=u(r),n=u(n),o=u(o)),{r,g:n,b:o}}({r:t.r+r,g:t.g+r,b:t.b+r})}function Tt(t){return Math.max(t.r,t.g,t.b)-Math.min(t.r,t.g,t.b)}function At(t,e){var r=["r","g","b"].sort(function(e,r){return t[e]-t[r]}),n=r[0],o=r[1],a=r[2],i={r:t.r,g:t.g,b:t.b};return i[a]>i[n]?(i[o]=(i[o]-i[n])*e/(i[a]-i[n]),i[a]=e):i[o]=i[a]=0,i[n]=0,i}function Dt(t,e){return Et(At(e,Tt(t)),Bt(t))}function Ft(t,e){return Et(At(t,Tt(e)),Bt(t))}function Nt(t,e){return Et(e,Bt(t))}function Lt(t,e){return Et(t,Bt(e))}function It(t,e){return Ot(t,e,st,ct)}function qt(t,e){return Ot(t,e,st,ht)}function Rt(t,e){return Ot(t,e,st,ft)}function $t(t,e){return Ot(t,e,st,gt)}function Vt(t,e){return Ot(t,e,st,dt)}function Kt(t,e){return Ot(t,e,st,bt)}function zt(t,e){return Ot(t,e,st,yt)}function Jt(t,e){return Ot(t,e,st,pt)}function Ht(t,e){return Ot(t,e,st,mt)}function Ut(t,e){return Ot(t,e,st,vt)}function Qt(t,e){return Ot(t,e,st,wt)}function Gt(t,e){return Ot(t,e,st,kt)}function Wt(t,e){return Ot(t,e,Pt,Dt)}function Xt(t,e){return Ot(t,e,Pt,Ft)}function Yt(t,e){return Ot(t,e,Pt,Nt)}function Zt(t,e){return Ot(t,e,Pt,Lt)}ut().windowtext=[0,0,0],ut().transparent=[255,255,255,0];var te=new RegExp(Object.keys(ut()).map(function(t){return"\\b".concat(t,"\\b")}).join("|"),"ig"),ee=function(t){var e=t.object();return e.a=e.alpha||1,delete e.alpha,e},re=function(t){return t.alpha=t.a,delete t.a,ne(t)},ne=function(t){var e=null;try{e=t instanceof it()?t:it()(t)}catch(e){console.log("ignore the invalid color: `".concat(t,"`"))}return e},oe=function(t,e){return t.replace(w,"").replace(te,function(t){if(!e&&"transparent"===t)return t;var r=ut()[t.toLowerCase()];return"".concat(r.length>3?"rgba":"rgb","(").concat(r.toString(),")")})},ae=function(t){var e=oe(t);return x.test(e)?e:""},ie=function(e){var r=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 n=ne(e.shift()),o=ne(e.shift());o;){if(!n&&o)n=o;else if(n||o)n&&o&&(n="mix"===r?n.mix(o,o.alpha()):re(t[r](ee(n),ee(o))));else{if(0===e.length)break;n=ne(e.shift())}if(0===e.length)break;o=ne(e.shift())}return n||null},le=function(t){return(299*t[0]+587*t[1]+114*t[2])/1e3},ue=function(t,e){var r=t/le(e),n=Math.min(255,e[0]*r),o=Math.min(255,e[1]*r),a=Math.min(255,e[2]*r);return 0===o||255===n||255===a?o=(1e3*t-299*n-114*a)/587:0===n?n=(1e3*t-587*o-114*a)/299:0!==a&&255!==o||(a=(1e3*t-299*n-587*o)/114),it().rgb(n,o,a)};function se(t){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(t)}function ce(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||fe(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function he(t){return function(t){if(Array.isArray(t))return ge(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||fe(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fe(t,e){if(t){if("string"==typeof t)return ge(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ge(t,e):void 0}}function ge(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function de(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ye(n.key),n)}}function be(t,e,r){return(e=ye(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ye(t){var e=function(t){if("object"!=se(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=se(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==se(e)?e:e+""}var pe=function(){return function(t,e){return e&&de(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),be(this,"_idx",0),be(this,"_defaultDarkTextColorRgb",null),be(this,"_defaultDarkBgColorRgb",null),be(this,"_defaultDarkBgColorHSL",null),be(this,"_defaultDarkTextColorBrightness",null),be(this,"_defaultDarkBgColorBrightness",null),be(this,"_defaultDarkBgColorHslBrightness",null),be(this,"_maxLimitOffsetBrightness",null),be(this,"isDarkmode",!1)},[{key:"_adjustBrightness",value:function(t,e,r,n,o){var a,i=t.alpha(),l="";if(r.isBgColor){if(i>=b&&(e[f]&&delete e[f],e[g])){if(e[g]===t.toString()||this.getContrast(e[g],t.toString())<1.1)return{newColor:o?t.toString():"",extStyle:l};rt(e).forEach(function(t){delete t[g]})}if(a=this._adjustBackgroundBrightness(t),!r.hasInlineColor){var u=e[c]||C.defaultLightTextColor,h=ne(u);if(h){var d=this._adjustBrightness(h,e,{isTextColor:!0,parentElementBgColorStr:a||t},n,o);d.newColor?l+=ke.genCssKV("color",d.newColor):l+=ke.genCssKV("color",h)}}}else if(r.isTextColor||r.isBorderColor){var y=r.parentElementBgColorStr||r.isTextColor&&e[s]||C.defaultDarkBgColor,p=ne(y);if(p&&!e[f]){a=this._adjustTextBrightness(t,p);var m="";n?m="ByUpdateStyle":o&&(m="ByReset"),me.emit("afterConvertTextColor".concat(m),e,{fontColor:a,bgColor:p})}}else r.isTextShadow&&(e[f]||(a=this._adjustBackgroundBrightness(t)));return{newColor:a&&t.toString()!==a.toString()&&a.alpha(i).rgb(),extStyle:l}}},{key:"_adjustTextBrightness",value:function(t,e){var r=e.rgb().array(),n=e.alpha(),o=le(r)*n+this._defaultDarkBgColorBrightness*(1-n),a=t.rgb().array(),i=t.hsl().array(),l=t.alpha(),u=le(a),s=Math.abs(o-u);if(u>=250)return t;if(s>this._maxLimitOffsetBrightness&&o<=this._defaultDarkBgColorBrightness+2)return ue(this._maxLimitOffsetBrightness+o,a).alpha(l);if(s>=65)return t;if(o>=100){if(i[2]>50){i[2]=90-i[2];var c=it().hsl.apply(it(),he(i)).alpha(l);return this._adjustTextBrightness(c,e)}return ue(Math.min(this._maxLimitOffsetBrightness,o-65),a).alpha(l)}if(i[2]<=40){i[2]=90-i[2];var h=it().hsl.apply(it(),he(i)).alpha(l);return this._adjustTextBrightness(h,e)}return ue(Math.min(this._maxLimitOffsetBrightness,o+65),a).alpha(l)}},{key:"_adjustBackgroundBrightness",value:function(t){var e=t.rgb().array(),r=t.hsl().array(),n=t.alpha(),o=le(e),a=t;return 0===r[1]&&r[2]>40||o>250?a=it().hsl(0,0,Math.min(100,100+this._defaultDarkBgColorHslBrightness-r[2])):o>190?a=ue(190,e).alpha(n):r[2]<22&&(r[2]=22,a=it().hsl.apply(it(),he(r))),a.alpha(n).rgb()}},{key:"_updateBgWithGradient",value:function(t,e,r,n,o,a,i){var l=ie([e[s]||C.defaultDarkBgColor,t],"normal"),u=(e[h]||C.defaultLightBgColor).split(d).concat(t.toString()).join(d);rt(e).forEach(function(t){t[s]=l,t[h]=u});var c=n.slice(-1)[0];if("color"===c[0]){var f=this._adjustBrightness(ne(oe(c[1])),e,{isBgColor:!1,isTextShadow:!1,isTextColor:!0,isBorderColor:!1,hasInlineColor:o},a,i);if(f.newColor)return ke.genCss(r,ke.genCssKV("color",f.newColor))}return""}},{key:"_try",value:function(t){try{return t()}catch(t){console.log("An error occurred when running the dark mode conversion algorithm\n",t),"function"==typeof C.error&&C.error(t)}}},{key:"init",value:function(){this._defaultDarkTextColorRgb=ne(C.defaultDarkTextColor).rgb().array(),this._defaultDarkBgColorRgb=ne(C.defaultDarkBgColor).rgb().array(),this._defaultDarkBgColorHSL=ne(C.defaultDarkBgColor).hsl().array(),this._defaultDarkTextColorBrightness=le(this._defaultDarkTextColorRgb),this._defaultDarkBgColorBrightness=le(this._defaultDarkBgColorRgb),this._defaultDarkBgColorHslBrightness=this._defaultDarkBgColorHSL[2],this._maxLimitOffsetBrightness=this._defaultDarkTextColorBrightness-this._defaultDarkBgColorBrightness}},{key:"convert",value:function(t,e,r,n){var i=this;me.resetCss();var l="";r?l="ByUpdateStyle":n&&(l="ByReset"),me.emit("beforeConvertNode".concat(l),t);var y="",S="";if(this.isDarkmode||r||n){var _=t.nodeName;if(C.whitelist.tagName.indexOf(_)>-1)return"";if(C.whitelist.attribute.some(function(e){return t.hasAttribute(e)}))return"";var j=t.style;e||(e=(j.cssText&&j.cssText.replace(/("[^;]*);([^;]*")|('[^;]*);([^;]*')/g,"$1$3".concat("<$#_SEMICOLON_#$>","$2$4")).split(";")||[]).map(function(t){var e=t.indexOf(":");return[t.slice(0,e).toLowerCase(),t.slice(e+1).replace(k,";")].map(function(t){return(t||"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")})}));var O=!1,P=!1,B=!1,E=null,T=null;e=e.filter(function(t){var e=ce(t,2),r=e[0],n=e[1];return"color"===r?O=!0:/background/i.test(r)&&(P=!0,"background-position"===r?E=n:"background-size"===r&&(T=n)),(/background/i.test(r)||/^(-webkit-)?border-image/.test(r))&&/url\([^)]*\)/i.test(n)&&(B=!0),m.indexOf(r)>-1}).sort(function(t,e){var r=ce(t,1)[0],n=ce(e,1)[0];return"color"===r||"background-image"===r&&"background-color"===n||0===n.indexOf("-webkit-text")?1:-1}),v.indexOf(_)>-1&&!P&&this._try(function(){var r=function(t){var e=null;return Array.prototype.some.call(t.classList,function(t){return!!nt[t]&&(e=nt[t],!0)}),e}(t);if(r||(r=t.getAttribute("bgcolor")),r){var n=ne(r);n&&(e.unshift(["background-color",n.toString()]),P=!0)}}),"FONT"!==_||O||this._try(function(){var r=t.getAttribute("color");if(r){var n=ne(r);n&&(e.push(["color",n.toString()]),O=!0)}});var A="",D="",F=0;e.some(function(t,e){var r=ce(t,2),n=r[0],o=r[1];return i._try(function(){if(0!==n.indexOf("-webkit-text"))return F=e,!0;switch(n){case"-webkit-text-fill-color":A=ae(o);break;case"-webkit-text-stroke":var t=o.split(" ");2===t.length&&(D=ae(t[1]));break;case"-webkit-text-stroke-color":D=ae(o)}return!1})}),A&&(O?e[e.length-1]=["-webkit-text-fill-color",A]:(e.push(["-webkit-text-fill-color",A]),O=!0)),F&&(e.splice(0,F),D&&e.unshift(["-webkit-text-stroke-color",D]));var N="",L="";if((r||n)&&t.className&&"string"==typeof t.className){var I=t.className.match(a);I&&(N=I[0]),(I=t.className.match(we.classNameReg))&&(L=I[0])}var q="",R=n;R&&ke.watch("color",function(){R=!1,ke.unwatch("color")}),e.forEach(function(o){var a=ce(o,2),l=a[0],m=a[1];return i._try(function(){var o,a=m,v=!1,k=p.BG_COLOR.indexOf(l)>-1,_=p.TEXT_SHADOW.indexOf(l)>-1,A=p.TEXT_COLOR.indexOf(l),D=p.BORDER_COLOR.indexOf(l)>-1,F=/gradient/.test(m),N=[],I="";if(m=oe(m,F),x.test(m)){if(F){for(var $=M.exec(m);$;)N.push($[0]),$=M.exec(m);o=ie(N)}var V=0;m=m.replace(M,function(e){F&&(e=o,v=!0);var a=ne(e);if((null==a?void 0:a.alpha())>=b){var l=i._adjustBrightness(a,t,{isBgColor:k,isTextShadow:_,isTextColor:A>-1,isBorderColor:D,hasInlineColor:O},r,n),g=!B&&l.newColor;if(I+=l.extStyle,k||A>=5){var y=g?g.toString():e;0===V&&rt(t).forEach(function(t){k?(t[s]=y,t[h]=(t[h]||C.defaultLightBgColor).split(d).concat(e).join(d)):(t[u]=y,t[c]=e);var r=ne(y);k&&(null==r?void 0:r.alpha())>=b&&t[f]&&delete t[f]})}return g&&(v=!0),V++,g||e}return e}).replace(/\s?!\s?important/gi,"")}if(I&&(q+=I),!(t instanceof SVGElement)){var K=/^background/.test(l),z=/^(-webkit-)?border-image/.test(l);if((K||z)&&/url\([^)]*\)/i.test(m)){v=!0;var J=ie((t[h]||C.defaultLightBgColor).split(d),"normal").toString();if(m=m.replace(/^(.*?)url\(([^)]*)\)(.*)$/i,function(e){var r=e,o="";return t[f]||rt(t).forEach(function(t){t[f]=!0}),K?(o=ke.genCssKV(l,J?"".concat(r,",linear-gradient(").concat(J,", ").concat(J,")"):r),E&&(q+=ke.genCssKV("background-position",E),o+=ke.genCssKV("background-position",J?"".concat(E,",top left"):E)),T&&(q+=ke.genCssKV("background-size",T),o+=ke.genCssKV("background-size",J?"".concat(T,",100%"):T)),n||(L?(S+=ke.genCss(L,o),rt(t).forEach(function(t){t[g]=J||r})):we.push(t,o,function(){rt(t).forEach(function(t){t[g]=J||r})}))):!J||P||n||(o=ke.genCssKV("background-image","linear-gradient(".concat(J,", ").concat(J,")")),L?S+=ke.genCss(L,o):we.push(t,o)),r}),!O){var H=t[c]||C.defaultLightTextColor;q+=ke.genCssKV("color",H),rt(t).forEach(function(t){t[u]=H})}}}(v||n)&&(!r&&!n&&w.test(a)&&(j[l]=a.replace(w,"")),F?n||(L?(S+=ke.genCss(L,ke.genCssKV(l,m)),/^background/.test(l)&&!/url\([^)]*\)/i.test(m)&&(y+=i._updateBgWithGradient(o,t,L,e,O,r,n))):we.push(t,ke.genCssKV(l,m),function(a){/^background/.test(l)&&!/url\([^)]*\)/i.test(m)&&(y+=i._updateBgWithGradient(o,t,a.className,e,O,r,n))})):("color"===l&&(R=!1,ke.unwatch("color")),q+=ke.genCssKV(l,!v&&n?t.style[l]:m)))})}),R&&(q+=ke.genCssKV("color",t.style.color||t[u]||C.defaultDarkTextColor),ke.unwatch("color")),q&&(N||(N="".concat(o).concat(this._idx++),t.classList.add(N)),y+=q?ke.genCss(N,q):""),y+=S,r||!function(t){return t.textContent.replace(/\s/g,"").length>0}(t)||n||(C.delayBgJudge?ve.push(t):we.contains(t,function(t){y+=ke.genCss(t.className,t.cssKV),"function"==typeof t.cb&&t.cb(t)}))}return me.emit("afterConvertNode".concat(l),t),y}},{key:"getContrast",value:function(t,e){var r=ne(t),n=ne(e);return r&&n?r.contrast(n):0}}])}(),me=new D,ve=new q("".concat(o,"text__")),we=new z("".concat(o,"bg__")),ke=new W,xe=new ot,Me=new pe;function Ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Se=new RegExp("".concat(o,"[^ ]+"),"g"),_e=null,je=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{type:"dom"};if(e.force&&(ke.isFinish=!1),!ke.isFinish)try{Me.isDarkmode=C.mode?"dark"===C.mode:t.matches,"dom"===e.type?(Me.isDarkmode&&"function"==typeof C.begin&&C.begin(xe.hasDelay()),Array.prototype.forEach.call(xe.get(),function(t){if(Me.isDarkmode&&t.className&&"string"==typeof t.className&&(t.className=t.className.replace(Se,"")),Me.isDarkmode||me.length)if(C.needJudgeFirstPage){var e=t.getBoundingClientRect(),r=e.top,n=e.bottom;r<=0&&n<=0?ke.addCss(Me.convert(t)):r>0&&r<y||n>0&&n<y?(xe.addFirstPageNode(t),ke.addCss(Me.convert(t),!0)):(C.needJudgeFirstPage=!1,ke.writeStyle(!0),xe.showFirstPageNodes(),"function"==typeof C.showFirstPage&&C.showFirstPage(),ke.addCss(Me.convert(t)))}else ke.addCss(Me.convert(t))}),me.loopTimes++):"bg"===e.type&&Me.isDarkmode&&ve.forEach(function(t){return we.contains(t,function(t){var e,r,n,o,a,i;ke.addCss(ke.genCss(t.className,t.cssKV)),"function"==typeof t.cb&&t.cb(t);var l=t.el,d=[[u,null!==(e=l[u])&&void 0!==e?e:null],[s,null!==(r=l[s])&&void 0!==r?r:null],[c,null!==(n=l[c])&&void 0!==n?n:null],[h,null!==(o=l[h])&&void 0!==o?o:null],[f,null!==(a=l[f])&&void 0!==a?a:null],[g,null!==(i=l[g])&&void 0!==i?i:null]],b=rt(l,!0);b.forEach(function(t){d.forEach(function(e){var r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ce(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ce(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e,2),n=r[0],o=r[1];null===o?delete t[n]:t[n]=o})}),b.forEach(function(t){ke.addCss(Me.convert(t,void 0,!1,!0))})})}),(C.needJudgeFirstPage||!C.needJudgeFirstPage&&!xe.showFirstPage)&&"function"==typeof C.showFirstPage&&C.showFirstPage(),ke.writeStyle(),xe.emptyFirstPageNodes(),Me.isDarkmode||(C.needJudgeFirstPage=!1,C.delayBgJudge=!1,null===C.container&&"dom"===e.type&&xe.length&&xe.delay())}catch(t){console.log("An error occurred when running the dark mode conversion algorithm\n",t),"function"==typeof C.error&&C.error(t)}};function Oe(t,e){Pe(e),xe.set(t),je(_e,{force:!0,type:"dom"})}function Pe(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!C.hasInit){C.hasInit=!0;var r=C.whitelist.tagName,n=C.whitelist.attribute;t.whitelist&&(t.whitelist.tagName instanceof Array&&t.whitelist.tagName.forEach(function(t){t=t.toUpperCase(),-1===r.indexOf(t)&&r.push(t)}),t.whitelist.attribute instanceof Array&&t.whitelist.attribute.forEach(function(t){-1===n.indexOf(t)&&n.push(t)})),["dark","light"].indexOf(t.mode)>-1&&(C.set("string",t,"mode"),"dark"===t.mode&&document.getElementsByTagName("html")[0].classList.add(i)),C.set("function",t,"begin"),C.set("function",t,"showFirstPage"),C.set("function",t,"error"),C.set("boolean",t,"needJudgeFirstPage"),C.set("boolean",t,"delayBgJudge"),C.set("dom",t,"container"),C.set("string",t,"cssSelectorsPrefix"),C.set("string",t,"defaultLightTextColor"),C.set("string",t,"defaultLightBgColor"),C.set("string",t,"defaultDarkTextColor"),C.set("string",t,"defaultDarkBgColor"),Me.init(),!C.mode&&null===_e&&window.matchMedia&&(_e=window.matchMedia(e)).addListener(je)}}function Be(t){xe.set(t),null!==C.container&&(we.update(t),ve.update(t)),je(_e,{force:!0,type:"bg"}),C.delayBgJudge&&0===ve.length&&we.clear()}function Ee(t,e){ke.isFinish&&(ke.addCss(Me.convert(t,e?Object.keys(e).map(function(t){return[t,e[t]]}):void 0,!0),!1),ke.writeStyle())}function Te(t,e){return Me.getContrast(t,e)}function Ae(t){t.forEach(function(t){return me.extend(t)})}})(),n})());
@@ -0,0 +1,136 @@
1
+ # Dark Mode 最佳实践
2
+
3
+ 微信公众平台 Dark Mode 转换算法秉承**尽可能保留原文信息**的原则(颜色也是一种信息,我们不会将红色转成橙色),仅当信息在 Dark Mode 下**看不清**(对比度不够)或**看得不舒服**(亮度太高)时才进行调整。
4
+
5
+ 因此,如果创作者的内容调校得足够好,那么它在 Dark Mode 下将会获得更好的阅读体验,而这也正是本文《最佳实践》的愿景。
6
+
7
+ 本文将从「颜色」、「结构」、「图片」、「SVG」和「排版技巧 & 注意事项」五个维度分别阐述,文中出现的 case 均可在浏览器的开发者工具中查看结构及样式源码。
8
+
9
+ ## 1. 颜色
10
+
11
+ ### 1.1 使用对比度适中的颜色
12
+
13
+ 尽管平台对颜色方面没有任何的限制,但是为了让文本在 Dark Mode 下看得更清楚、看得更舒服,算法会检测文本和背景的对比度,如果过低或过高,会进行相应的平衡调整。
14
+
15
+ ![case 1](https://res.wx.qq.com/op_res/OrcPOrqCHUZIUCn-gvS_MAhnuABnAYRzNUjs-5eI0PSV6vp-oXOwqTfpfolK06xG08ONQ7_WURnuUYMHONO05g)
16
+
17
+ ↑ [case 1](https://codepen.io/jaminqian/pen/EaPEJVq)
18
+
19
+ ### 1.2 如非必要,文字背景尽量不要使用渐变
20
+
21
+ 先用 css 定义一个简单的渐变,比如 `background-image: linear-gradient(rgb(248, 245, 247), rgb(194, 43, 76))` ,表示从白色渐变到红色。
22
+
23
+ 如果只是简单对渐变的两个颜色进行算法转换的话,算法无法保证渐变过程中的颜色是否能在 Dark Mode 下保持良好的阅读体验(想象一下如果这个渐变有透明度,而渐变背后还有其它的渐变背景色,或者渐变上方有带有渐变的文本,就有可能导致文本不可阅读了),因此算法会先对渐变进行 mix 混合计算,将渐变转换成纯色,再进行算法转换,来减少不确定性。
24
+
25
+ ![case 2](https://res.wx.qq.com/op_res/OrcPOrqCHUZIUCn-gvS_MK0ZC1hZzoM_-SWicIWNAwYYnYEiW8BWftUEFwv6F_8HNMdv5sUHfTN-K0fR_jWpHA)
26
+
27
+ ↑ [case 2](https://codepen.io/jaminqian/pen/PwZRgpO)
28
+
29
+ 下面这个 bad case 也是由渐变带来的,由于使用了渐变来实现格子背景,所以在 Dark Mode 下没有了格子背景。
30
+
31
+ ![case 3](https://res.wx.qq.com/op_res/OrcPOrqCHUZIUCn-gvS_MGb_4kfsuEBvlN8F5VahEcUibX1zQgepk9WuocfqYPaSSmdCystjKLBBrmIcMGI9Kw)
32
+
33
+ ↑ [case 3](https://codepen.io/jaminqian/pen/emJMorO)
34
+
35
+ ### 1.3 纯背景可以使用渐变
36
+
37
+ 渐变背景上方如果没有文字的话,算法将不会对该渐变做处理。
38
+
39
+ ![case 4](https://res.wx.qq.com/op_res/OrcPOrqCHUZIUCn-gvS_MJA5WB30lpi3k2Gd3hpJQhdABcHm_Ur1crT-kph1ARpvD8bLZYrmznyO_07T77Db7Q)
40
+
41
+ ↑ [case 4](https://codepen.io/jaminqian/pen/ZYQxZMz)
42
+
43
+ ## 2. 结构
44
+
45
+ ### 2.1 建议使用背景容器 + 多文本节点的结构
46
+
47
+ 如果需要给多个文本添加同一个背景(背景颜色或渐变),建议将这些文本节点包裹在一个容器里,背景样式写到这个容器上,而非给每个文本节点添加相同的背景样式。这样既可以提高算法性能,减少重复计算,也可以避免以下 bad case。
48
+
49
+ ![case 5](https://res.wx.qq.com/op_res/coOfx8lhv5jNDzvOHXSt-pl1ol1lX_YbO8-fMBfRXEGxOo29d5TNJT6AQl3-9jP5Tm6vAsi32qcIC8hIB4qUOw)
50
+
51
+ ↑ [case 5](https://codepen.io/jaminqian/pen/QwymPJo)
52
+
53
+ 正确的做法是把背景样式写在容器上。
54
+
55
+ ![case 6](https://res.wx.qq.com/op_res/coOfx8lhv5jNDzvOHXSt-lbWDwvPjSBNF2QDa9ZA-BFYT6x78qX25I5uhcBsQv4z7Xbfus4C9Q18HkMima9x_A)
56
+
57
+ ↑ [case 6](https://codepen.io/jaminqian/pen/QwymPPP)
58
+
59
+ ### 2.2 保持正确的嵌套关系
60
+
61
+ 由于算法是深度优先遍历(可以简单理解为跟视觉顺序一致,自上而下,从左至右),因此,切忌使用绝对定位或变形等手段破坏视觉与结构顺序的一致性(比如将结构上靠前的节点通过绝对定位挪到后面,抑或是将文本定位到没有从属关系的背景色区域)。
62
+
63
+ ![case 7](https://res.wx.qq.com/op_res/coOfx8lhv5jNDzvOHXSt-pMkv2EY5NEwb8VSdCTqvzvvP7Xma0A-vaue-tm-Xe4KhTZ6meYPNGLvTVPjW0Of7A)
64
+
65
+ ↑ [case 7](https://codepen.io/jaminqian/pen/GgoxLbG)
66
+
67
+ ## 3. 图片
68
+
69
+ ### 3.1 如非必要,不要使用图片来承载纯文本
70
+
71
+ 出于对性能方面的考虑,算法目前没有对图片进行内容识别,因此无法提取图片中的文本做转换,并且也不建议使用图片来承载纯文本。
72
+
73
+ ![case 8](https://res.wx.qq.com/op_res/coOfx8lhv5jNDzvOHXSt-naG0kTCUYaKcuxIofO6jM0l49u7rwkofPyUhm59dRFMd0wdqsXInc362SQDc74q1A)
74
+
75
+ ↑ [case 8](https://codepen.io/jaminqian/pen/xbZWNKg)
76
+
77
+ ### 3.2 谨慎使用透明底色图片
78
+
79
+ 创作过程中免不了会使用到透明底色图片,但需要注意的是,如果图片中使用到了黑色相关的颜色,需要注意在 Dark Mode 下是否和正文的黑底 `#191919` 有足够的对比度,否则会无法看清。
80
+
81
+ ![case 9](https://res.wx.qq.com/op_res/coOfx8lhv5jNDzvOHXSt-gX9wrx3UnmFPDQQZPTFkbFn0wEJgrrLGH0zI2EXJ6OXukmdVsKhlKqoEPncAFpoLA)
82
+
83
+ ↑ [case 9](https://codepen.io/jaminqian/pen/jEWzoEg)
84
+
85
+ ### 3.3 简单了解一下背景图片的补色机制
86
+
87
+ 注意,这里特指**背景图片**,即 `background-image` 而非 `<img>`,顺带一说,背景图片上方的文字颜色会保留 Light Mode 原色。
88
+
89
+ 我们注意到,有些创作者会在文字底部加背景图片做装饰(比如条纹、网格),当这些背景图片是透明底色时,可能会导致文字无法阅读,因此算法对背景图片加上了独特的“补色”机制。
90
+
91
+ ![case 10](https://res.wx.qq.com/op_res/coOfx8lhv5jNDzvOHXSt-tsobj6JpfQiZQbgr5wC_VLoeJFVqHoYAjK9VZfPRW6pU-X6P1zcZpoaA8vAn5EiIw)
92
+
93
+ ↑ [case 10](https://codepen.io/jaminqian/pen/LEGdopz)
94
+
95
+ 补色机制的具体细节(如何检测文字、补什么颜色等等)就不在这里赘述了,感兴趣的话可以看算法源码。
96
+
97
+ ## 4. SVG
98
+
99
+ 算法目前不会对 SVG 进行处理,绝大部分 SVG 在 Dark Mode 下都和 Light Mode 表现一致。
100
+
101
+ 但也因此,会出现以下 bad case。
102
+
103
+ ![case 11](https://res.wx.qq.com/op_res/coOfx8lhv5jNDzvOHXSt-qtCt0vaXfhgC06_1qxYCt60klUbj5ZsQyCDoIbQ-MLkZYR-FmikK_Un3Tjxn2E_wQ)
104
+
105
+ ↑ [case 11](https://codepen.io/jaminqian/pen/zxrWQZZ)
106
+
107
+ 想要规避上述 bad case,可以指定 `stroke="currentColor" fill="currentColor"`,或者加上底色。
108
+
109
+ ## 5. 排版技巧 & 注意事项
110
+
111
+ ### 5.1 指定节点跳过算法转换
112
+
113
+ 可以使用 `data-no-dark` 属性来指定当前节点跳过算法转换,但仅针对当前节点生效,其后代节点如果有内联样式,依然会进行算法转换。
114
+
115
+ ```HTML
116
+ <ul style="color: #000;" data-no-dark>
117
+ <li>这是黑色字体</li>
118
+ <li style="color: #000;">这也是黑色字体,但是有style="color: #000;"</li>
119
+ </ul>
120
+ ```
121
+
122
+ ![case 12](https://res.wx.qq.com/op_res/coOfx8lhv5jNDzvOHXSt-sRyP9sdreDpNCJhXpHoloep8fJhSWBUYQSdtG7aXoSgNeBrj0JrNhgbBKotEINY3g)
123
+
124
+ ↑ [case 12](https://codepen.io/jaminqian/pen/Ggoxamw)
125
+
126
+ ### 5.2 不要使用 `!important`
127
+
128
+ 无论是什么场景,我们都不建议创作者在排版时使用 `!important`,这会使平台添加的公共样式失效,并且 Dark Mode 算法也需要搭配 `!important` 来实现样式覆盖。
129
+
130
+ ## 相关内容
131
+
132
+ - [cases 合集](https://codepen.io/collection/adBbBM?sort_by=ItemCreatedAt&grid_type=LIST)
133
+ - [Dark Mode 处理原则](https://github.com/wechatjs/mp-darkmode/blob/master/doc/cn/principle.md)
134
+ - [微信公众平台 Dark Mode 最佳实践 公众号文章](https://mp.weixin.qq.com/s/jgipW2ihmXJBj-4WuiV_rw)
135
+ - [微信公众平台 Dark Mode 转换算法 源码](https://github.com/wechatjs/mp-darkmode)
136
+ - [微信公众平台 Dark Mode 转换算法 npm](https://www.npmjs.com/package/mp-darkmode)
@@ -1,4 +1,4 @@
1
- # 图文富文本内容 Dark Mode 处理原则
1
+ # Dark Mode 处理原则
2
2
 
3
3
  ## 处理 1:带颜色节点
4
4
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mp-darkmode",
3
- "version": "1.2.0",
4
- "description": "微信公众平台图文 Dark Mode 转换算法",
3
+ "version": "1.2.2",
4
+ "description": "微信公众平台 Dark Mode 转换算法",
5
5
  "main": "dist/darkmode.min.js",
6
6
  "dependencies": {
7
7
  "color": "^3.1.2",