diff --git a/www/mushroom.js b/www/mushroom.js index 982ceb3..e1d2e04 100644 --- a/www/mushroom.js +++ b/www/mushroom.js @@ -602,11 +602,11 @@ const er=h`.mdc-floating-label{-moz-osx-font-smoothing:grayscale;-webkit-font-sm * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const sr="important",lr=" !"+sr,cr=He(class extends Ye{constructor(t){var e;if(super(t),t.type!==Ve||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,i)=>{const o=t[i];return null==o?e:e+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`}),"")}update(t,[e]){const{style:i}=t.element;if(void 0===this.ut){this.ut=new Set;for(const t in e)this.ut.add(t);return this.render(e)}this.ut.forEach((t=>{null==e[t]&&(this.ut.delete(t),t.includes("-")?i.removeProperty(t):i[t]="")}));for(const t in e){const o=e[t];if(null!=o){this.ut.add(t);const e="string"==typeof o&&o.endsWith(lr);t.includes("-")||e?i.setProperty(t,e?o.slice(0,-11):o,e?sr:""):i[t]=o}}return X}});var dr={exports:{}},ur={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]},hr={exports:{}},mr=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))},pr=Array.prototype.concat,fr=Array.prototype.slice,gr=hr.exports=function(t){for(var e=[],i=0,o=t.length;i=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},kr.to.keyword=function(t){return xr[t.slice(0,3)]};var Er=dr.exports;const Ar=ur,Sr={};for(const t of Object.keys(Ar))Sr[Ar[t]]=t;const Ir={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"]}};var Tr=Ir;for(const t of Object.keys(Ir)){if(!("channels"in Ir[t]))throw new Error("missing channels property: "+t);if(!("labels"in Ir[t]))throw new Error("missing channel labels property: "+t);if(Ir[t].labels.length!==Ir[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:i}=Ir[t];delete Ir[t].channels,delete Ir[t].labels,Object.defineProperty(Ir[t],"channels",{value:e}),Object.defineProperty(Ir[t],"labels",{value:i})}function zr(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Ir.rgb.hsl=function(t){const e=t[0]/255,i=t[1]/255,o=t[2]/255,n=Math.min(e,i,o),a=Math.max(e,i,o),r=a-n;let s,l;a===n?s=0:e===a?s=(i-o)/r:i===a?s=2+(o-e)/r:o===a&&(s=4+(e-i)/r),s=Math.min(60*s,360),s<0&&(s+=360);const c=(n+a)/2;return l=a===n?0:c<=.5?r/(a+n):r/(2-a-n),[s,100*l,100*c]},Ir.rgb.hsv=function(t){let e,i,o,n,a;const r=t[0]/255,s=t[1]/255,l=t[2]/255,c=Math.max(r,s,l),d=c-Math.min(r,s,l),u=function(t){return(c-t)/6/d+.5};return 0===d?(n=0,a=0):(a=d/c,e=u(r),i=u(s),o=u(l),r===c?n=o-i:s===c?n=1/3+e-o:l===c&&(n=2/3+i-e),n<0?n+=1:n>1&&(n-=1)),[360*n,100*a,100*c]},Ir.rgb.hwb=function(t){const e=t[0],i=t[1];let o=t[2];const n=Ir.rgb.hsl(t)[0],a=1/255*Math.min(e,Math.min(i,o));return o=1-1/255*Math.max(e,Math.max(i,o)),[n,100*a,100*o]},Ir.rgb.cmyk=function(t){const e=t[0]/255,i=t[1]/255,o=t[2]/255,n=Math.min(1-e,1-i,1-o);return[100*((1-e-n)/(1-n)||0),100*((1-i-n)/(1-n)||0),100*((1-o-n)/(1-n)||0),100*n]},Ir.rgb.keyword=function(t){const e=Sr[t];if(e)return e;let i,o=1/0;for(const e of Object.keys(Ar)){const n=zr(t,Ar[e]);n.04045?((e+.055)/1.055)**2.4:e/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,o=o>.04045?((o+.055)/1.055)**2.4:o/12.92;return[100*(.4124*e+.3576*i+.1805*o),100*(.2126*e+.7152*i+.0722*o),100*(.0193*e+.1192*i+.9505*o)]},Ir.rgb.lab=function(t){const e=Ir.rgb.xyz(t);let i=e[0],o=e[1],n=e[2];i/=95.047,o/=100,n/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;return[116*o-16,500*(i-o),200*(o-n)]},Ir.hsl.rgb=function(t){const e=t[0]/360,i=t[1]/100,o=t[2]/100;let n,a,r;if(0===i)return r=255*o,[r,r,r];n=o<.5?o*(1+i):o+i-o*i;const s=2*o-n,l=[0,0,0];for(let t=0;t<3;t++)a=e+1/3*-(t-1),a<0&&a++,a>1&&a--,r=6*a<1?s+6*(n-s)*a:2*a<1?n:3*a<2?s+(n-s)*(2/3-a)*6:s,l[t]=255*r;return l},Ir.hsl.hsv=function(t){const e=t[0];let i=t[1]/100,o=t[2]/100,n=i;const a=Math.max(o,.01);o*=2,i*=o<=1?o:2-o,n*=a<=1?a:2-a;return[e,100*(0===o?2*n/(a+n):2*i/(o+i)),100*((o+i)/2)]},Ir.hsv.rgb=function(t){const e=t[0]/60,i=t[1]/100;let o=t[2]/100;const n=Math.floor(e)%6,a=e-Math.floor(e),r=255*o*(1-i),s=255*o*(1-i*a),l=255*o*(1-i*(1-a));switch(o*=255,n){case 0:return[o,l,r];case 1:return[s,o,r];case 2:return[r,o,l];case 3:return[r,s,o];case 4:return[l,r,o];case 5:return[o,r,s]}},Ir.hsv.hsl=function(t){const e=t[0],i=t[1]/100,o=t[2]/100,n=Math.max(o,.01);let a,r;r=(2-i)*o;const s=(2-i)*n;return a=i*n,a/=s<=1?s:2-s,a=a||0,r/=2,[e,100*a,100*r]},Ir.hwb.rgb=function(t){const e=t[0]/360;let i=t[1]/100,o=t[2]/100;const n=i+o;let a;n>1&&(i/=n,o/=n);const r=Math.floor(6*e),s=1-o;a=6*e-r,0!=(1&r)&&(a=1-a);const l=i+a*(s-i);let c,d,u;switch(r){default:case 6:case 0:c=s,d=l,u=i;break;case 1:c=l,d=s,u=i;break;case 2:c=i,d=s,u=l;break;case 3:c=i,d=l,u=s;break;case 4:c=l,d=i,u=s;break;case 5:c=s,d=i,u=l}return[255*c,255*d,255*u]},Ir.cmyk.rgb=function(t){const e=t[0]/100,i=t[1]/100,o=t[2]/100,n=t[3]/100;return[255*(1-Math.min(1,e*(1-n)+n)),255*(1-Math.min(1,i*(1-n)+n)),255*(1-Math.min(1,o*(1-n)+n))]},Ir.xyz.rgb=function(t){const e=t[0]/100,i=t[1]/100,o=t[2]/100;let n,a,r;return n=3.2406*e+-1.5372*i+-.4986*o,a=-.9689*e+1.8758*i+.0415*o,r=.0557*e+-.204*i+1.057*o,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,n=Math.min(Math.max(0,n),1),a=Math.min(Math.max(0,a),1),r=Math.min(Math.max(0,r),1),[255*n,255*a,255*r]},Ir.xyz.lab=function(t){let e=t[0],i=t[1],o=t[2];e/=95.047,i/=100,o/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*i-16,500*(e-i),200*(i-o)]},Ir.lab.xyz=function(t){let e,i,o;i=(t[0]+16)/116,e=t[1]/500+i,o=i-t[2]/200;const n=i**3,a=e**3,r=o**3;return i=n>.008856?n:(i-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,o=r>.008856?r:(o-16/116)/7.787,e*=95.047,i*=100,o*=108.883,[e,i,o]},Ir.lab.lch=function(t){const e=t[0],i=t[1],o=t[2];let n;n=360*Math.atan2(o,i)/2/Math.PI,n<0&&(n+=360);return[e,Math.sqrt(i*i+o*o),n]},Ir.lch.lab=function(t){const e=t[0],i=t[1],o=t[2]/360*2*Math.PI;return[e,i*Math.cos(o),i*Math.sin(o)]},Ir.rgb.ansi16=function(t,e=null){const[i,o,n]=t;let a=null===e?Ir.rgb.hsv(t)[2]:e;if(a=Math.round(a/50),0===a)return 30;let r=30+(Math.round(n/255)<<2|Math.round(o/255)<<1|Math.round(i/255));return 2===a&&(r+=60),r},Ir.hsv.ansi16=function(t){return Ir.rgb.ansi16(Ir.hsv.rgb(t),t[2])},Ir.rgb.ansi256=function(t){const e=t[0],i=t[1],o=t[2];if(e===i&&i===o)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;return 16+36*Math.round(e/255*5)+6*Math.round(i/255*5)+Math.round(o/255*5)},Ir.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const i=.5*(1+~~(t>50));return[(1&e)*i*255,(e>>1&1)*i*255,(e>>2&1)*i*255]},Ir.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;t-=16;return[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},Ir.rgb.hex=function(t){const 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},Ir.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let i=e[0];3===e[0].length&&(i=i.split("").map((t=>t+t)).join(""));const o=parseInt(i,16);return[o>>16&255,o>>8&255,255&o]},Ir.rgb.hcg=function(t){const e=t[0]/255,i=t[1]/255,o=t[2]/255,n=Math.max(Math.max(e,i),o),a=Math.min(Math.min(e,i),o),r=n-a;let s,l;return s=r<1?a/(1-r):0,l=r<=0?0:n===e?(i-o)/r%6:n===i?2+(o-e)/r:4+(e-i)/r,l/=6,l%=1,[360*l,100*r,100*s]},Ir.hsl.hcg=function(t){const e=t[1]/100,i=t[2]/100,o=i<.5?2*e*i:2*e*(1-i);let n=0;return o<1&&(n=(i-.5*o)/(1-o)),[t[0],100*o,100*n]},Ir.hsv.hcg=function(t){const e=t[1]/100,i=t[2]/100,o=e*i;let n=0;return o<1&&(n=(i-o)/(1-o)),[t[0],100*o,100*n]},Ir.hcg.rgb=function(t){const e=t[0]/360,i=t[1]/100,o=t[2]/100;if(0===i)return[255*o,255*o,255*o];const n=[0,0,0],a=e%1*6,r=a%1,s=1-r;let l=0;switch(Math.floor(a)){case 0:n[0]=1,n[1]=r,n[2]=0;break;case 1:n[0]=s,n[1]=1,n[2]=0;break;case 2:n[0]=0,n[1]=1,n[2]=r;break;case 3:n[0]=0,n[1]=s,n[2]=1;break;case 4:n[0]=r,n[1]=0,n[2]=1;break;default:n[0]=1,n[1]=0,n[2]=s}return l=(1-i)*o,[255*(i*n[0]+l),255*(i*n[1]+l),255*(i*n[2]+l)]},Ir.hcg.hsv=function(t){const e=t[1]/100,i=e+t[2]/100*(1-e);let o=0;return i>0&&(o=e/i),[t[0],100*o,100*i]},Ir.hcg.hsl=function(t){const e=t[1]/100,i=t[2]/100*(1-e)+.5*e;let o=0;return i>0&&i<.5?o=e/(2*i):i>=.5&&i<1&&(o=e/(2*(1-i))),[t[0],100*o,100*i]},Ir.hcg.hwb=function(t){const e=t[1]/100,i=e+t[2]/100*(1-e);return[t[0],100*(i-e),100*(1-i)]},Ir.hwb.hcg=function(t){const e=t[1]/100,i=1-t[2]/100,o=i-e;let n=0;return o<1&&(n=(i-o)/(1-o)),[t[0],100*o,100*n]},Ir.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},Ir.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},Ir.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},Ir.gray.hsl=function(t){return[0,0,t[0]]},Ir.gray.hsv=Ir.gray.hsl,Ir.gray.hwb=function(t){return[0,100,t[0]]},Ir.gray.cmyk=function(t){return[0,0,0,t[0]]},Ir.gray.lab=function(t){return[t[0],0,0]},Ir.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i},Ir.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};const Or=Tr;function Mr(t){const e=function(){const t={},e=Object.keys(Or);for(let i=e.length,o=0;o{Nr[t]={},Object.defineProperty(Nr[t],"channels",{value:Lr[t].channels}),Object.defineProperty(Nr[t],"labels",{value:Lr[t].labels});const e=Pr(t);Object.keys(e).forEach((i=>{const o=e[i];Nr[t][i]=function(t){const e=function(...e){const i=e[0];if(null==i)return i;i.length>1&&(e=i);const o=t(e);if("object"==typeof o)for(let t=o.length,e=0;e1&&(e=i),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(o)}))}));const Rr=Er,Fr=Nr,Vr=["keyword","gray","hex"],Br={};for(const t of Object.keys(Fr))Br[[...Fr[t].labels].sort().join("")]=t;const Ur={};function Hr(t,e){if(!(this instanceof Hr))return new Hr(t,e);if(e&&e in Vr&&(e=null),e&&!(e in Fr))throw new Error("Unknown model: "+e);let i,o;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof Hr)this.model=t.model,this.color=[...t.color],this.valpha=t.valpha;else if("string"==typeof t){const e=Rr.get(t);if(null===e)throw new Error("Unable to parse color from string: "+t);this.model=e.model,o=Fr[this.model].channels,this.color=e.value.slice(0,o),this.valpha="number"==typeof e.value[o]?e.value[o]:1}else if(t.length>0){this.model=e||"rgb",o=Fr[this.model].channels;const i=Array.prototype.slice.call(t,0,o);this.color=Kr(i,o),this.valpha="number"==typeof t[o]?t[o]:1}else if("number"==typeof t)this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;const e=Object.keys(t);"alpha"in t&&(e.splice(e.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);const o=e.sort().join("");if(!(o in Br))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=Br[o];const{labels:n}=Fr[this.model],a=[];for(i=0;i(t%360+360)%360)),saturationl:Wr("hsl",1,Xr(100)),lightness:Wr("hsl",2,Xr(100)),saturationv:Wr("hsv",1,Xr(100)),value:Wr("hsv",2,Xr(100)),chroma:Wr("hcg",1,Xr(100)),gray:Wr("hcg",2,Xr(100)),white:Wr("hwb",1,Xr(100)),wblack:Wr("hwb",2,Xr(100)),cyan:Wr("cmyk",0,Xr(100)),magenta:Wr("cmyk",1,Xr(100)),yellow:Wr("cmyk",2,Xr(100)),black:Wr("cmyk",3,Xr(100)),x:Wr("xyz",0,Xr(95.047)),y:Wr("xyz",1,Xr(100)),z:Wr("xyz",2,Xr(108.833)),l:Wr("lab",0,Xr(100)),a:Wr("lab",1),b:Wr("lab",2),keyword(t){return void 0!==t?new Hr(t):Fr[this.model].keyword(this.color)},hex(t){return void 0!==t?new Hr(t):Rr.to.hex(this.rgb().round().color)},hexa(t){if(void 0!==t)return new Hr(t);const e=this.rgb().round().color;let i=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===i.length&&(i="0"+i),Rr.to.hex(e)+i},rgbNumber(){const t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity(){const t=this.rgb().color,e=[];for(const[i,o]of t.entries()){const t=o/255;e[i]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(t){const e=this.luminosity(),i=t.luminosity();return e>i?(e+.05)/(i+.05):(i+.05)/(e+.05)},level(t){const e=this.contrast(t);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const t=this.rgb().color;return(2126*t[0]+7152*t[1]+722*t[2])/1e4<128},isLight(){return!this.isDark()},negate(){const t=this.rgb();for(let e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten(t){const e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken(t){const e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate(t){const e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate(t){const e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten(t){const e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken(t){const e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale(){const t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return Hr.rgb(e,e,e)},fade(t){return this.alpha(this.valpha-this.valpha*t)},opaquer(t){return this.alpha(this.valpha+this.valpha*t)},rotate(t){const e=this.hsl();let i=e.color[0];return i=(i+t)%360,i=i<0?360+i:i,e.color[0]=i,e},mix(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);const i=t.rgb(),o=this.rgb(),n=void 0===e?.5:e,a=2*n-1,r=i.alpha()-o.alpha(),s=((a*r==-1?a:(a+r)/(1+a*r))+1)/2,l=1-s;return Hr.rgb(s*i.red()+l*o.red(),s*i.green()+l*o.green(),s*i.blue()+l*o.blue(),i.alpha()*n+o.alpha()*(1-n))}};for(const t of Object.keys(Fr)){if(Vr.includes(t))continue;const{channels:e}=Fr[t];Hr.prototype[t]=function(...e){return this.model===t?new Hr(this):e.length>0?new Hr(e,t):new Hr([...(i=Fr[this.model][t].raw(this.color),Array.isArray(i)?i:[i]),this.valpha],t);var i},Hr[t]=function(...i){let o=i[0];return"number"==typeof o&&(o=Kr(i,e)),new Hr(o,t)}}function Yr(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}function Wr(t,e,i){t=Array.isArray(t)?t:[t];for(const o of t)(Ur[o]||(Ur[o]=[]))[e]=i;return t=t[0],function(o){let n;return void 0!==o?(i&&(o=i(o)),n=this[t](),n.color[e]=o,n):(n=this[t]().color[e],i&&(n=i(n)),n)}}function Xr(t){return function(e){return Math.max(0,Math.min(t,e))}}function Kr(t,e){for(let i=0;i2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,i)=>{const o=t[i];return null==o?e:e+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`}),"")}update(t,[e]){const{style:i}=t.element;if(void 0===this.ut){this.ut=new Set;for(const t in e)this.ut.add(t);return this.render(e)}this.ut.forEach((t=>{null==e[t]&&(this.ut.delete(t),t.includes("-")?i.removeProperty(t):i[t]="")}));for(const t in e){const o=e[t];if(null!=o){this.ut.add(t);const e="string"==typeof o&&o.endsWith(lr);t.includes("-")||e?i.setProperty(t,e?o.slice(0,-11):o,e?sr:""):i[t]=o}}return X}});var dr={exports:{}},ur={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]},hr={exports:{}},mr=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))},pr=Array.prototype.concat,fr=Array.prototype.slice,gr=hr.exports=function(t){for(var e=[],i=0,o=t.length;i=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},kr.to.keyword=function(t){return xr[t.slice(0,3)]};var Er=dr.exports;const Ar=ur,Sr={};for(const t of Object.keys(Ar))Sr[Ar[t]]=t;const Ir={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"]}};var Tr=Ir;for(const t of Object.keys(Ir)){if(!("channels"in Ir[t]))throw new Error("missing channels property: "+t);if(!("labels"in Ir[t]))throw new Error("missing channel labels property: "+t);if(Ir[t].labels.length!==Ir[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:i}=Ir[t];delete Ir[t].channels,delete Ir[t].labels,Object.defineProperty(Ir[t],"channels",{value:e}),Object.defineProperty(Ir[t],"labels",{value:i})}function zr(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Ir.rgb.hsl=function(t){const e=t[0]/255,i=t[1]/255,o=t[2]/255,n=Math.min(e,i,o),a=Math.max(e,i,o),r=a-n;let s,l;a===n?s=0:e===a?s=(i-o)/r:i===a?s=2+(o-e)/r:o===a&&(s=4+(e-i)/r),s=Math.min(60*s,360),s<0&&(s+=360);const c=(n+a)/2;return l=a===n?0:c<=.5?r/(a+n):r/(2-a-n),[s,100*l,100*c]},Ir.rgb.hsv=function(t){let e,i,o,n,a;const r=t[0]/255,s=t[1]/255,l=t[2]/255,c=Math.max(r,s,l),d=c-Math.min(r,s,l),u=function(t){return(c-t)/6/d+.5};return 0===d?(n=0,a=0):(a=d/c,e=u(r),i=u(s),o=u(l),r===c?n=o-i:s===c?n=1/3+e-o:l===c&&(n=2/3+i-e),n<0?n+=1:n>1&&(n-=1)),[360*n,100*a,100*c]},Ir.rgb.hwb=function(t){const e=t[0],i=t[1];let o=t[2];const n=Ir.rgb.hsl(t)[0],a=1/255*Math.min(e,Math.min(i,o));return o=1-1/255*Math.max(e,Math.max(i,o)),[n,100*a,100*o]},Ir.rgb.cmyk=function(t){const e=t[0]/255,i=t[1]/255,o=t[2]/255,n=Math.min(1-e,1-i,1-o);return[100*((1-e-n)/(1-n)||0),100*((1-i-n)/(1-n)||0),100*((1-o-n)/(1-n)||0),100*n]},Ir.rgb.keyword=function(t){const e=Sr[t];if(e)return e;let i,o=1/0;for(const e of Object.keys(Ar)){const n=zr(t,Ar[e]);n.04045?((e+.055)/1.055)**2.4:e/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,o=o>.04045?((o+.055)/1.055)**2.4:o/12.92;return[100*(.4124*e+.3576*i+.1805*o),100*(.2126*e+.7152*i+.0722*o),100*(.0193*e+.1192*i+.9505*o)]},Ir.rgb.lab=function(t){const e=Ir.rgb.xyz(t);let i=e[0],o=e[1],n=e[2];i/=95.047,o/=100,n/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;return[116*o-16,500*(i-o),200*(o-n)]},Ir.hsl.rgb=function(t){const e=t[0]/360,i=t[1]/100,o=t[2]/100;let n,a,r;if(0===i)return r=255*o,[r,r,r];n=o<.5?o*(1+i):o+i-o*i;const s=2*o-n,l=[0,0,0];for(let t=0;t<3;t++)a=e+1/3*-(t-1),a<0&&a++,a>1&&a--,r=6*a<1?s+6*(n-s)*a:2*a<1?n:3*a<2?s+(n-s)*(2/3-a)*6:s,l[t]=255*r;return l},Ir.hsl.hsv=function(t){const e=t[0];let i=t[1]/100,o=t[2]/100,n=i;const a=Math.max(o,.01);o*=2,i*=o<=1?o:2-o,n*=a<=1?a:2-a;return[e,100*(0===o?2*n/(a+n):2*i/(o+i)),100*((o+i)/2)]},Ir.hsv.rgb=function(t){const e=t[0]/60,i=t[1]/100;let o=t[2]/100;const n=Math.floor(e)%6,a=e-Math.floor(e),r=255*o*(1-i),s=255*o*(1-i*a),l=255*o*(1-i*(1-a));switch(o*=255,n){case 0:return[o,l,r];case 1:return[s,o,r];case 2:return[r,o,l];case 3:return[r,s,o];case 4:return[l,r,o];case 5:return[o,r,s]}},Ir.hsv.hsl=function(t){const e=t[0],i=t[1]/100,o=t[2]/100,n=Math.max(o,.01);let a,r;r=(2-i)*o;const s=(2-i)*n;return a=i*n,a/=s<=1?s:2-s,a=a||0,r/=2,[e,100*a,100*r]},Ir.hwb.rgb=function(t){const e=t[0]/360;let i=t[1]/100,o=t[2]/100;const n=i+o;let a;n>1&&(i/=n,o/=n);const r=Math.floor(6*e),s=1-o;a=6*e-r,0!=(1&r)&&(a=1-a);const l=i+a*(s-i);let c,d,u;switch(r){default:case 6:case 0:c=s,d=l,u=i;break;case 1:c=l,d=s,u=i;break;case 2:c=i,d=s,u=l;break;case 3:c=i,d=l,u=s;break;case 4:c=l,d=i,u=s;break;case 5:c=s,d=i,u=l}return[255*c,255*d,255*u]},Ir.cmyk.rgb=function(t){const e=t[0]/100,i=t[1]/100,o=t[2]/100,n=t[3]/100;return[255*(1-Math.min(1,e*(1-n)+n)),255*(1-Math.min(1,i*(1-n)+n)),255*(1-Math.min(1,o*(1-n)+n))]},Ir.xyz.rgb=function(t){const e=t[0]/100,i=t[1]/100,o=t[2]/100;let n,a,r;return n=3.2406*e+-1.5372*i+-.4986*o,a=-.9689*e+1.8758*i+.0415*o,r=.0557*e+-.204*i+1.057*o,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,n=Math.min(Math.max(0,n),1),a=Math.min(Math.max(0,a),1),r=Math.min(Math.max(0,r),1),[255*n,255*a,255*r]},Ir.xyz.lab=function(t){let e=t[0],i=t[1],o=t[2];e/=95.047,i/=100,o/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*i-16,500*(e-i),200*(i-o)]},Ir.lab.xyz=function(t){let e,i,o;i=(t[0]+16)/116,e=t[1]/500+i,o=i-t[2]/200;const n=i**3,a=e**3,r=o**3;return i=n>.008856?n:(i-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,o=r>.008856?r:(o-16/116)/7.787,e*=95.047,i*=100,o*=108.883,[e,i,o]},Ir.lab.lch=function(t){const e=t[0],i=t[1],o=t[2];let n;n=360*Math.atan2(o,i)/2/Math.PI,n<0&&(n+=360);return[e,Math.sqrt(i*i+o*o),n]},Ir.lch.lab=function(t){const e=t[0],i=t[1],o=t[2]/360*2*Math.PI;return[e,i*Math.cos(o),i*Math.sin(o)]},Ir.rgb.ansi16=function(t,e=null){const[i,o,n]=t;let a=null===e?Ir.rgb.hsv(t)[2]:e;if(a=Math.round(a/50),0===a)return 30;let r=30+(Math.round(n/255)<<2|Math.round(o/255)<<1|Math.round(i/255));return 2===a&&(r+=60),r},Ir.hsv.ansi16=function(t){return Ir.rgb.ansi16(Ir.hsv.rgb(t),t[2])},Ir.rgb.ansi256=function(t){const e=t[0],i=t[1],o=t[2];if(e===i&&i===o)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;return 16+36*Math.round(e/255*5)+6*Math.round(i/255*5)+Math.round(o/255*5)},Ir.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const i=.5*(1+~~(t>50));return[(1&e)*i*255,(e>>1&1)*i*255,(e>>2&1)*i*255]},Ir.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;t-=16;return[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},Ir.rgb.hex=function(t){const 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},Ir.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let i=e[0];3===e[0].length&&(i=i.split("").map((t=>t+t)).join(""));const o=parseInt(i,16);return[o>>16&255,o>>8&255,255&o]},Ir.rgb.hcg=function(t){const e=t[0]/255,i=t[1]/255,o=t[2]/255,n=Math.max(Math.max(e,i),o),a=Math.min(Math.min(e,i),o),r=n-a;let s,l;return s=r<1?a/(1-r):0,l=r<=0?0:n===e?(i-o)/r%6:n===i?2+(o-e)/r:4+(e-i)/r,l/=6,l%=1,[360*l,100*r,100*s]},Ir.hsl.hcg=function(t){const e=t[1]/100,i=t[2]/100,o=i<.5?2*e*i:2*e*(1-i);let n=0;return o<1&&(n=(i-.5*o)/(1-o)),[t[0],100*o,100*n]},Ir.hsv.hcg=function(t){const e=t[1]/100,i=t[2]/100,o=e*i;let n=0;return o<1&&(n=(i-o)/(1-o)),[t[0],100*o,100*n]},Ir.hcg.rgb=function(t){const e=t[0]/360,i=t[1]/100,o=t[2]/100;if(0===i)return[255*o,255*o,255*o];const n=[0,0,0],a=e%1*6,r=a%1,s=1-r;let l=0;switch(Math.floor(a)){case 0:n[0]=1,n[1]=r,n[2]=0;break;case 1:n[0]=s,n[1]=1,n[2]=0;break;case 2:n[0]=0,n[1]=1,n[2]=r;break;case 3:n[0]=0,n[1]=s,n[2]=1;break;case 4:n[0]=r,n[1]=0,n[2]=1;break;default:n[0]=1,n[1]=0,n[2]=s}return l=(1-i)*o,[255*(i*n[0]+l),255*(i*n[1]+l),255*(i*n[2]+l)]},Ir.hcg.hsv=function(t){const e=t[1]/100,i=e+t[2]/100*(1-e);let o=0;return i>0&&(o=e/i),[t[0],100*o,100*i]},Ir.hcg.hsl=function(t){const e=t[1]/100,i=t[2]/100*(1-e)+.5*e;let o=0;return i>0&&i<.5?o=e/(2*i):i>=.5&&i<1&&(o=e/(2*(1-i))),[t[0],100*o,100*i]},Ir.hcg.hwb=function(t){const e=t[1]/100,i=e+t[2]/100*(1-e);return[t[0],100*(i-e),100*(1-i)]},Ir.hwb.hcg=function(t){const e=t[1]/100,i=1-t[2]/100,o=i-e;let n=0;return o<1&&(n=(i-o)/(1-o)),[t[0],100*o,100*n]},Ir.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},Ir.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},Ir.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},Ir.gray.hsl=function(t){return[0,0,t[0]]},Ir.gray.hsv=Ir.gray.hsl,Ir.gray.hwb=function(t){return[0,100,t[0]]},Ir.gray.cmyk=function(t){return[0,0,0,t[0]]},Ir.gray.lab=function(t){return[t[0],0,0]},Ir.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i},Ir.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};const Or=Tr;function Mr(t){const e=function(){const t={},e=Object.keys(Or);for(let i=e.length,o=0;o{Nr[t]={},Object.defineProperty(Nr[t],"channels",{value:Lr[t].channels}),Object.defineProperty(Nr[t],"labels",{value:Lr[t].labels});const e=Pr(t);Object.keys(e).forEach((i=>{const o=e[i];Nr[t][i]=function(t){const e=function(...e){const i=e[0];if(null==i)return i;i.length>1&&(e=i);const o=t(e);if("object"==typeof o)for(let t=o.length,e=0;e1&&(e=i),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(o)}))}));const Rr=Er,Fr=Nr,Vr=["keyword","gray","hex"],Br={};for(const t of Object.keys(Fr))Br[[...Fr[t].labels].sort().join("")]=t;const Ur={};function Hr(t,e){if(!(this instanceof Hr))return new Hr(t,e);if(e&&e in Vr&&(e=null),e&&!(e in Fr))throw new Error("Unknown model: "+e);let i,o;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof Hr)this.model=t.model,this.color=[...t.color],this.valpha=t.valpha;else if("string"==typeof t){const e=Rr.get(t);if(null===e)throw new Error("Unable to parse color from string: "+t);this.model=e.model,o=Fr[this.model].channels,this.color=e.value.slice(0,o),this.valpha="number"==typeof e.value[o]?e.value[o]:1}else if(t.length>0){this.model=e||"rgb",o=Fr[this.model].channels;const i=Array.prototype.slice.call(t,0,o);this.color=Kr(i,o),this.valpha="number"==typeof t[o]?t[o]:1}else if("number"==typeof t)this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;const e=Object.keys(t);"alpha"in t&&(e.splice(e.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);const o=e.sort().join("");if(!(o in Br))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=Br[o];const{labels:n}=Fr[this.model],a=[];for(i=0;i(t%360+360)%360)),saturationl:Wr("hsl",1,Xr(100)),lightness:Wr("hsl",2,Xr(100)),saturationv:Wr("hsv",1,Xr(100)),value:Wr("hsv",2,Xr(100)),chroma:Wr("hcg",1,Xr(100)),gray:Wr("hcg",2,Xr(100)),white:Wr("hwb",1,Xr(100)),wblack:Wr("hwb",2,Xr(100)),cyan:Wr("cmyk",0,Xr(100)),magenta:Wr("cmyk",1,Xr(100)),yellow:Wr("cmyk",2,Xr(100)),black:Wr("cmyk",3,Xr(100)),x:Wr("xyz",0,Xr(95.047)),y:Wr("xyz",1,Xr(100)),z:Wr("xyz",2,Xr(108.833)),l:Wr("lab",0,Xr(100)),a:Wr("lab",1),b:Wr("lab",2),keyword(t){return void 0!==t?new Hr(t):Fr[this.model].keyword(this.color)},hex(t){return void 0!==t?new Hr(t):Rr.to.hex(this.rgb().round().color)},hexa(t){if(void 0!==t)return new Hr(t);const e=this.rgb().round().color;let i=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===i.length&&(i="0"+i),Rr.to.hex(e)+i},rgbNumber(){const t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity(){const t=this.rgb().color,e=[];for(const[i,o]of t.entries()){const t=o/255;e[i]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(t){const e=this.luminosity(),i=t.luminosity();return e>i?(e+.05)/(i+.05):(i+.05)/(e+.05)},level(t){const e=this.contrast(t);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const t=this.rgb().color;return(2126*t[0]+7152*t[1]+722*t[2])/1e4<128},isLight(){return!this.isDark()},negate(){const t=this.rgb();for(let e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten(t){const e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken(t){const e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate(t){const e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate(t){const e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten(t){const e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken(t){const e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale(){const t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return Hr.rgb(e,e,e)},fade(t){return this.alpha(this.valpha-this.valpha*t)},opaquer(t){return this.alpha(this.valpha+this.valpha*t)},rotate(t){const e=this.hsl();let i=e.color[0];return i=(i+t)%360,i=i<0?360+i:i,e.color[0]=i,e},mix(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);const i=t.rgb(),o=this.rgb(),n=void 0===e?.5:e,a=2*n-1,r=i.alpha()-o.alpha(),s=((a*r==-1?a:(a+r)/(1+a*r))+1)/2,l=1-s;return Hr.rgb(s*i.red()+l*o.red(),s*i.green()+l*o.green(),s*i.blue()+l*o.blue(),i.alpha()*n+o.alpha()*(1-n))}};for(const t of Object.keys(Fr)){if(Vr.includes(t))continue;const{channels:e}=Fr[t];Hr.prototype[t]=function(...e){return this.model===t?new Hr(this):e.length>0?new Hr(e,t):new Hr([...(i=Fr[this.model][t].raw(this.color),Array.isArray(i)?i:[i]),this.valpha],t);var i},Hr[t]=function(...i){let o=i[0];return"number"==typeof o&&(o=Kr(i,e)),new Hr(o,t)}}function Yr(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}function Wr(t,e,i){t=Array.isArray(t)?t:[t];for(const o of t)(Ur[o]||(Ur[o]=[]))[e]=i;return t=t[0],function(o){let n;return void 0!==o?(i&&(o=i(o)),n=this[t](),n.color[e]=o,n):(n=this[t]().color[e],i&&(n=i(n)),n)}}function Xr(t){return function(e){return Math.max(0,Math.min(t,e))}}function Kr(t,e){for(let i=0;i - + `}static get styles(){return h` :host { @@ -841,15 +843,15 @@ const sr="important",lr=" !"+sr,cr=He(class extends Ye{constructor(t){var e;if(s cursor: not-allowed; background-color: var(--bg-color-disabled); } - .button ha-icon { + .button ::slotted(*) { --mdc-icon-size: var(--control-icon-size); color: var(--icon-color); pointer-events: none; } - .button:disabled ha-icon { + .button:disabled ::slotted(*) { color: var(--icon-color-disabled); } - `}};n([_t()],gs.prototype,"icon",void 0),n([_t()],gs.prototype,"title",void 0),n([_t({type:Boolean})],gs.prototype,"disabled",void 0),gs=n([pt("mushroom-button")],gs);let _s=class extends ht{constructor(){super(...arguments),this.fill=!1,this.rtl=!1}render(){return Y` + `}};n([_t()],gs.prototype,"title",void 0),n([_t({type:Boolean})],gs.prototype,"disabled",void 0),gs=n([pt("mushroom-button")],gs);let _s=class extends ht{constructor(){super(...arguments),this.fill=!1,this.rtl=!1}render(){return Y`
@@ -1011,7 +1013,8 @@ const sr="important",lr=" !"+sr,cr=He(class extends Ye{constructor(t){var e;if(s font-weight: var(--card-primary-font-weight); font-size: var(--card-primary-font-size); line-height: var(--card-primary-line-height); - color: var(--primary-text-color); + color: var(--card-primary-color); + letter-spacing: var(--card-primary-letter-spacing); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; @@ -1020,7 +1023,8 @@ const sr="important",lr=" !"+sr,cr=He(class extends Ye{constructor(t){var e;if(s font-weight: var(--card-secondary-font-weight); font-size: var(--card-secondary-font-size); line-height: var(--card-secondary-line-height); - color: var(--secondary-text-color); + color: var(--card-secondary-color); + letter-spacing: var(--card-secondary-letter-spacing); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; @@ -1133,10 +1137,14 @@ const sr="important",lr=" !"+sr,cr=He(class extends Ye{constructor(t){var e;if(s /* Card */ --card-primary-font-size: var(--mush-card-primary-font-size, 14px); --card-secondary-font-size: var(--mush-card-secondary-font-size, 12px); - --card-primary-font-weight: var(--mush-card-primary-font-weight, bold); - --card-secondary-font-weight: var(--mush-card-secondary-font-weight, bolder); - --card-primary-line-height: var(--mush-card-primary-line-height, 1.5); - --card-secondary-line-height: var(--mush-card-secondary-line-height, 1.5); + --card-primary-font-weight: var(--mush-card-primary-font-weight, 500); + --card-secondary-font-weight: var(--mush-card-secondary-font-weight, 400); + --card-primary-line-height: var(--mush-card-primary-line-height, 20px); + --card-secondary-line-height: var(--mush-card-secondary-line-height, 16px); + --card-primary-color: var(--mush-card-primary-color, var(--primary-text-color)); + --card-secondary-color: var(--mush-card-secondary-color, var(--primary-text-color)); + --card-primary-letter-spacing: var(--mush-card-secondary-color, 0.1px); + --card-secondary-letter-spacing: var(--mush-card-secondary-color, 0.4px); /* Chips */ --chip-spacing: var(--mush-chip-spacing, 8px); @@ -1180,8 +1188,8 @@ const sr="important",lr=" !"+sr,cr=He(class extends Ye{constructor(t){var e;if(s /* Icon */ --icon-border-radius: var(--mush-icon-border-radius, 50%); - --icon-size: var(--mush-icon-size, 42px); - --icon-symbol-size: var(--mush-icon-symbol-size, 0.5em); + --icon-size: var(--mush-icon-size, 40px); + --icon-symbol-size: var(--mush-icon-symbol-size, 0.6em); `,Os=h` /* RGB */ /* Standard colors */ @@ -1202,7 +1210,9 @@ const sr="important",lr=" !"+sr,cr=He(class extends Ye{constructor(t){var e;if(s --rgb-orange: var(--mush-rgb-orange, var(--default-orange)); --rgb-deep-orange: var(--mush-rgb-deep-orange, var(--default-deep-orange)); --rgb-brown: var(--mush-rgb-brown, var(--default-brown)); + --rgb-light-grey: var(--mush-rgb-light-grey, var(--default-light-grey)); --rgb-grey: var(--mush-rgb-grey, var(--default-grey)); + --rgb-dark-grey: var(--mush-rgb-dark-grey, var(--default-dark-grey)); --rgb-blue-grey: var(--mush-rgb-blue-grey, var(--default-blue-grey)); --rgb-black: var(--mush-rgb-black, var(--default-black)); --rgb-white: var(--mush-rgb-white, var(--default-white)); @@ -1377,10 +1387,12 @@ const sr="important",lr=" !"+sr,cr=He(class extends Ye{constructor(t){var e;if(s > ${r.map((t=>Y` {switch(t){case"armed_away":return"mdi:shield-lock-outline";case"armed_vacation":return"mdi:shield-airplane-outline";case"armed_home":return"mdi:shield-home-outline";case"armed_night":return"mdi:shield-moon-outline";case"armed_custom_bypass":return"mdi:shield-half-full";case"disarmed":return"mdi:shield-off-outline";default:return"mdi:shield-outline"}})(t.state)} @click=${e=>this._onTap(e,t.state)} .disabled=${!s} - > + > + {switch(t){case"armed_away":return"mdi:shield-lock-outline";case"armed_vacation":return"mdi:shield-airplane-outline";case"armed_home":return"mdi:shield-home-outline";case"armed_night":return"mdi:shield-moon-outline";case"armed_custom_bypass":return"mdi:shield-half-full";case"disarmed":return"mdi:shield-off-outline";default:return"mdi:shield-outline"}})(t.state)}> + + `))} `:K} @@ -2500,10 +2512,9 @@ const Tl={},zl=He(class extends Ye{constructor(t){if(super(t),t.type!==Be&&t.typ > `:K}renderOtherControls(){const t=this._controls.filter((t=>t!=this._activeControl));return Y` ${t.map((t=>Y` - this._onControlTap(t,e)} - > + this._onControlTap(t,e)}> + + `))} `}renderActiveControl(t){var e;const i=null!==(e=this._config.hvac_modes)&&void 0!==e?e:[],o=$s(this._config);switch(this._activeControl){case"temperature_control":return Y` ${Wt(this.entity,1)?Y` {switch(t.attributes.device_class){case"awning":case"curtain":case"door":case"gate":return"mdi:arrow-expand-horizontal";default:return"mdi:arrow-up"}})(this.entity)} .disabled=${!Ut(this.entity)||this.openDisabled} @click=${this._onOpenTap} - > + > + {switch(t.attributes.device_class){case"awning":case"curtain":case"door":case"gate":return"mdi:arrow-expand-horizontal";default:return"mdi:arrow-up"}})(this.entity)}> + `:void 0} ${Wt(this.entity,8)?Y` + > + + `:void 0} ${Wt(this.entity,2)?Y` {switch(t.attributes.device_class){case"awning":case"curtain":case"door":case"gate":return"mdi:arrow-collapse-horizontal";default:return"mdi:arrow-down"}})(this.entity)} .disabled=${!Ut(this.entity)||this.closedDisabled} @click=${this._onCloseTap} - > + > + {switch(t.attributes.device_class){case"awning":case"curtain":case"door":case"gate":return"mdi:arrow-collapse-horizontal";default:return"mdi:arrow-down"}})(this.entity)}> + `:void 0} `}};n([_t({attribute:!1})],nh.prototype,"hass",void 0),n([_t({attribute:!1})],nh.prototype,"entity",void 0),n([_t()],nh.prototype,"fill",void 0),nh=n([pt("mushroom-cover-buttons-control")],nh);var ah; @@ -2716,26 +2731,28 @@ const Tl={},zl=He(class extends Ye{constructor(t){if(super(t),t.type!==Be&&t.typ + > + + `:K}renderActiveControl(t,e){switch(this._activeControl){case"buttons_control":return Y` + > `;case"position_control":{const e=ch(t),i={};return i["--slider-color"]=`rgb(${e})`,i["--slider-bg-color"]=`rgba(${e}, 0.2)`,Y` + > `}case"tilt_position_control":{const e=ch(t),i={};return i["--slider-color"]=`rgb(${e})`,i["--slider-bg-color"]=`rgba(${e}, 0.2)`,Y` + > `}default:return K}}static get styles(){return[super.styles,Ls,h` mushroom-state-item { cursor: pointer; @@ -2786,10 +2803,13 @@ const Tl={},zl=He(class extends Ye{constructor(t){if(super(t),t.type!==Be&&t.typ `]}};n([vt()],_h.prototype,"_config",void 0),_h=n([pt(fh)],_h);const vh=`${Ns}-fan-card`,bh=`${vh}-editor`,yh=["fan"];function xh(t){return null!=t.attributes.percentage?Math.round(t.attributes.percentage):void 0}function wh(t){return null!=t.attributes.oscillating&&Boolean(t.attributes.oscillating)}let kh=class extends ht{_onTap(t){t.stopPropagation();const e=wh(this.entity);this.hass.callService("fan","oscillate",{entity_id:this.entity.entity_id,oscillating:!e})}render(){const t=wh(this.entity),e=Bt(this.entity);return Y` + > + + `}static get styles(){return h` :host { display: flex; @@ -3080,10 +3100,9 @@ const Tl={},zl=He(class extends Ye{constructor(t){if(super(t),t.type!==Be&&t.typ `}renderOtherControls(){const t=this._controls.filter((t=>t!=this._activeControl));return Y` ${t.map((t=>Y` - this._onControlTap(t,e)} - /> + this._onControlTap(t,e)}> + + `))} `}renderActiveControl(t){var e,i;switch(this._activeControl){case"brightness_control":const o=zu(t),n={},a=null===(e=this._config)||void 0===e?void 0:e.icon_color;if(o&&(null===(i=this._config)||void 0===i?void 0:i.use_light_color)){const t=o.join(",");n["--slider-color"]=`rgb(${t})`,n["--slider-bg-color"]=`rgba(${t}, 0.2)`,Ou(o)&&!this.hass.themes.darkMode&&(n["--slider-bg-color"]="rgba(var(--rgb-primary-text-color), 0.05)",n["--slider-color"]="rgba(var(--rgb-primary-text-color), 0.15)")}else if(a){const t=Zr(a);n["--slider-color"]=`rgb(${t})`,n["--slider-bg-color"]=`rgba(${t}, 0.2)`}return Y` ${Zh.filter((t=>t.isVisible(this.entity))).map((t=>Y` + > + + `))} - `}};n([_t({attribute:!1})],Jh.prototype,"hass",void 0),n([_t({attribute:!1})],Jh.prototype,"entity",void 0),n([_t()],Jh.prototype,"fill",void 0),Jh=n([pt("mushroom-lock-buttons-control")],Jh),Ps({type:Yh,name:"Mushroom Lock Card",description:"Card for all lock entities"});let Qh=class extends Ds{static async getConfigElement(){return await Promise.resolve().then((function(){return Pf})),document.createElement(Wh)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Xh.includes(t.split(".")[0])));return{type:`custom:${Yh}`,entity:e[0]}}getCardSize(){return 1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._config.entity,e=this.hass.states[t];if(!e)return this.renderNotFound(this._config);const i=this._config.name||e.attributes.friendly_name||"",o=this._config.icon,n=$s(this._config),a=rs(e,n.icon_type),r=Ie(this.hass);return Y` + `}};n([_t({attribute:!1})],Jh.prototype,"hass",void 0),n([_t({attribute:!1})],Jh.prototype,"entity",void 0),n([_t({type:Boolean})],Jh.prototype,"fill",void 0),Jh=n([pt("mushroom-lock-buttons-control")],Jh),Ps({type:Yh,name:"Mushroom Lock Card",description:"Card for all lock entities"});let Qh=class extends Ds{static async getConfigElement(){return await Promise.resolve().then((function(){return Pf})),document.createElement(Wh)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Xh.includes(t.split(".")[0])));return{type:`custom:${Yh}`,entity:e[0]}}getCardSize(){return 1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._config.entity,e=this.hass.states[t];if(!e)return this.renderNotFound(this._config);const i=this._config.name||e.attributes.friendly_name||"",o=this._config.icon,n=$s(this._config),a=rs(e,n.icon_type),r=Ie(this.hass);return Y` {if(!t)return[];const i=t.state;if("off"===i)return Wt(t,128)&&e.includes("on_off")?[{icon:"mdi:power",action:"turn_on"}]:[];const o=[];Wt(t,256)&&e.includes("on_off")&&o.push({icon:"mdi:power",action:"turn_off"});const n=!0===t.attributes.assumed_state,a=t.attributes;return("playing"===i||"paused"===i||n)&&Wt(t,32768)&&e.includes("shuffle")&&o.push({icon:!0===a.shuffle?"mdi:shuffle":"mdi:shuffle-disabled",action:"shuffle_set"}),("playing"===i||"paused"===i||n)&&Wt(t,16)&&e.includes("previous")&&o.push({icon:"mdi:skip-previous",action:"media_previous_track"}),!n&&("playing"===i&&(Wt(t,1)||Wt(t,4096))||("paused"===i||"idle"===i)&&Wt(t,Pe)||"on"===i&&(Wt(t,Pe)||Wt(t,1)))&&e.includes("play_pause_stop")&&o.push({icon:"on"===i?"mdi:play-pause":"playing"!==i?"mdi:play":Wt(t,1)?"mdi:pause":"mdi:stop",action:"playing"!==i?"media_play":Wt(t,1)?"media_pause":"media_stop"}),n&&Wt(t,Pe)&&e.includes("play_pause_stop")&&o.push({icon:"mdi:play",action:"media_play"}),n&&Wt(t,1)&&e.includes("play_pause_stop")&&o.push({icon:"mdi:pause",action:"media_pause"}),n&&Wt(t,4096)&&e.includes("play_pause_stop")&&o.push({icon:"mdi:stop",action:"media_stop"}),("playing"===i||"paused"===i||n)&&Wt(t,32)&&e.includes("next")&&o.push({icon:"mdi:skip-next",action:"media_next_track"}),("playing"===i||"paused"===i||n)&&Wt(t,262144)&&e.includes("repeat")&&o.push({icon:"all"===a.repeat?"mdi:repeat":"one"===a.repeat?"mdi:repeat-once":"mdi:repeat-off",action:"repeat_set"}),o.length>0?o:[]},am=(t,e,i)=>{let o={};"shuffle_set"===i?o={shuffle:!e.attributes.shuffle}:"repeat_set"===i?o={repeat:"all"===e.attributes.repeat?"one":"off"===e.attributes.repeat?"all":"off"}:"volume_mute"===i&&(o={is_volume_muted:!e.attributes.is_volume_muted}),t.callService("media_player",i,Object.assign({entity_id:e.entity_id},o))};let rm=class extends ht{constructor(){super(...arguments),this.fill=!1}_handleClick(t){t.stopPropagation();const e=t.target.action;am(this.hass,this.entity,e)}render(){const t=Ie(this.hass),e=nm(this.entity,this.controls);return Y` ${e.map((t=>Y` - + + + `))} - `}};n([_t({attribute:!1})],rm.prototype,"hass",void 0),n([_t({attribute:!1})],rm.prototype,"entity",void 0),n([_t({attribute:!1})],rm.prototype,"controls",void 0),n([_t()],rm.prototype,"fill",void 0),rm=n([pt("mushroom-media-player-media-control")],rm);let sm=class extends ht{constructor(){super(...arguments),this.fill=!1}handleSliderChange(t){const e=t.detail.value;this.hass.callService("media_player","volume_set",{entity_id:this.entity.entity_id,volume_level:e/100})}handleSliderCurrentChange(t){let e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}handleClick(t){t.stopPropagation();const e=t.target.action;am(this.hass,this.entity,e)}render(){var t,e,i;if(!this.entity)return K;const o=om(this.entity),n=Ie(this.hass),a=(null===(t=this.controls)||void 0===t?void 0:t.includes("volume_set"))&&Wt(this.entity,4),r=(null===(e=this.controls)||void 0===e?void 0:e.includes("volume_mute"))&&Wt(this.entity,8),s=(null===(i=this.controls)||void 0===i?void 0:i.includes("volume_buttons"))&&Wt(this.entity,1024);return Y` + `}};n([_t({attribute:!1})],rm.prototype,"hass",void 0),n([_t({attribute:!1})],rm.prototype,"entity",void 0),n([_t({attribute:!1})],rm.prototype,"controls",void 0),n([_t({type:Boolean})],rm.prototype,"fill",void 0),rm=n([pt("mushroom-media-player-media-control")],rm);let sm=class extends ht{constructor(){super(...arguments),this.fill=!1}handleSliderChange(t){const e=t.detail.value;this.hass.callService("media_player","volume_set",{entity_id:this.entity.entity_id,volume_level:e/100})}handleSliderCurrentChange(t){let e=t.detail.value;this.dispatchEvent(new CustomEvent("current-change",{detail:{value:e}}))}handleClick(t){t.stopPropagation();const e=t.target.action;am(this.hass,this.entity,e)}render(){var t,e,i;if(!this.entity)return K;const o=om(this.entity),n=Ie(this.hass),a=(null===(t=this.controls)||void 0===t?void 0:t.includes("volume_set"))&&Wt(this.entity,4),r=(null===(e=this.controls)||void 0===e?void 0:e.includes("volume_mute"))&&Wt(this.entity,8),s=(null===(i=this.controls)||void 0===i?void 0:i.includes("volume_buttons"))&&Wt(this.entity,1024);return Y` ${a?Y` + > + + `:void 0} ${s?Y` + `:void 0} ${s?Y` @@ -3204,6 +3226,8 @@ const Tl={},zl=He(class extends Ye{constructor(t){if(super(t),t.type!==Be&&t.typ icon="mdi:volume-plus" .disabled=${!Ut(this.entity)||Ht(this.entity)} @click=${this.handleClick} + > + `:void 0} @@ -3213,7 +3237,7 @@ const Tl={},zl=He(class extends Ye{constructor(t){if(super(t),t.type!==Be&&t.typ --main-color: rgb(var(--rgb-state-media-player)); --bg-color: rgba(var(--rgb-state-media-player), 0.2); } - `}};n([_t({attribute:!1})],sm.prototype,"hass",void 0),n([_t({attribute:!1})],sm.prototype,"entity",void 0),n([_t()],sm.prototype,"fill",void 0),n([_t({attribute:!1})],sm.prototype,"controls",void 0),sm=n([pt("mushroom-media-player-volume-control")],sm);const lm={media_control:"mdi:play-pause",volume_control:"mdi:volume-high"};Ps({type:tm,name:"Mushroom Media Card",description:"Card for media player entity"});let cm=class extends Ds{constructor(){super(...arguments),this._controls=[]}static async getConfigElement(){return await Promise.resolve().then((function(){return Hf})),document.createElement(em)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>im.includes(t.split(".")[0])));return{type:`custom:${tm}`,entity:e[0]}}_onControlTap(t,e){e.stopPropagation(),this._activeControl=t}getCardSize(){return 1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t),this.updateControls(),this.updateVolume()}updated(t){super.updated(t),this.hass&&t.has("hass")&&(this.updateControls(),this.updateVolume())}updateVolume(){if(this.volume=void 0,!this._config||!this.hass||!this._config.entity)return;const t=this._config.entity,e=this.hass.states[t];if(!e)return;const i=om(e);this.volume=null!=i?Math.round(i):i}onCurrentVolumeChange(t){null!=t.detail.value&&(this.volume=t.detail.value)}updateControls(){var t;if(!this._config||!this.hass||!this._config.entity)return;const e=this._config.entity,i=this.hass.states[e];if(!i)return;const o=[];this._config.collapsible_controls&&!Bt(i)||(((t,e)=>nm(t,null!=e?e:[]).length>0)(i,null===(t=this._config)||void 0===t?void 0:t.media_controls)&&o.push("media_control"),((t,e)=>(null==e?void 0:e.includes("volume_buttons"))&&Wt(t,1024)||(null==e?void 0:e.includes("volume_mute"))&&Wt(t,8)||(null==e?void 0:e.includes("volume_set"))&&Wt(t,4))(i,this._config.volume_controls)&&o.push("volume_control")),this._controls=o;const n=!!this._activeControl&&o.includes(this._activeControl);this._activeControl=n?this._activeControl:o[0]}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._config.entity,e=this.hass.states[t];if(!e)return this.renderNotFound(this._config);const i=function(t,e){var i,o=t.icon;if(![Nt,Rt,Ft].includes(e.state)&&t.use_media_info)switch(null===(i=e.attributes.app_name)||void 0===i?void 0:i.toLowerCase()){case"spotify":return"mdi:spotify";case"google podcasts":return"mdi:google-podcast";case"plex":return"mdi:plex";case"soundcloud":return"mdi:soundcloud";case"youtube":return"mdi:youtube";case"oto music":return"mdi:music-circle";case"netflix":return"mdi:netflix";default:return}return o}(this._config,e),o=function(t,e){let i=t.name||e.attributes.friendly_name||"";return![Nt,Rt,Ft].includes(e.state)&&t.use_media_info&&e.attributes.media_title&&(i=e.attributes.media_title),i}(this._config,e),n=function(t,e,i){let o=i.formatEntityState?i.formatEntityState(e):ne(i.localize,e,i.locale,i.config,i.entities);return![Nt,Rt,Ft].includes(e.state)&&t.use_media_info&&(t=>{let e;switch(t.attributes.media_content_type){case"music":case"image":e=t.attributes.media_artist;break;case"playlist":e=t.attributes.media_playlist;break;case"tvshow":e=t.attributes.media_series_title,t.attributes.media_season&&(e+=" S"+t.attributes.media_season,t.attributes.media_episode&&(e+="E"+t.attributes.media_episode));break;default:e=t.attributes.app_name||""}return e})(e)||o}(this._config,e,this.hass),a=$s(this._config),r=rs(e,a.icon_type),s=null!=this.volume&&this._config.show_volume_level?`${n} - ${this.volume}${oe(this.hass.locale)}%`:n,l=Ie(this.hass);return Y` + `}};n([_t({attribute:!1})],sm.prototype,"hass",void 0),n([_t({attribute:!1})],sm.prototype,"entity",void 0),n([_t({type:Boolean})],sm.prototype,"fill",void 0),n([_t({attribute:!1})],sm.prototype,"controls",void 0),sm=n([pt("mushroom-media-player-volume-control")],sm);const lm={media_control:"mdi:play-pause",volume_control:"mdi:volume-high"};Ps({type:tm,name:"Mushroom Media Card",description:"Card for media player entity"});let cm=class extends Ds{constructor(){super(...arguments),this._controls=[]}static async getConfigElement(){return await Promise.resolve().then((function(){return Hf})),document.createElement(em)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>im.includes(t.split(".")[0])));return{type:`custom:${tm}`,entity:e[0]}}_onControlTap(t,e){e.stopPropagation(),this._activeControl=t}getCardSize(){return 1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t),this.updateControls(),this.updateVolume()}updated(t){super.updated(t),this.hass&&t.has("hass")&&(this.updateControls(),this.updateVolume())}updateVolume(){if(this.volume=void 0,!this._config||!this.hass||!this._config.entity)return;const t=this._config.entity,e=this.hass.states[t];if(!e)return;const i=om(e);this.volume=null!=i?Math.round(i):i}onCurrentVolumeChange(t){null!=t.detail.value&&(this.volume=t.detail.value)}updateControls(){var t;if(!this._config||!this.hass||!this._config.entity)return;const e=this._config.entity,i=this.hass.states[e];if(!i)return;const o=[];this._config.collapsible_controls&&!Bt(i)||(((t,e)=>nm(t,null!=e?e:[]).length>0)(i,null===(t=this._config)||void 0===t?void 0:t.media_controls)&&o.push("media_control"),((t,e)=>(null==e?void 0:e.includes("volume_buttons"))&&Wt(t,1024)||(null==e?void 0:e.includes("volume_mute"))&&Wt(t,8)||(null==e?void 0:e.includes("volume_set"))&&Wt(t,4))(i,this._config.volume_controls)&&o.push("volume_control")),this._controls=o;const n=!!this._activeControl&&o.includes(this._activeControl);this._activeControl=n?this._activeControl:o[0]}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._config.entity,e=this.hass.states[t];if(!e)return this.renderNotFound(this._config);const i=function(t,e){var i,o=t.icon;if(![Nt,Rt,Ft].includes(e.state)&&t.use_media_info)switch(null===(i=e.attributes.app_name)||void 0===i?void 0:i.toLowerCase()){case"spotify":return"mdi:spotify";case"google podcasts":return"mdi:google-podcast";case"plex":return"mdi:plex";case"soundcloud":return"mdi:soundcloud";case"youtube":return"mdi:youtube";case"oto music":return"mdi:music-circle";case"netflix":return"mdi:netflix";default:return}return o}(this._config,e),o=function(t,e){let i=t.name||e.attributes.friendly_name||"";return![Nt,Rt,Ft].includes(e.state)&&t.use_media_info&&e.attributes.media_title&&(i=e.attributes.media_title),i}(this._config,e),n=function(t,e,i){let o=i.formatEntityState?i.formatEntityState(e):ne(i.localize,e,i.locale,i.config,i.entities);return![Nt,Rt,Ft].includes(e.state)&&t.use_media_info&&(t=>{let e;switch(t.attributes.media_content_type){case"music":case"image":e=t.attributes.media_artist;break;case"playlist":e=t.attributes.media_playlist;break;case"tvshow":e=t.attributes.media_series_title,t.attributes.media_season&&(e+=" S"+t.attributes.media_season,t.attributes.media_episode&&(e+="E"+t.attributes.media_episode));break;default:e=t.attributes.app_name||""}return e})(e)||o}(this._config,e,this.hass),a=$s(this._config),r=rs(e,a.icon_type),s=null!=this.volume&&this._config.show_volume_level?`${n} - ${this.volume}${oe(this.hass.locale)}%`:n,l=Ie(this.hass);return Y` `}renderOtherControls(){const t=this._controls.filter((t=>t!=this._activeControl));return Y` ${t.map((t=>Y` - this._onControlTap(t,e)} - /> + this._onControlTap(t,e)}> + + `))} `}renderActiveControl(t,e){var i,o,n,a;const r=null!==(o=null===(i=this._config)||void 0===i?void 0:i.media_controls)&&void 0!==o?o:[],s=null!==(a=null===(n=this._config)||void 0===n?void 0:n.volume_controls)&&void 0!==a?a:[];switch(this._activeControl){case"media_control":return Y` - - + + + + + + - `}};n([_t({attribute:!1})],Om.prototype,"hass",void 0),n([_t({attribute:!1})],Om.prototype,"entity",void 0),n([_t()],Om.prototype,"fill",void 0),Om=n([pt("mushroom-update-buttons-control")],Om),Ps({type:Sm,name:"Mushroom Update Card",description:"Card for update entity"});let Mm=class extends Ds{static async getConfigElement(){return await Promise.resolve().then((function(){return cg})),document.createElement(Im)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Tm.includes(t.split(".")[0])));return{type:`custom:${Sm}`,entity:e[0]}}getCardSize(){return 1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._config.entity,e=this.hass.states[t];if(!e)return this.renderNotFound(this._config);const i=this._config.name||e.attributes.friendly_name||"",o=this._config.icon,n=$s(this._config),a=rs(e,n.icon_type),r=Ie(this.hass),s=(!this._config.collapsible_controls||Bt(e))&&this._config.show_buttons_control&&Wt(e,1);return Y` + `}};n([_t({attribute:!1})],Om.prototype,"hass",void 0),n([_t({attribute:!1})],Om.prototype,"entity",void 0),n([_t({type:Boolean})],Om.prototype,"fill",void 0),Om=n([pt("mushroom-update-buttons-control")],Om),Ps({type:Sm,name:"Mushroom Update Card",description:"Card for update entity"});let Mm=class extends Ds{static async getConfigElement(){return await Promise.resolve().then((function(){return cg})),document.createElement(Im)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Tm.includes(t.split(".")[0])));return{type:`custom:${Sm}`,entity:e[0]}}getCardSize(){return 1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){if(!this._config||!this.hass||!this._config.entity)return K;const t=this._config.entity,e=this.hass.states[t];if(!e)return this.renderNotFound(this._config);const i=this._config.name||e.attributes.friendly_name||"",o=this._config.icon,n=$s(this._config),a=rs(e,n.icon_type),r=Ie(this.hass),s=(!this._config.collapsible_controls||Bt(e))&&this._config.show_buttons_control&&Wt(e,1);return Y` ${Rm.filter((t=>t.isVisible(this.entity,this.commands))).map((t=>Y` + > + + `))} - `}};n([_t({attribute:!1})],Fm.prototype,"hass",void 0),n([_t({attribute:!1})],Fm.prototype,"entity",void 0),n([_t({attribute:!1})],Fm.prototype,"commands",void 0),n([_t()],Fm.prototype,"fill",void 0),Fm=n([pt("mushroom-vacuum-commands-control")],Fm),Ps({type:jm,name:"Mushroom Vacuum Card",description:"Card for vacuum entity"});let Vm=class extends Ds{static async getConfigElement(){return await Promise.resolve().then((function(){return fg})),document.createElement(Dm)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Lm.includes(t.split(".")[0])));return{type:`custom:${jm}`,entity:e[0]}}getCardSize(){return 1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){var t,e;if(!this._config||!this.hass||!this._config.entity)return K;const i=this._config.entity,o=this.hass.states[i];if(!o)return this.renderNotFound(this._config);const n=this._config.name||o.attributes.friendly_name||"",a=this._config.icon,r=$s(this._config),s=rs(o,r.icon_type),l=Ie(this.hass),c=null!==(e=null===(t=this._config)||void 0===t?void 0:t.commands)&&void 0!==e?e:[];return Y` + `}};n([_t({attribute:!1})],Fm.prototype,"hass",void 0),n([_t({attribute:!1})],Fm.prototype,"entity",void 0),n([_t({attribute:!1})],Fm.prototype,"commands",void 0),n([_t({type:Boolean})],Fm.prototype,"fill",void 0),Fm=n([pt("mushroom-vacuum-commands-control")],Fm),Ps({type:jm,name:"Mushroom Vacuum Card",description:"Card for vacuum entity"});let Vm=class extends Ds{static async getConfigElement(){return await Promise.resolve().then((function(){return fg})),document.createElement(Dm)}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>Lm.includes(t.split(".")[0])));return{type:`custom:${jm}`,entity:e[0]}}getCardSize(){return 1}setConfig(t){this._config=Object.assign({tap_action:{action:"more-info"},hold_action:{action:"more-info"}},t)}_handleAction(t){Ke(this,this.hass,this._config,t.detail.action)}render(){var t,e;if(!this._config||!this.hass||!this._config.entity)return K;const i=this._config.entity,o=this.hass.states[i];if(!o)return this.renderNotFound(this._config);const n=this._config.name||o.attributes.friendly_name||"",a=this._config.icon,r=$s(this._config),s=rs(o,r.icon_type),l=Ie(this.hass),c=null!==(e=null===(t=this._config)||void 0===t?void 0:t.commands)&&void 0!==e?e:[];return Y` [{name:"tap_action",selector:{"ui-action":{actions:t}}},{name:"hold_action",selector:{"ui-action":{actions:t}}},{name:"double_tap_action",selector:{"ui-action":{actions:t}}}],Hm=Ce({layout:$e(Se([we("horizontal"),we("vertical"),we("default")])),fill_container:$e(ye()),primary_info:$e(xe(os)),secondary_info:$e(xe(os)),icon_type:$e(xe(ns))}),Ym=[{type:"grid",name:"",schema:[{name:"layout",selector:{mush_layout:{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"primary_info",selector:{mush_info:{}}},{name:"secondary_info",selector:{mush_info:{}}},{name:"icon_type",selector:{mush_icon_type:{}}}]}],Wm=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],Xm=Ce({entity:$e(Ee()),name:$e(Ee()),icon:$e(Ee())}),Km=Ce({index:$e(ke()),view_index:$e(ke()),view_layout:ve(),type:Ee()}),Gm=fe(Km,fe(Xm,Hm,Bm),Ce({states:$e(be()),show_keypad:$e(ye())})),qm=["more-info","navigate","url","call-service","assist","none"],Zm=["armed_home","armed_away","armed_night","armed_vacation","armed_custom_bypass"],Jm=["show_keypad"],Qm=Tt((t=>[{name:"entity",selector:{entity:{domain:Vs}}},{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},...Ym,{type:"multi_select",name:"states",options:Zm.map((e=>[e,t(`ui.card.alarm_control_panel.${e.replace("armed","arm")}`)]))},{name:"show_keypad",selector:{boolean:{}}},...Um(qm)]));let tp=class extends js{constructor(){super(...arguments),this._computeLabel=t=>{const e=zo(this.hass);return Wm.includes(t.name)?e(`editor.card.generic.${t.name}`):Jm.includes(t.name)?e(`editor.card.alarm_control_panel.${t.name}`):"states"===t.name?this.hass.localize("ui.panel.lovelace.editor.card.alarm-panel.available_states"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){super.connectedCallback(),vl()}setConfig(t){me(t,Gm),this._config=t}render(){if(!this.hass||!this._config)return K;const t=Qm(this.hass.localize);return Y` + `]}};n([vt()],Vm.prototype,"_config",void 0),Vm=n([pt(jm)],Vm),console.info("%c🍄 Mushroom 🍄 - 3.4.0","color: #ef5350; font-weight: 700;");const Bm=Ce({tap_action:$e(ni),hold_action:$e(ni),double_tap_action:$e(ni)}),Um=t=>[{name:"tap_action",selector:{"ui-action":{actions:t}}},{name:"hold_action",selector:{"ui-action":{actions:t}}},{name:"double_tap_action",selector:{"ui-action":{actions:t}}}],Hm=Ce({layout:$e(Se([we("horizontal"),we("vertical"),we("default")])),fill_container:$e(ye()),primary_info:$e(xe(os)),secondary_info:$e(xe(os)),icon_type:$e(xe(ns))}),Ym=[{type:"grid",name:"",schema:[{name:"layout",selector:{mush_layout:{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"primary_info",selector:{mush_info:{}}},{name:"secondary_info",selector:{mush_info:{}}},{name:"icon_type",selector:{mush_icon_type:{}}}]}],Wm=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],Xm=Ce({entity:$e(Ee()),name:$e(Ee()),icon:$e(Ee())}),Km=Ce({index:$e(ke()),view_index:$e(ke()),view_layout:ve(),type:Ee()}),Gm=fe(Km,fe(Xm,Hm,Bm),Ce({states:$e(be()),show_keypad:$e(ye())})),qm=["more-info","navigate","url","call-service","assist","none"],Zm=["armed_home","armed_away","armed_night","armed_vacation","armed_custom_bypass"],Jm=["show_keypad"],Qm=Tt((t=>[{name:"entity",selector:{entity:{domain:Vs}}},{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},...Ym,{type:"multi_select",name:"states",options:Zm.map((e=>[e,t(`ui.card.alarm_control_panel.${e.replace("armed","arm")}`)]))},{name:"show_keypad",selector:{boolean:{}}},...Um(qm)]));let tp=class extends js{constructor(){super(...arguments),this._computeLabel=t=>{const e=zo(this.hass);return Wm.includes(t.name)?e(`editor.card.generic.${t.name}`):Jm.includes(t.name)?e(`editor.card.alarm_control_panel.${t.name}`):"states"===t.name?this.hass.localize("ui.panel.lovelace.editor.card.alarm-panel.available_states"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){super.connectedCallback(),vl()}setConfig(t){me(t,Gm),this._config=t}render(){if(!this.hass||!this._config)return K;const t=Qm(this.hass.localize);return Y`